All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] drm/i915: Add GEN12 RPSTAT reg to get CAGF
@ 2022-09-27 11:35 ` Badal Nilawar
  0 siblings, 0 replies; 9+ messages in thread
From: Badal Nilawar @ 2022-09-27 11:35 UTC (permalink / raw)
  To: intel-gfx
  Cc: andi.shyti, donhiatt, tvrtko.ursulin, anshuman.gupta, dri-devel,
	ashutosh.dixit, jon.ewins, vinay.belgaumkar

In this series added GEN12 RPSTAT (0x1381b4) to get Current Actual
Graphics frequency of GT

To review saperately the patch in this series split from 
https://patchwork.freedesktop.org/series/108156/#rev3 

Test-with: 20220927062839.2718582-1-ashutosh.dixit@intel.com

v2: Fix review comments (Ashutosh, Tvrtko)

Don Hiatt (1):
  drm/i915: Use GEN12 RPSTAT register

 drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c |  2 +-
 drivers/gpu/drm/i915/gt/intel_gt_regs.h       |  4 +++
 drivers/gpu/drm/i915/gt/intel_rps.c           | 32 +++++++++++++++++--
 drivers/gpu/drm/i915/gt/intel_rps.h           |  2 ++
 drivers/gpu/drm/i915/i915_pmu.c               |  3 +-
 5 files changed, 38 insertions(+), 5 deletions(-)

-- 
2.25.1


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

* [Intel-gfx] [PATCH 0/1] drm/i915: Add GEN12 RPSTAT reg to get CAGF
@ 2022-09-27 11:35 ` Badal Nilawar
  0 siblings, 0 replies; 9+ messages in thread
From: Badal Nilawar @ 2022-09-27 11:35 UTC (permalink / raw)
  To: intel-gfx; +Cc: andi.shyti, donhiatt, dri-devel

In this series added GEN12 RPSTAT (0x1381b4) to get Current Actual
Graphics frequency of GT

To review saperately the patch in this series split from 
https://patchwork.freedesktop.org/series/108156/#rev3 

Test-with: 20220927062839.2718582-1-ashutosh.dixit@intel.com

v2: Fix review comments (Ashutosh, Tvrtko)

Don Hiatt (1):
  drm/i915: Use GEN12 RPSTAT register

 drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c |  2 +-
 drivers/gpu/drm/i915/gt/intel_gt_regs.h       |  4 +++
 drivers/gpu/drm/i915/gt/intel_rps.c           | 32 +++++++++++++++++--
 drivers/gpu/drm/i915/gt/intel_rps.h           |  2 ++
 drivers/gpu/drm/i915/i915_pmu.c               |  3 +-
 5 files changed, 38 insertions(+), 5 deletions(-)

-- 
2.25.1


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

* [PATCH 1/1] drm/i915: Use GEN12 RPSTAT register
  2022-09-27 11:35 ` [Intel-gfx] " Badal Nilawar
@ 2022-09-27 11:35   ` Badal Nilawar
  -1 siblings, 0 replies; 9+ messages in thread
From: Badal Nilawar @ 2022-09-27 11:35 UTC (permalink / raw)
  To: intel-gfx
  Cc: andi.shyti, donhiatt, tvrtko.ursulin, anshuman.gupta, dri-devel,
	ashutosh.dixit, jon.ewins, vinay.belgaumkar

From: Don Hiatt <don.hiatt@intel.com>

On GEN12 and above use GEN12_RPSTAT register to get Current
Actual Graphics Frequency of GT

v2:
  - Fixed review comments(Ashutosh)
  - Added function intel_rps_read_rpstat_fw to read RPSTAT without
    forcewake, required especially for GEN6_RPSTAT1 (Ashutosh, Tvrtko)

Cc: Don Hiatt <donhiatt@gmail.com>
Cc: Andi Shyti <andi.shyti@intel.com>
Signed-off-by: Don Hiatt <don.hiatt@intel.com>
Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c |  2 +-
 drivers/gpu/drm/i915/gt/intel_gt_regs.h       |  4 +++
 drivers/gpu/drm/i915/gt/intel_rps.c           | 32 +++++++++++++++++--
 drivers/gpu/drm/i915/gt/intel_rps.h           |  2 ++
 drivers/gpu/drm/i915/i915_pmu.c               |  3 +-
 5 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
index 10f680dbd7b6..b9b47052b26d 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
@@ -380,7 +380,7 @@ void intel_gt_pm_frequency_dump(struct intel_gt *gt, struct drm_printer *p)
 		rpinclimit = intel_uncore_read(uncore, GEN6_RP_UP_THRESHOLD);
 		rpdeclimit = intel_uncore_read(uncore, GEN6_RP_DOWN_THRESHOLD);
 
-		rpstat = intel_uncore_read(uncore, GEN6_RPSTAT1);
+		rpstat = intel_rps_read_rpstat(rps);
 		rpcurupei = intel_uncore_read(uncore, GEN6_RP_CUR_UP_EI) & GEN6_CURICONT_MASK;
 		rpcurup = intel_uncore_read(uncore, GEN6_RP_CUR_UP) & GEN6_CURBSYTAVG_MASK;
 		rpprevup = intel_uncore_read(uncore, GEN6_RP_PREV_UP) & GEN6_CURBSYTAVG_MASK;
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
index 7f79bbf97828..1f1e90acc1ab 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
@@ -1519,6 +1519,10 @@
 #define VLV_RENDER_C0_COUNT			_MMIO(0x138118)
 #define VLV_MEDIA_C0_COUNT			_MMIO(0x13811c)
 
+#define GEN12_RPSTAT1				_MMIO(0x1381b4)
+#define   GEN12_CAGF_SHIFT			11
+#define   GEN12_CAGF_MASK			REG_GENMASK(19, 11)
+
 #define GEN11_GT_INTR_DW(x)			_MMIO(0x190018 + ((x) * 4))
 #define   GEN11_CSME				(31)
 #define   GEN11_GUNIT				(28)
diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
index 17b40b625e31..5a15a630b1c6 100644
--- a/drivers/gpu/drm/i915/gt/intel_rps.c
+++ b/drivers/gpu/drm/i915/gt/intel_rps.c
@@ -2068,12 +2068,40 @@ void intel_rps_sanitize(struct intel_rps *rps)
 		rps_disable_interrupts(rps);
 }
 
+u32 intel_rps_read_rpstat_fw(struct intel_rps *rps)
+{
+	struct drm_i915_private *i915 = rps_to_i915(rps);
+	i915_reg_t rpstat;
+
+	if (GRAPHICS_VER(i915) >= 12)
+		rpstat = GEN12_RPSTAT1;
+	else
+		rpstat = GEN6_RPSTAT1;
+
+	return intel_uncore_read_fw(rps_to_gt(rps)->uncore, rpstat);
+}
+
+u32 intel_rps_read_rpstat(struct intel_rps *rps)
+{
+	struct drm_i915_private *i915 = rps_to_i915(rps);
+	i915_reg_t rpstat;
+
+	if (GRAPHICS_VER(i915) >= 12)
+		rpstat = GEN12_RPSTAT1;
+	else
+		rpstat = GEN6_RPSTAT1;
+
+	return intel_uncore_read(rps_to_gt(rps)->uncore, rpstat);
+}
+
 u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat)
 {
 	struct drm_i915_private *i915 = rps_to_i915(rps);
 	u32 cagf;
 
-	if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
+	if (GRAPHICS_VER(i915) >= 12)
+		cagf = (rpstat & GEN12_CAGF_MASK) >> GEN12_CAGF_SHIFT;
+	else if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
 		cagf = (rpstat >> 8) & 0xff;
 	else if (GRAPHICS_VER(i915) >= 9)
 		cagf = (rpstat & GEN9_CAGF_MASK) >> GEN9_CAGF_SHIFT;
@@ -2099,7 +2127,7 @@ static u32 read_cagf(struct intel_rps *rps)
 		freq = vlv_punit_read(i915, PUNIT_REG_GPU_FREQ_STS);
 		vlv_punit_put(i915);
 	} else if (GRAPHICS_VER(i915) >= 6) {
-		freq = intel_uncore_read(uncore, GEN6_RPSTAT1);
+		freq = intel_rps_read_rpstat(rps);
 	} else {
 		freq = intel_uncore_read(uncore, MEMSTAT_ILK);
 	}
