]> Git Repo - J-linux.git/commitdiff
vhost-vdpa: Use iommu_paging_domain_alloc()
authorLu Baolu <[email protected]>
Mon, 10 Jun 2024 08:55:38 +0000 (16:55 +0800)
committerWill Deacon <[email protected]>
Thu, 4 Jul 2024 13:09:33 +0000 (14:09 +0100)
Replace iommu_domain_alloc() with iommu_paging_domain_alloc().

Signed-off-by: Lu Baolu <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Will Deacon <[email protected]>
drivers/vhost/vdpa.c

index 63a53680a85cb97e58b6d4eba379ee60108e87e9..e31ec9ebc4ce842accc0ac2be8feb1a237c6e126 100644 (file)
@@ -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);
        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;
 
        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;
        }
 
        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)
 
        ret = iommu_attach_device(v->domain, dma_dev);
        if (ret)
This page took 0.051055 seconds and 4 git commands to generate.