From: Peter Xu <peterx@redhat.com>
To: "Aviv B.D" <bd.aviv@gmail.com>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
Alex Williamson <alex.williamson@redhat.com>,
Jan Kiszka <jan.kiszka@siemens.com>
Subject: Re: [Qemu-devel] [PATCH v4 RESEND 3/3] IOMMU: enable intel_iommu map and unmap notifiers
Date: Thu, 20 Oct 2016 15:28:18 +0800 [thread overview]
Message-ID: <20161020072818.GH15168@pxdev.xzpeter.org> (raw)
In-Reply-To: <1476719064-9242-4-git-send-email-bd.aviv@gmail.com>
On Mon, Oct 17, 2016 at 06:44:24PM +0300, Aviv B.D wrote:
[...]
> @@ -2000,8 +2065,10 @@ static void vtd_iommu_notify_flag_changed(MemoryRegion *iommu,
> IOMMUNotifierFlag new)
> {
> VTDAddressSpace *vtd_as = container_of(iommu, VTDAddressSpace, iommu);
> + IntelIOMMUState *s = vtd_as->iommu_state;
> + IntelIOMMUNotifierNode *node = NULL;
>
> - if (new & IOMMU_NOTIFIER_MAP) {
> + if (!s->cache_mode_enabled && new & IOMMU_NOTIFIER_MAP) {
> error_report("Device at bus %s addr %02x.%d requires iommu "
> "notifier which is currently not supported by "
> "intel-iommu emulation",
Here after the patch works, we can modify the warning message into
something like:
"We need to set cache_mode=1 for intel-iommu to enable device
assignment with IOMMU protection."
> @@ -2009,6 +2076,27 @@ static void vtd_iommu_notify_flag_changed(MemoryRegion *iommu,
> PCI_FUNC(vtd_as->devfn));
> exit(1);
> }
> +
> + /* Add new ndoe if no mapping was exising before this call */
> + if (old == IOMMU_NOTIFIER_NONE) {
> + node = g_malloc0(sizeof(*node));
> + node->vtd_as = vtd_as;
> + node->notifier_flag = new;
> + QLIST_INSERT_HEAD(&s->notifiers_list, node, next);
> + return;
> + }
> +
> + /* update notifier node with new flags */
> + QLIST_FOREACH(node, &s->notifiers_list, next) {
Though in this case it is safe, I would still suggest we use
QLIST_FOREACH_SAFE here.
> + if (node->vtd_as == vtd_as) {
> + if (new == IOMMU_NOTIFIER_NONE) {
> + QLIST_REMOVE(node, next);
Memory leak here?
Thanks,
-- peterx
next prev parent reply other threads:[~2016-10-20 7:28 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-17 15:44 [Qemu-devel] [PATCH v4 RESEND 0/3] IOMMU: intel_iommu support map and unmap notifications Aviv B.D
2016-10-17 15:44 ` [Qemu-devel] [PATCH v4 RESEND 1/3] IOMMU: add option to enable VTD_CAP_CM to vIOMMU capility exposoed to guest Aviv B.D
2016-10-21 7:14 ` Jason Wang
2016-10-21 19:47 ` Michael S. Tsirkin
2016-10-24 2:32 ` Jason Wang
2016-10-17 15:44 ` [Qemu-devel] [PATCH v4 RESEND 2/3] IOMMU: change iommu_op->translate's is_write to flags, add support to NO_FAIL flag mode Aviv B.D
2016-10-18 3:57 ` David Gibson
2016-10-19 8:35 ` Peter Xu
2016-10-20 18:54 ` Aviv B.D.
2016-10-17 15:44 ` [Qemu-devel] [PATCH v4 RESEND 3/3] IOMMU: enable intel_iommu map and unmap notifiers Aviv B.D
2016-10-18 4:04 ` David Gibson
2016-10-19 9:33 ` Peter Xu
2016-10-20 19:11 ` Aviv B.D.
2016-10-20 19:11 ` Aviv B.D.
2016-10-21 3:57 ` Peter Xu
2016-10-24 7:53 ` Aviv B.D.
2016-10-24 8:02 ` Peter Xu
2016-10-25 10:07 ` Aviv B.D.
2016-10-20 7:28 ` Peter Xu [this message]
2016-10-17 16:07 ` [Qemu-devel] [PATCH v4 RESEND 0/3] IOMMU: intel_iommu support map and unmap notifications Alex Williamson
2016-10-18 4:06 ` David Gibson
2016-10-18 4:47 ` Alex Williamson
2016-10-18 5:52 ` David Gibson
2016-10-18 8:03 ` Alex Williamson
2016-10-20 19:17 ` Aviv B.D.
2016-10-20 20:06 ` Alex Williamson
2016-10-21 0:50 ` David Gibson
2016-10-21 5:17 ` Peter Xu
2016-10-21 14:43 ` Alex Williamson
2016-10-31 6:47 ` Peter Xu
2016-10-24 6:03 ` David Gibson
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=20161020072818.GH15168@pxdev.xzpeter.org \
--to=peterx@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=bd.aviv@gmail.com \
--cc=jan.kiszka@siemens.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/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.