diff mbox series

[12/13] iommu/virtio: Clean up bus_set_iommu()

Message ID 4db34a35e07f3741a658465045b78c96a569c591.1649935679.git.robin.murphy@arm.com (mailing list archive)
State New, archived
Headers show
Series iommu: Retire bus_set_iommu() | expand

Commit Message

Robin Murphy April 14, 2022, 12:42 p.m. UTC
Stop calling bus_set_iommu() since it's now unnecessary, and simplify
the probe failure path accordingly.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 drivers/iommu/virtio-iommu.c | 24 ------------------------
 1 file changed, 24 deletions(-)

Comments

Jean-Philippe Brucker April 21, 2022, 5:12 p.m. UTC | #1
On Thu, Apr 14, 2022 at 01:42:41PM +0100, Robin Murphy wrote:
> Stop calling bus_set_iommu() since it's now unnecessary, and simplify
> the probe failure path accordingly.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  drivers/iommu/virtio-iommu.c | 24 ------------------------
>  1 file changed, 24 deletions(-)
> 
> diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
> index 25be4b822aa0..371f8657c0ce 100644
> --- a/drivers/iommu/virtio-iommu.c
> +++ b/drivers/iommu/virtio-iommu.c
> @@ -7,7 +7,6 @@
>  
>  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>  
> -#include <linux/amba/bus.h>
>  #include <linux/delay.h>
>  #include <linux/dma-iommu.h>
>  #include <linux/dma-map-ops.h>

<linux/platform_device.h> isn't needed anymore either. In any case it
looks great, thanks

Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>

and tested on QEMU (so only PCI for now)


