Skip to contentSkip to conversation

amd_iommu: Fix opcode reported in invalid command handling

PATCH New Alejandro Jimenez 1 participant 1 message Jun 16

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 amd_iommu: Fix opcode reported in invalid command handling

From: David Hoppenbrouwers <[email protected]>

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")

---
Sending v2 to the list for visibility before inclusion in 11.1. v2 changes:
- Edit title and commit message with IOMMU spec reference.
- Add Reviewed-by and Acked-by from v1.

 hw/i386/amd_iommu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/i386/amd_iommu.c +2 -2
index 79216fb305..05b7c638f4 100644
@@ -1509,9 +1509,9 @@ static void amdvi_cmdbuf_exec(AMDVIState *s)
         amdvi_inval_all(s, cmd);
         break;
     default:
-        trace_amdvi_unhandled_command(extract64(cmd[1], 60, 4));
+        trace_amdvi_unhandled_command(extract64(cmd[0], 60, 4));
         /* log illegal command */
-        amdvi_log_illegalcom_error(s, extract64(cmd[1], 60, 4),
+        amdvi_log_illegalcom_error(s, extract64(cmd[0], 60, 4),
                                    s->cmdbuf + s->cmdbuf_head);
     }
 }

base-commit: 608ad9307d5b4797d2254ee3a4bad2bc8c8bcbae

Signature · 1 line
2.47.3