On Sun, Sep 23, 2018 at 10:39:25AM +0800, Lu Baolu wrote: > > +int iommu_sva_init_device(struct device *dev, unsigned long features, > > + unsigned int min_pasid, unsigned int max_pasid) > > +{ > > + int ret; > > + struct iommu_sva_param *param; > > + struct iommu_domain *domain = iommu_get_domain_for_dev(dev); > > This doesn't work for vt-d. The domains for host iova are self-managed > by vt-d driver itself. Hence, iommu_get_domain_for_dev() will always > return NULL unless an UNMANAGED domain is attached to the device. > > How about > > const struct iommu_ops *ops = dev->bus->iommu_ops; > > instead? The per-bus iommu-ops might go away sooner or later as we move to per-device iommu-ops. How about fixing the VT-d driver to not keep that domain internal to itself? Regards, Joerg