Skip to contentSkip to conversation

drm/xe: Introduce GuC PC debugfs

PATCH New Rodrigo Vivi 2 participants 5 messages Jan 15, 2025

Subsystems (2)
lore
Share & tools
lore

Rodrigo Vivi

author maintainer
#0 lore raw

PATCH 1/2 drm/xe: Introduce GuC PC debugfs

Allows the visualization of the current GuC power conservation status and policies.

v2: Fix DCC msg (Vinay)
v3: Simplify pc_get_state_string (Jonathan)

---
 drivers/gpu/drm/xe/xe_guc_debugfs.c | 15 ++++++++
 drivers/gpu/drm/xe/xe_guc_pc.c      | 59 +++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_guc_pc.h      |  2 +
 3 files changed, 76 insertions(+)
drivers/gpu/drm/xe/xe_guc_debugfs.c +15 -0
index 995b306aced7..0aff1d462bc0 100644
@@ -13,6 +13,7 @@
 #include "xe_guc.h"
 #include "xe_guc_ct.h"
 #include "xe_guc_log.h"
+#include "xe_guc_pc.h"
 #include "xe_macros.h"
 #include "xe_pm.h"
 
@@ -60,10 +61,24 @@ static int guc_ctb(struct seq_file *m, void *data)
 	return 0;
 }
 
+static int guc_pc(struct seq_file *m, void *data)
+{
+	struct xe_guc *guc = node_to_guc(m->private);
+	struct xe_device *xe = guc_to_xe(guc);
+	struct drm_printer p = drm_seq_file_printer(m);
+
+	xe_pm_runtime_get(xe);
+	xe_guc_pc_print(&guc->pc, &p);
+	xe_pm_runtime_put(xe);
+
+	return 0;
+}
+
 static const struct drm_info_list debugfs_list[] = {
 	{"guc_info", guc_info, 0},
 	{"guc_log", guc_log, 0},
 	{"guc_ctb", guc_ctb, 0},
+	{"guc_pc", guc_pc, 0},
 };
 
 void xe_guc_debugfs_register(struct xe_guc *guc, struct dentry *parent)
drivers/gpu/drm/xe/xe_guc_pc.c +59 -0

68 lines not on this page · raw message

drivers/gpu/drm/xe/xe_guc_pc.h +2 -0
index 619f59cd633c..39102b79602f 100644
@@ -10,6 +10,7 @@
 
 struct xe_guc_pc;
 enum slpc_gucrc_mode;
+struct drm_printer;
 
 int xe_guc_pc_init(struct xe_guc_pc *pc);
 int xe_guc_pc_start(struct xe_guc_pc *pc);
@@ -17,6 +18,7 @@ int xe_guc_pc_stop(struct xe_guc_pc *pc);
 int xe_guc_pc_gucrc_disable(struct xe_guc_pc *pc);
 int xe_guc_pc_override_gucrc_mode(struct xe_guc_pc *pc, enum slpc_gucrc_mode mode);
 int xe_guc_pc_unset_gucrc_mode(struct xe_guc_pc *pc);
+void xe_guc_pc_print(struct xe_guc_pc *pc, struct drm_printer *p);
 
 u32 xe_guc_pc_get_act_freq(struct xe_guc_pc *pc);
 int xe_guc_pc_get_cur_freq(struct xe_guc_pc *pc, u32 *freq);
Signature · 1 line
2.47.1
author maintainer
#1 lore raw

PATCH 2/2 drm/xe/lnl: Enable GuC SLPC DCC task

Enable DCC (Duty Cycle Control) in Lunar Lake.

DCC is the SLPC task that tries to keep
the GT from operating inefficiently when thermally constrained.

Although the recommendation is to enable it, LNL GuC is leaving it disabled by default on LNL.

It would minimize the GT frequency oscillation on throttled scenarios, which could potentially reduce latencies.