diff --git a/drivers/gpu/drm/i915/gt/intel_rps.h b/drivers/gpu/drm/i915/gt/intel_rps.h
index 4509dfdc52e0..76c8404d8416 100644
--- a/drivers/gpu/drm/i915/gt/intel_rps.h
+++ b/drivers/gpu/drm/i915/gt/intel_rps.h
@@ -47,6 +47,8 @@ u32 intel_rps_get_rp1_frequency(struct intel_rps *rps);
 u32 intel_rps_get_rpn_frequency(struct intel_rps *rps);
 u32 intel_rps_read_punit_req(struct intel_rps *rps);
 u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps);
+u32 intel_rps_read_rpstat(struct intel_rps *rps);
+u32 intel_rps_read_rpstat_fw(struct intel_rps *rps);
 void gen6_rps_get_freq_caps(struct intel_rps *rps, struct intel_rps_freq_caps *caps);
 void intel_rps_raise_unslice(struct intel_rps *rps);
 void intel_rps_lower_unslice(struct intel_rps *rps);
diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index 958b37123bf1..67140a87182f 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -371,7 +371,6 @@ static void
 frequency_sample(struct intel_gt *gt, unsigned int period_ns)
 {
 	struct drm_i915_private *i915 = gt->i915;
-	struct intel_uncore *uncore = gt->uncore;
 	struct i915_pmu *pmu = &i915->pmu;
 	struct intel_rps *rps = &gt->rps;
 
@@ -394,7 +393,7 @@ frequency_sample(struct intel_gt *gt, unsigned int period_ns)
 		 * case we assume the system is running at the intended
 		 * frequency. Fortunately, the read should rarely fail!
 		 */
-		val = intel_uncore_read_fw(uncore, GEN6_RPSTAT1);
+		val = intel_rps_read_rpstat_fw(rps);
 		if (val)
 			val = intel_rps_get_cagf(rps, val);
 		else
-- 
2.25.1


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

* [Intel-gfx] [PATCH 1/1] drm/i915: Use GEN12 RPSTAT register
@ 2022-09-27 11:35   ` Badal Nilawar
  0 siblings, 0 replies; 9+ messages in thread
From: Badal Nilawar @ 2022-09-27 11:35 UTC (permalink / raw)
  To: intel-gfx; +Cc: andi.shyti, donhiatt, dri-devel

From: Don Hiatt <don.hiatt@intel.com>

On GEN12 and above use GEN12_RPSTAT register to get Current
Actual Graphics Frequency of GT

v2:
  - Fixed review comments(Ashutosh)
  - Added function intel_rps_read_rpstat_fw to read RPSTAT without
    forcewake, required especially for GEN6_RPSTAT1 (Ashutosh, Tvrtko)

Cc: Don Hiatt <donhiatt@gmail.com>
Cc: Andi Shyti <andi.shyti@intel.com>
Signed-off-by: Don Hiatt <don.hiatt@intel.com>
Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c |  2 +-
 drivers/gpu/drm/i915/gt/intel_gt_regs.h       |  4 +++
 drivers/gpu/drm/i915/gt/intel_rps.c           | 32 +++++++++++++++++--
 drivers/gpu/drm/i915/gt/intel_rps.h           |  2 ++
 drivers/gpu/drm/i915/i915_pmu.c               |  3 +-
 5 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
index 10f680dbd7b6..b9b47052b26d 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
@@ -380,7 +380,7 @@ void intel_gt_pm_frequency_dump(struct intel_gt *gt, struct drm_printer *p)
 		rpinclimit = intel_uncore_read(uncore, GEN6_RP_UP_THRESHOLD);
 		rpdeclimit = intel_uncore_read(uncore, GEN6_RP_DOWN_THRESHOLD);
 
-		rpstat = intel_uncore_read(uncore, GEN6_RPSTAT1);
+		rpstat = intel_rps_read_rpstat(rps);
 		rpcurupei = intel_uncore_read(uncore, GEN6_RP_CUR_UP_EI) & GEN6_CURICONT_MASK;
 		rpcurup = intel_uncore_read(uncore, GEN6_RP_CUR_UP) & GEN6_CURBSYTAVG_MASK;
 		rpprevup = intel_uncore_read(uncore, GEN6_RP_PREV_UP) & GEN6_CURBSYTAVG_MASK;
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
index 7f79bbf97828..1f1e90acc1ab 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
@@ -1519,6 +1519,10 @@
 #define VLV_RENDER_C0_COUNT			_MMIO(0x138118)
 #define VLV_MEDIA_C0_COUNT			_MMIO(0x13811c)
 
+#define GEN12_RPSTAT1				_MMIO(0x1381b4)
+#define   GEN12_CAGF_SHIFT			11
+#define   GEN12_CAGF_MASK			REG_GENMASK(19, 11)
+
 #define GEN11_GT_INTR_DW(x)			_MMIO(0x190018 + ((x) * 4))
 #define   GEN11_CSME				(31)
 #define   GEN11_GUNIT				(28)
diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
index 17b40b625e31..5a15a630b1c6 100644
--- a/drivers/gpu/drm/i915/gt/intel_rps.c
+++ b/drivers/gpu/drm/i915/gt/intel_rps.c
@@ -2068,12 +2068,40 @@ void intel_rps_sanitize(struct intel_rps *rps)
 		rps_disable_interrupts(rps);
 }
 
+u32 intel_rps_read_rpstat_fw(struct intel_rps *rps)
+{
+	struct drm_i915_private *i915 = rps_to_i915(rps);
+	i915_reg_t rpstat;
+
+	if (GRAPHICS_VER(i915) >= 12)
+		rpstat = GEN12_RPSTAT1;
+	else
+		rpstat = GEN6_RPSTAT1;
+
+	return intel_uncore_read_fw(rps_to_gt(rps)->uncore, rpstat);
+}
+
+u32 intel_rps_read_rpstat(struct intel_rps *rps)
+{
+	struct drm_i915_private *i915 = rps_to_i915(rps);
+	i915_reg_t rpstat;
+
+	if (GRAPHICS_VER(i915) >= 12)
+		rpstat = GEN12_RPSTAT1;
+	else
+		rpstat = GEN6_RPSTAT1;
+
+	return intel_uncore_read(rps_to_gt(rps)->uncore, rpstat);
+}
+
 u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat)
 {
 	struct drm_i915_private *i915 = rps_to_i915(rps);
 	u32 cagf;
 
-	if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
+	if (GRAPHICS_VER(i915) >= 12)
+		cagf = (rpstat & GEN12_CAGF_MASK) >> GEN12_CAGF_SHIFT;
+	else if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
 		cagf = (rpstat >> 8) & 0xff;
 	else if (GRAPHICS_VER(i915) >= 9)
 		cagf = (rpstat & GEN9_CAGF_MASK) >> GEN9_CAGF_SHIFT;
@@ -2099,7 +2127,7 @@ static u32 read_cagf(struct intel_rps *rps)
 		freq = vlv_punit_read(i915, PUNIT_REG_GPU_FREQ_STS);
 		vlv_punit_put(i915);
 	} else if (GRAPHICS_VER(i915) >= 6) {
-		freq = intel_uncore_read(uncore, GEN6_RPSTAT1);
+		freq = intel_rps_read_rpstat(rps);
 	} else {
 		freq = intel_uncore_read(uncore, MEMSTAT_ILK);
 	}
diff --git a/drivers/gpu/drm/i915/gt/intel_rps.h b/drivers/gpu/drm/i915/gt/intel_rps.h
index 4509dfdc52e0..76c8404d8416 100644
--- a/drivers/gpu/drm/i915/gt/intel_rps.h
+++ b/drivers/gpu/drm/i915/gt/intel_rps.h
@@ -47,6 +47,8 @@ u32 intel_rps_get_rp1_frequency(struct intel_rps *rps);
 u32 intel_rps_get_rpn_frequency(struct intel_rps *rps);
 u32 intel_rps_read_punit_req(struct intel_rps *rps);
 u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps);
+u32 intel_rps_read_rpstat(struct intel_rps *rps);
+u32 intel_rps_read_rpstat_fw(struct intel_rps *rps);
 void gen6_rps_get_freq_caps(struct intel_rps *rps, struct intel_rps_freq_caps *caps);
 void intel_rps_raise_unslice(struct intel_rps *rps);
 void intel_rps_lower_unslice(struct intel_rps *rps);
diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index 958b37123bf1..67140a87182f 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -371,7 +371,6 @@ static void
 frequency_sample(struct intel_gt *gt, unsigned int period_ns)
 {
 	struct drm_i915_private *i915 = gt->i915;
-	struct intel_uncore *uncore = gt->uncore;
 	struct i915_pmu *pmu = &i915->pmu;
 	struct intel_rps *rps = &gt->rps;
 
@@ -394,7 +393,7 @@ frequency_sample(struct intel_gt *gt, unsigned int period_ns)
 		 * case we assume the system is running at the intended
 		 * frequency. Fortunately, the read should rarely fail!
 		 */
-		val = intel_uncore_read_fw(uncore, GEN6_RPSTAT1);
+		val = intel_rps_read_rpstat_fw(rps);
 		if (val)
 			val = intel_rps_get_cagf(rps, val);
 		else
-- 
2.25.1


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

* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Add GEN12 RPSTAT reg to get CAGF
  2022-09-27 11:35 ` [Intel-gfx] " Badal Nilawar
  (?)
  (?)
@ 2022-09-27 23:02 ` Patchwork
  -1 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2022-09-27 23:02 UTC (permalink / raw)
  To: Badal Nilawar; +Cc: intel-gfx

[-- Attachment #1: Type: text/plain, Size: 8368 bytes --]

== Series Details ==

Series: drm/i915: Add GEN12 RPSTAT reg to get CAGF
URL   : https://patchwork.freedesktop.org/series/109116/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_12192 -> Patchwork_109116v1
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_109116v1 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_109116v1, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/index.html

Participating hosts (46 -> 42)
------------------------------

  Missing    (4): fi-skl-guc fi-bdw-samus fi-tgl-dsi fi-pnv-d510 

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_109116v1:

### IGT changes ###

#### Possible regressions ####

  * igt@i915_selftest@live@execlists:
    - fi-bsw-nick:        [PASS][1] -> [INCOMPLETE][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12192/fi-bsw-nick/igt@i915_selftest@live@execlists.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/fi-bsw-nick/igt@i915_selftest@live@execlists.html

  
Known issues
------------

  Here are the changes found in Patchwork_109116v1 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@i915_selftest@live@hangcheck:
    - fi-hsw-4770:        [PASS][3] -> [INCOMPLETE][4] ([i915#4785])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12192/fi-hsw-4770/igt@i915_selftest@live@hangcheck.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/fi-hsw-4770/igt@i915_selftest@live@hangcheck.html

  * igt@i915_selftest@live@mman:
    - fi-rkl-guc:         [PASS][5] -> [INCOMPLETE][6] ([i915#6794])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12192/fi-rkl-guc/igt@i915_selftest@live@mman.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/fi-rkl-guc/igt@i915_selftest@live@mman.html

  * igt@i915_suspend@basic-s3-without-i915:
    - fi-bdw-5557u:       [PASS][7] -> [INCOMPLETE][8] ([i915#146] / [i915#6712])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12192/fi-bdw-5557u/igt@i915_suspend@basic-s3-without-i915.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/fi-bdw-5557u/igt@i915_suspend@basic-s3-without-i915.html

  * igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size:
    - fi-bsw-kefka:       [PASS][9] -> [FAIL][10] ([i915#6298])
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12192/fi-bsw-kefka/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/fi-bsw-kefka/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size.html

  * igt@runner@aborted:
    - fi-hsw-4770:        NOTRUN -> [FAIL][11] ([fdo#109271] / [i915#4312] / [i915#5594])
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/fi-hsw-4770/igt@runner@aborted.html
    - fi-bsw-nick:        NOTRUN -> [FAIL][12] ([fdo#109271] / [i915#4312])
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/fi-bsw-nick/igt@runner@aborted.html

  
#### Possible fixes ####

  * igt@gem_exec_suspend@basic-s3@smem:
    - {bat-rplp-1}:       [DMESG-WARN][13] ([i915#2867]) -> [PASS][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12192/bat-rplp-1/igt@gem_exec_suspend@basic-s3@smem.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/bat-rplp-1/igt@gem_exec_suspend@basic-s3@smem.html
    - {bat-adlm-1}:       [DMESG-WARN][15] ([i915#2867]) -> [PASS][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12192/bat-adlm-1/igt@gem_exec_suspend@basic-s3@smem.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/bat-adlm-1/igt@gem_exec_suspend@basic-s3@smem.html

  * igt@i915_pm_rpm@module-reload:
    - fi-cfl-8109u:       [DMESG-FAIL][17] ([i915#62]) -> [PASS][18]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12192/fi-cfl-8109u/igt@i915_pm_rpm@module-reload.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/fi-cfl-8109u/igt@i915_pm_rpm@module-reload.html

  * igt@i915_selftest@live@late_gt_pm:
    - fi-cfl-8109u:       [DMESG-WARN][19] ([i915#5904]) -> [PASS][20] +30 similar issues
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12192/fi-cfl-8109u/igt@i915_selftest@live@late_gt_pm.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/fi-cfl-8109u/igt@i915_selftest@live@late_gt_pm.html

  * igt@i915_suspend@basic-s2idle-without-i915:
    - fi-cfl-8109u:       [DMESG-WARN][21] ([i915#5904] / [i915#62]) -> [PASS][22]
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12192/fi-cfl-8109u/igt@i915_suspend@basic-s2idle-without-i915.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/fi-cfl-8109u/igt@i915_suspend@basic-s2idle-without-i915.html

  * igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions:
    - fi-bsw-kefka:       [FAIL][23] ([i915#6298]) -> [PASS][24]
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12192/fi-bsw-kefka/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/fi-bsw-kefka/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions.html

  * igt@kms_frontbuffer_tracking@basic:
    - fi-cfl-8109u:       [DMESG-WARN][25] ([i915#62]) -> [PASS][26] +12 similar issues
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12192/fi-cfl-8109u/igt@kms_frontbuffer_tracking@basic.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/fi-cfl-8109u/igt@kms_frontbuffer_tracking@basic.html

  * igt@kms_pipe_crc_basic@suspend-read-crc@pipe-d-dp-2:
    - {bat-dg2-11}:       [FAIL][27] ([i915#6818]) -> [PASS][28] +1 similar issue
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12192/bat-dg2-11/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-d-dp-2.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/bat-dg2-11/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-d-dp-2.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [i915#146]: https://gitlab.freedesktop.org/drm/intel/issues/146
  [i915#2867]: https://gitlab.freedesktop.org/drm/intel/issues/2867
  [i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
  [i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
  [i915#4785]: https://gitlab.freedesktop.org/drm/intel/issues/4785
  [i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
  [i915#5134]: https://gitlab.freedesktop.org/drm/intel/issues/5134
  [i915#5153]: https://gitlab.freedesktop.org/drm/intel/issues/5153
  [i915#5594]: https://gitlab.freedesktop.org/drm/intel/issues/5594
  [i915#5904]: https://gitlab.freedesktop.org/drm/intel/issues/5904
  [i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62
  [i915#6298]: https://gitlab.freedesktop.org/drm/intel/issues/6298
  [i915#6712]: https://gitlab.freedesktop.org/drm/intel/issues/6712
  [i915#6794]: https://gitlab.freedesktop.org/drm/intel/issues/6794
  [i915#6818]: https://gitlab.freedesktop.org/drm/intel/issues/6818


Build changes
-------------

  * IGT: IGT_6666 -> IGTPW_7846
  * Linux: CI_DRM_12192 -> Patchwork_109116v1

  CI-20190529: 20190529
  CI_DRM_12192: 83f5b1665fc067c78ed2d46c585d8c49e57e6b06 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_7846: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7846/index.html
  IGT_6666: 1e3ecbaa3c56f4c52c62047707eb4942d3a39c44 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  Patchwork_109116v1: 83f5b1665fc067c78ed2d46c585d8c49e57e6b06 @ git://anongit.freedesktop.org/gfx-ci/linux


### Linux commits

c90d076f1056 drm/i915: Use GEN12 RPSTAT register

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109116v1/index.html

[-- Attachment #2: Type: text/html, Size: 9554 bytes --]

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

* Re: [PATCH 1/1] drm/i915: Use GEN12 RPSTAT register
  2022-09-27 11:35   ` [Intel-gfx] " Badal Nilawar
@ 2022-09-28  1:47     ` Dixit, Ashutosh
  -1 siblings, 0 replies; 9+ messages in thread
From: Dixit, Ashutosh @ 2022-09-28  1:47 UTC (permalink / raw)
  To: Badal Nilawar
  Cc: andi.shyti, donhiatt, tvrtko.ursulin, anshuman.gupta, intel-gfx,
	dri-devel, jon.ewins, vinay.belgaumkar

On Tue, 27 Sep 2022 04:35:29 -0700, Badal Nilawar wrote:
>
> From: Don Hiatt <don.hiatt@intel.com>
>
> On GEN12 and above use GEN12_RPSTAT register to get Current
> Actual Graphics Frequency of GT

I think even for the purposes of reviewing this it would be good to mention
in the commit message that:

a. GEN12_RPSTAT register doesn't require a forcewake to be read (it doesn't
   belong to a forcewake domain)
b. Will result in a 0 frequency if the GT is in RC6

Thanks.
--
Ashutosh

> v2:
>   - Fixed review comments(Ashutosh)
>   - Added function intel_rps_read_rpstat_fw to read RPSTAT without
>     forcewake, required especially for GEN6_RPSTAT1 (Ashutosh, Tvrtko)
>
> Cc: Don Hiatt <donhiatt@gmail.com>
> Cc: Andi Shyti <andi.shyti@intel.com>
> Signed-off-by: Don Hiatt <don.hiatt@intel.com>
> Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c |  2 +-
>  drivers/gpu/drm/i915/gt/intel_gt_regs.h       |  4 +++
>  drivers/gpu/drm/i915/gt/intel_rps.c           | 32 +++++++++++++++++--
>  drivers/gpu/drm/i915/gt/intel_rps.h           |  2 ++
>  drivers/gpu/drm/i915/i915_pmu.c               |  3 +-
>  5 files changed, 38 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> index 10f680dbd7b6..b9b47052b26d 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> @@ -380,7 +380,7 @@ void intel_gt_pm_frequency_dump(struct intel_gt *gt, struct drm_printer *p)
>		rpinclimit = intel_uncore_read(uncore, GEN6_RP_UP_THRESHOLD);
>		rpdeclimit = intel_uncore_read(uncore, GEN6_RP_DOWN_THRESHOLD);
>
> -		rpstat = intel_uncore_read(uncore, GEN6_RPSTAT1);
> +		rpstat = intel_rps_read_rpstat(rps);
>		rpcurupei = intel_uncore_read(uncore, GEN6_RP_CUR_UP_EI) & GEN6_CURICONT_MASK;
>		rpcurup = intel_uncore_read(uncore, GEN6_RP_CUR_UP) & GEN6_CURBSYTAVG_MASK;
>		rpprevup = intel_uncore_read(uncore, GEN6_RP_PREV_UP) & GEN6_CURBSYTAVG_MASK;
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> index 7f79bbf97828..1f1e90acc1ab 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> @@ -1519,6 +1519,10 @@
>  #define VLV_RENDER_C0_COUNT			_MMIO(0x138118)
>  #define VLV_MEDIA_C0_COUNT			_MMIO(0x13811c)
>
> +#define GEN12_RPSTAT1				_MMIO(0x1381b4)
> +#define   GEN12_CAGF_SHIFT			11
> +#define   GEN12_CAGF_MASK			REG_GENMASK(19, 11)
> +
>  #define GEN11_GT_INTR_DW(x)			_MMIO(0x190018 + ((x) * 4))
>  #define   GEN11_CSME				(31)
>  #define   GEN11_GUNIT				(28)
> diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
> index 17b40b625e31..5a15a630b1c6 100644
> --- a/drivers/gpu/drm/i915/gt/intel_rps.c
> +++ b/drivers/gpu/drm/i915/gt/intel_rps.c
> @@ -2068,12 +2068,40 @@ void intel_rps_sanitize(struct intel_rps *rps)
>		rps_disable_interrupts(rps);
>  }
>
> +u32 intel_rps_read_rpstat_fw(struct intel_rps *rps)
> +{
> +	struct drm_i915_private *i915 = rps_to_i915(rps);
> +	i915_reg_t rpstat;
> +
> +	if (GRAPHICS_VER(i915) >= 12)
> +		rpstat = GEN12_RPSTAT1;
> +	else
> +		rpstat = GEN6_RPSTAT1;
> +
> +	return intel_uncore_read_fw(rps_to_gt(rps)->uncore, rpstat);
> +}
> +
> +u32 intel_rps_read_rpstat(struct intel_rps *rps)
> +{
> +	struct drm_i915_private *i915 = rps_to_i915(rps);
> +	i915_reg_t rpstat;
> +
> +	if (GRAPHICS_VER(i915) >= 12)
> +		rpstat = GEN12_RPSTAT1;
> +	else
> +		rpstat = GEN6_RPSTAT1;
> +
> +	return intel_uncore_read(rps_to_gt(rps)->uncore, rpstat);
> +}
> +
>  u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat)
>  {
>	struct drm_i915_private *i915 = rps_to_i915(rps);
>	u32 cagf;
>
> -	if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
> +	if (GRAPHICS_VER(i915) >= 12)
> +		cagf = (rpstat & GEN12_CAGF_MASK) >> GEN12_CAGF_SHIFT;
> +	else if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
>		cagf = (rpstat >> 8) & 0xff;
>	else if (GRAPHICS_VER(i915) >= 9)
>		cagf = (rpstat & GEN9_CAGF_MASK) >> GEN9_CAGF_SHIFT;
> @@ -2099,7 +2127,7 @@ static u32 read_cagf(struct intel_rps *rps)
>		freq = vlv_punit_read(i915, PUNIT_REG_GPU_FREQ_STS);
>		vlv_punit_put(i915);
>	} else if (GRAPHICS_VER(i915) >= 6) {
> -		freq = intel_uncore_read(uncore, GEN6_RPSTAT1);
> +		freq = intel_rps_read_rpstat(rps);
>	} else {
>		freq = intel_uncore_read(uncore, MEMSTAT_ILK);
>	}
> diff --git a/drivers/gpu/drm/i915/gt/intel_rps.h b/drivers/gpu/drm/i915/gt/intel_rps.h
> index 4509dfdc52e0..76c8404d8416 100644
> --- a/drivers/gpu/drm/i915/gt/intel_rps.h
> +++ b/drivers/gpu/drm/i915/gt/intel_rps.h
> @@ -47,6 +47,8 @@ u32 intel_rps_get_rp1_frequency(struct intel_rps *rps);
>  u32 intel_rps_get_rpn_frequency(struct intel_rps *rps);
>  u32 intel_rps_read_punit_req(struct intel_rps *rps);
>  u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps);
> +u32 intel_rps_read_rpstat(struct intel_rps *rps);
> +u32 intel_rps_read_rpstat_fw(struct intel_rps *rps);
>  void gen6_rps_get_freq_caps(struct intel_rps *rps, struct intel_rps_freq_caps *caps);
>  void intel_rps_raise_unslice(struct intel_rps *rps);
>  void intel_rps_lower_unslice(struct intel_rps *rps);
> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> index 958b37123bf1..67140a87182f 100644
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
> @@ -371,7 +371,6 @@ static void
>  frequency_sample(struct intel_gt *gt, unsigned int period_ns)
>  {
>	struct drm_i915_private *i915 = gt->i915;
> -	struct intel_uncore *uncore = gt->uncore;
>	struct i915_pmu *pmu = &i915->pmu;
>	struct intel_rps *rps = &gt->rps;
>
> @@ -394,7 +393,7 @@ frequency_sample(struct intel_gt *gt, unsigned int period_ns)
>		 * case we assume the system is running at the intended
>		 * frequency. Fortunately, the read should rarely fail!
>		 */
> -		val = intel_uncore_read_fw(uncore, GEN6_RPSTAT1);
> +		val = intel_rps_read_rpstat_fw(rps);
>		if (val)
>			val = intel_rps_get_cagf(rps, val);
>		else
> --
> 2.25.1
>

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

* Re: [Intel-gfx] [PATCH 1/1] drm/i915: Use GEN12 RPSTAT register
@ 2022-09-28  1:47     ` Dixit, Ashutosh
  0 siblings, 0 replies; 9+ messages in thread
From: Dixit, Ashutosh @ 2022-09-28  1:47 UTC (permalink / raw)
  To: Badal Nilawar; +Cc: andi.shyti, donhiatt, intel-gfx, dri-devel

On Tue, 27 Sep 2022 04:35:29 -0700, Badal Nilawar wrote:
>
> From: Don Hiatt <don.hiatt@intel.com>
>
> On GEN12 and above use GEN12_RPSTAT register to get Current
> Actual Graphics Frequency of GT

I think even for the purposes of reviewing this it would be good to mention
in the commit message that:

a. GEN12_RPSTAT register doesn't require a forcewake to be read (it doesn't
   belong to a forcewake domain)
