* [Qemu-devel] [PATCH] intel_iommu: fixing source id during IOTLB hash key calculation
@ 2016-11-03 1:22 Jason Wang
2016-11-07 16:04 ` Peter Xu
0 siblings, 1 reply; 2+ messages in thread
From: Jason Wang @ 2016-11-03 1:22 UTC (permalink / raw)
To: qemu-devel
Cc: Jason Wang, Paolo Bonzini, Richard Henderson, Eduardo Habkost,
Michael S . Tsirkin
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>
---
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 2efd69b..1c5d40e 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -215,7 +215,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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] intel_iommu: fixing source id during IOTLB hash key calculation
2016-11-03 1:22 [Qemu-devel] [PATCH] intel_iommu: fixing source id during IOTLB hash key calculation Jason Wang
@ 2016-11-07 16:04 ` Peter Xu
0 siblings, 0 replies; 2+ messages in thread
From: Peter Xu @ 2016-11-07 16:04 UTC (permalink / raw)
To: Jason Wang
Cc: qemu-devel, Paolo Bonzini, Michael S . Tsirkin, Eduardo Habkost,
Richard Henderson
On Thu, Nov 03, 2016 at 09:22:23AM +0800, Jason Wang wrote:
> 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: Peter Xu <peterx@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-07 16:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-03 1:22 [Qemu-devel] [PATCH] intel_iommu: fixing source id during IOTLB hash key calculation Jason Wang
2016-11-07 16:04 ` Peter Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).