All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-xe] [PATCH] drm/xe/mtl: Use 16.67 Mhz freq scale factor to get rpX
@ 2023-11-01 15:17 Badal Nilawar
  2023-11-01 15:12 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Badal Nilawar @ 2023-11-01 15:17 UTC (permalink / raw)
  To: intel-xe

For mtl and above 16.67 Mhz is the scale factor to calculate
rpX frequencies.

Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_pc.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
index 74247e0d3674..90e3e1b56c27 100644
--- a/drivers/gpu/drm/xe/xe_guc_pc.c
+++ b/drivers/gpu/drm/xe/xe_guc_pc.c
@@ -306,14 +306,15 @@ static int pc_set_max_freq(struct xe_guc_pc *pc, u32 freq)
 static void mtl_update_rpe_value(struct xe_guc_pc *pc)
 {
 	struct xe_gt *gt = pc_to_gt(pc);
-	u32 reg;
+	u32 freq;
 
 	if (xe_gt_is_media_type(gt))
-		reg = xe_mmio_read32(gt, MTL_MPE_FREQUENCY);
+		freq = xe_mmio_read32(gt, MTL_MPE_FREQUENCY);
 	else
-		reg = xe_mmio_read32(gt, MTL_GT_RPE_FREQUENCY);
+		freq = xe_mmio_read32(gt, MTL_GT_RPE_FREQUENCY);
 
-	pc->rpe_freq = REG_FIELD_GET(MTL_RPE_MASK, reg) * GT_FREQUENCY_MULTIPLIER;
+	freq = REG_FIELD_GET(MTL_RPE_MASK, freq);
+	pc->rpe_freq = decode_freq(freq);
 }
 
 static void tgl_update_rpe_value(struct xe_guc_pc *pc)
@@ -645,18 +646,20 @@ static const struct attribute *pc_attrs[] = {
 static void mtl_init_fused_rp_values(struct xe_guc_pc *pc)
 {
 	struct xe_gt *gt = pc_to_gt(pc);
-	u32 reg;
+	u32 freq;
 
 	xe_device_assert_mem_access(pc_to_xe(pc));
 
 	if (xe_gt_is_media_type(gt))
-		reg = xe_mmio_read32(gt, MTL_MEDIAP_STATE_CAP);
+		freq = xe_mmio_read32(gt, MTL_MEDIAP_STATE_CAP);
 	else
-		reg = xe_mmio_read32(gt, MTL_RP_STATE_CAP);
-	pc->rp0_freq = REG_FIELD_GET(MTL_RP0_CAP_MASK, reg) *
-		GT_FREQUENCY_MULTIPLIER;
-	pc->rpn_freq = REG_FIELD_GET(MTL_RPN_CAP_MASK, reg) *
-		GT_FREQUENCY_MULTIPLIER;
+		freq = xe_mmio_read32(gt, MTL_RP_STATE_CAP);
+
+	freq = REG_FIELD_GET(MTL_RP0_CAP_MASK, freq);
+	pc->rp0_freq = decode_freq(freq);
+
+	freq = REG_FIELD_GET(MTL_RPN_CAP_MASK, freq);
+	pc->rpn_freq = decode_freq(freq);
 }
 
 static void tgl_init_fused_rp_values(struct xe_guc_pc *pc)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [Intel-xe] [PATCH] drm/xe/mtl: Use 16.67 Mhz freq scale factor to get rpX
@ 2023-11-01 16:32 Badal Nilawar
  2023-11-01 16:28 ` Dixit, Ashutosh
  0 siblings, 1 reply; 12+ messages in thread
From: Badal Nilawar @ 2023-11-01 16:32 UTC (permalink / raw)
  To: intel-xe

For mtl and above 16.67 Mhz is the scale factor to calculate
rpX frequencies.

v2: Fix review comment (Ashutosh)

Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_pc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
index 74247e0d3674..020c6597cd78 100644
--- a/drivers/gpu/drm/xe/xe_guc_pc.c
+++ b/drivers/gpu/drm/xe/xe_guc_pc.c
@@ -313,7 +313,7 @@ static void mtl_update_rpe_value(struct xe_guc_pc *pc)
 	else
 		reg = xe_mmio_read32(gt, MTL_GT_RPE_FREQUENCY);
 
-	pc->rpe_freq = REG_FIELD_GET(MTL_RPE_MASK, reg) * GT_FREQUENCY_MULTIPLIER;
+	pc->rpe_freq = decode_freq(REG_FIELD_GET(MTL_RPE_MASK, reg));
 }
 
 static void tgl_update_rpe_value(struct xe_guc_pc *pc)
@@ -653,10 +653,10 @@ static void mtl_init_fused_rp_values(struct xe_guc_pc *pc)
 		reg = xe_mmio_read32(gt, MTL_MEDIAP_STATE_CAP);
 	else
 		reg = xe_mmio_read32(gt, MTL_RP_STATE_CAP);
-	pc->rp0_freq = REG_FIELD_GET(MTL_RP0_CAP_MASK, reg) *
-		GT_FREQUENCY_MULTIPLIER;
-	pc->rpn_freq = REG_FIELD_GET(MTL_RPN_CAP_MASK, reg) *
-		GT_FREQUENCY_MULTIPLIER;
+
+	pc->rp0_freq = decode_freq(REG_FIELD_GET(MTL_RP0_CAP_MASK, reg));
+
+	pc->rpn_freq = decode_freq(REG_FIELD_GET(MTL_RPN_CAP_MASK, reg));
 }
 
 static void tgl_init_fused_rp_values(struct xe_guc_pc *pc)
-- 
2.25.1


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

end of thread, other threads:[~2023-11-01 16:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-01 15:17 [Intel-xe] [PATCH] drm/xe/mtl: Use 16.67 Mhz freq scale factor to get rpX Badal Nilawar
2023-11-01 15:12 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-11-01 15:12 ` [Intel-xe] ✓ CI.checkpatch: " Patchwork
2023-11-01 15:13 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-11-01 15:21 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-11-01 15:21 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-11-01 15:22 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-11-01 15:23 ` [Intel-xe] [PATCH] " Dixit, Ashutosh
2023-11-01 15:58   ` Nilawar, Badal
2023-11-01 15:55 ` [Intel-xe] ✓ CI.BAT: success for " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-11-01 16:32 [Intel-xe] [PATCH] " Badal Nilawar
2023-11-01 16:28 ` Dixit, Ashutosh

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.