[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 07/34] intel_iommu: fixing source id during IOTLB
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 07/34] intel_iommu: fixing source id during IOTLB hash key calculation |
Date: |
Fri, 11 Nov 2016 20:10:22 +0200 |
From: Jason Wang <address@hidden>
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>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/i386/intel_iommu_internal.h | 2 +-
hw/i386/intel_iommu.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
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 */
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) |
--
MST
- [Qemu-devel] [PULL v2 00/34] virtio, vhost, pc, pci: tests, documentation, fixes and cleanups, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 01/34] tests/vhost-user-bridge: remove false comment, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 02/34] tests/vhost-user-bridge: remove unnecessary dispatcher_remove, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 03/34] tests/vhost-user-bridge: indicate peer disconnected, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 04/34] tests/vhost-user-bridge: do not accept more than one connection, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 05/34] contrib: add libvhost-user, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 06/34] tests/vhost-user-bridge: use contrib/libvhost-user, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 08/34] virtio: rename virtqueue_discard to virtqueue_unpop, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 07/34] intel_iommu: fixing source id during IOTLB hash key calculation,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 11/34] intel_iommu: fix several incorrect endianess and bit fields, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 09/34] virtio: make virtqueue_alloc_element static, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 12/34] intel_iommu: fix incorrect assert, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 10/34] virtio-crypto: tag as not hotpluggable and migration, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 13/34] acpi: fix DMAR device scope for IOAPIC, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 15/34] virtio-net: mark VIRTIO_NET_F_GSO as legacy, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 14/34] virtio: allow per-device-class legacy features, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 16/34] vhost: migration blocker only if shared log is used, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 17/34] qdev: hotplug: drop HotplugHandler.post_plug callback, Michael S. Tsirkin, 2016/11/11
- [Qemu-devel] [PULL v2 18/34] nvdimm acpi: drop the lock of fit buffer, Michael S. Tsirkin, 2016/11/11