]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/i386/amd_iommu: Fix event log generation
authorSairaj Kodilkar <sarunkod@amd.com>
Fri, 1 Aug 2025 06:05:07 +0000 (11:35 +0530)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 1 Aug 2025 14:23:50 +0000 (10:23 -0400)
commitc0ef803a879b97f3d269348c968fb3874c2761f6
tree1cd32be5efb4f6fc5df5ee4db07220d019c87d77
parent10690920b0efb3ed8b166443bae8077104bb129d
hw/i386/amd_iommu: Fix event log generation

Current event logging code is broken, because of following issues

1. The code uses '|' instead of '&' to test the bit field, which causes
   vIOMMU to generate overflow interrupt for every log entry.
2. Code does not update the eventlog tail MMIO register after adding an
   entry to the buffer, because of which guest cannot process new
   entries (as head == tail means buffer is empty).
3. Compares eventlog tail (which is byte offset in the buffer) to
   eventlog length (which is number of maximum entries in the buffer).
   This causes vIOMMU to generate only fix number of event logs, after
   which it keeps on generating overflow interrupts, without
   actually resetting the log buffer.
4. Updates ComWaitInt instead of EventLogInt bitfield in Status
   register. Guest checks this field to see if there are new event log
   entries in the buffer.
5. Does not reset event log head and tail pointers when guest writes to
   eventlog base register.

Fix above issues, so that guest can process event log entries.

Fixes: d29a09ca68428 ("hw/i386: Introduce AMD IOMMU")
Signed-off-by: Sairaj Kodilkar <sarunkod@amd.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Message-Id: <20250801060507.3382-7-sarunkod@amd.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/i386/amd_iommu.c
hw/i386/amd_iommu.h