b. Will result in a 0 frequency if the GT is in RC6

Thanks.
--
Ashutosh

> v2:
>   - Fixed review comments(Ashutosh)
>   - Added function intel_rps_read_rpstat_fw to read RPSTAT without
>     forcewake, required especially for GEN6_RPSTAT1 (Ashutosh, Tvrtko)
>
> Cc: Don Hiatt <donhiatt@gmail.com>
> Cc: Andi Shyti <andi.shyti@intel.com>
> Signed-off-by: Don Hiatt <don.hiatt@intel.com>
> Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c |  2 +-
>  drivers/gpu/drm/i915/gt/intel_gt_regs.h       |  4 +++
>  drivers/gpu/drm/i915/gt/intel_rps.c           | 32 +++++++++++++++++--
>  drivers/gpu/drm/i915/gt/intel_rps.h           |  2 ++
>  drivers/gpu/drm/i915/i915_pmu.c               |  3 +-
>  5 files changed, 38 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> index 10f680dbd7b6..b9b47052b26d 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> @@ -380,7 +380,7 @@ void intel_gt_pm_frequency_dump(struct intel_gt *gt, struct drm_printer *p)
>		rpinclimit = intel_uncore_read(uncore, GEN6_RP_UP_THRESHOLD);
>		rpdeclimit = intel_uncore_read(uncore, GEN6_RP_DOWN_THRESHOLD);
>
> -		rpstat = intel_uncore_read(uncore, GEN6_RPSTAT1);
> +		rpstat = intel_rps_read_rpstat(rps);
>		rpcurupei = intel_uncore_read(uncore, GEN6_RP_CUR_UP_EI) & GEN6_CURICONT_MASK;
>		rpcurup = intel_uncore_read(uncore, GEN6_RP_CUR_UP) & GEN6_CURBSYTAVG_MASK;
>		rpprevup = intel_uncore_read(uncore, GEN6_RP_PREV_UP) & GEN6_CURBSYTAVG_MASK;
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> index 7f79bbf97828..1f1e90acc1ab 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> @@ -1519,6 +1519,10 @@
>  #define VLV_RENDER_C0_COUNT			_MMIO(0x138118)
>  #define VLV_MEDIA_C0_COUNT			_MMIO(0x13811c)
>
> +#define GEN12_RPSTAT1				_MMIO(0x1381b4)
> +#define   GEN12_CAGF_SHIFT			11
> +#define   GEN12_CAGF_MASK			REG_GENMASK(19, 11)
> +
>  #define GEN11_GT_INTR_DW(x)			_MMIO(0x190018 + ((x) * 4))
>  #define   GEN11_CSME				(31)
>  #define   GEN11_GUNIT				(28)
> diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
> index 17b40b625e31..5a15a630b1c6 100644
> --- a/drivers/gpu/drm/i915/gt/intel_rps.c
> +++ b/drivers/gpu/drm/i915/gt/intel_rps.c
> @@ -2068,12 +2068,40 @@ void intel_rps_sanitize(struct intel_rps *rps)
>		rps_disable_interrupts(rps);
>  }
>
> +u32 intel_rps_read_rpstat_fw(struct intel_rps *rps)
> +{
> +	struct drm_i915_private *i915 = rps_to_i915(rps);
> +	i915_reg_t rpstat;
> +
> +	if (GRAPHICS_VER(i915) >= 12)
> +		rpstat = GEN12_RPSTAT1;
> +	else
> +		rpstat = GEN6_RPSTAT1;
> +
> +	return intel_uncore_read_fw(rps_to_gt(rps)->uncore, rpstat);
> +}
> +
> +u32 intel_rps_read_rpstat(struct intel_rps *rps)
> +{
> +	struct drm_i915_private *i915 = rps_to_i915(rps);
> +	i915_reg_t rpstat;
> +
> +	if (GRAPHICS_VER(i915) >= 12)
> +		rpstat = GEN12_RPSTAT1;
> +	else
> +		rpstat = GEN6_RPSTAT1;
> +
> +	return intel_uncore_read(rps_to_gt(rps)->uncore, rpstat);
> +}
> +
>  u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat)
>  {
>	struct drm_i915_private *i915 = rps_to_i915(rps);
>	u32 cagf;
>
> -	if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
> +	if (GRAPHICS_VER(i915) >= 12)
> +		cagf = (rpstat & GEN12_CAGF_MASK) >> GEN12_CAGF_SHIFT;
> +	else if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
>		cagf = (rpstat >> 8) & 0xff;
>	else if (GRAPHICS_VER(i915) >= 9)
>		cagf = (rpstat & GEN9_CAGF_MASK) >> GEN9_CAGF_SHIFT;
> @@ -2099,7 +2127,7 @@ static u32 read_cagf(struct intel_rps *rps)
>		freq = vlv_punit_read(i915, PUNIT_REG_GPU_FREQ_STS);
>		vlv_punit_put(i915);
>	} else if (GRAPHICS_VER(i915) >= 6) {
> -		freq = intel_uncore_read(uncore, GEN6_RPSTAT1);
> +		freq = intel_rps_read_rpstat(rps);
>	} else {
>		freq = intel_uncore_read(uncore, MEMSTAT_ILK);
>	}
> diff --git a/drivers/gpu/drm/i915/gt/intel_rps.h b/drivers/gpu/drm/i915/gt/intel_rps.h
> index 4509dfdc52e0..76c8404d8416 100644
> --- a/drivers/gpu/drm/i915/gt/intel_rps.h
> +++ b/drivers/gpu/drm/i915/gt/intel_rps.h
> @@ -47,6 +47,8 @@ u32 intel_rps_get_rp1_frequency(struct intel_rps *rps);
>  u32 intel_rps_get_rpn_frequency(struct intel_rps *rps);
>  u32 intel_rps_read_punit_req(struct intel_rps *rps);
>  u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps);
> +u32 intel_rps_read_rpstat(struct intel_rps *rps);
> +u32 intel_rps_read_rpstat_fw(struct intel_rps *rps);
>  void gen6_rps_get_freq_caps(struct intel_rps *rps, struct intel_rps_freq_caps *caps);
>  void intel_rps_raise_unslice(struct intel_rps *rps);
>  void intel_rps_lower_unslice(struct intel_rps *rps);
> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> index 958b37123bf1..67140a87182f 100644
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
> @@ -371,7 +371,6 @@ static void
>  frequency_sample(struct intel_gt *gt, unsigned int period_ns)
>  {
>	struct drm_i915_private *i915 = gt->i915;
> -	struct intel_uncore *uncore = gt->uncore;
>	struct i915_pmu *pmu = &i915->pmu;
>	struct intel_rps *rps = &gt->rps;
>
> @@ -394,7 +393,7 @@ frequency_sample(struct intel_gt *gt, unsigned int period_ns)
>		 * case we assume the system is running at the intended
>		 * frequency. Fortunately, the read should rarely fail!
>		 */
> -		val = intel_uncore_read_fw(uncore, GEN6_RPSTAT1);
> +		val = intel_rps_read_rpstat_fw(rps);
>		if (val)
>			val = intel_rps_get_cagf(rps, val);
>		else
> --
> 2.25.1
>

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

* Re: [Intel-gfx] [PATCH 1/1] drm/i915: Use GEN12 RPSTAT register
  2022-09-28  1:47     ` [Intel-gfx] " Dixit, Ashutosh
@ 2022-10-03 17:22       ` Andi Shyti
  -1 siblings, 0 replies; 9+ messages in thread
From: Andi Shyti @ 2022-10-03 17:22 UTC (permalink / raw)
  To: Dixit, Ashutosh; +Cc: dri-devel, intel-gfx, donhiatt, Badal Nilawar

On Tue, Sep 27, 2022 at 06:47:28PM -0700, Dixit, Ashutosh wrote:
> On Tue, 27 Sep 2022 04:35:29 -0700, Badal Nilawar wrote:
> >
> > From: Don Hiatt <don.hiatt@intel.com>
> >
> > On GEN12 and above use GEN12_RPSTAT register to get Current
> > Actual Graphics Frequency of GT
> 
> I think even for the purposes of reviewing this it would be good to mention
> in the commit message that:
> 
> a. GEN12_RPSTAT register doesn't require a forcewake to be read (it doesn't
>    belong to a forcewake domain)
> b. Will result in a 0 frequency if the GT is in RC6

