All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Don't enable hwmon for selftests
@ 2024-04-10  4:28 Ashutosh Dixit
  2024-04-10  4:37 ` Dixit, Ashutosh
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Ashutosh Dixit @ 2024-04-10  4:28 UTC (permalink / raw)
  To: intel-gfx; +Cc: Badal Nilawar

There are no hwmon selftests so there is no need to enable hwmon for
selftests. So enable hwmon only for real driver load.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/10366
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 drivers/gpu/drm/i915/i915_driver.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index 9ee902d5b72c..6fa6d2c8109f 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -94,6 +94,7 @@
 #include "i915_memcpy.h"
 #include "i915_perf.h"
 #include "i915_query.h"
+#include "i915_selftest.h"
 #include "i915_suspend.h"
 #include "i915_switcheroo.h"
 #include "i915_sysfs.h"
@@ -589,6 +590,15 @@ static void i915_driver_hw_remove(struct drm_i915_private *dev_priv)
 		pci_disable_msi(pdev);
 }
 
+static bool is_selftest(void)
+{
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+	return i915_selftest.live || i915_selftest.perf || i915_selftest.mock;
+#else
+	return false;
+#endif
+}
+
 /**
  * i915_driver_register - register the driver with the rest of the system
  * @dev_priv: device private
@@ -624,7 +634,8 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
 
 	intel_pxp_debugfs_register(dev_priv->pxp);
 
-	i915_hwmon_register(dev_priv);
+	if (!is_selftest())
+		i915_hwmon_register(dev_priv);
 
 	intel_display_driver_register(dev_priv);
 
@@ -660,7 +671,8 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)
 	for_each_gt(gt, dev_priv, i)
 		intel_gt_driver_unregister(gt);
 
-	i915_hwmon_unregister(dev_priv);
+	if (!is_selftest())
+		i915_hwmon_unregister(dev_priv);
 
 	i915_perf_unregister(dev_priv);
 	i915_pmu_unregister(dev_priv);
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread
* [PATCH] drm/i915: Don't enable hwmon for selftests
@ 2024-04-10  4:58 Ashutosh Dixit
  2024-04-10  5:17 ` Nilawar, Badal
  0 siblings, 1 reply; 17+ messages in thread
From: Ashutosh Dixit @ 2024-04-10  4:58 UTC (permalink / raw)
  To: intel-gfx; +Cc: Badal Nilawar

There are no hwmon selftests so there is no need to enable hwmon for
selftests. So enable hwmon only for real driver load.

v2: Move the logic inside i915_hwmon.c

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/10366
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 drivers/gpu/drm/i915/i915_hwmon.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_hwmon.c b/drivers/gpu/drm/i915/i915_hwmon.c
index 8c3f443c8347..511ba9be4de5 100644
--- a/drivers/gpu/drm/i915/i915_hwmon.c
+++ b/drivers/gpu/drm/i915/i915_hwmon.c
@@ -10,6 +10,7 @@
 #include "i915_drv.h"
 #include "i915_hwmon.h"
 #include "i915_reg.h"
+#include "i915_selftest.h"
 #include "intel_mchbar_regs.h"
 #include "intel_pcode.h"
 #include "gt/intel_gt.h"
@@ -778,6 +779,15 @@ hwm_get_preregistration_info(struct drm_i915_private *i915)
 	}
 }
 
