Skip to contentSkip to conversation

drm/xe/hwmon: Enable energy attributes for CRI

PATCH Superseded Karthik Poosa 4 participants 6 messages Mar 10 – Mar 26

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/xe/hwmon: Enable energy attributes for CRI

Enable HWMON energy attributes for CRI which is available through MMIO registers.

---
 drivers/gpu/drm/xe/regs/xe_pcode_regs.h | 3 +++
 drivers/gpu/drm/xe/xe_hwmon.c           | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/regs/xe_pcode_regs.h +3 -0
index 4b3c46eb858f..c63b409d7a82 100644
@@ -27,4 +27,7 @@
 #define   TEMP_SIGN_MASK			REG_BIT(31)
 #define BMG_PACKAGE_TEMPERATURE			XE_REG(0x138434)
 
+#define CRI_PACKAGE_ENERGY_STATUS		XE_REG(0x138120)
+#define CRI_PLATFORM_ENERGY_STATUS		XE_REG(0x138458)
+
 #endif /* _XE_PCODE_REGS_H_ */
drivers/gpu/drm/xe/xe_hwmon.c +6 -1
index 0fd4d4f1014a..852681bdb84c 100644
@@ -296,7 +296,12 @@ static struct xe_reg xe_hwmon_get_reg(struct xe_hwmon *hwmon, enum xe_hwmon_reg
 			return GT_PERF_STATUS;
 		break;
 	case REG_PKG_ENERGY_STATUS:
-		if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG) {
+		if (xe->info.platform == XE_CRESCENTISLAND) {
+			if (channel == CHANNEL_CARD)
+				return CRI_PLATFORM_ENERGY_STATUS;
+			else if (channel == CHANNEL_PKG)
+				return CRI_PACKAGE_ENERGY_STATUS;
+		} else if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG) {
 			return PVC_GT0_PLATFORM_ENERGY_STATUS;
 		} else if ((xe->info.platform == XE_DG2) && (channel == CHANNEL_PKG)) {
 			return PCU_CR_PACKAGE_ENERGY_STATUS;
Signature · 1 line
2.25.1
#1 lore raw

✗ CI.KUnit: failure for drm/xe/hwmon: Enable energy attributes for CRI

== Series Details ==

== Series Details ==

Series: drm/xe/hwmon: Enable energy attributes for CRI
URL : https://patchwork.freedesktop.org/series/162951/
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_lrc.c: In function ‘xe_lrc_ctx_init’:
../drivers/gpu/drm/xe/xe_lrc.c:1554:43: error: implicit declaration of function ‘_MASKED_BIT_ENABLE’; did you mean ‘REG_MASKED_FIELD_ENABLE’? [-Werror=implicit-function-declaration]

 1554 |                 state_cache_perf_fix[2] = _MASKED_BIT_ENABLE(DISABLE_STATE_CACHE_PERF_FIX);
      |                                           ^~~~~~~~~~~~~~~~~~
      |                                           REG_MASKED_FIELD_ENABLE

cc1: some warnings being treated as errors
make[7]: *** [../scripts/Makefile.build:289: drivers/gpu/drm/xe/xe_lrc.o] Error 1 make[7]: *** Waiting for unfinished jobs....
make[6]: *** [../scripts/Makefile.build:548: drivers/gpu/drm/xe] Error 2 make[5]: *** [../scripts/Makefile.build:548: drivers/gpu/drm] Error 2 make[4]: *** [../scripts/Makefile.build:548: drivers/gpu] Error 2 make[3]: *** [../scripts/Makefile.build:548: drivers] Error 2 make[2]: *** [/kernel/Makefile:2101: .] Error 2
make[1]: *** [/kernel/Makefile:248: __sub-make] Error 2
make: *** [Makefile:248: __sub-make] Error 2

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

$ make ARCH=um O=.kunit olddefconfig
[15:05:35] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=25
+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel
#2 lore raw
In reply to Karthik Poosa
Quoted 12 lines

-----Original Message-----
From: Poosa, Karthik <[email protected]>
Sent: Tuesday, March 10, 2026 5:50 PM
To: [email protected]
Cc: Gupta, Anshuman <[email protected]>; Nilawar, Badal <[email protected]>; Vivi, Rodrigo <[email protected]>; Jadav, Raag <[email protected]>; Tauro, Riana <[email protected]>; Poosa, Karthik <[email protected]>
Subject: [PATCH] drm/xe/hwmon: Enable energy attributes for CRI

Quoted 2 lines

Enable HWMON energy attributes for CRI which is available through MMIO registers.

Can you explain why this change required in commit message ? BR,
Anshuman

Quoted 45 lines
---
 drivers/gpu/drm/xe/regs/xe_pcode_regs.h | 3 +++
 drivers/gpu/drm/xe/xe_hwmon.c           | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/regs/xe_pcode_regs.h +3 -0
index 4b3c46eb858f..c63b409d7a82 100644
@@ -27,4 +27,7 @@
 #define   TEMP_SIGN_MASK			REG_BIT(31)
 #define BMG_PACKAGE_TEMPERATURE			XE_REG(0x138434)
 
+#define CRI_PACKAGE_ENERGY_STATUS		XE_REG(0x138120)
+#define CRI_PLATFORM_ENERGY_STATUS		XE_REG(0x138458)
+
 #endif /* _XE_PCODE_REGS_H_ */
(quoted diff) +0 -0

b/drivers/gpu/drm/xe/xe_hwmon.c index 0fd4d4f1014a..852681bdb84c 100644

drivers/gpu/drm/xe/xe_hwmon.c +0 -0
@@ -296,7 +296,12 @@ static struct xe_reg xe_hwmon_get_reg(struct

xe_hwmon *hwmon, enum xe_hwmon_reg

drivers/gpu/drm/xe/xe_hwmon.c +0 -1
 			return GT_PERF_STATUS;
 		break;
 	case REG_PKG_ENERGY_STATUS:
-		if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG)

{

drivers/gpu/drm/xe/xe_hwmon.c +6 -0
+		if (xe->info.platform == XE_CRESCENTISLAND) {
+			if (channel == CHANNEL_CARD)
+				return CRI_PLATFORM_ENERGY_STATUS;
+			else if (channel == CHANNEL_PKG)
+				return CRI_PACKAGE_ENERGY_STATUS;
+		} else if (xe->info.platform == XE_PVC && channel ==

CHANNEL_PKG) {

drivers/gpu/drm/xe/xe_hwmon.c +0 -0
 			return PVC_GT0_PLATFORM_ENERGY_STATUS;
 		} else if ((xe->info.platform == XE_DG2) && (channel ==

CHANNEL_PKG)) {
return PCU_CR_PACKAGE_ENERGY_STATUS;
--
2.25.1

#3 lore raw
In reply to Karthik Poosa

Hi Karthik,

Quoted 26 lines · Karthik Poosa

Enable HWMON energy attributes for CRI which is available through MMIO registers.

---
  drivers/gpu/drm/xe/regs/xe_pcode_regs.h | 3 +++
  drivers/gpu/drm/xe/xe_hwmon.c           | 7 ++++++-
  2 files changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/regs/xe_pcode_regs.h +3 -0
index 4b3c46eb858f..c63b409d7a82 100644
@@ -27,4 +27,7 @@
  #define   TEMP_SIGN_MASK			REG_BIT(31)
  #define BMG_PACKAGE_TEMPERATURE			XE_REG(0x138434)
 
+#define CRI_PACKAGE_ENERGY_STATUS		XE_REG(0x138120)
+#define CRI_PLATFORM_ENERGY_STATUS		XE_REG(0x138458)
+
  #endif /* _XE_PCODE_REGS_H_ */
drivers/gpu/drm/xe/xe_hwmon.c +0 -0
index 0fd4d4f1014a..852681bdb84c 100644

drivers/gpu/drm/xe/xe_hwmon.c static struct xe_reg xe_hwmon_get_reg(struct xe_hwmon *hwmon, enum xe_hwmon_reg · line 300

Quoted 6 lines
drivers/gpu/drm/xe/xe_hwmon.c +2 -1
@@ -296,7 +296,12 @@ static struct xe_reg xe_hwmon_get_reg(struct xe_hwmon *hwmon, enum xe_hwmon_reg
  			return GT_PERF_STATUS;
  		break;
  	case REG_PKG_ENERGY_STATUS:
-		if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG) {
+		if (xe->info.platform == XE_CRESCENTISLAND) {
+			if (channel == CHANNEL_CARD)

Instead of using if-else better to use switch-case here.

Thanks,
Soham

Quoted 7 lines
drivers/gpu/drm/xe/xe_hwmon.c +4 -0
+				return CRI_PLATFORM_ENERGY_STATUS;
+			else if (channel == CHANNEL_PKG)
+				return CRI_PACKAGE_ENERGY_STATUS;
+		} else if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG) {
  			return PVC_GT0_PLATFORM_ENERGY_STATUS;
  		} else if ((xe->info.platform == XE_DG2) && (channel == CHANNEL_PKG)) {
  			return PCU_CR_PACKAGE_ENERGY_STATUS;
#4 lore raw
Quoted 38 lines · Soham

Hi Karthik,

Quoted 25 lines · Karthik Poosa

Enable HWMON energy attributes for CRI which is available through MMIO registers.

---
  drivers/gpu/drm/xe/regs/xe_pcode_regs.h | 3 +++ drivers/gpu/drm/xe/xe_hwmon.c           | 7 ++++++-

  2 files changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/regs/xe_pcode_regs.h +2 -0
index 4b3c46eb858f..c63b409d7a82 100644
@@ -27,4 +27,7 @@
   #define   TEMP_SIGN_MASK            REG_BIT(31)
   #define BMG_PACKAGE_TEMPERATURE            XE_REG(0x138434)
   +#define CRI_PACKAGE_ENERGY_STATUS        XE_REG(0x138120)
+#define CRI_PLATFORM_ENERGY_STATUS        XE_REG(0x138458)
+
   #endif /* _XE_PCODE_REGS_H_ */
drivers/gpu/drm/xe/xe_hwmon.c +0 -0
index 0fd4d4f1014a..852681bdb84c 100644
@@ -296,7 +296,12 @@ static struct xe_reg xe_hwmon_get_reg(struct 
Quoted 7 lines

xe_hwmon *hwmon, enum xe_hwmon_reg
              return GT_PERF_STATUS;
          break;
      case REG_PKG_ENERGY_STATUS:
-        if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG) { +        if (xe->info.platform == XE_CRESCENTISLAND) {
+            if (channel == CHANNEL_CARD)

Instead of using if-else better to use switch-case here.

Quoted 2 lines

Thanks,
Soham

That will need refactor of this entire function. Those shall be handled in a separate patch series.

Quoted 9 lines
Quoted 9 lines

+                return CRI_PLATFORM_ENERGY_STATUS;
+            else if (channel == CHANNEL_PKG)
+                return CRI_PACKAGE_ENERGY_STATUS;
+        } else if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG) {
              return PVC_GT0_PLATFORM_ENERGY_STATUS;
          } else if ((xe->info.platform == XE_DG2) && (channel == CHANNEL_PKG)) { return PCU_CR_PACKAGE_ENERGY_STATUS;

#5 lore raw

________________________________
From: Poosa, Karthik <[email protected]>
Sent: Friday, March 20, 2026 6:16 PM
To: Purkait, Soham <[email protected]>; [email protected] <[email protected]>
Cc: Gupta, Anshuman <[email protected]>; Nilawar, Badal <[email protected]>; Vivi, Rodrigo <[email protected]>; Jadav, Raag <[email protected]>; Tauro, Riana <[email protected]>
Subject: Re: drm/xe/hwmon: Enable energy attributes for CRI

Quoted 40 lines · Soham

Hi Karthik,

Quoted 31 lines · Karthik Poosa

Enable HWMON energy attributes for CRI which is available through MMIO registers.

---
  drivers/gpu/drm/xe/regs/xe_pcode_regs.h | 3 +++
  drivers/gpu/drm/xe/xe_hwmon.c           | 7 ++++++-
  2 files changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/regs/xe_pcode_regs.h +2 -0
index 4b3c46eb858f..c63b409d7a82 100644
@@ -27,4 +27,7 @@
  #define   TEMP_SIGN_MASK            REG_BIT(31)
  #define BMG_PACKAGE_TEMPERATURE            XE_REG(0x138434)
  +#define CRI_PACKAGE_ENERGY_STATUS        XE_REG(0x138120)
+#define CRI_PLATFORM_ENERGY_STATUS        XE_REG(0x138458)
+
  #endif /* _XE_PCODE_REGS_H_ */
drivers/gpu/drm/xe/xe_hwmon.c +0 -0
index 0fd4d4f1014a..852681bdb84c 100644
@@ -296,7 +296,12 @@ static struct xe_reg xe_hwmon_get_reg(struct

xe_hwmon *hwmon, enum xe_hwmon_reg

              return GT_PERF_STATUS;
          break;
      case REG_PKG_ENERGY_STATUS:

drivers/gpu/drm/xe/xe_hwmon.c static struct xe_reg xe_hwmon_get_reg(struct xe_hwmon *hwmon, enum xe_hwmon_reg · line 300

Quoted 3 lines
drivers/gpu/drm/xe/xe_hwmon.c +2 -1
-        if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG) {
+        if (xe->info.platform == XE_CRESCENTISLAND) {
+            if (channel == CHANNEL_CARD)

Instead of using if-else better to use switch-case here.

Quoted 2 lines

Thanks,
Soham

That will need refactor of this entire function. Those shall be handled in a separate patch series.

As per offline discussion, switch case was suggested for channels under energy. As energy is supported only for card and package channels, switch case is not needed here.

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/xe/xe_hwmon.c +4 -0
+                return CRI_PLATFORM_ENERGY_STATUS;
+            else if (channel == CHANNEL_PKG)
+                return CRI_PACKAGE_ENERGY_STATUS;
+        } else if (xe->info.platform == XE_PVC && channel ==
CHANNEL_PKG) {
              return PVC_GT0_PLATFORM_ENERGY_STATUS;
          } else if ((xe->info.platform == XE_DG2) && (channel ==
CHANNEL_PKG)) {
              return PCU_CR_PACKAGE_ENERGY_STATUS;