perhaps also in a comment... (continue)

> 
> Thanks.
> --
> Ashutosh
> 
> > v2:
> >   - Fixed review comments(Ashutosh)
> >   - Added function intel_rps_read_rpstat_fw to read RPSTAT without
> >     forcewake, required especially for GEN6_RPSTAT1 (Ashutosh, Tvrtko)
> >
> > Cc: Don Hiatt <donhiatt@gmail.com>
> > Cc: Andi Shyti <andi.shyti@intel.com>
> > Signed-off-by: Don Hiatt <don.hiatt@intel.com>
> > Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
> > ---
> >  drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c |  2 +-
> >  drivers/gpu/drm/i915/gt/intel_gt_regs.h       |  4 +++
> >  drivers/gpu/drm/i915/gt/intel_rps.c           | 32 +++++++++++++++++--
> >  drivers/gpu/drm/i915/gt/intel_rps.h           |  2 ++
> >  drivers/gpu/drm/i915/i915_pmu.c               |  3 +-
> >  5 files changed, 38 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> > index 10f680dbd7b6..b9b47052b26d 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> > @@ -380,7 +380,7 @@ void intel_gt_pm_frequency_dump(struct intel_gt *gt, struct drm_printer *p)
> >		rpinclimit = intel_uncore_read(uncore, GEN6_RP_UP_THRESHOLD);
> >		rpdeclimit = intel_uncore_read(uncore, GEN6_RP_DOWN_THRESHOLD);
> >
> > -		rpstat = intel_uncore_read(uncore, GEN6_RPSTAT1);
> > +		rpstat = intel_rps_read_rpstat(rps);
> >		rpcurupei = intel_uncore_read(uncore, GEN6_RP_CUR_UP_EI) & GEN6_CURICONT_MASK;
> >		rpcurup = intel_uncore_read(uncore, GEN6_RP_CUR_UP) & GEN6_CURBSYTAVG_MASK;
> >		rpprevup = intel_uncore_read(uncore, GEN6_RP_PREV_UP) & GEN6_CURBSYTAVG_MASK;
> > diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> > index 7f79bbf97828..1f1e90acc1ab 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> > +++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> > @@ -1519,6 +1519,10 @@
> >  #define VLV_RENDER_C0_COUNT			_MMIO(0x138118)
> >  #define VLV_MEDIA_C0_COUNT			_MMIO(0x13811c)
> >
> > +#define GEN12_RPSTAT1				_MMIO(0x1381b4)
> > +#define   GEN12_CAGF_SHIFT			11
> > +#define   GEN12_CAGF_MASK			REG_GENMASK(19, 11)
> > +
> >  #define GEN11_GT_INTR_DW(x)			_MMIO(0x190018 + ((x) * 4))
> >  #define   GEN11_CSME				(31)
> >  #define   GEN11_GUNIT				(28)
> > diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
> > index 17b40b625e31..5a15a630b1c6 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_rps.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_rps.c
> > @@ -2068,12 +2068,40 @@ void intel_rps_sanitize(struct intel_rps *rps)
> >		rps_disable_interrupts(rps);
> >  }

