linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Replace intel_iommu_gfx_mapped with device_iommu_mapped()
@ 2022-02-11  3:05 Lu Baolu
  2022-02-11  3:05 ` [PATCH 1/2] agp/intel: Use per device iommu check Lu Baolu
  2022-02-11  3:05 ` [PATCH 2/2] iommu/vt-d: Remove unnecessary exported symbol Lu Baolu
  0 siblings, 2 replies; 4+ messages in thread
From: Lu Baolu @ 2022-02-11  3:05 UTC (permalink / raw)
  To: David Airlie, Joerg Roedel, Will Deacon, Chris Wilson, Nathan Myers
  Cc: Tvrtko Ursulin, Lucas De Marchi, Robin Murphy, iommu,
	linux-kernel, Lu Baolu

Hi,

This follows commit cca084692394a ("drm/i915: Use per device iommu check")
to convert intel_iommu_gfx_mapped use in agp/intel to device_iommu_mapped().
With this changed, the export intel_iommu_gfx_mapped could be removed.

Best regards,
baolu

Lu Baolu (2):
  agp/intel: Use per device iommu check
  iommu/vt-d: Remove unnecessary exported symbol

 include/linux/intel-iommu.h  |  1 -
 drivers/char/agp/intel-gtt.c | 17 +++++++----------
 drivers/iommu/intel/iommu.c  |  6 ------
 3 files changed, 7 insertions(+), 17 deletions(-)

-- 
2.25.1


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

* [PATCH 1/2] agp/intel: Use per device iommu check
  2022-02-11  3:05 [PATCH 0/2] Replace intel_iommu_gfx_mapped with device_iommu_mapped() Lu Baolu
@ 2022-02-11  3:05 ` Lu Baolu
  2022-03-08  6:42   ` Lu Baolu
  2022-02-11  3:05 ` [PATCH 2/2] iommu/vt-d: Remove unnecessary exported symbol Lu Baolu
  1 sibling, 1 reply; 4+ messages in thread
From: Lu Baolu @ 2022-02-11  3:05 UTC (permalink / raw)
  To: David Airlie, Joerg Roedel, Will Deacon, Chris Wilson, Nathan Myers
  Cc: Tvrtko Ursulin, Lucas De Marchi, Robin Murphy, iommu,
	linux-kernel, Lu Baolu

The IOMMU subsystem has already provided an interface to query whether
the IOMMU hardware is enabled for a specific device. This changes the
check from Intel specific intel_iommu_gfx_mapped (globally exported by
the Intel IOMMU driver) to probing the presence of IOMMU on a specific
device using the generic device_iommu_mapped().

This follows commit cca084692394a ("drm/i915: Use per device iommu check")
which converted drm/i915 driver to use device_iommu_mapped().

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 drivers/char/agp/intel-gtt.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index c53cc9868cd8..9631cbc7002e 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -20,7 +20,7 @@
 #include <linux/kernel.h>
 #include <linux/pagemap.h>
 #include <linux/agp_backend.h>
-#include <linux/intel-iommu.h>
+#include <linux/iommu.h>
 #include <linux/delay.h>
 #include <asm/smp.h>
 #include "agp.h"
@@ -573,18 +573,15 @@ static void intel_gtt_cleanup(void)
  */
 static inline int needs_ilk_vtd_wa(void)
 {
-#ifdef CONFIG_INTEL_IOMMU
 	const unsigned short gpu_devid = intel_private.pcidev->device;
 
-	/* Query intel_iommu to see if we need the workaround. Presumably that
-	 * was loaded first.
+	/*
+	 * Query iommu subsystem to see if we need the workaround. Presumably
+	 * that was loaded first.
 	 */
-	if ((gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG ||
-	     gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG) &&
-	     intel_iommu_gfx_mapped)
-		return 1;
-#endif
-	return 0;
+	return ((gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG ||
+		 gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG) &&
+		device_iommu_mapped(&intel_private.pcidev->dev));
 }
 
 static bool intel_gtt_can_wc(void)
-- 
2.25.1


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

* [PATCH 2/2] iommu/vt-d: Remove unnecessary exported symbol
  2022-02-11  3:05 [PATCH 0/2] Replace intel_iommu_gfx_mapped with device_iommu_mapped() Lu Baolu
  2022-02-11  3:05 ` [PATCH 1/2] agp/intel: Use per device iommu check Lu Baolu
