Skip to content

Commit e90f7a5

Browse files
kpoosarodrigovivi
authored andcommitted
drm/xe/hwmon: Add HWMON support for BMG
Add HWMON support for BMG. Exposing the pkg power, current, energy info. Signed-off-by: Karthik Poosa <karthik.poosa@intel.com> Reviewed-by: Badal Nilawar <badal.nilawar@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://lore.kernel.org/r/20240523144351.4040131-2-balasubramani.vivekanandan@intel.com Signed-off-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240529050758.442056-2-balasubramani.vivekanandan@intel.com Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent dac81a9 commit e90f7a5

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

drivers/gpu/drm/xe/regs/xe_pcode_regs.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@
1818
#define PVC_GT0_PLATFORM_ENERGY_STATUS XE_REG(0x28106c)
1919
#define PVC_GT0_PACKAGE_POWER_SKU XE_REG(0x281080)
2020

21+
#define BMG_PACKAGE_POWER_SKU XE_REG(0x138098)
22+
#define BMG_PACKAGE_POWER_SKU_UNIT XE_REG(0x1380dc)
23+
#define BMG_PACKAGE_ENERGY_STATUS XE_REG(0x138120)
24+
#define BMG_PACKAGE_RAPL_LIMIT XE_REG(0x138440)
25+
2126
#endif /* _XE_PCODE_REGS_H_ */

drivers/gpu/drm/xe/xe_hwmon.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,25 @@ static struct xe_reg xe_hwmon_get_reg(struct xe_hwmon *hwmon, enum xe_hwmon_reg
8686

8787
switch (hwmon_reg) {
8888
case REG_PKG_RAPL_LIMIT:
89-
if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG)
89+
if (xe->info.platform == XE_BATTLEMAGE && channel == CHANNEL_PKG)
90+
return BMG_PACKAGE_RAPL_LIMIT;
91+
else if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG)
9092
return PVC_GT0_PACKAGE_RAPL_LIMIT;
9193
else if ((xe->info.platform == XE_DG2) && (channel == CHANNEL_PKG))
9294
return PCU_CR_PACKAGE_RAPL_LIMIT;
9395
break;
9496
case REG_PKG_POWER_SKU:
95-
if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG)
97+
if (xe->info.platform == XE_BATTLEMAGE)
98+
return BMG_PACKAGE_POWER_SKU;
99+
else if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG)
96100
return PVC_GT0_PACKAGE_POWER_SKU;
97101
else if ((xe->info.platform == XE_DG2) && (channel == CHANNEL_PKG))
98102
return PCU_CR_PACKAGE_POWER_SKU;
99103
break;
100104
case REG_PKG_POWER_SKU_UNIT:
101-
if (xe->info.platform == XE_PVC)
105+
if (xe->info.platform == XE_BATTLEMAGE)
106+
return BMG_PACKAGE_POWER_SKU_UNIT;
107+
else if (xe->info.platform == XE_PVC)
102108
return PVC_GT0_PACKAGE_POWER_SKU_UNIT;
103109
else if (xe->info.platform == XE_DG2)
104110
return PCU_CR_PACKAGE_POWER_SKU_UNIT;
@@ -108,7 +114,9 @@ static struct xe_reg xe_hwmon_get_reg(struct xe_hwmon *hwmon, enum xe_hwmon_reg
108114
return GT_PERF_STATUS;
109115
break;
110116
case REG_PKG_ENERGY_STATUS:
111-
if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG)
117+
if (xe->info.platform == XE_BATTLEMAGE && channel == CHANNEL_PKG)
118+
return BMG_PACKAGE_ENERGY_STATUS;
119+
else if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG)
112120
return PVC_GT0_PLATFORM_ENERGY_STATUS;
113121
else if ((xe->info.platform == XE_DG2) && (channel == CHANNEL_PKG))
114122
return PCU_CR_PACKAGE_ENERGY_STATUS;

0 commit comments

Comments
 (0)