qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH fixup 2/2] vhost: genearlize iommu memory region


From: Peter Xu
Subject: Re: [Qemu-devel] [PATCH fixup 2/2] vhost: genearlize iommu memory region
Date: Mon, 20 Mar 2017 17:07:34 +0800
User-agent: Mutt/1.5.24 (2015-08-30)

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 <address@hidden>

[...]

> @@ -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 <address@hidden>

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 via email to

[Prev in Thread] Current Thread [Next in Thread]