[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V2 01/11] intel_iommu: fixing source id during IOTLB
From: |
Jason Wang |
Subject: |
[Qemu-devel] [PATCH V2 01/11] intel_iommu: fixing source id during IOTLB hash key calculation |
Date: |
Thu, 3 Nov 2016 17:27:13 +0800 |
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 <address@hidden>
Cc: Richard Henderson <address@hidden>
Cc: Eduardo Habkost <address@hidden>
Cc: Michael S. Tsirkin <address@hidden>
Signed-off-by: Jason Wang <address@hidden>
---
hw/i386/intel_iommu.c | 2 +-
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 */
--
2.7.4
- [Qemu-devel] [PATCH V2 00/11] vhost device IOTLB support, Jason Wang, 2016/11/03
- [Qemu-devel] [PATCH V2 01/11] intel_iommu: fixing source id during IOTLB hash key calculation,
Jason Wang <=
- [Qemu-devel] [PATCH V2 03/11] intel_iommu: name vtd address space with devfn, Jason Wang, 2016/11/03
- [Qemu-devel] [PATCH V2 02/11] virtio: convert to use DMA api, Jason Wang, 2016/11/03
- [Qemu-devel] [PATCH V2 04/11] intel_iommu: allocate new key when creating new address space, Jason Wang, 2016/11/03
- [Qemu-devel] [PATCH V2 05/11] exec: introduce address_space_get_iotlb_entry(), Jason Wang, 2016/11/03
- [Qemu-devel] [PATCH V2 06/11] intel_iommu: support device iotlb descriptor, Jason Wang, 2016/11/03
- [Qemu-devel] [PATCH V2 07/11] virtio-pci: address space translation service (ATS) support, Jason Wang, 2016/11/03