On Mon, Mar 20, 2017 at 05:07:34PM +0800, Peter Xu wrote: > 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 <jasow...@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 <pet...@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
Sounds good. It's best to order patches in a way that avoids breakages even for people that bisect though. Might require some patch squashing. -- MST