> @@ -1146,26 +1145,6 @@ static int viommu_probe(struct virtio_device *vdev)
>  
>  	iommu_device_register(&viommu->iommu, &viommu_ops, parent_dev);
>  
> -#ifdef CONFIG_PCI
> -	if (pci_bus_type.iommu_ops != &viommu_ops) {
> -		ret = bus_set_iommu(&pci_bus_type, &viommu_ops);
> -		if (ret)
> -			goto err_unregister;
> -	}
> -#endif
> -#ifdef CONFIG_ARM_AMBA
> -	if (amba_bustype.iommu_ops != &viommu_ops) {
> -		ret = bus_set_iommu(&amba_bustype, &viommu_ops);
> -		if (ret)
> -			goto err_unregister;
> -	}
> -#endif
> -	if (platform_bus_type.iommu_ops != &viommu_ops) {
> -		ret = bus_set_iommu(&platform_bus_type, &viommu_ops);
> -		if (ret)
> -			goto err_unregister;
> -	}
> -
>  	vdev->priv = viommu;
>  
>  	dev_info(dev, "input address: %u bits\n",
> @@ -1174,9 +1153,6 @@ static int viommu_probe(struct virtio_device *vdev)
>  
>  	return 0;
>  
> -err_unregister:
> -	iommu_device_sysfs_remove(&viommu->iommu);
> -	iommu_device_unregister(&viommu->iommu);
>  err_free_vqs:
>  	vdev->config->del_vqs(vdev);
>  
> -- 
> 2.28.0.dirty
>
Robin Murphy April 21, 2022, 7:44 p.m. UTC | #2
On 2022-04-21 18:12, Jean-Philippe Brucker wrote:
> On Thu, Apr 14, 2022 at 01:42:41PM +0100, Robin Murphy wrote:
>> Stop calling bus_set_iommu() since it's now unnecessary, and simplify
>> the probe failure path accordingly.
>>
>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
>> ---
>>   drivers/iommu/virtio-iommu.c | 24 ------------------------
>>   1 file changed, 24 deletions(-)
>>
>> diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
>> index 25be4b822aa0..371f8657c0ce 100644
>> --- a/drivers/iommu/virtio-iommu.c
>> +++ b/drivers/iommu/virtio-iommu.c
>> @@ -7,7 +7,6 @@
>>   
>>   #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>>   
>> -#include <linux/amba/bus.h>
>>   #include <linux/delay.h>
>>   #include <linux/dma-iommu.h>
>>   #include <linux/dma-map-ops.h>
> 
> <linux/platform_device.h> isn't needed anymore either. In any case it
> looks great, thanks

Ha, it totally passed me by that this one *isn't* a platform driver, derp :)

> Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
> 
> and tested on QEMU (so only PCI for now)

Thanks!

Robin.

>> @@ -1146,26 +1145,6 @@ static int viommu_probe(struct virtio_device *vdev)
>>   
>>   	iommu_device_register(&viommu->iommu, &viommu_ops, parent_dev);
>>   
>> -#ifdef CONFIG_PCI
>> -	if (pci_bus_type.iommu_ops != &viommu_ops) {
>> -		ret = bus_set_iommu(&pci_bus_type, &viommu_ops);
>> -		if (ret)
>> -			goto err_unregister;
>> -	}
>> -#endif
>> -#ifdef CONFIG_ARM_AMBA
>> -	if (amba_bustype.iommu_ops != &viommu_ops) {
>> -		ret = bus_set_iommu(&amba_bustype, &viommu_ops);
>> -		if (ret)
>> -			goto err_unregister;
>> -	}
>> -#endif
>> -	if (platform_bus_type.iommu_ops != &viommu_ops) {
>> -		ret = bus_set_iommu(&platform_bus_type, &viommu_ops);
>> -		if (ret)
>> -			goto err_unregister;
>> -	}
>> -
>>   	vdev->priv = viommu;
>>   
>>   	dev_info(dev, "input address: %u bits\n",
>> @@ -1174,9 +1153,6 @@ static int viommu_probe(struct virtio_device *vdev)
>>   
>>   	return 0;
>>   
>> -err_unregister:
>> -	iommu_device_sysfs_remove(&viommu->iommu);
>> -	iommu_device_unregister(&viommu->iommu);
>>   err_free_vqs:
>>   	vdev->config->del_vqs(vdev);
>>   
>> -- 
>> 2.28.0.dirty
>>
diff mbox series

Patch

diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
index 25be4b822aa0..371f8657c0ce 100644
--- a/drivers/iommu/virtio-iommu.c
+++ b/drivers/iommu/virtio-iommu.c
@@ -7,7 +7,6 @@ 
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include <linux/amba/bus.h>
 #include <linux/delay.h>
 #include <linux/dma-iommu.h>
 #include <linux/dma-map-ops.h>
@@ -1146,26 +1145,6 @@  static int viommu_probe(struct virtio_device *vdev)
 
 	iommu_device_register(&viommu->iommu, &viommu_ops, parent_dev);
 
-#ifdef CONFIG_PCI
-	if (pci_bus_type.iommu_ops != &viommu_ops) {
-		ret = bus_set_iommu(&pci_bus_type, &viommu_ops);
-		if (ret)
-			goto err_unregister;
-	}
-#endif
-#ifdef CONFIG_ARM_AMBA
-	if (amba_bustype.iommu_ops != &viommu_ops) {
-		ret = bus_set_iommu(&amba_bustype, &viommu_ops);
-		if (ret)
-			goto err_unregister;
-	}
-#endif
-	if (platform_bus_type.iommu_ops != &viommu_ops) {
-		ret = bus_set_iommu(&platform_bus_type, &viommu_ops);
-		if (ret)
-			goto err_unregister;
-	}
-
 	vdev->priv = viommu;
 
 	dev_info(dev, "input address: %u bits\n",
@@ -1174,9 +1153,6 @@  static int viommu_probe(struct virtio_device *vdev)
 
 	return 0;
 
-err_unregister:
-	iommu_device_sysfs_remove(&viommu->iommu);
-	iommu_device_unregister(&viommu->iommu);
 err_free_vqs:
 	vdev->config->del_vqs(vdev);