mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 17:22:07 +00:00
vhost-vdpa: Use iommu_paging_domain_alloc()
Replace iommu_domain_alloc() with iommu_paging_domain_alloc(). Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20240610085555.88197-5-baolu.lu@linux.intel.com Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
60ffc45017
commit
9c159f6de1
@ -1312,26 +1312,24 @@ static int vhost_vdpa_alloc_domain(struct vhost_vdpa *v)
|
||||
struct vdpa_device *vdpa = v->vdpa;
|
||||
const struct vdpa_config_ops *ops = vdpa->config;
|
||||
struct device *dma_dev = vdpa_get_dma_dev(vdpa);
|
||||
const struct bus_type *bus;
|
||||
int ret;
|
||||
|
||||
/* Device want to do DMA by itself */
|
||||
if (ops->set_map || ops->dma_map)
|
||||
return 0;
|
||||
|
||||
bus = dma_dev->bus;
|
||||
if (!bus)
|
||||
return -EFAULT;
|
||||
|
||||
if (!device_iommu_capable(dma_dev, IOMMU_CAP_CACHE_COHERENCY)) {
|
||||
dev_warn_once(&v->dev,
|
||||
"Failed to allocate domain, device is not IOMMU cache coherent capable\n");
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
|
||||
v->domain = iommu_domain_alloc(bus);
|
||||
if (!v->domain)
|
||||
return -EIO;
|
||||
v->domain = iommu_paging_domain_alloc(dma_dev);
|
||||
if (IS_ERR(v->domain)) {
|
||||
ret = PTR_ERR(v->domain);
|
||||
v->domain = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = iommu_attach_device(v->domain, dma_dev);
|
||||
if (ret)
|
||||
|
Loading…
Reference in New Issue
Block a user