+static bool is_selftest(void)
+{
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+	return i915_selftest.live || i915_selftest.perf || i915_selftest.mock;
+#else
+	return false;
+#endif
+}
+
 void i915_hwmon_register(struct drm_i915_private *i915)
 {
 	struct device *dev = i915->drm.dev;
@@ -789,7 +799,7 @@ void i915_hwmon_register(struct drm_i915_private *i915)
 	int i;
 
 	/* hwmon is available only for dGfx */
-	if (!IS_DGFX(i915))
+	if (!IS_DGFX(i915) || is_selftest())
 		return;
 
 	hwmon = devm_kzalloc(dev, sizeof(*hwmon), GFP_KERNEL);
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread
* [PATCH] drm/i915: Don't enable hwmon for selftests
@ 2024-04-10  6:05 Ashutosh Dixit
  2024-04-10  6:45 ` Nilawar, Badal
  2024-04-10 13:53 ` Andi Shyti
  0 siblings, 2 replies; 17+ messages in thread
From: Ashutosh Dixit @ 2024-04-10  6:05 UTC (permalink / raw)
  To: intel-gfx; +Cc: Badal Nilawar

There are no hwmon selftests so there is no need to enable hwmon for
selftests. So enable hwmon only for real driver load.

v2: Move the logic inside i915_hwmon.c
v3: Move is_i915_selftest definition to i915_selftest.h (Badal)

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/10366
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 drivers/gpu/drm/i915/i915_hwmon.c    |  3 ++-
 drivers/gpu/drm/i915/i915_selftest.h | 10 ++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_hwmon.c b/drivers/gpu/drm/i915/i915_hwmon.c
index 8c3f443c8347..cf1689333ebf 100644
--- a/drivers/gpu/drm/i915/i915_hwmon.c
+++ b/drivers/gpu/drm/i915/i915_hwmon.c
@@ -10,6 +10,7 @@
 #include "i915_drv.h"
 #include "i915_hwmon.h"
 #include "i915_reg.h"
+#include "i915_selftest.h"
 #include "intel_mchbar_regs.h"
 #include "intel_pcode.h"
 #include "gt/intel_gt.h"
@@ -789,7 +790,7 @@ void i915_hwmon_register(struct drm_i915_private *i915)
 	int i;
 
 	/* hwmon is available only for dGfx */
-	if (!IS_DGFX(i915))
+	if (!IS_DGFX(i915) || is_i915_selftest())
 		return;
 
 	hwmon = devm_kzalloc(dev, sizeof(*hwmon), GFP_KERNEL);
diff --git a/drivers/gpu/drm/i915/i915_selftest.h b/drivers/gpu/drm/i915/i915_selftest.h
index bdf3e22c0a34..19e5076823a7 100644
--- a/drivers/gpu/drm/i915/i915_selftest.h
+++ b/drivers/gpu/drm/i915/i915_selftest.h
@@ -111,6 +111,11 @@ int __i915_subtests(const char *caller,
 #define I915_SELFTEST_ONLY(x) unlikely(x)
 #define I915_SELFTEST_EXPORT
 
+static inline bool is_i915_selftest(void)
+{
+	return i915_selftest.live || i915_selftest.perf || i915_selftest.mock;
+}
+
 #else /* !IS_ENABLED(CONFIG_DRM_I915_SELFTEST) */
 
 static inline int i915_mock_selftests(void) { return 0; }
@@ -121,6 +126,11 @@ static inline int i915_perf_selftests(struct pci_dev *pdev) { return 0; }
 #define I915_SELFTEST_ONLY(x) 0
 #define I915_SELFTEST_EXPORT static
 
+static inline bool is_i915_selftest(void)
+{
+	return false;
+}
+
 #endif
 
 /* Using the i915_selftest_ prefix becomes a little unwieldy with the helpers.
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread
* [PATCH] drm/i915: Don't enable hwmon for selftests
@ 2024-04-10 20:07 Ashutosh Dixit
  0 siblings, 0 replies; 17+ messages in thread
From: Ashutosh Dixit @ 2024-04-10 20:07 UTC (permalink / raw)
  To: intel-gfx; +Cc: Badal Nilawar, Andi Shyti

There are no hwmon selftests so there is no need to enable hwmon for
selftests. So enable hwmon only for real driver load.

v2: Move the logic inside i915_hwmon.c
v3: Move is_i915_selftest definition to i915_selftest.h (Badal)
v4: s/is_i915_selftest/is_i915_selftest_module/

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/10366
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_hwmon.c    | 3 ++-
 drivers/gpu/drm/i915/i915_selftest.h | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_hwmon.c b/drivers/gpu/drm/i915/i915_hwmon.c
index 8c3f443c8347..86d7cd1ef45e 100644
--- a/drivers/gpu/drm/i915/i915_hwmon.c
+++ b/drivers/gpu/drm/i915/i915_hwmon.c
@@ -10,6 +10,7 @@
 #include "i915_drv.h"
 #include "i915_hwmon.h"
 #include "i915_reg.h"
+#include "i915_selftest.h"
 #include "intel_mchbar_regs.h"
 #include "intel_pcode.h"
 #include "gt/intel_gt.h"
@@ -789,7 +790,7 @@ void i915_hwmon_register(struct drm_i915_private *i915)
 	int i;
 
 	/* hwmon is available only for dGfx */
-	if (!IS_DGFX(i915))
+	if (!IS_DGFX(i915) || is_i915_selftest_module())
 		return;
 
 	hwmon = devm_kzalloc(dev, sizeof(*hwmon), GFP_KERNEL);
diff --git a/drivers/gpu/drm/i915/i915_selftest.h b/drivers/gpu/drm/i915/i915_selftest.h
index bdf3e22c0a34..bba3fafaac8d 100644
--- a/drivers/gpu/drm/i915/i915_selftest.h
+++ b/drivers/gpu/drm/i915/i915_selftest.h
@@ -123,6 +123,15 @@ static inline int i915_perf_selftests(struct pci_dev *pdev) { return 0; }
 
 #endif
 
+static inline bool is_i915_selftest_module(void)
+{
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+	return i915_selftest.live || i915_selftest.perf || i915_selftest.mock;
+#else
+	return false;
+#endif
+}
+
 /* Using the i915_selftest_ prefix becomes a little unwieldy with the helpers.
  * Instead we use the igt_ shorthand, in reference to the intel-gpu-tools
  * suite of uabi test cases (which includes a test runner for our selftests).
-- 
2.41.0


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

end of thread, other threads:[~2024-04-13  0:37 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-10  4:28 [PATCH] drm/i915: Don't enable hwmon for selftests Ashutosh Dixit
2024-04-10  4:37 ` Dixit, Ashutosh
2024-04-10  4:56 ` Nilawar, Badal
2024-04-10  5:26 ` ✗ Fi.CI.BAT: failure for " Patchwork
2024-04-10 11:42 ` [PATCH] " Ville Syrjälä
2024-04-11  5:09   ` Dixit, Ashutosh
2024-04-11 10:47     ` Ville Syrjälä
2024-04-13  0:35       ` Dixit, Ashutosh
2024-04-13  0:37         ` Dixit, Ashutosh
  -- strict thread matches above, loose matches on Subject: below --
2024-04-10  4:58 Ashutosh Dixit
2024-04-10  5:17 ` Nilawar, Badal
2024-04-10  6:06   ` Dixit, Ashutosh
2024-04-10  6:05 Ashutosh Dixit
2024-04-10  6:45 ` Nilawar, Badal
2024-04-10 13:53 ` Andi Shyti
2024-04-11  4:59   ` Dixit, Ashutosh
2024-04-10 20:07 Ashutosh Dixit

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.