From: Jason Wang <jasowang@redhat.com>
To: mst@redhat.com, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, peterx@redhat.com, cornelia.huck@de.ibm.com,
wexu@redhat.com, vkaplans@redhat.com,
Jason Wang <jasowang@redhat.com>,
Richard Henderson <rth@twiddle.net>,
Eduardo Habkost <ehabkost@redhat.com>
Subject: [Qemu-devel] [PATCH V4 03/10] intel_iommu: allocate new key when creating new address space
Date: Fri, 30 Dec 2016 18:09:12 +0800 [thread overview]
Message-ID: <1483092559-24488-4-git-send-email-jasowang@redhat.com> (raw)
In-Reply-To: <1483092559-24488-1-git-send-email-jasowang@redhat.com>
We use the pointer to stack for key for new address space, this will break hash
table searching, fixing by g_malloc() a new key instead.
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
hw/i386/intel_iommu.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index bf25e04..58ab143 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -2327,12 +2327,13 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, int devfn)
char name[128];
if (!vtd_bus) {
+ uintptr_t *new_key = g_malloc(sizeof(*new_key));
+ *new_key = (uintptr_t)bus;
/* No corresponding free() */
vtd_bus = g_malloc0(sizeof(VTDBus) + sizeof(VTDAddressSpace *) * \
X86_IOMMU_PCI_DEVFN_MAX);
vtd_bus->bus = bus;
- key = (uintptr_t)bus;
- g_hash_table_insert(s->vtd_as_by_busptr, &key, vtd_bus);
+ g_hash_table_insert(s->vtd_as_by_busptr, new_key, vtd_bus);
}
vtd_dev_as = vtd_bus->dev_as[devfn];
--
2.7.4
next prev parent reply other threads:[~2016-12-30 10:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-30 10:09 [Qemu-devel] [PATCH V4 00/10] vhost device IOTLB support Jason Wang
2016-12-30 10:09 ` [Qemu-devel] [PATCH V4 01/10] virtio: convert to use DMA api Jason Wang
2016-12-30 10:09 ` [Qemu-devel] [PATCH V4 02/10] intel_iommu: name vtd address space with devfn Jason Wang
2016-12-30 10:09 ` Jason Wang [this message]
2016-12-30 10:09 ` [Qemu-devel] [PATCH V4 04/10] exec: introduce address_space_get_iotlb_entry() Jason Wang
2016-12-30 10:09 ` [Qemu-devel] [PATCH V4 05/10] intel_iommu: support device iotlb descriptor Jason Wang
2017-01-03 3:37 ` Peter Xu
2016-12-30 10:09 ` [Qemu-devel] [PATCH V4 06/10] virtio-pci: address space translation service (ATS) support Jason Wang
2016-12-30 10:09 ` [Qemu-devel] [PATCH V4 07/10] acpi: add ATSR for q35 Jason Wang
2016-12-30 10:09 ` [Qemu-devel] [PATCH V4 08/10] memory: handle alias for iommu notifier Jason Wang
2017-01-03 3:42 ` Peter Xu
2016-12-30 10:09 ` [Qemu-devel] [PATCH V4 09/10] memory: handle alias in memory_region_is_iommu() Jason Wang
2017-01-03 3:42 ` Peter Xu
2016-12-30 10:09 ` [Qemu-devel] [PATCH V4 10/10] vhost_net: device IOTLB support Jason Wang
2017-01-10 4:55 ` Michael S. Tsirkin
2017-01-11 2:34 ` Jason Wang
2017-01-10 4:54 ` [Qemu-devel] [PATCH V4 00/10] vhost " Michael S. Tsirkin
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=1483092559-24488-4-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 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).