All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: mst@redhat.com, peterx@redhat.com, wexu@redhat.com,
	qemu-devel@nongnu.org
Cc: vkaplans@redhat.com, pbonzini@redhat.com,
	cornelia.huck@de.ibm.com, Jason Wang <jasowang@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Eduardo Habkost <ehabkost@redhat.com>
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	[thread overview]
Message-ID: <1478165243-4767-2-git-send-email-jasowang@redhat.com> (raw)
In-Reply-To: <1478165243-4767-1-git-send-email-jasowang@redhat.com>

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 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

  reply	other threads:[~2016-11-03  9:27 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-03  9:27 [Qemu-devel] [PATCH V2 00/11] vhost device IOTLB support Jason Wang
2016-11-03  9:27 ` Jason Wang [this message]
2016-11-03  9:27 ` [Qemu-devel] [PATCH V2 02/11] virtio: convert to use DMA api Jason Wang
2016-11-03 19:46   ` Michael S. Tsirkin
2016-11-04  6:36     ` Jason Wang
2016-11-03  9:27 ` [Qemu-devel] [PATCH V2 03/11] intel_iommu: name vtd address space with devfn Jason Wang
2016-11-03  9:27 ` [Qemu-devel] [PATCH V2 04/11] intel_iommu: allocate new key when creating new address space Jason Wang
2016-11-03  9:27 ` [Qemu-devel] [PATCH V2 05/11] exec: introduce address_space_get_iotlb_entry() Jason Wang
2016-11-03 17:03   ` Paolo Bonzini
2016-11-04  6:33     ` Jason Wang
2016-11-03  9:27 ` [Qemu-devel] [PATCH V2 06/11] intel_iommu: support device iotlb descriptor Jason Wang
2016-11-03  9:27 ` [Qemu-devel] [PATCH V2 07/11] virtio-pci: address space translation service (ATS) support Jason Wang
2016-11-03 19:49   ` Michael S. Tsirkin
2016-11-04  6:48     ` Jason Wang
2016-11-10 17:32       ` Michael S. Tsirkin
2016-11-11  3:26         ` Jason Wang
2016-11-11  3:49           ` Michael S. Tsirkin
2016-11-11  4:24             ` Jason Wang
2016-11-03  9:27 ` [Qemu-devel] [PATCH V2 08/11] acpi: add ATSR for q35 Jason Wang
2016-11-03  9:27 ` [Qemu-devel] [PATCH V2 09/11] memory: handle alias for iommu notifier Jason Wang
2016-11-03 16:55   ` Paolo Bonzini
2016-11-03  9:27 ` [Qemu-devel] [PATCH V2 10/11] memory: handle alias in memory_region_is_iommu() Jason Wang
2016-11-03 16:56   ` Paolo Bonzini
2016-11-03  9:27 ` [Qemu-devel] [PATCH V2 11/11] vhost_net: device IOTLB support Jason Wang
2016-11-03  9:48 ` [Qemu-devel] [PATCH V2 00/11] vhost " no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1478165243-4767-2-git-send-email-jasowang@redhat.com \
    --to=jasowang@redhat.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=ehabkost@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=vkaplans@redhat.com \
    --cc=wexu@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.