diff mbox series

crypto: qat - stop using iommu_present()

Message ID ef01fbd7d2c60d56a0b8e8847a08ccb3ee5132af.1649161511.git.robin.murphy@arm.com
State Accepted
Commit c79c09ad31e2c0a5ba0166b284f433b95d9c4c18
Headers show
Series crypto: qat - stop using iommu_present() | expand

Commit Message

Robin Murphy April 5, 2022, 12:25 p.m. UTC
Even if an IOMMU might be present for some PCI segment in the system,
that doesn't necessarily mean it provides translation for the device
we care about. Replace iommu_present() with a more appropriate check.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 drivers/crypto/qat/qat_common/adf_sriov.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Giovanni Cabiddu April 10, 2022, 7:52 p.m. UTC | #1
On Tue, Apr 05, 2022 at 01:25:11PM +0100, Robin Murphy wrote:
> Even if an IOMMU might be present for some PCI segment in the system,
> that doesn't necessarily mean it provides translation for the device
> we care about. Replace iommu_present() with a more appropriate check.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  drivers/crypto/qat/qat_common/adf_sriov.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/qat/qat_common/adf_sriov.c b/drivers/crypto/qat/qat_common/adf_sriov.c
> index b960bca1f9d2..7f9c18dc4540 100644
> --- a/drivers/crypto/qat/qat_common/adf_sriov.c
> +++ b/drivers/crypto/qat/qat_common/adf_sriov.c
> @@ -3,7 +3,6 @@
>  #include <linux/workqueue.h>
>  #include <linux/pci.h>
>  #include <linux/device.h>
> -#include <linux/iommu.h>
>  #include "adf_common_drv.h"
>  #include "adf_cfg.h"
>  #include "adf_pfvf_pf_msg.h"
> @@ -176,7 +175,7 @@ int adf_sriov_configure(struct pci_dev *pdev, int numvfs)
>  		return -EFAULT;
>  	}
>  
> -	if (!iommu_present(&pci_bus_type))
> +	if (!device_iommu_mapped(&pdev->dev))
>  		dev_warn(&pdev->dev, "IOMMU should be enabled for SR-IOV to work correctly\n");
>  
>  	if (accel_dev->pf.vf_info) {
> -- 
> 2.28.0.dirty
> 
I tried this patch and it appears to work as expected.

Acked-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>

Regards,
Herbert Xu April 15, 2022, 8:39 a.m. UTC | #2
On Tue, Apr 05, 2022 at 01:25:11PM +0100, Robin Murphy wrote:
> Even if an IOMMU might be present for some PCI segment in the system,
> that doesn't necessarily mean it provides translation for the device
> we care about. Replace iommu_present() with a more appropriate check.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  drivers/crypto/qat/qat_common/adf_sriov.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/crypto/qat/qat_common/adf_sriov.c b/drivers/crypto/qat/qat_common/adf_sriov.c
index b960bca1f9d2..7f9c18dc4540 100644
--- a/drivers/crypto/qat/qat_common/adf_sriov.c
+++ b/drivers/crypto/qat/qat_common/adf_sriov.c
@@ -3,7 +3,6 @@ 
 #include <linux/workqueue.h>
 #include <linux/pci.h>
 #include <linux/device.h>
-#include <linux/iommu.h>
 #include "adf_common_drv.h"
 #include "adf_cfg.h"
 #include "adf_pfvf_pf_msg.h"
@@ -176,7 +175,7 @@  int adf_sriov_configure(struct pci_dev *pdev, int numvfs)
 		return -EFAULT;
 	}
 
-	if (!iommu_present(&pci_bus_type))
+	if (!device_iommu_mapped(&pdev->dev))
 		dev_warn(&pdev->dev, "IOMMU should be enabled for SR-IOV to work correctly\n");
 
 	if (accel_dev->pf.vf_info) {