[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 RESEND 3/3] IOMMU: enable intel_iommu map and
From: |
Peter Xu |
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 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
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
- Re: [Qemu-devel] [PATCH v4 RESEND 1/3] IOMMU: add option to enable VTD_CAP_CM to vIOMMU capility exposoed to guest, (continued)
- [Qemu-devel] [PATCH v4 RESEND 3/3] IOMMU: enable intel_iommu map and unmap notifiers, Aviv B.D, 2016/10/17
- Re: [Qemu-devel] [PATCH v4 RESEND 3/3] IOMMU: enable intel_iommu map and unmap notifiers, David Gibson, 2016/10/18
- Re: [Qemu-devel] [PATCH v4 RESEND 3/3] IOMMU: enable intel_iommu map and unmap notifiers, Peter Xu, 2016/10/19
- Re: [Qemu-devel] [PATCH v4 RESEND 3/3] IOMMU: enable intel_iommu map and unmap notifiers, Aviv B.D., 2016/10/20
- Re: [Qemu-devel] [PATCH v4 RESEND 3/3] IOMMU: enable intel_iommu map and unmap notifiers, Aviv B.D., 2016/10/20
- Re: [Qemu-devel] [PATCH v4 RESEND 3/3] IOMMU: enable intel_iommu map and unmap notifiers, Peter Xu, 2016/10/20
- Re: [Qemu-devel] [PATCH v4 RESEND 3/3] IOMMU: enable intel_iommu map and unmap notifiers, Aviv B.D., 2016/10/24
- Re: [Qemu-devel] [PATCH v4 RESEND 3/3] IOMMU: enable intel_iommu map and unmap notifiers, Peter Xu, 2016/10/24
- Re: [Qemu-devel] [PATCH v4 RESEND 3/3] IOMMU: enable intel_iommu map and unmap notifiers, Aviv B.D., 2016/10/25
Re: [Qemu-devel] [PATCH v4 RESEND 3/3] IOMMU: enable intel_iommu map and unmap notifiers,
Peter Xu <=
[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/17
Re: [Qemu-devel] [PATCH v4 RESEND 0/3] IOMMU: intel_iommu support map and unmap notifications, Alex Williamson, 2016/10/17
Re: [Qemu-devel] [PATCH v4 RESEND 0/3] IOMMU: intel_iommu support map and unmap notifications, Aviv B.D., 2016/10/20