drm/xe/hwmon: Enable energy attributes for CRI
authorKarthik Poosa <karthik.poosa@intel.com>
Fri, 17 Apr 2026 04:14:56 +0000 (09:44 +0530)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Fri, 17 Apr 2026 18:27:19 +0000 (14:27 -0400)
Enable HWMON energy attributes for CRI, which are available through MMIO
registers.
Although these attributes can also be accessed via PMT, MMIO is preferred
as it avoids dependency on ocode firmware load in late binding scenario.

v2: Rephrase commit message. (Anshuman)

Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
Reviewed-by: Soham Purkait <soham.purkait@intel.com>
Link: https://patch.msgid.link/20260417041456.818668-1-karthik.poosa@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/regs/xe_pcode_regs.h
drivers/gpu/drm/xe/xe_hwmon.c

index 4b3c46e..c63b409 100644 (file)
@@ -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_ */
index 0f92aa3..2e95989 100644 (file)
@@ -303,7 +303,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;