@samitouri / QOSamiQemu / commits / 0611d39303

amd_iommu: Fix opcode reported in invalid command handling

According to the AMD I/O Virtualization Technology (IOMMU) Specification (Rev 3.10), Section 2.4 Commands, the Generic Command Buffer Entry Format encodes the opcode in bits [63:60] of the command buffer. When handling illegal opcodes, the traces for unhandled commands and event log info extract the opcode from an incorrect offset in the command buffer. Fix this issue to avoid potential confusion with mismatched opcodes in traces and unlikely errors in guest event processing. Fixes: d29a09ca68428 ("hw/i386: Introduce AMD IOMMU") Signed-off-by: David Hoppenbrouwers <qemu@demindiro.com> Reviewed-by: Sairaj Kodilkar <sarunkod@amd.com> Acked-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20260630220806.1758748-2-alejandro.j.jimenez@oracle.com>

David Hoppenbrouwers committed Jun 30, 2026 at 22:08 UTC 0611d393031f9941fcfaf3f17c3ac2b7a0ea00d1
1 file changed +2 -2
hw/i386/amd_iommu.c
+2 -2
@@ -1509,9 +1509,9 @@ static void amdvi_cmdbuf_exec(AMDVIState *s)
1509 amdvi_inval_all(s, cmd);
1510 break;
1511 default:
1512 - trace_amdvi_unhandled_command(extract64(cmd[1], 60, 4));
1512 + trace_amdvi_unhandled_command(extract64(cmd[0], 60, 4));
1513 /* log illegal command */
1514 - amdvi_log_illegalcom_error(s, extract64(cmd[1], 60, 4),
1514 + amdvi_log_illegalcom_error(s, extract64(cmd[0], 60, 4),
1515 s->cmdbuf + s->cmdbuf_head);
1516 }
1517 }