... here!

> > +u32 intel_rps_read_rpstat_fw(struct intel_rps *rps)
> > +{
> > +	struct drm_i915_private *i915 = rps_to_i915(rps);
> > +	i915_reg_t rpstat;
> > +
> > +	if (GRAPHICS_VER(i915) >= 12)
> > +		rpstat = GEN12_RPSTAT1;
> > +	else
> > +		rpstat = GEN6_RPSTAT1;
> > +
> > +	return intel_uncore_read_fw(rps_to_gt(rps)->uncore, rpstat);
> > +}
> > +
> > +u32 intel_rps_read_rpstat(struct intel_rps *rps)
> > +{
> > +	struct drm_i915_private *i915 = rps_to_i915(rps);
> > +	i915_reg_t rpstat;
> > +
> > +	if (GRAPHICS_VER(i915) >= 12)
> > +		rpstat = GEN12_RPSTAT1;
> > +	else
> > +		rpstat = GEN6_RPSTAT1;
> > +
> > +	return intel_uncore_read(rps_to_gt(rps)->uncore, rpstat);
> > +}

perhaps this can be simplified a bit more to avoid some code
duplication, but I'm not going to push on this.

I see that CI got stuck somewhere, but the failure doesn't seem
to be related to this patch.

Otherwise it all looks good, with the improved git comment as
Ashutosh asked and the comment above:

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>

