diff options
author | Jason Wang <jasowang@redhat.com> | 2016-11-03 09:22:23 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2016-11-15 17:20:36 +0200 |
commit | bacabb0afadb47294806481a7ebb6fa5d4f1c7bd (patch) | |
tree | 71ed1d5be2761469f2992b27af332c6fc6a95f8e /hw | |
parent | 6bbcb76301a72dc80c8d29af13d40bb9a759c9c6 (diff) | |
download | qemu-bacabb0afadb47294806481a7ebb6fa5d4f1c7bd.zip qemu-bacabb0afadb47294806481a7ebb6fa5d4f1c7bd.tar.gz qemu-bacabb0afadb47294806481a7ebb6fa5d4f1c7bd.tar.bz2 |
intel_iommu: fixing source id during IOTLB hash key calculation
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 <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/i386/intel_iommu.c | 2 | ||||
-rw-r--r-- | hw/i386/intel_iommu_internal.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 1655a65..5a12ae7 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -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) | diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 0829a50..11abfa2 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -115,7 +115,7 @@ /* 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 */ |