]> Git Repo - qemu.git/commitdiff
intel_iommu: fixing source id during IOTLB hash key calculation
authorJason Wang <[email protected]>
Thu, 3 Nov 2016 01:22:23 +0000 (09:22 +0800)
committerMichael S. Tsirkin <[email protected]>
Tue, 15 Nov 2016 15:20:36 +0000 (17:20 +0200)
Using uint8_t for source id will lose bus num and get the
wrong/invalid IOTLB entry. Fixing by using uint16_t instead and
enlarge level shift.

Cc: Paolo Bonzini <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
hw/i386/intel_iommu.c
hw/i386/intel_iommu_internal.h

index 1655a65bced868b0c2f346812eca18ee8ed79681..5a12ae7a931c0314ca859ec0f19dbb8012dc2a9b 100644 (file)
@@ -218,7 +218,7 @@ static void vtd_reset_iotlb(IntelIOMMUState *s)
     g_hash_table_remove_all(s->iotlb);
 }
 
-static uint64_t vtd_get_iotlb_key(uint64_t gfn, uint8_t source_id,
+static uint64_t vtd_get_iotlb_key(uint64_t gfn, uint16_t source_id,
                                   uint32_t level)
 {
     return gfn | ((uint64_t)(source_id) << VTD_IOTLB_SID_SHIFT) |
index 0829a5064f2c6c4e5d148392a743176512ee01ce..11abfa22334ef26c6446a498994549e8df8f6c9a 100644 (file)
 
 /* The shift of source_id in the key of IOTLB hash table */
 #define VTD_IOTLB_SID_SHIFT         36
-#define VTD_IOTLB_LVL_SHIFT         44
+#define VTD_IOTLB_LVL_SHIFT         52
 #define VTD_IOTLB_MAX_SIZE          1024    /* Max size of the hash table */
 
 /* IOTLB_REG */
This page took 0.031872 seconds and 4 git commands to generate.