Andi

> >  u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat)
> >  {
> >	struct drm_i915_private *i915 = rps_to_i915(rps);
> >	u32 cagf;
> >
> > -	if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
> > +	if (GRAPHICS_VER(i915) >= 12)
> > +		cagf = (rpstat & GEN12_CAGF_MASK) >> GEN12_CAGF_SHIFT;
> > +	else if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
> >		cagf = (rpstat >> 8) & 0xff;
> >	else if (GRAPHICS_VER(i915) >= 9)
> >		cagf = (rpstat & GEN9_CAGF_MASK) >> GEN9_CAGF_SHIFT;
> > @@ -2099,7 +2127,7 @@ static u32 read_cagf(struct intel_rps *rps)
> >		freq = vlv_punit_read(i915, PUNIT_REG_GPU_FREQ_STS);
> >		vlv_punit_put(i915);
> >	} else if (GRAPHICS_VER(i915) >= 6) {
> > -		freq = intel_uncore_read(uncore, GEN6_RPSTAT1);
> > +		freq = intel_rps_read_rpstat(rps);
> >	} else {
> >		freq = intel_uncore_read(uncore, MEMSTAT_ILK);
> >	}
> > diff --git a/drivers/gpu/drm/i915/gt/intel_rps.h b/drivers/gpu/drm/i915/gt/intel_rps.h
> > index 4509dfdc52e0..76c8404d8416 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_rps.h
> > +++ b/drivers/gpu/drm/i915/gt/intel_rps.h
> > @@ -47,6 +47,8 @@ u32 intel_rps_get_rp1_frequency(struct intel_rps *rps);
> >  u32 intel_rps_get_rpn_frequency(struct intel_rps *rps);
> >  u32 intel_rps_read_punit_req(struct intel_rps *rps);
> >  u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps);
> > +u32 intel_rps_read_rpstat(struct intel_rps *rps);
> > +u32 intel_rps_read_rpstat_fw(struct intel_rps *rps);
> >  void gen6_rps_get_freq_caps(struct intel_rps *rps, struct intel_rps_freq_caps *caps);
> >  void intel_rps_raise_unslice(struct intel_rps *rps);
> >  void intel_rps_lower_unslice(struct intel_rps *rps);
> > diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> > index 958b37123bf1..67140a87182f 100644
> > --- a/drivers/gpu/drm/i915/i915_pmu.c
> > +++ b/drivers/gpu/drm/i915/i915_pmu.c
> > @@ -371,7 +371,6 @@ static void
> >  frequency_sample(struct intel_gt *gt, unsigned int period_ns)
> >  {
> >	struct drm_i915_private *i915 = gt->i915;
> > -	struct intel_uncore *uncore = gt->uncore;
> >	struct i915_pmu *pmu = &i915->pmu;
> >	struct intel_rps *rps = &gt->rps;
> >
> > @@ -394,7 +393,7 @@ frequency_sample(struct intel_gt *gt, unsigned int period_ns)
> >		 * case we assume the system is running at the intended
> >		 * frequency. Fortunately, the read should rarely fail!
> >		 */
> > -		val = intel_uncore_read_fw(uncore, GEN6_RPSTAT1);
> > +		val = intel_rps_read_rpstat_fw(rps);
> >		if (val)
> >			val = intel_rps_get_cagf(rps, val);
> >		else
> > --
> > 2.25.1
> >

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

* Re: [Intel-gfx] [PATCH 1/1] drm/i915: Use GEN12 RPSTAT register
@ 2022-10-03 17:22       ` Andi Shyti
  0 siblings, 0 replies; 9+ messages in thread
From: Andi Shyti @ 2022-10-03 17:22 UTC (permalink / raw)
  To: Dixit, Ashutosh; +Cc: dri-devel, intel-gfx, donhiatt

On Tue, Sep 27, 2022 at 06:47:28PM -0700, Dixit, Ashutosh wrote:
> On Tue, 27 Sep 2022 04:35:29 -0700, Badal Nilawar wrote:
> >
> > From: Don Hiatt <don.hiatt@intel.com>
> >
> > On GEN12 and above use GEN12_RPSTAT register to get Current
> > Actual Graphics Frequency of GT
> 
> I think even for the purposes of reviewing this it would be good to mention
> in the commit message that:
> 
> a. GEN12_RPSTAT register doesn't require a forcewake to be read (it doesn't
>    belong to a forcewake domain)
> b. Will result in a 0 frequency if the GT is in RC6

perhaps also in a comment... (continue)

> 
> Thanks.
> --
> Ashutosh
> 
> > v2:
> >   - Fixed review comments(Ashutosh)
> >   - Added function intel_rps_read_rpstat_fw to read RPSTAT without
> >     forcewake, required especially for GEN6_RPSTAT1 (Ashutosh, Tvrtko)
> >
> > Cc: Don Hiatt <donhiatt@gmail.com>
> > Cc: Andi Shyti <andi.shyti@intel.com>
> > Signed-off-by: Don Hiatt <don.hiatt@intel.com>
> > Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
> > ---
> >  drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c |  2 +-
> >  drivers/gpu/drm/i915/gt/intel_gt_regs.h       |  4 +++
> >  drivers/gpu/drm/i915/gt/intel_rps.c           | 32 +++++++++++++++++--
> >  drivers/gpu/drm/i915/gt/intel_rps.h           |  2 ++
> >  drivers/gpu/drm/i915/i915_pmu.c               |  3 +-
> >  5 files changed, 38 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> > index 10f680dbd7b6..b9b47052b26d 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
> > @@ -380,7 +380,7 @@ void intel_gt_pm_frequency_dump(struct intel_gt *gt, struct drm_printer *p)
> >		rpinclimit = intel_uncore_read(uncore, GEN6_RP_UP_THRESHOLD);
> >		rpdeclimit = intel_uncore_read(uncore, GEN6_RP_DOWN_THRESHOLD);
> >
> > -		rpstat = intel_uncore_read(uncore, GEN6_RPSTAT1);
> > +		rpstat = intel_rps_read_rpstat(rps);
> >		rpcurupei = intel_uncore_read(uncore, GEN6_RP_CUR_UP_EI) & GEN6_CURICONT_MASK;
> >		rpcurup = intel_uncore_read(uncore, GEN6_RP_CUR_UP) & GEN6_CURBSYTAVG_MASK;
> >		rpprevup = intel_uncore_read(uncore, GEN6_RP_PREV_UP) & GEN6_CURBSYTAVG_MASK;
> > diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> > index 7f79bbf97828..1f1e90acc1ab 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> > +++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> > @@ -1519,6 +1519,10 @@
> >  #define VLV_RENDER_C0_COUNT			_MMIO(0x138118)
> >  #define VLV_MEDIA_C0_COUNT			_MMIO(0x13811c)
> >
> > +#define GEN12_RPSTAT1				_MMIO(0x1381b4)
> > +#define   GEN12_CAGF_SHIFT			11
> > +#define   GEN12_CAGF_MASK			REG_GENMASK(19, 11)
> > +
> >  #define GEN11_GT_INTR_DW(x)			_MMIO(0x190018 + ((x) * 4))
> >  #define   GEN11_CSME				(31)
> >  #define   GEN11_GUNIT				(28)
> > diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
> > index 17b40b625e31..5a15a630b1c6 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_rps.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_rps.c
> > @@ -2068,12 +2068,40 @@ void intel_rps_sanitize(struct intel_rps *rps)
> >		rps_disable_interrupts(rps);
> >  }

... here!

> > +u32 intel_rps_read_rpstat_fw(struct intel_rps *rps)
> > +{
> > +	struct drm_i915_private *i915 = rps_to_i915(rps);
> > +	i915_reg_t rpstat;
> > +
> > +	if (GRAPHICS_VER(i915) >= 12)
> > +		rpstat = GEN12_RPSTAT1;
> > +	else
> > +		rpstat = GEN6_RPSTAT1;
> > +
> > +	return intel_uncore_read_fw(rps_to_gt(rps)->uncore, rpstat);
> > +}
> > +
> > +u32 intel_rps_read_rpstat(struct intel_rps *rps)
> > +{
> > +	struct drm_i915_private *i915 = rps_to_i915(rps);
> > +	i915_reg_t rpstat;
> > +
> > +	if (GRAPHICS_VER(i915) >= 12)
> > +		rpstat = GEN12_RPSTAT1;
> > +	else
> > +		rpstat = GEN6_RPSTAT1;
> > +
> > +	return intel_uncore_read(rps_to_gt(rps)->uncore, rpstat);
> > +}

perhaps this can be simplified a bit more to avoid some code
duplication, but I'm not going to push on this.

I see that CI got stuck somewhere, but the failure doesn't seem
to be related to this patch.

Otherwise it all looks good, with the improved git comment as
Ashutosh asked and the comment above:

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>

Andi

> >  u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat)
> >  {
> >	struct drm_i915_private *i915 = rps_to_i915(rps);
> >	u32 cagf;
> >
> > -	if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
> > +	if (GRAPHICS_VER(i915) >= 12)
> > +		cagf = (rpstat & GEN12_CAGF_MASK) >> GEN12_CAGF_SHIFT;
> > +	else if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
> >		cagf = (rpstat >> 8) & 0xff;
> >	else if (GRAPHICS_VER(i915) >= 9)
> >		cagf = (rpstat & GEN9_CAGF_MASK) >> GEN9_CAGF_SHIFT;
> > @@ -2099,7 +2127,7 @@ static u32 read_cagf(struct intel_rps *rps)
> >		freq = vlv_punit_read(i915, PUNIT_REG_GPU_FREQ_STS);
> >		vlv_punit_put(i915);
> >	} else if (GRAPHICS_VER(i915) >= 6) {
> > -		freq = intel_uncore_read(uncore, GEN6_RPSTAT1);
> > +		freq = intel_rps_read_rpstat(rps);
> >	} else {
> >		freq = intel_uncore_read(uncore, MEMSTAT_ILK);
> >	}
> > diff --git a/drivers/gpu/drm/i915/gt/intel_rps.h b/drivers/gpu/drm/i915/gt/intel_rps.h
> > index 4509dfdc52e0..76c8404d8416 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_rps.h
> > +++ b/drivers/gpu/drm/i915/gt/intel_rps.h
> > @@ -47,6 +47,8 @@ u32 intel_rps_get_rp1_frequency(struct intel_rps *rps);
> >  u32 intel_rps_get_rpn_frequency(struct intel_rps *rps);
> >  u32 intel_rps_read_punit_req(struct intel_rps *rps);
> >  u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps);
> > +u32 intel_rps_read_rpstat(struct intel_rps *rps);
> > +u32 intel_rps_read_rpstat_fw(struct intel_rps *rps);
> >  void gen6_rps_get_freq_caps(struct intel_rps *rps, struct intel_rps_freq_caps *caps);
> >  void intel_rps_raise_unslice(struct intel_rps *rps);
> >  void intel_rps_lower_unslice(struct intel_rps *rps);
> > diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> > index 958b37123bf1..67140a87182f 100644
> > --- a/drivers/gpu/drm/i915/i915_pmu.c
> > +++ b/drivers/gpu/drm/i915/i915_pmu.c
> > @@ -371,7 +371,6 @@ static void
> >  frequency_sample(struct intel_gt *gt, unsigned int period_ns)
> >  {
> >	struct drm_i915_private *i915 = gt->i915;
> > -	struct intel_uncore *uncore = gt->uncore;
> >	struct i915_pmu *pmu = &i915->pmu;
> >	struct intel_rps *rps = &gt->rps;
> >
> > @@ -394,7 +393,7 @@ frequency_sample(struct intel_gt *gt, unsigned int period_ns)
> >		 * case we assume the system is running at the intended
> >		 * frequency. Fortunately, the read should rarely fail!
> >		 */
> > -		val = intel_uncore_read_fw(uncore, GEN6_RPSTAT1);
> > +		val = intel_rps_read_rpstat_fw(rps);
> >		if (val)
> >			val = intel_rps_get_cagf(rps, val);
> >		else
> > --
> > 2.25.1
> >

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

end of thread, other threads:[~2022-10-03 17:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-27 11:35 [PATCH 0/1] drm/i915: Add GEN12 RPSTAT reg to get CAGF Badal Nilawar
2022-09-27 11:35 ` [Intel-gfx] " Badal Nilawar
2022-09-27 11:35 ` [PATCH 1/1] drm/i915: Use GEN12 RPSTAT register Badal Nilawar
2022-09-27 11:35   ` [Intel-gfx] " Badal Nilawar
2022-09-28  1:47   ` Dixit, Ashutosh
2022-09-28  1:47     ` [Intel-gfx] " Dixit, Ashutosh
2022-10-03 17:22     ` Andi Shyti
2022-10-03 17:22       ` Andi Shyti
2022-09-27 23:02 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Add GEN12 RPSTAT reg to get CAGF Patchwork

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.