qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/1] amd_iommu: fix device entry invalidation


From: Roman Kapl
Subject: [PATCH 1/1] amd_iommu: fix device entry invalidation
Date: Tue, 1 Jun 2021 16:10:39 +0200

Since QEMU maintains TLB entries keyed by the device ID, there is no separate
device entry cache. This means we need to invalidate all translations keyed by
the device ID.

Signed-off-by: Roman Kapl <rka@sysgo.com>
---
 hw/i386/amd_iommu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 2801dff97c..62d22b220b 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -356,6 +356,7 @@ static void amdvi_update_iotlb(AMDVIState *s, uint16_t 
devid,
         }
 
         entry->domid = domid;
+        entry->devid = devid;
         entry->perms = to_cache.perm;
         entry->translated_addr = to_cache.translated_addr;
         entry->page_mask = to_cache.addr_mask;
@@ -399,6 +400,8 @@ static void amdvi_inval_devtab_entry(AMDVIState *s, 
uint64_t *cmd)
         amdvi_log_illegalcom_error(s, extract64(cmd[0], 60, 4),
                                    s->cmdbuf + s->cmdbuf_head);
     }
+    g_hash_table_foreach_remove(s->iotlb, amdvi_iotlb_remove_by_devid,
+                                &devid);
     trace_amdvi_devtab_inval(PCI_BUS_NUM(devid), PCI_SLOT(devid),
                              PCI_FUNC(devid));
 }
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]