v2: Move set_policies call after wait for running state, so
we ensure it is not overwritten. (Vinay)
v3: Fix English in the commit message (Jonathan)
v4: Also set disable to 0 so DCC can really get into effect.
v5: Avoid lnl_ prefix (Vinay)

---
 drivers/gpu/drm/xe/xe_guc_pc.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/gpu/drm/xe/xe_guc_pc.c +25 -0
index 43f9617baba2..864fb858dbe3 100644
@@ -993,6 +993,27 @@ static int pc_init_freqs(struct xe_guc_pc *pc)
 	return ret;
 }
 
+static int slpc_enable_dcc(struct xe_guc_pc *pc)
+{
+	int ret;
+
+	ret = pc_action_set_param(pc, SLPC_PARAM_TASK_ENABLE_DCC, 1);
+	if (ret)
+		return ret;
+
+	return pc_action_set_param(pc, SLPC_PARAM_TASK_DISABLE_DCC, 0);
+}
+
+static int slpc_set_policies(struct xe_guc_pc *pc)
+{
+	struct xe_device *xe = pc_to_xe(pc);
+
+	if (xe->info.platform == XE_LUNARLAKE)
+		return lnl_enable_dcc(pc);
+
+	return 0;
+}
+
 /**
  * xe_guc_pc_start - Start GuC's Power Conservation component
  * @pc: Xe_GuC_PC instance
@@ -1037,6 +1058,10 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)
 		goto out;
 	}
 
+	ret = slpc_set_policies(pc);
+	if (ret)
+		goto out;
+
 	ret = pc_init_freqs(pc);
 	if (ret)
 		goto out;
Signature · 1 line
2.47.1
#2 lore raw

✓ CI.Patch_applied: success for series starting with [CI,1/2] drm/xe: Introduce GuC PC debugfs

In reply to Rodrigo Vivi
== Series Details ==

== Series Details ==

Series: series starting with [CI,1/2] drm/xe: Introduce GuC PC debugfs
URL : https://patchwork.freedesktop.org/series/143558/
State : success

== Summary ==

=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: f28dfb722dce drm-tip: 2025y-01m-15d-13h-27m-10s UTC integration manifest === git am output follows ===
Applying: drm/xe: Introduce GuC PC debugfs
Applying: drm/xe/lnl: Enable GuC SLPC DCC task

CI Reviewed-by Vinay Belgaumkar Reviewed-by Jonathan Cavitt on v1 1/2
#3 lore raw

✓ CI.checkpatch: success for series starting with [CI,1/2] drm/xe: Introduce GuC PC debugfs

In reply to Rodrigo Vivi
== Series Details ==

== Series Details ==

Series: series starting with [CI,1/2] drm/xe: Introduce GuC PC debugfs
URL : https://patchwork.freedesktop.org/series/143558/
State : success

== Summary ==

+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master 30ab6715fc09baee6cc14cb3c89ad8858688d474
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit 6bcd21c442eb10ad167184aecbffb90e39ec63e5

Author: Rodrigo Vivi <[email protected]>
Date:   Wed Jan 15 09:46:03 2025 -0500

drm/xe/lnl: Enable GuC SLPC DCC task

Enable DCC (Duty Cycle Control) in Lunar Lake.

DCC is the SLPC task that tries to keep
the GT from operating inefficiently when thermally constrained.

Although the recommendation is to enable it, LNL GuC is leaving it disabled by default on LNL.

It would minimize the GT frequency oscillation on throttled scenarios, which could potentially reduce latencies.

v2: Move set_policies call after wait for running state, so
we ensure it is not overwritten. (Vinay)
v3: Fix English in the commit message (Jonathan)
v4: Also set disable to 0 so DCC can really get into effect.
v5: Avoid lnl_ prefix (Vinay)

+ /mt/dim checkpatch f28dfb722dce66482e5d1741deae312d96c29ee0 drm-intel e9e7b3cb5fbd drm/xe: Introduce GuC PC debugfs
6bcd21c442eb drm/xe/lnl: Enable GuC SLPC DCC task

#4 lore raw

✗ CI.KUnit: failure for series starting with [CI,1/2] drm/xe: Introduce GuC PC debugfs

In reply to Rodrigo Vivi
== Series Details ==

== Series Details ==

Series: series starting with [CI,1/2] drm/xe: Introduce GuC PC debugfs
URL : https://patchwork.freedesktop.org/series/143558/
State : failure

== Summary ==

+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig
ERROR:root:../drivers/gpu/drm/xe/xe_guc_pc.c: In function ‘slpc_set_policies’:
../drivers/gpu/drm/xe/xe_guc_pc.c:1012:24: error: implicit declaration of function ‘lnl_enable_dcc’; did you mean ‘slpc_enable_dcc’? [-Werror=implicit-function-declaration]

 1012 |                 return lnl_enable_dcc(pc);
      |                        ^~~~~~~~~~~~~~
      |                        slpc_enable_dcc
../drivers/gpu/drm/xe/xe_guc_pc.c: At top level:
../drivers/gpu/drm/xe/xe_guc_pc.c:996:12: warning: ‘slpc_enable_dcc’ defined but not used [-Wunused-function]
  996 | static int slpc_enable_dcc(struct xe_guc_pc *pc)
      |            ^~~~~~~~~~~~~~~

cc1: some warnings being treated as errors
make[7]: *** [../scripts/Makefile.build:194: drivers/gpu/drm/xe/xe_guc_pc.o] Error 1 make[7]: *** Waiting for unfinished jobs....
../lib/iomap.c:156:5: warning: no previous prototype for ‘ioread64_lo_hi’ [-Wmissing-prototypes]
156 | u64 ioread64_lo_hi(const void __iomem *addr)

      |     ^~~~~~~~~~~~~~
../lib/iomap.c:163:5: warning: no previous prototype for ‘ioread64_hi_lo’ [-Wmissing-prototypes]
  163 | u64 ioread64_hi_lo(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~
../lib/iomap.c:170:5: warning: no previous prototype for ‘ioread64be_lo_hi’ [-Wmissing-prototypes]
  170 | u64 ioread64be_lo_hi(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~~~
../lib/iomap.c:178:5: warning: no previous prototype for ‘ioread64be_hi_lo’ [-Wmissing-prototypes]
  178 | u64 ioread64be_hi_lo(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~~~
../lib/iomap.c:264:6: warning: no previous prototype for ‘iowrite64_lo_hi’ [-Wmissing-prototypes]
  264 | void iowrite64_lo_hi(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:272:6: warning: no previous prototype for ‘iowrite64_hi_lo’ [-Wmissing-prototypes]
  272 | void iowrite64_hi_lo(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:280:6: warning: no previous prototype for ‘iowrite64be_lo_hi’ [-Wmissing-prototypes]
  280 | void iowrite64be_lo_hi(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~~~
../lib/iomap.c:288:6: warning: no previous prototype for ‘iowrite64be_hi_lo’ [-Wmissing-prototypes]
  288 | void iowrite64be_hi_lo(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~~~

make[6]: *** [../scripts/Makefile.build:440: drivers/gpu/drm/xe] Error 2 make[5]: *** [../scripts/Makefile.build:440: drivers/gpu/drm] Error 2 make[4]: *** [../scripts/Makefile.build:440: drivers/gpu] Error 2 make[3]: *** [../scripts/Makefile.build:440: drivers] Error 2 make[2]: *** [/kernel/Makefile:1989: .] Error 2
make[1]: *** [/kernel/Makefile:251: __sub-make] Error 2
make: *** [Makefile:251: __sub-make] Error 2

[15:31:26] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:

$ make ARCH=um O=.kunit olddefconfig
[15:31:30] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json ARCH=um O=.kunit --jobs=48
+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel