diff mbox series

[1/5] drm/i915/pmu: report irqs to pmu code

Message ID 26018446c6aef2386dddc8814dd9d352ababe508.1698939671.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/pmu: hide struct i915_pmu | expand

Commit Message

Jani Nikula Nov. 2, 2023, 3:42 p.m. UTC
Avoid accessing PMU details directly from irq code.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/i915_irq.c | 6 +-----
 drivers/gpu/drm/i915/i915_pmu.c | 9 +++++++++
 drivers/gpu/drm/i915/i915_pmu.h | 2 ++
 3 files changed, 12 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 8130f043693b..183520ba06bd 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -71,11 +71,7 @@  static inline void pmu_irq_stats(struct drm_i915_private *i915,
 	if (unlikely(res != IRQ_HANDLED))
 		return;
 
-	/*
-	 * A clever compiler translates that into INC. A not so clever one
-	 * should at least prevent store tearing.
-	 */
-	WRITE_ONCE(i915->pmu.irq_count, i915->pmu.irq_count + 1);
+	i915_pmu_irq(i915);
 }
 
 void gen3_irq_reset(struct intel_uncore *uncore, i915_reg_t imr,
diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index 878a27e1c8ef..ef4b907a799b 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -1348,3 +1348,12 @@  void i915_pmu_unregister(struct drm_i915_private *i915)
 		kfree(pmu->name);
 	free_event_attributes(pmu);
 }
+
+void i915_pmu_irq(struct drm_i915_private *i915)
+{
+	/*
+	 * A clever compiler translates that into INC. A not so clever one
+	 * should at least prevent store tearing.
+	 */
+	WRITE_ONCE(i915->pmu.irq_count, i915->pmu.irq_count + 1);
+}
diff --git a/drivers/gpu/drm/i915/i915_pmu.h b/drivers/gpu/drm/i915/i915_pmu.h
index 41af038c3738..26b06132a44f 100644
--- a/drivers/gpu/drm/i915/i915_pmu.h
+++ b/drivers/gpu/drm/i915/i915_pmu.h
@@ -159,6 +159,7 @@  int i915_pmu_init(void);
 void i915_pmu_exit(void);
 void i915_pmu_register(struct drm_i915_private *i915);
 void i915_pmu_unregister(struct drm_i915_private *i915);
+void i915_pmu_irq(struct drm_i915_private *i915);
 void i915_pmu_gt_parked(struct intel_gt *gt);
 void i915_pmu_gt_unparked(struct intel_gt *gt);
 #else
@@ -166,6 +167,7 @@  static inline int i915_pmu_init(void) { return 0; }
 static inline void i915_pmu_exit(void) {}
 static inline void i915_pmu_register(struct drm_i915_private *i915) {}
 static inline void i915_pmu_unregister(struct drm_i915_private *i915) {}
+static inline void i915_pmu_irq(struct drm_i915_private *i915) {}
 static inline void i915_pmu_gt_parked(struct intel_gt *gt) {}
 static inline void i915_pmu_gt_unparked(struct intel_gt *gt) {}
 #endif