Skip to content

Commit 9c159f6

Browse files
LuBaoluwilldeacon
authored andcommitted
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>
1 parent 60ffc45 commit 9c159f6

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/vhost/vdpa.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,26 +1312,24 @@ static int vhost_vdpa_alloc_domain(struct vhost_vdpa *v)
13121312
struct vdpa_device *vdpa = v->vdpa;
13131313
const struct vdpa_config_ops *ops = vdpa->config;
13141314
struct device *dma_dev = vdpa_get_dma_dev(vdpa);
1315-
const struct bus_type *bus;
13161315
int ret;
13171316

13181317
/* Device want to do DMA by itself */
13191318
if (ops->set_map || ops->dma_map)
13201319
return 0;
13211320

1322-
bus = dma_dev->bus;
1323-
if (!bus)
1324-
return -EFAULT;
1325-
13261321
if (!device_iommu_capable(dma_dev, IOMMU_CAP_CACHE_COHERENCY)) {
13271322
dev_warn_once(&v->dev,
13281323
"Failed to allocate domain, device is not IOMMU cache coherent capable\n");
13291324
return -ENOTSUPP;
13301325
}
13311326

1332-
v->domain = iommu_domain_alloc(bus);
1333-
if (!v->domain)
1334-
return -EIO;
1327+
v->domain = iommu_paging_domain_alloc(dma_dev);
1328+
if (IS_ERR(v->domain)) {
1329+
ret = PTR_ERR(v->domain);
1330+
v->domain = NULL;
1331+
return ret;
1332+
}
13351333

13361334
ret = iommu_attach_device(v->domain, dma_dev);
13371335
if (ret)

0 commit comments

Comments
 (0)