All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: mst@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH fixup 2/2] vhost: genearlize iommu memory region
Date: Mon, 20 Mar 2017 17:07:34 +0800	[thread overview]
Message-ID: <20170320090734.GN17405@pxdev.xzpeter.org> (raw)
In-Reply-To: <1489980999-5965-3-git-send-email-jasowang@redhat.com>

On Mon, Mar 20, 2017 at 11:36:39AM +0800, Jason Wang wrote:
> We assumes the iommu_ops were attached to the root region of address
> space. This may not true for all kinds of IOMMU implementation. So fix
> this by not assume as->root has iommu_ops and:
> 
> - register a memory listener to dma_as
> - during region_add, if it's a region of IOMMU, register a specific
>   IOMMU notifier, and store all notifiers in a list
> - during region_del, compare and delete the IOMMU notifier
> 
> This is a must for making vhost device IOTLB works for IOMMU other
> than intel ones.
> 
> Signed-off-by: Jason Wang <jasowang@redhat.com>

[...]

> @@ -1454,9 +1509,8 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
>          goto fail_features;
>      }
>  
> -    if (vhost_dev_has_iommu(hdev)) {
> -        memory_region_register_iommu_notifier(vdev->dma_as->root,
> -                                              &hdev->n);
> +    if (true) {

Here the if clause can be removed. And...

> +        memory_listener_register(&hdev->iommu_listener, vdev->dma_as);
>      }
>  
>      r = hdev->vhost_ops->vhost_set_mem_table(hdev, hdev->mem);
> @@ -1536,10 +1590,9 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev)
>                               hdev->vq_index + i);
>      }
>  
> -    if (vhost_dev_has_iommu(hdev)) {
> +    if (true) {

...here. Besides that:

Reviewed-by: Peter Xu <peterx@redhat.com>

Since this patchset depends on vtd vfio series and fixes its breakage
to vhost, I'll pick them up for consistency for next post of vtd vfio
series as well.

Thanks,

-- peterx

  reply	other threads:[~2017-03-20  9:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20  3:36 [Qemu-devel] [PATCH fixup 0/2] Vhost device IOTLB fixup for vfio enablment Jason Wang
2017-03-20  3:36 ` [Qemu-devel] [PATCH fixup 1/2] intel_iommu: use the correct memory region for device IOTLB notification Jason Wang
2017-03-20  7:10   ` Peter Xu
2017-03-20  3:36 ` [Qemu-devel] [PATCH fixup 2/2] vhost: genearlize iommu memory region Jason Wang
2017-03-20  9:07   ` Peter Xu [this message]
2017-03-21  1:12     ` Michael S. Tsirkin
2017-03-21  1:21       ` Eric Blake
2017-03-21  1:39         ` Peter Xu
2017-03-29  2:57           ` Jason Wang

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=20170320090734.GN17405@pxdev.xzpeter.org \
    --to=peterx@redhat.com \
    --cc=jasowang@redhat.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.