@ 2022-02-11  3:05 ` Lu Baolu
  1 sibling, 0 replies; 4+ messages in thread
From: Lu Baolu @ 2022-02-11  3:05 UTC (permalink / raw)
  To: David Airlie, Joerg Roedel, Will Deacon, Chris Wilson, Nathan Myers
  Cc: Tvrtko Ursulin, Lucas De Marchi, Robin Murphy, iommu,
	linux-kernel, Lu Baolu

The exported symbol intel_iommu_gfx_mapped is not used anywhere in the
tree. Remove it to avoid dead code.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 include/linux/intel-iommu.h | 1 -
 drivers/iommu/intel/iommu.c | 6 ------
 2 files changed, 7 deletions(-)

diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 2f8a4517c929..b8b8be58cb6b 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -789,7 +789,6 @@ extern int iommu_calculate_agaw(struct intel_iommu *iommu);
 extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu);
 extern int dmar_disabled;
 extern int intel_iommu_enabled;
-extern int intel_iommu_gfx_mapped;
 #else
 static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
 {
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 4b06f2f365bd..88a53140c7f1 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -311,9 +311,6 @@ static int iommu_skip_te_disable;
 #define IDENTMAP_GFX		2
 #define IDENTMAP_AZALIA		4
 
-int intel_iommu_gfx_mapped;
-EXPORT_SYMBOL_GPL(intel_iommu_gfx_mapped);
-
 static DEFINE_XARRAY_ALLOC(device_domain_array);
 
 /* Convert device source ID into the index of device_domain_array. */
@@ -4070,9 +4067,6 @@ int __init intel_iommu_init(void)
 	if (list_empty(&dmar_satc_units))
 		pr_info("No SATC found\n");
 
-	if (dmar_map_gfx)
-		intel_iommu_gfx_mapped = 1;
-
 	init_no_remapping_devices();
 
 	ret = init_dmars();
-- 
2.25.1


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

* Re: [PATCH 1/2] agp/intel: Use per device iommu check
  2022-02-11  3:05 ` [PATCH 1/2] agp/intel: Use per device iommu check Lu Baolu
@ 2022-03-08  6:42   ` Lu Baolu
  0 siblings, 0 replies; 4+ messages in thread
From: Lu Baolu @ 2022-03-08  6:42 UTC (permalink / raw)
  To: David Airlie, Joerg Roedel, Will Deacon, Chris Wilson, Nathan Myers
  Cc: baolu.lu, Tvrtko Ursulin, Lucas De Marchi, Robin Murphy, iommu,
	linux-kernel

On 2022/2/11 11:05, Lu Baolu wrote:
> The IOMMU subsystem has already provided an interface to query whether
> the IOMMU hardware is enabled for a specific device. This changes the
> check from Intel specific intel_iommu_gfx_mapped (globally exported by
> the Intel IOMMU driver) to probing the presence of IOMMU on a specific
> device using the generic device_iommu_mapped().
> 
> This follows commit cca084692394a ("drm/i915: Use per device iommu check")
> which converted drm/i915 driver to use device_iommu_mapped().
> 
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> ---
>   drivers/char/agp/intel-gtt.c | 17 +++++++----------
>   1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
> index c53cc9868cd8..9631cbc7002e 100644
> --- a/drivers/char/agp/intel-gtt.c
> +++ b/drivers/char/agp/intel-gtt.c
> @@ -20,7 +20,7 @@
>   #include <linux/kernel.h>
>   #include <linux/pagemap.h>
>   #include <linux/agp_backend.h>
> -#include <linux/intel-iommu.h>
> +#include <linux/iommu.h>
>   #include <linux/delay.h>
>   #include <asm/smp.h>
>   #include "agp.h"
> @@ -573,18 +573,15 @@ static void intel_gtt_cleanup(void)
>    */
>   static inline int needs_ilk_vtd_wa(void)
>   {
> -#ifdef CONFIG_INTEL_IOMMU
>   	const unsigned short gpu_devid = intel_private.pcidev->device;
>   
> -	/* Query intel_iommu to see if we need the workaround. Presumably that
> -	 * was loaded first.
> +	/*
> +	 * Query iommu subsystem to see if we need the workaround. Presumably
> +	 * that was loaded first.
>   	 */
> -	if ((gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG ||
> -	     gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG) &&
> -	     intel_iommu_gfx_mapped)
> -		return 1;
> -#endif
> -	return 0;
> +	return ((gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG ||
> +		 gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG) &&
> +		device_iommu_mapped(&intel_private.pcidev->dev));
>   }
>   
>   static bool intel_gtt_can_wc(void)

A gentle ping ...:-)

Best regards,
baolu

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

end of thread, other threads:[~2022-03-08  6:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-11  3:05 [PATCH 0/2] Replace intel_iommu_gfx_mapped with device_iommu_mapped() Lu Baolu
2022-02-11  3:05 ` [PATCH 1/2] agp/intel: Use per device iommu check Lu Baolu
2022-03-08  6:42   ` Lu Baolu
2022-02-11  3:05 ` [PATCH 2/2] iommu/vt-d: Remove unnecessary exported symbol Lu Baolu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).