diff mbox series

[3/6] drm/i915/pmu: Transform PMU parking code to be GT based

Message ID 20230506005816.1891043-4-umesh.nerlige.ramappa@intel.com (mailing list archive)
State New, archived
Headers show
Series Add MTL PMU support for multi-gt | expand

Commit Message

Umesh Nerlige Ramappa May 6, 2023, 12:58 a.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Trivial prep work for full multi-tile enablement later.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_gt_pm.c |  4 ++--
 drivers/gpu/drm/i915/i915_pmu.c       | 16 ++++++++--------
 drivers/gpu/drm/i915/i915_pmu.h       |  9 +++++----
 3 files changed, 15 insertions(+), 14 deletions(-)

Comments

Umesh Nerlige Ramappa May 8, 2023, 5:55 p.m. UTC | #1
On Fri, May 05, 2023 at 05:58:13PM -0700, Umesh Nerlige Ramappa wrote:
>From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
>Trivial prep work for full multi-tile enablement later.

Some more description on what this does OR how park/unpark affects pmu 
counters would help.

Thanks,
Umesh

>
>Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
>Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
>---
> drivers/gpu/drm/i915/gt/intel_gt_pm.c |  4 ++--
> drivers/gpu/drm/i915/i915_pmu.c       | 16 ++++++++--------
> drivers/gpu/drm/i915/i915_pmu.h       |  9 +++++----
> 3 files changed, 15 insertions(+), 14 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
>index e02cb90723ae..c2e69bafd02b 100644
>--- a/drivers/gpu/drm/i915/gt/intel_gt_pm.c
>+++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
>@@ -87,7 +87,7 @@ static int __gt_unpark(struct intel_wakeref *wf)
>
> 	intel_rc6_unpark(&gt->rc6);
> 	intel_rps_unpark(&gt->rps);
>-	i915_pmu_gt_unparked(i915);
>+	i915_pmu_gt_unparked(gt);
> 	intel_guc_busyness_unpark(gt);
>
> 	intel_gt_unpark_requests(gt);
>@@ -109,7 +109,7 @@ static int __gt_park(struct intel_wakeref *wf)
>
> 	intel_guc_busyness_park(gt);
> 	i915_vma_parked(gt);
>-	i915_pmu_gt_parked(i915);
>+	i915_pmu_gt_parked(gt);
> 	intel_rps_park(&gt->rps);
> 	intel_rc6_park(&gt->rc6);
>
>diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
>index ba769f7fc385..2b63ee31e1b3 100644
>--- a/drivers/gpu/drm/i915/i915_pmu.c
>+++ b/drivers/gpu/drm/i915/i915_pmu.c
>@@ -217,11 +217,11 @@ static void init_rc6(struct i915_pmu *pmu)
> 	}
> }
>
>-static void park_rc6(struct drm_i915_private *i915)
>+static void park_rc6(struct intel_gt *gt)
> {
>-	struct i915_pmu *pmu = &i915->pmu;
>+	struct i915_pmu *pmu = &gt->i915->pmu;
>
>-	pmu->sample[__I915_SAMPLE_RC6].cur = __get_rc6(to_gt(i915));
>+	pmu->sample[__I915_SAMPLE_RC6].cur = __get_rc6(gt);
> 	pmu->sleep_last = ktime_get_raw();
> }
>
>@@ -236,16 +236,16 @@ static void __i915_pmu_maybe_start_timer(struct i915_pmu *pmu)
> 	}
> }
>
>-void i915_pmu_gt_parked(struct drm_i915_private *i915)
>+void i915_pmu_gt_parked(struct intel_gt *gt)
> {
>-	struct i915_pmu *pmu = &i915->pmu;
>+	struct i915_pmu *pmu = &gt->i915->pmu;
>
> 	if (!pmu->base.event_init)
> 		return;
>
> 	spin_lock_irq(&pmu->lock);
>
>-	park_rc6(i915);
>+	park_rc6(gt);
>
> 	/*
> 	 * Signal sampling timer to stop if only engine events are enabled and
>@@ -256,9 +256,9 @@ void i915_pmu_gt_parked(struct drm_i915_private *i915)
> 	spin_unlock_irq(&pmu->lock);
> }
>
>-void i915_pmu_gt_unparked(struct drm_i915_private *i915)
>+void i915_pmu_gt_unparked(struct intel_gt *gt)
> {
>-	struct i915_pmu *pmu = &i915->pmu;
>+	struct i915_pmu *pmu = &gt->i915->pmu;
>
> 	if (!pmu->base.event_init)
> 		return;
>diff --git a/drivers/gpu/drm/i915/i915_pmu.h b/drivers/gpu/drm/i915/i915_pmu.h
>index c30f43319a78..a686fd7ccedf 100644
>--- a/drivers/gpu/drm/i915/i915_pmu.h
>+++ b/drivers/gpu/drm/i915/i915_pmu.h
>@@ -13,6 +13,7 @@
> #include <uapi/drm/i915_drm.h>
>
> struct drm_i915_private;
>+struct intel_gt;
>
> /*
>  * Non-engine events that we need to track enabled-disabled transition and
>@@ -151,15 +152,15 @@ 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_gt_parked(struct drm_i915_private *i915);
>-void i915_pmu_gt_unparked(struct drm_i915_private *i915);
>+void i915_pmu_gt_parked(struct intel_gt *gt);
>+void i915_pmu_gt_unparked(struct intel_gt *gt);
> #else
> 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_gt_parked(struct drm_i915_private *i915) {}
>-static inline void i915_pmu_gt_unparked(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
>
> #endif
>-- 
>2.36.1
>
Umesh Nerlige Ramappa May 9, 2023, 3:10 p.m. UTC | #2
On Mon, May 08, 2023 at 10:55:01AM -0700, Umesh Nerlige Ramappa wrote:
>On Fri, May 05, 2023 at 05:58:13PM -0700, Umesh Nerlige Ramappa wrote:
>>From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>>Trivial prep work for full multi-tile enablement later.
>
>Some more description on what this does OR how park/unpark affects pmu 
>counters would help.

Described later, so

Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>

>
>Thanks,
>Umesh
>
>>
>>Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
>>Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
>>---
>>drivers/gpu/drm/i915/gt/intel_gt_pm.c |  4 ++--
>>drivers/gpu/drm/i915/i915_pmu.c       | 16 ++++++++--------
>>drivers/gpu/drm/i915/i915_pmu.h       |  9 +++++----
>>3 files changed, 15 insertions(+), 14 deletions(-)
>>
>>diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
>>index e02cb90723ae..c2e69bafd02b 100644
>>--- a/drivers/gpu/drm/i915/gt/intel_gt_pm.c
>>+++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
>>@@ -87,7 +87,7 @@ static int __gt_unpark(struct intel_wakeref *wf)
>>
>>	intel_rc6_unpark(&gt->rc6);
>>	intel_rps_unpark(&gt->rps);
>>-	i915_pmu_gt_unparked(i915);
>>+	i915_pmu_gt_unparked(gt);
>>	intel_guc_busyness_unpark(gt);
>>
>>	intel_gt_unpark_requests(gt);
>>@@ -109,7 +109,7 @@ static int __gt_park(struct intel_wakeref *wf)
>>
>>	intel_guc_busyness_park(gt);
>>	i915_vma_parked(gt);
>>-	i915_pmu_gt_parked(i915);
>>+	i915_pmu_gt_parked(gt);
>>	intel_rps_park(&gt->rps);
>>	intel_rc6_park(&gt->rc6);
>>
>>diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
>>index ba769f7fc385..2b63ee31e1b3 100644
>>--- a/drivers/gpu/drm/i915/i915_pmu.c
>>+++ b/drivers/gpu/drm/i915/i915_pmu.c
>>@@ -217,11 +217,11 @@ static void init_rc6(struct i915_pmu *pmu)
>>	}
>>}
>>
>>-static void park_rc6(struct drm_i915_private *i915)
>>+static void park_rc6(struct intel_gt *gt)
>>{
>>-	struct i915_pmu *pmu = &i915->pmu;
>>+	struct i915_pmu *pmu = &gt->i915->pmu;
>>
>>-	pmu->sample[__I915_SAMPLE_RC6].cur = __get_rc6(to_gt(i915));
>>+	pmu->sample[__I915_SAMPLE_RC6].cur = __get_rc6(gt);
>>	pmu->sleep_last = ktime_get_raw();
>>}
>>
>>@@ -236,16 +236,16 @@ static void __i915_pmu_maybe_start_timer(struct i915_pmu *pmu)
>>	}
>>}
>>
>>-void i915_pmu_gt_parked(struct drm_i915_private *i915)
>>+void i915_pmu_gt_parked(struct intel_gt *gt)
>>{
>>-	struct i915_pmu *pmu = &i915->pmu;
>>+	struct i915_pmu *pmu = &gt->i915->pmu;
>>
>>	if (!pmu->base.event_init)
>>		return;
>>
>>	spin_lock_irq(&pmu->lock);
>>
>>-	park_rc6(i915);
>>+	park_rc6(gt);
>>
>>	/*
>>	 * Signal sampling timer to stop if only engine events are enabled and
>>@@ -256,9 +256,9 @@ void i915_pmu_gt_parked(struct drm_i915_private *i915)
>>	spin_unlock_irq(&pmu->lock);
>>}
>>
>>-void i915_pmu_gt_unparked(struct drm_i915_private *i915)
>>+void i915_pmu_gt_unparked(struct intel_gt *gt)
>>{
>>-	struct i915_pmu *pmu = &i915->pmu;
>>+	struct i915_pmu *pmu = &gt->i915->pmu;
>>
>>	if (!pmu->base.event_init)
>>		return;
>>diff --git a/drivers/gpu/drm/i915/i915_pmu.h b/drivers/gpu/drm/i915/i915_pmu.h
>>index c30f43319a78..a686fd7ccedf 100644
>>--- a/drivers/gpu/drm/i915/i915_pmu.h
>>+++ b/drivers/gpu/drm/i915/i915_pmu.h
>>@@ -13,6 +13,7 @@
>>#include <uapi/drm/i915_drm.h>
>>
>>struct drm_i915_private;
>>+struct intel_gt;
>>
>>/*
>> * Non-engine events that we need to track enabled-disabled transition and
>>@@ -151,15 +152,15 @@ 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_gt_parked(struct drm_i915_private *i915);
>>-void i915_pmu_gt_unparked(struct drm_i915_private *i915);
>>+void i915_pmu_gt_parked(struct intel_gt *gt);
>>+void i915_pmu_gt_unparked(struct intel_gt *gt);
>>#else
>>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_gt_parked(struct drm_i915_private *i915) {}
>>-static inline void i915_pmu_gt_unparked(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
>>
>>#endif
>>-- 
>>2.36.1
>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
index e02cb90723ae..c2e69bafd02b 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.c
@@ -87,7 +87,7 @@  static int __gt_unpark(struct intel_wakeref *wf)
 
 	intel_rc6_unpark(&gt->rc6);
 	intel_rps_unpark(&gt->rps);
-	i915_pmu_gt_unparked(i915);
+	i915_pmu_gt_unparked(gt);
 	intel_guc_busyness_unpark(gt);
 
 	intel_gt_unpark_requests(gt);
@@ -109,7 +109,7 @@  static int __gt_park(struct intel_wakeref *wf)
 
 	intel_guc_busyness_park(gt);
 	i915_vma_parked(gt);
-	i915_pmu_gt_parked(i915);
+	i915_pmu_gt_parked(gt);
 	intel_rps_park(&gt->rps);
 	intel_rc6_park(&gt->rc6);
 
diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index ba769f7fc385..2b63ee31e1b3 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -217,11 +217,11 @@  static void init_rc6(struct i915_pmu *pmu)
 	}
 }
 
-static void park_rc6(struct drm_i915_private *i915)
+static void park_rc6(struct intel_gt *gt)
 {
-	struct i915_pmu *pmu = &i915->pmu;
+	struct i915_pmu *pmu = &gt->i915->pmu;
 
-	pmu->sample[__I915_SAMPLE_RC6].cur = __get_rc6(to_gt(i915));
+	pmu->sample[__I915_SAMPLE_RC6].cur = __get_rc6(gt);
 	pmu->sleep_last = ktime_get_raw();
 }
 
@@ -236,16 +236,16 @@  static void __i915_pmu_maybe_start_timer(struct i915_pmu *pmu)
 	}
 }
 
-void i915_pmu_gt_parked(struct drm_i915_private *i915)
+void i915_pmu_gt_parked(struct intel_gt *gt)
 {
-	struct i915_pmu *pmu = &i915->pmu;
+	struct i915_pmu *pmu = &gt->i915->pmu;
 
 	if (!pmu->base.event_init)
 		return;
 
 	spin_lock_irq(&pmu->lock);
 
-	park_rc6(i915);
+	park_rc6(gt);
 
 	/*
 	 * Signal sampling timer to stop if only engine events are enabled and
@@ -256,9 +256,9 @@  void i915_pmu_gt_parked(struct drm_i915_private *i915)
 	spin_unlock_irq(&pmu->lock);
 }
 
-void i915_pmu_gt_unparked(struct drm_i915_private *i915)
+void i915_pmu_gt_unparked(struct intel_gt *gt)
 {
-	struct i915_pmu *pmu = &i915->pmu;
+	struct i915_pmu *pmu = &gt->i915->pmu;
 
 	if (!pmu->base.event_init)
 		return;
diff --git a/drivers/gpu/drm/i915/i915_pmu.h b/drivers/gpu/drm/i915/i915_pmu.h
index c30f43319a78..a686fd7ccedf 100644
--- a/drivers/gpu/drm/i915/i915_pmu.h
+++ b/drivers/gpu/drm/i915/i915_pmu.h
@@ -13,6 +13,7 @@ 
 #include <uapi/drm/i915_drm.h>
 
 struct drm_i915_private;
+struct intel_gt;
 
 /*
  * Non-engine events that we need to track enabled-disabled transition and
@@ -151,15 +152,15 @@  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_gt_parked(struct drm_i915_private *i915);
-void i915_pmu_gt_unparked(struct drm_i915_private *i915);
+void i915_pmu_gt_parked(struct intel_gt *gt);
+void i915_pmu_gt_unparked(struct intel_gt *gt);
 #else
 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_gt_parked(struct drm_i915_private *i915) {}
-static inline void i915_pmu_gt_unparked(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
 
 #endif