Skip to content

Commit 25a2aa7

Browse files
kpoosaThomas Hellström
authored andcommitted
drm/xe/hwmon: Add support to manage power limits though mailbox
Add support to manage power limits using pcode mailbox commands for supported platforms. v2: - Address review comments. (Badal) - Use mailbox commands instead of registers to manage power limits for BMG. - Clamp the maximum power limit to GPU firmware default value. v3: - Clamp power limit in write also for platforms with mailbox support. v4: - Remove unnecessary debug prints. (Badal) v5: - Update description of variable pl1_on_boot to fix kernel-doc error. v6: - Improve commit message, refer to BIOS as GPU firmware. - Change macro READ_PL_FROM_BIOS to READ_PL_FROM_FW. - Rectify drm_warn to drm_info. Signed-off-by: Karthik Poosa <[email protected]> Fixes: e90f7a5 ("drm/xe/hwmon: Add HWMON support for BMG") Reviewed-by: Badal Nilawar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rodrigo Vivi <[email protected]> (cherry picked from commit 7596d83) Signed-off-by: Thomas Hellström <[email protected]>
1 parent 8cf8cde commit 25a2aa7

File tree

8 files changed

+318
-106
lines changed

8 files changed

+318
-106
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838
#define TEMP_MASK REG_GENMASK(7, 0)
3939

4040
#define PCU_CR_PACKAGE_RAPL_LIMIT XE_REG(MCHBAR_MIRROR_BASE_SNB + 0x59a0)
41-
#define PKG_PWR_LIM_1 REG_GENMASK(14, 0)
42-
#define PKG_PWR_LIM_1_EN REG_BIT(15)
43-
#define PKG_PWR_LIM_1_TIME REG_GENMASK(23, 17)
44-
#define PKG_PWR_LIM_1_TIME_X REG_GENMASK(23, 22)
45-
#define PKG_PWR_LIM_1_TIME_Y REG_GENMASK(21, 17)
41+
#define PWR_LIM_VAL REG_GENMASK(14, 0)
42+
#define PWR_LIM_EN REG_BIT(15)
43+
#define PWR_LIM_TIME REG_GENMASK(23, 17)
44+
#define PWR_LIM_TIME_X REG_GENMASK(23, 22)
45+
#define PWR_LIM_TIME_Y REG_GENMASK(21, 17)
4646

4747
#endif /* _XE_MCHBAR_REGS_H_ */

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,12 @@
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)
2321
#define BMG_PACKAGE_ENERGY_STATUS XE_REG(0x138120)
2422
#define BMG_FAN_1_SPEED XE_REG(0x138140)
2523
#define BMG_FAN_2_SPEED XE_REG(0x138170)
2624
#define BMG_FAN_3_SPEED XE_REG(0x1381a0)
2725
#define BMG_VRAM_TEMPERATURE XE_REG(0x1382c0)
2826
#define BMG_PACKAGE_TEMPERATURE XE_REG(0x138434)
29-
#define BMG_PACKAGE_RAPL_LIMIT XE_REG(0x138440)
3027
#define BMG_PLATFORM_ENERGY_STATUS XE_REG(0x138458)
31-
#define BMG_PLATFORM_POWER_LIMIT XE_REG(0x138460)
3228

3329
#endif /* _XE_PCODE_REGS_H_ */

drivers/gpu/drm/xe/xe_device_types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ struct xe_device {
325325
u8 has_heci_gscfi:1;
326326
/** @info.has_llc: Device has a shared CPU+GPU last level cache */
327327
u8 has_llc:1;
328+
/** @info.has_mbx_power_limits: Device has support to manage power limits using
329+
* pcode mailbox commands.
330+
*/
331+
u8 has_mbx_power_limits:1;
328332
/** @info.has_pxp: Device has PXP support */
329333
u8 has_pxp:1;
330334
/** @info.has_range_tlb_invalidation: Has range based TLB invalidations */

0 commit comments

Comments
 (0)