All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: qat - stop using iommu_present()
@ 2022-04-05 12:25 ` Robin Murphy
  0 siblings, 0 replies; 6+ messages in thread
From: Robin Murphy @ 2022-04-05 12:25 UTC (permalink / raw)
  To: giovanni.cabiddu, herbert, davem
  Cc: linux-kernel, iommu, qat-linux, linux-crypto

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

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] crypto: qat - stop using iommu_present()
@ 2022-04-05 12:25 ` Robin Murphy
  0 siblings, 0 replies; 6+ messages in thread
From: Robin Murphy @ 2022-04-05 12:25 UTC (permalink / raw)
  To: giovanni.cabiddu, herbert, davem
  Cc: qat-linux, linux-crypto, iommu, linux-kernel

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: qat - stop using iommu_present()
  2022-04-05 12:25 ` Robin Murphy
@ 2022-04-10 19:52   ` Giovanni Cabiddu
  -1 siblings, 0 replies; 6+ messages in thread
From: Giovanni Cabiddu @ 2022-04-10 19:52 UTC (permalink / raw)
  To: Robin Murphy; +Cc: herbert, davem, qat-linux, linux-crypto, iommu, linux-kernel

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,

-- 
Giovanni

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: qat - stop using iommu_present()
@ 2022-04-10 19:52   ` Giovanni Cabiddu
  0 siblings, 0 replies; 6+ messages in thread
From: Giovanni Cabiddu @ 2022-04-10 19:52 UTC (permalink / raw)
  To: Robin Murphy; +Cc: herbert, qat-linux, linux-kernel, iommu, linux-crypto, davem

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,

-- 
Giovanni
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: qat - stop using iommu_present()
  2022-04-05 12:25 ` Robin Murphy
@ 2022-04-15  8:39   ` Herbert Xu
  -1 siblings, 0 replies; 6+ messages in thread
From: Herbert Xu @ 2022-04-15  8:39 UTC (permalink / raw)
  To: Robin Murphy
  Cc: giovanni.cabiddu, davem, qat-linux, linux-crypto, iommu, linux-kernel

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.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: qat - stop using iommu_present()
@ 2022-04-15  8:39   ` Herbert Xu
  0 siblings, 0 replies; 6+ messages in thread
From: Herbert Xu @ 2022-04-15  8:39 UTC (permalink / raw)
  To: Robin Murphy; +Cc: linux-kernel, qat-linux, iommu, linux-crypto, davem

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.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-04-15  8:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 12:25 [PATCH] crypto: qat - stop using iommu_present() Robin Murphy
2022-04-05 12:25 ` Robin Murphy
2022-04-10 19:52 ` Giovanni Cabiddu
2022-04-10 19:52   ` Giovanni Cabiddu
2022-04-15  8:39 ` Herbert Xu
2022-04-15  8:39   ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.