* [PATCH] drm/xe/hwmon: Expose powerX_cap_max
@ 2026-11-19 10:40 Karthik Poosa
2026-11-19 10:47 ` sashiko-bot
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Karthik Poosa @ 2026-11-19 10:40 UTC (permalink / raw)
To: intel-xe
Cc: rodrigo.vivi, anshuman.gupta, badal.nilawar, raag.jadav,
riana.tauro, sk.anirban, mallesh.koujalagi, soham.purkait,
ravi.kishore.koppuravuri, Karthik Poosa
Add a read-only power<i>_cap_max attribute for the card and package
channels. It reports the PL2 (burst) power limit that firmware sets at
boot, which is the highest value userspace can write to power<i>_cap.
The attribute is present only on platforms using mailbox power limits
where PL2 is enabled at boot.
Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
---
.../ABI/testing/sysfs-driver-intel-xe-hwmon | 24 +++++++++++++++++++
drivers/gpu/drm/xe/xe_hwmon.c | 11 +++++++--
2 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
index 0da739d9a816..097902fd8346 100644
--- a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
+++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon
@@ -296,6 +296,30 @@ Description: RW. Package burst (PL2) power limit in microwatts.
Only supported for particular Intel Xe graphics platforms.
+What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_cap_max
+Date: November 2026
+KernelVersion: 7.4
+Contact: intel-xe@lists.freedesktop.org
+Description: RO. Card default burst (PL2) power limit in microwatts.
+
+ This is the firmware-provided default limit and the maximum
+ value accepted for power1_cap.
+
+ Only supported for particular Intel Xe graphics platforms where
+ PL2 is enabled.
+
+What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power2_cap_max
+Date: November 2026
+KernelVersion: 7.4
+Contact: intel-xe@lists.freedesktop.org
+Description: RO. Package default burst (PL2) power limit in microwatts.
+
+ This is the firmware-provided default limit and the maximum
+ value accepted for power2_cap.
+
+ Only supported for particular Intel Xe graphics platforms where
+ PL2 is enabled.
+
What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_cap_interval
Date: May 2025
KernelVersion: 6.15
diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
index 515b288f18e5..023a317a443e 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.c
+++ b/drivers/gpu/drm/xe/xe_hwmon.c
@@ -865,8 +865,9 @@ static const struct hwmon_channel_info hwmon_temp_info = {
static const struct hwmon_channel_info * const hwmon_info[] = {
&hwmon_temp_info,
HWMON_CHANNEL_INFO(power, HWMON_P_MAX | HWMON_P_RATED_MAX | HWMON_P_LABEL | HWMON_P_CRIT |
- HWMON_P_CAP,
- HWMON_P_MAX | HWMON_P_RATED_MAX | HWMON_P_LABEL | HWMON_P_CAP),
+ HWMON_P_CAP | HWMON_P_CAP_MAX,
+ HWMON_P_MAX | HWMON_P_RATED_MAX | HWMON_P_LABEL | HWMON_P_CAP |
+ HWMON_P_CAP_MAX),
HWMON_CHANNEL_INFO(curr, HWMON_C_LABEL, HWMON_C_CRIT | HWMON_C_LABEL),
HWMON_CHANNEL_INFO(in, HWMON_I_INPUT | HWMON_I_LABEL, HWMON_I_INPUT | HWMON_I_LABEL),
HWMON_CHANNEL_INFO(energy, HWMON_E_INPUT | HWMON_E_LABEL, HWMON_E_INPUT | HWMON_E_LABEL),
@@ -1423,6 +1424,8 @@ xe_hwmon_power_is_visible(struct xe_hwmon *hwmon, u32 attr, int channel)
struct xe_mmio *mmio = xe_root_tile_mmio(hwmon->xe);
switch (attr) {
+ case hwmon_power_cap_max:
+ return hwmon->pl2_on_boot[channel] ? 0444 : 0;
case hwmon_power_max:
case hwmon_power_cap:
if (hwmon->xe->info.has_mbx_power_limits) {
@@ -1486,6 +1489,10 @@ static int
xe_hwmon_power_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val)
{
switch (attr) {
+ case hwmon_power_cap_max:
+ *val = mul_u32_u32(REG_FIELD_GET(PWR_LIM_VAL, hwmon->pl2_on_boot[channel]),
+ SF_POWER) >> hwmon->scl_shift_power;
+ return 0;
case hwmon_power_max:
case hwmon_power_cap:
return xe_hwmon_power_max_read(hwmon, attr, channel, val);
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH] drm/xe/hwmon: Expose powerX_cap_max 2026-11-19 10:40 [PATCH] drm/xe/hwmon: Expose powerX_cap_max Karthik Poosa @ 2026-11-19 10:47 ` sashiko-bot 2026-11-19 15:24 ` Poosa, Karthik 2026-11-20 22:32 ` Vivi, Rodrigo 2026-11-21 13:23 ` Mallesh, Koujalagi 2 siblings, 1 reply; 8+ messages in thread From: sashiko-bot @ 2026-11-19 10:47 UTC (permalink / raw) To: Karthik Poosa, intel-xe Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [High] drm/xe/hwmon: power limit clamped to 0 in xe_hwmon_power_max_write() [1] -- commit 26f9457c44502cd969a84eaf5b2ee961f51b7a3e Author: Karthik Poosa <karthik.poosa@intel.com> drm/xe/hwmon: Expose powerX_cap_max This commit adds a read-only power<i>_cap_max sysfs attribute on platforms with mailbox power limits to report the default PL2 (burst) power limit set by firmware at boot. > diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c > index defe8aaca7c11..8e0d295aabc88 100644 > --- a/drivers/gpu/drm/xe/xe_hwmon.c > +++ b/drivers/gpu/drm/xe/xe_hwmon.c [ ... ] > @@ -1423,6 +1424,8 @@ xe_hwmon_power_is_visible(struct xe_hwmon *hwmon, u32 attr, int channel) > struct xe_mmio *mmio = xe_root_tile_mmio(hwmon->xe); > > switch (attr) { > + case hwmon_power_cap_max: > + return hwmon->pl2_on_boot[channel] ? 0444 : 0; [Severity: High] This problem wasn't introduced by this patch, but can a pcode read failure during probe cause xe_hwmon_power_max_write() to clamp user power limits to 0 [1]? If reading the initial power limits in xe_hwmon_get_preregistration_info() fails, pl1_on_boot[] and pl2_on_boot[] remain zero while hwmon registration still proceeds: drivers/gpu/drm/xe/xe_hwmon.c:xe_hwmon_get_preregistration_info() { if (hwmon->xe->info.has_mbx_power_limits) { if (xe_hwmon_pcode_read_power_limit(hwmon, PL1_HWMON_ATTR, CHANNEL_CARD, &hwmon->pl1_on_boot[CHANNEL_CARD]) | ... xe_hwmon_pcode_read_power_limit(hwmon, PL2_HWMON_ATTR, CHANNEL_PKG, &hwmon->pl2_on_boot[CHANNEL_PKG])) { drm_warn(&hwmon->xe->drm, "Failed to read power limits, check GPU firmware !\n"); } else { } If the subsequent pcode read in xe_hwmon_power_is_visible() succeeds, the writable powerX_max and powerX_cap attributes are exposed, and any value userspace writes is clamped to the zeroed pl1_on_boot[] or pl2_on_boot[] entry in xe_hwmon_power_max_write(), programming a 0W power limit into firmware and severely throttling the GPU. [1] https://sashiko.dev/#/bug/linux-9f11cfb5-f9c5-490e-879e-791ecaae33e5 -- Sashiko AI review · https://sashiko.dev/#/patchset/20261119104029.3066660-1-karthik.poosa@intel.com?part=1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] drm/xe/hwmon: Expose powerX_cap_max 2026-11-19 10:47 ` sashiko-bot @ 2026-11-19 15:24 ` Poosa, Karthik 0 siblings, 0 replies; 8+ messages in thread From: Poosa, Karthik @ 2026-11-19 15:24 UTC (permalink / raw) To: sashiko-reviews, intel-xe On 19-11-2026 16:17, sashiko-bot@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found no new issues > in this patch, but noticed 1 related pre-existing issue it does not > introduce: > - [High] drm/xe/hwmon: power limit clamped to 0 in > xe_hwmon_power_max_write() [1] > -- > > commit 26f9457c44502cd969a84eaf5b2ee961f51b7a3e > Author: Karthik Poosa <karthik.poosa@intel.com> > > drm/xe/hwmon: Expose powerX_cap_max > > This commit adds a read-only power<i>_cap_max sysfs attribute on platforms > with mailbox power limits to report the default PL2 (burst) power limit > set by firmware at boot. > >> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c >> index defe8aaca7c11..8e0d295aabc88 100644 >> --- a/drivers/gpu/drm/xe/xe_hwmon.c >> +++ b/drivers/gpu/drm/xe/xe_hwmon.c > [ ... ] >> @@ -1423,6 +1424,8 @@ xe_hwmon_power_is_visible(struct xe_hwmon *hwmon, u32 attr, int channel) >> struct xe_mmio *mmio = xe_root_tile_mmio(hwmon->xe); >> >> switch (attr) { >> + case hwmon_power_cap_max: >> + return hwmon->pl2_on_boot[channel] ? 0444 : 0; > [Severity: High] > This problem wasn't introduced by this patch, but can a pcode read failure > during probe cause xe_hwmon_power_max_write() to clamp user power limits > to 0 [1]? > > If reading the initial power limits in xe_hwmon_get_preregistration_info() > fails, pl1_on_boot[] and pl2_on_boot[] remain zero while hwmon registration > still proceeds: > > drivers/gpu/drm/xe/xe_hwmon.c:xe_hwmon_get_preregistration_info() { > if (hwmon->xe->info.has_mbx_power_limits) { > if (xe_hwmon_pcode_read_power_limit(hwmon, PL1_HWMON_ATTR, CHANNEL_CARD, > &hwmon->pl1_on_boot[CHANNEL_CARD]) | > ... > xe_hwmon_pcode_read_power_limit(hwmon, PL2_HWMON_ATTR, CHANNEL_PKG, > &hwmon->pl2_on_boot[CHANNEL_PKG])) { > drm_warn(&hwmon->xe->drm, > "Failed to read power limits, check GPU firmware !\n"); > } else { > } > > If the subsequent pcode read in xe_hwmon_power_is_visible() succeeds, the > writable powerX_max and powerX_cap attributes are exposed, and any value > userspace writes is clamped to the zeroed pl1_on_boot[] or pl2_on_boot[] > entry in xe_hwmon_power_max_write(), programming a 0W power limit into > firmware and severely throttling the GPU. Power-limit reads during probe are expected to be available and pass at probe time. If they are unavailable, we should not create the corresponding entries. I think we should update |xe_hwmon_power_is_visible()| to use |pl1_on_boot[]| or |pl2_on_boot[]| accordingly. > > [1] https://sashiko.dev/#/bug/linux-9f11cfb5-f9c5-490e-879e-791ecaae33e5 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] drm/xe/hwmon: Expose powerX_cap_max 2026-11-19 10:40 [PATCH] drm/xe/hwmon: Expose powerX_cap_max Karthik Poosa 2026-11-19 10:47 ` sashiko-bot @ 2026-11-20 22:32 ` Vivi, Rodrigo 2026-11-23 6:56 ` Poosa, Karthik 2026-11-21 13:23 ` Mallesh, Koujalagi 2 siblings, 1 reply; 8+ messages in thread From: Vivi, Rodrigo @ 2026-11-20 22:32 UTC (permalink / raw) To: intel-xe@lists.freedesktop.org, Poosa, Karthik Cc: Anirban, Sk, Jadav, Raag, Koppuravuri, Ravi Kishore, Koujalagi, Mallesh, Purkait, Soham, Tauro, Riana, Nilawar, Badal, Gupta, Anshuman On Thu, 2026-11-19 at 16:10 +0530, Karthik Poosa wrote: > Add a read-only power<i>_cap_max attribute for the card and package > channels. It reports the PL2 (burst) power limit that firmware sets > at > boot, which is the highest value userspace can write to power<i>_cap. > The attribute is present only on platforms using mailbox power limits > where PL2 is enabled at boot. > > Signed-off-by: Karthik Poosa <karthik.poosa@intel.com> > --- > .../ABI/testing/sysfs-driver-intel-xe-hwmon | 24 > +++++++++++++++++++ > drivers/gpu/drm/xe/xe_hwmon.c | 11 +++++++-- > 2 files changed, 33 insertions(+), 2 deletions(-) > > diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon > b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon > index 0da739d9a816..097902fd8346 100644 > --- a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon > +++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon > @@ -296,6 +296,30 @@ Description: RW. Package burst (PL2) > power limit in microwatts. > > Only supported for particular Intel Xe graphics > platforms. > > +What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_ca > p_max > +Date: November 2026 > +KernelVersion: 7.4 7.5 if merged in the next 1.5 week. 7.6 after Thomas send the last drm-xe-next PR of this cycle. > +Contact: intel-xe@lists.freedesktop.org > +Description: RO. Card default burst (PL2) power limit in > microwatts. > + > + This is the firmware-provided default limit and the > maximum > + value accepted for power1_cap. > + > + Only supported for particular Intel Xe graphics > platforms where > + PL2 is enabled. > + > +What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power2_ca > p_max > +Date: November 2026 > +KernelVersion: 7.4 > +Contact: intel-xe@lists.freedesktop.org > +Description: RO. Package default burst (PL2) power limit in > microwatts. > + > + This is the firmware-provided default limit and the > maximum > + value accepted for power2_cap. > + > + Only supported for particular Intel Xe graphics > platforms where > + PL2 is enabled. > + > What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_ca > p_interval > Date: May 2025 > KernelVersion: 6.15 > diff --git a/drivers/gpu/drm/xe/xe_hwmon.c > b/drivers/gpu/drm/xe/xe_hwmon.c > index 515b288f18e5..023a317a443e 100644 > --- a/drivers/gpu/drm/xe/xe_hwmon.c > +++ b/drivers/gpu/drm/xe/xe_hwmon.c > @@ -865,8 +865,9 @@ static const struct hwmon_channel_info > hwmon_temp_info = { > static const struct hwmon_channel_info * const hwmon_info[] = { > &hwmon_temp_info, > HWMON_CHANNEL_INFO(power, HWMON_P_MAX | HWMON_P_RATED_MAX | > HWMON_P_LABEL | HWMON_P_CRIT | > - HWMON_P_CAP, > - HWMON_P_MAX | HWMON_P_RATED_MAX | > HWMON_P_LABEL | HWMON_P_CAP), > + HWMON_P_CAP | HWMON_P_CAP_MAX, > + HWMON_P_MAX | HWMON_P_RATED_MAX | > HWMON_P_LABEL | HWMON_P_CAP | > + HWMON_P_CAP_MAX), > HWMON_CHANNEL_INFO(curr, HWMON_C_LABEL, HWMON_C_CRIT | > HWMON_C_LABEL), > HWMON_CHANNEL_INFO(in, HWMON_I_INPUT | HWMON_I_LABEL, > HWMON_I_INPUT | HWMON_I_LABEL), > HWMON_CHANNEL_INFO(energy, HWMON_E_INPUT | HWMON_E_LABEL, > HWMON_E_INPUT | HWMON_E_LABEL), > @@ -1423,6 +1424,8 @@ xe_hwmon_power_is_visible(struct xe_hwmon > *hwmon, u32 attr, int channel) > struct xe_mmio *mmio = xe_root_tile_mmio(hwmon->xe); > > switch (attr) { > + case hwmon_power_cap_max: > + return hwmon->pl2_on_boot[channel] ? 0444 : 0; I believe we also need to take PWR_LIM_EN in consideration here, no?! Perhaps checking has_mbx_power_limits && (pl2_on_boot[channel] & PWR_LIM_EN) ?! > case hwmon_power_max: > case hwmon_power_cap: > if (hwmon->xe->info.has_mbx_power_limits) { > @@ -1486,6 +1489,10 @@ static int > xe_hwmon_power_read(struct xe_hwmon *hwmon, u32 attr, int channel, > long *val) > { > switch (attr) { > + case hwmon_power_cap_max: > + *val = mul_u32_u32(REG_FIELD_GET(PWR_LIM_VAL, hwmon- > >pl2_on_boot[channel]), > + SF_POWER) >> hwmon- > >scl_shift_power; > + return 0; > case hwmon_power_max: > case hwmon_power_cap: > return xe_hwmon_power_max_read(hwmon, attr, channel, > val); ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] drm/xe/hwmon: Expose powerX_cap_max 2026-11-20 22:32 ` Vivi, Rodrigo @ 2026-11-23 6:56 ` Poosa, Karthik 2026-11-23 10:23 ` Poosa, Karthik 0 siblings, 1 reply; 8+ messages in thread From: Poosa, Karthik @ 2026-11-23 6:56 UTC (permalink / raw) To: Vivi, Rodrigo, intel-xe@lists.freedesktop.org Cc: Anirban, Sk, Jadav, Raag, Koppuravuri, Ravi Kishore, Koujalagi, Mallesh, Purkait, Soham, Tauro, Riana, Nilawar, Badal, Gupta, Anshuman [-- Attachment #1: Type: text/plain, Size: 5173 bytes --] On 21-11-2026 04:02, Vivi, Rodrigo wrote: > On Thu, 2026-11-19 at 16:10 +0530, Karthik Poosa wrote: >> Add a read-only power<i>_cap_max attribute for the card and package >> channels. It reports the PL2 (burst) power limit that firmware sets >> at >> boot, which is the highest value userspace can write to power<i>_cap. >> The attribute is present only on platforms using mailbox power limits >> where PL2 is enabled at boot. >> >> Signed-off-by: Karthik Poosa<karthik.poosa@intel.com> >> --- >> .../ABI/testing/sysfs-driver-intel-xe-hwmon | 24 >> +++++++++++++++++++ >> drivers/gpu/drm/xe/xe_hwmon.c | 11 +++++++-- >> 2 files changed, 33 insertions(+), 2 deletions(-) >> >> diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon >> b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon >> index 0da739d9a816..097902fd8346 100644 >> --- a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon >> +++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon >> @@ -296,6 +296,30 @@ Description: RW. Package burst (PL2) >> power limit in microwatts. >> >> Only supported for particular Intel Xe graphics >> platforms. >> >> +What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_ca >> p_max >> +Date: November 2026 >> +KernelVersion: 7.4 > 7.5 if merged in the next 1.5 week. okay, this will be 7.5 we are planning to merge this week > 7.6 after Thomas send the last drm-xe-next PR of this cycle. > >> +Contact: intel-xe@lists.freedesktop.org >> +Description: RO. Card default burst (PL2) power limit in >> microwatts. >> + >> + This is the firmware-provided default limit and the >> maximum >> + value accepted for power1_cap. >> + >> + Only supported for particular Intel Xe graphics >> platforms where >> + PL2 is enabled. >> + >> +What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power2_ca >> p_max >> +Date: November 2026 >> +KernelVersion: 7.4 >> +Contact: intel-xe@lists.freedesktop.org >> +Description: RO. Package default burst (PL2) power limit in >> microwatts. >> + >> + This is the firmware-provided default limit and the >> maximum >> + value accepted for power2_cap. >> + >> + Only supported for particular Intel Xe graphics >> platforms where >> + PL2 is enabled. >> + >> What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_ca >> p_interval >> Date: May 2025 >> KernelVersion: 6.15 >> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c >> b/drivers/gpu/drm/xe/xe_hwmon.c >> index 515b288f18e5..023a317a443e 100644 >> --- a/drivers/gpu/drm/xe/xe_hwmon.c >> +++ b/drivers/gpu/drm/xe/xe_hwmon.c >> @@ -865,8 +865,9 @@ static const struct hwmon_channel_info >> hwmon_temp_info = { >> static const struct hwmon_channel_info * const hwmon_info[] = { >> &hwmon_temp_info, >> HWMON_CHANNEL_INFO(power, HWMON_P_MAX | HWMON_P_RATED_MAX | >> HWMON_P_LABEL | HWMON_P_CRIT | >> - HWMON_P_CAP, >> - HWMON_P_MAX | HWMON_P_RATED_MAX | >> HWMON_P_LABEL | HWMON_P_CAP), >> + HWMON_P_CAP | HWMON_P_CAP_MAX, >> + HWMON_P_MAX | HWMON_P_RATED_MAX | >> HWMON_P_LABEL | HWMON_P_CAP | >> + HWMON_P_CAP_MAX), >> HWMON_CHANNEL_INFO(curr, HWMON_C_LABEL, HWMON_C_CRIT | >> HWMON_C_LABEL), >> HWMON_CHANNEL_INFO(in, HWMON_I_INPUT | HWMON_I_LABEL, >> HWMON_I_INPUT | HWMON_I_LABEL), >> HWMON_CHANNEL_INFO(energy, HWMON_E_INPUT | HWMON_E_LABEL, >> HWMON_E_INPUT | HWMON_E_LABEL), >> @@ -1423,6 +1424,8 @@ xe_hwmon_power_is_visible(struct xe_hwmon >> *hwmon, u32 attr, int channel) >> struct xe_mmio *mmio = xe_root_tile_mmio(hwmon->xe); >> >> switch (attr) { >> + case hwmon_power_cap_max: >> + return hwmon->pl2_on_boot[channel] ? 0444 : 0; > I believe we also need to take PWR_LIM_EN in consideration here, no?! not needed, because pl2_on_boot filled with xe_hwmon_pcode_read_power_limit(), which is give power limit > 0 value, only if corresponding power limit is enabled. 261 static int xe_hwmon_pcode_read_power_limit(const struct xe_hwmon *hwmon, u32 attr, int channel, 282 /* return the value only if limit is enabled */ 283 if (attr == PL1_HWMON_ATTR) 284 *uval = (val0 & PWR_LIM_EN) ? val0 : 0; 285 else if (attr == PL2_HWMON_ATTR) 286 *uval = (val1 & PWR_LIM_EN) ? val1 : 0; 287 else if (attr == hwmon_power_label) 288 *uval = (val0 | val1) & PWR_LIM_EN; > Perhaps checking has_mbx_power_limits && (pl2_on_boot[channel] & > PWR_LIM_EN) ?! we can add has_mbx_power_limits though. > >> case hwmon_power_max: >> case hwmon_power_cap: >> if (hwmon->xe->info.has_mbx_power_limits) { >> @@ -1486,6 +1489,10 @@ static int >> xe_hwmon_power_read(struct xe_hwmon *hwmon, u32 attr, int channel, >> long *val) >> { >> switch (attr) { >> + case hwmon_power_cap_max: >> + *val = mul_u32_u32(REG_FIELD_GET(PWR_LIM_VAL, hwmon- >>> pl2_on_boot[channel]), >> + SF_POWER) >> hwmon- >>> scl_shift_power; >> + return 0; >> case hwmon_power_max: >> case hwmon_power_cap: >> return xe_hwmon_power_max_read(hwmon, attr, channel, >> val); [-- Attachment #2: Type: text/html, Size: 7346 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] drm/xe/hwmon: Expose powerX_cap_max 2026-11-23 6:56 ` Poosa, Karthik @ 2026-11-23 10:23 ` Poosa, Karthik 0 siblings, 0 replies; 8+ messages in thread From: Poosa, Karthik @ 2026-11-23 10:23 UTC (permalink / raw) To: Vivi, Rodrigo, intel-xe@lists.freedesktop.org Cc: Anirban, Sk, Jadav, Raag, Koppuravuri, Ravi Kishore, Koujalagi, Mallesh, Purkait, Soham, Tauro, Riana, Nilawar, Badal, Gupta, Anshuman On 23-11-2026 12:26, Poosa, Karthik wrote: > > > On 21-11-2026 04:02, Vivi, Rodrigo wrote: >> On Thu, 2026-11-19 at 16:10 +0530, Karthik Poosa wrote: >>> Add a read-only power<i>_cap_max attribute for the card and package >>> channels. It reports the PL2 (burst) power limit that firmware sets >>> at >>> boot, which is the highest value userspace can write to power<i>_cap. >>> The attribute is present only on platforms using mailbox power limits >>> where PL2 is enabled at boot. >>> >>> Signed-off-by: Karthik Poosa<karthik.poosa@intel.com> >>> --- >>> .../ABI/testing/sysfs-driver-intel-xe-hwmon | 24 >>> +++++++++++++++++++ >>> drivers/gpu/drm/xe/xe_hwmon.c | 11 +++++++-- >>> 2 files changed, 33 insertions(+), 2 deletions(-) >>> >>> diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon >>> b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon >>> index 0da739d9a816..097902fd8346 100644 >>> --- a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon >>> +++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon >>> @@ -296,6 +296,30 @@ Description: RW. Package burst (PL2) >>> power limit in microwatts. >>> >>> Only supported for particular Intel Xe graphics >>> platforms. >>> >>> +What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_ca >>> p_max >>> +Date: November 2026 >>> +KernelVersion: 7.4 >> 7.5 if merged in the next 1.5 week. > okay, this will be 7.5 we are planning to merge this week >> 7.6 after Thomas send the last drm-xe-next PR of this cycle. >> >>> +Contact: intel-xe@lists.freedesktop.org >>> +Description: RO. Card default burst (PL2) power limit in >>> microwatts. >>> + >>> + This is the firmware-provided default limit and the >>> maximum >>> + value accepted for power1_cap. >>> + >>> + Only supported for particular Intel Xe graphics >>> platforms where >>> + PL2 is enabled. >>> + >>> +What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power2_ca >>> p_max >>> +Date: November 2026 >>> +KernelVersion: 7.4 >>> +Contact: intel-xe@lists.freedesktop.org >>> +Description: RO. Package default burst (PL2) power limit in >>> microwatts. >>> + >>> + This is the firmware-provided default limit and the >>> maximum >>> + value accepted for power2_cap. >>> + >>> + Only supported for particular Intel Xe graphics >>> platforms where >>> + PL2 is enabled. >>> + >>> What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_ca >>> p_interval >>> Date: May 2025 >>> KernelVersion: 6.15 >>> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c >>> b/drivers/gpu/drm/xe/xe_hwmon.c >>> index 515b288f18e5..023a317a443e 100644 >>> --- a/drivers/gpu/drm/xe/xe_hwmon.c >>> +++ b/drivers/gpu/drm/xe/xe_hwmon.c >>> @@ -865,8 +865,9 @@ static const struct hwmon_channel_info >>> hwmon_temp_info = { >>> static const struct hwmon_channel_info * const hwmon_info[] = { >>> &hwmon_temp_info, >>> HWMON_CHANNEL_INFO(power, HWMON_P_MAX | HWMON_P_RATED_MAX | >>> HWMON_P_LABEL | HWMON_P_CRIT | >>> - HWMON_P_CAP, >>> - HWMON_P_MAX | HWMON_P_RATED_MAX | >>> HWMON_P_LABEL | HWMON_P_CAP), >>> + HWMON_P_CAP | HWMON_P_CAP_MAX, >>> + HWMON_P_MAX | HWMON_P_RATED_MAX | >>> HWMON_P_LABEL | HWMON_P_CAP | >>> + HWMON_P_CAP_MAX), >>> HWMON_CHANNEL_INFO(curr, HWMON_C_LABEL, HWMON_C_CRIT | >>> HWMON_C_LABEL), >>> HWMON_CHANNEL_INFO(in, HWMON_I_INPUT | HWMON_I_LABEL, >>> HWMON_I_INPUT | HWMON_I_LABEL), >>> HWMON_CHANNEL_INFO(energy, HWMON_E_INPUT | HWMON_E_LABEL, >>> HWMON_E_INPUT | HWMON_E_LABEL), >>> @@ -1423,6 +1424,8 @@ xe_hwmon_power_is_visible(struct xe_hwmon >>> *hwmon, u32 attr, int channel) >>> struct xe_mmio *mmio = xe_root_tile_mmio(hwmon->xe); >>> >>> switch (attr) { >>> + case hwmon_power_cap_max: >>> + return hwmon->pl2_on_boot[channel] ? 0444 : 0; >> I believe we also need to take PWR_LIM_EN in consideration here, no?! > > not needed, because pl2_on_boot filled with > xe_hwmon_pcode_read_power_limit(), > > which is give power limit > 0 value, only if corresponding power limit > is enabled. > > 261 static int xe_hwmon_pcode_read_power_limit(const struct xe_hwmon > *hwmon, u32 attr, int channel, > > 282 /* return the value only if limit is enabled */ > 283 if (attr == PL1_HWMON_ATTR) > 284 *uval = (val0 & PWR_LIM_EN) ? val0 : 0; > 285 else if (attr == PL2_HWMON_ATTR) > 286 *uval = (val1 & PWR_LIM_EN) ? val1 : 0; > 287 else if (attr == hwmon_power_label) > 288 *uval = (val0 | val1) & PWR_LIM_EN; > >> Perhaps checking has_mbx_power_limits && (pl2_on_boot[channel] & >> PWR_LIM_EN) ?! > we can add has_mbx_power_limits though. On the second look, has_mbx_power_limits check not needed either as pl2_on_boot[channel] is only filled in on platforms where has_mbx_power_limits is true, so a nonzero value already implies it. >>> case hwmon_power_max: >>> case hwmon_power_cap: >>> if (hwmon->xe->info.has_mbx_power_limits) { >>> @@ -1486,6 +1489,10 @@ static int >>> xe_hwmon_power_read(struct xe_hwmon *hwmon, u32 attr, int channel, >>> long *val) >>> { >>> switch (attr) { >>> + case hwmon_power_cap_max: >>> + *val = mul_u32_u32(REG_FIELD_GET(PWR_LIM_VAL, hwmon- >>>> pl2_on_boot[channel]), >>> + SF_POWER) >> hwmon- >>>> scl_shift_power; >>> + return 0; >>> case hwmon_power_max: >>> case hwmon_power_cap: >>> return xe_hwmon_power_max_read(hwmon, attr, channel, >>> val); ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] drm/xe/hwmon: Expose powerX_cap_max 2026-11-19 10:40 [PATCH] drm/xe/hwmon: Expose powerX_cap_max Karthik Poosa 2026-11-19 10:47 ` sashiko-bot 2026-11-20 22:32 ` Vivi, Rodrigo @ 2026-11-21 13:23 ` Mallesh, Koujalagi 2026-11-23 9:49 ` Poosa, Karthik 2 siblings, 1 reply; 8+ messages in thread From: Mallesh, Koujalagi @ 2026-11-21 13:23 UTC (permalink / raw) To: Karthik Poosa Cc: rodrigo.vivi, anshuman.gupta, badal.nilawar, raag.jadav, riana.tauro, sk.anirban, soham.purkait, ravi.kishore.koppuravuri, intel-xe@lists.freedesktop.org On 19-11-2026 04:10 pm, Karthik Poosa wrote: > Add a read-only power<i>_cap_max attribute for the card and package > channels. It reports the PL2 (burst) power limit that firmware sets at > boot, which is the highest value userspace can write to power<i>_cap. > The attribute is present only on platforms using mailbox power limits > where PL2 is enabled at boot. > > Signed-off-by: Karthik Poosa <karthik.poosa@intel.com> > --- > .../ABI/testing/sysfs-driver-intel-xe-hwmon | 24 +++++++++++++++++++ > drivers/gpu/drm/xe/xe_hwmon.c | 11 +++++++-- > 2 files changed, 33 insertions(+), 2 deletions(-) > > diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon > index 0da739d9a816..097902fd8346 100644 > --- a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon > +++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon > @@ -296,6 +296,30 @@ Description: RW. Package burst (PL2) power limit in microwatts. > > Only supported for particular Intel Xe graphics platforms. > > +What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_cap_max > +Date: November 2026 > +KernelVersion: 7.4 > +Contact: intel-xe@lists.freedesktop.org > +Description: RO. Card default burst (PL2) power limit in microwatts. > + > + This is the firmware-provided default limit and the maximum > + value accepted for power1_cap. > + > + Only supported for particular Intel Xe graphics platforms where > + PL2 is enabled. > + > +What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power2_cap_max > +Date: November 2026 > +KernelVersion: 7.4 > +Contact: intel-xe@lists.freedesktop.org > +Description: RO. Package default burst (PL2) power limit in microwatts. > + > + This is the firmware-provided default limit and the maximum > + value accepted for power2_cap. > + > + Only supported for particular Intel Xe graphics platforms where > + PL2 is enabled. > + > What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_cap_interval > Date: May 2025 > KernelVersion: 6.15 > diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c > index 515b288f18e5..023a317a443e 100644 > --- a/drivers/gpu/drm/xe/xe_hwmon.c > +++ b/drivers/gpu/drm/xe/xe_hwmon.c > @@ -865,8 +865,9 @@ static const struct hwmon_channel_info hwmon_temp_info = { > static const struct hwmon_channel_info * const hwmon_info[] = { > &hwmon_temp_info, > HWMON_CHANNEL_INFO(power, HWMON_P_MAX | HWMON_P_RATED_MAX | HWMON_P_LABEL | HWMON_P_CRIT | > - HWMON_P_CAP, > - HWMON_P_MAX | HWMON_P_RATED_MAX | HWMON_P_LABEL | HWMON_P_CAP), > + HWMON_P_CAP | HWMON_P_CAP_MAX, > + HWMON_P_MAX | HWMON_P_RATED_MAX | HWMON_P_LABEL | HWMON_P_CAP | > + HWMON_P_CAP_MAX), > HWMON_CHANNEL_INFO(curr, HWMON_C_LABEL, HWMON_C_CRIT | HWMON_C_LABEL), > HWMON_CHANNEL_INFO(in, HWMON_I_INPUT | HWMON_I_LABEL, HWMON_I_INPUT | HWMON_I_LABEL), > HWMON_CHANNEL_INFO(energy, HWMON_E_INPUT | HWMON_E_LABEL, HWMON_E_INPUT | HWMON_E_LABEL), > @@ -1423,6 +1424,8 @@ xe_hwmon_power_is_visible(struct xe_hwmon *hwmon, u32 attr, int channel) > struct xe_mmio *mmio = xe_root_tile_mmio(hwmon->xe); > > switch (attr) { > + case hwmon_power_cap_max: > + return hwmon->pl2_on_boot[channel] ? 0444 : 0; > case hwmon_power_max: > case hwmon_power_cap: > if (hwmon->xe->info.has_mbx_power_limits) { > @@ -1486,6 +1489,10 @@ static int > xe_hwmon_power_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val) > { > switch (attr) { > + case hwmon_power_cap_max: > + *val = mul_u32_u32(REG_FIELD_GET(PWR_LIM_VAL, hwmon->pl2_on_boot[channel]), > + SF_POWER) >> hwmon->scl_shift_power; At line: https://elixir.bootlin.com/linux/v7.4-rc1/source/drivers/gpu/drm/xe/xe_hwmon.c#L1501 What happen when pl2 is nonzero and scl_shift_power is not initialized. it will show 8x high value. right? Thanks, -/Mallesh > + return 0; > case hwmon_power_max: > case hwmon_power_cap: > return xe_hwmon_power_max_read(hwmon, attr, channel, val); ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] drm/xe/hwmon: Expose powerX_cap_max 2026-11-21 13:23 ` Mallesh, Koujalagi @ 2026-11-23 9:49 ` Poosa, Karthik 0 siblings, 0 replies; 8+ messages in thread From: Poosa, Karthik @ 2026-11-23 9:49 UTC (permalink / raw) To: Mallesh, Koujalagi Cc: rodrigo.vivi, anshuman.gupta, badal.nilawar, raag.jadav, riana.tauro, sk.anirban, soham.purkait, ravi.kishore.koppuravuri, intel-xe@lists.freedesktop.org On 21-11-2026 18:53, Mallesh, Koujalagi wrote: > > On 19-11-2026 04:10 pm, Karthik Poosa wrote: >> Add a read-only power<i>_cap_max attribute for the card and package >> channels. It reports the PL2 (burst) power limit that firmware sets at >> boot, which is the highest value userspace can write to power<i>_cap. >> The attribute is present only on platforms using mailbox power limits >> where PL2 is enabled at boot. >> >> Signed-off-by: Karthik Poosa <karthik.poosa@intel.com> >> --- >> .../ABI/testing/sysfs-driver-intel-xe-hwmon | 24 +++++++++++++++++++ >> drivers/gpu/drm/xe/xe_hwmon.c | 11 +++++++-- >> 2 files changed, 33 insertions(+), 2 deletions(-) >> >> diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon >> b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon >> index 0da739d9a816..097902fd8346 100644 >> --- a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon >> +++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon >> @@ -296,6 +296,30 @@ Description: RW. Package burst (PL2) power >> limit in microwatts. >> Only supported for particular Intel Xe graphics platforms. >> +What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_cap_max >> +Date: November 2026 >> +KernelVersion: 7.4 >> +Contact: intel-xe@lists.freedesktop.org >> +Description: RO. Card default burst (PL2) power limit in microwatts. >> + >> + This is the firmware-provided default limit and the maximum >> + value accepted for power1_cap. >> + >> + Only supported for particular Intel Xe graphics platforms where >> + PL2 is enabled. >> + >> +What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power2_cap_max >> +Date: November 2026 >> +KernelVersion: 7.4 >> +Contact: intel-xe@lists.freedesktop.org >> +Description: RO. Package default burst (PL2) power limit in >> microwatts. >> + >> + This is the firmware-provided default limit and the maximum >> + value accepted for power2_cap. >> + >> + Only supported for particular Intel Xe graphics platforms where >> + PL2 is enabled. >> + >> What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_cap_interval >> Date: May 2025 >> KernelVersion: 6.15 >> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c >> b/drivers/gpu/drm/xe/xe_hwmon.c >> index 515b288f18e5..023a317a443e 100644 >> --- a/drivers/gpu/drm/xe/xe_hwmon.c >> +++ b/drivers/gpu/drm/xe/xe_hwmon.c >> @@ -865,8 +865,9 @@ static const struct hwmon_channel_info >> hwmon_temp_info = { >> static const struct hwmon_channel_info * const hwmon_info[] = { >> &hwmon_temp_info, >> HWMON_CHANNEL_INFO(power, HWMON_P_MAX | HWMON_P_RATED_MAX | >> HWMON_P_LABEL | HWMON_P_CRIT | >> - HWMON_P_CAP, >> - HWMON_P_MAX | HWMON_P_RATED_MAX | HWMON_P_LABEL | >> HWMON_P_CAP), >> + HWMON_P_CAP | HWMON_P_CAP_MAX, >> + HWMON_P_MAX | HWMON_P_RATED_MAX | HWMON_P_LABEL | >> HWMON_P_CAP | >> + HWMON_P_CAP_MAX), >> HWMON_CHANNEL_INFO(curr, HWMON_C_LABEL, HWMON_C_CRIT | >> HWMON_C_LABEL), >> HWMON_CHANNEL_INFO(in, HWMON_I_INPUT | HWMON_I_LABEL, >> HWMON_I_INPUT | HWMON_I_LABEL), >> HWMON_CHANNEL_INFO(energy, HWMON_E_INPUT | HWMON_E_LABEL, >> HWMON_E_INPUT | HWMON_E_LABEL), >> @@ -1423,6 +1424,8 @@ xe_hwmon_power_is_visible(struct xe_hwmon >> *hwmon, u32 attr, int channel) >> struct xe_mmio *mmio = xe_root_tile_mmio(hwmon->xe); >> switch (attr) { >> + case hwmon_power_cap_max: >> + return hwmon->pl2_on_boot[channel] ? 0444 : 0; >> case hwmon_power_max: >> case hwmon_power_cap: >> if (hwmon->xe->info.has_mbx_power_limits) { >> @@ -1486,6 +1489,10 @@ static int >> xe_hwmon_power_read(struct xe_hwmon *hwmon, u32 attr, int channel, >> long *val) >> { >> switch (attr) { >> + case hwmon_power_cap_max: >> + *val = mul_u32_u32(REG_FIELD_GET(PWR_LIM_VAL, >> hwmon->pl2_on_boot[channel]), >> + SF_POWER) >> hwmon->scl_shift_power; > > At line: > https://elixir.bootlin.com/linux/v7.4-rc1/source/drivers/gpu/drm/xe/xe_hwmon.c#L1501 > What happen when pl2 is nonzero and scl_shift_power is not > initialized. it will show 8x high value. right? you are right, we can move the assignment of hwmon->scl_shift_power(), before reading the power limits as below @@ -1824,6 +1824,11 @@ xe_hwmon_get_preregistration_info(struct xe_hwmon *hwmon) struct xe_reg pkg_power_sku_unit; if (hwmon->xe->info.has_mbx_power_limits) { + /* Mailbox units are fixed; set them even if the limit reads below fail. */ + hwmon->scl_shift_power = PWR_UNIT; + hwmon->scl_shift_energy = ENERGY_UNIT; + hwmon->scl_shift_time = TIME_UNIT; + /* Check if GPU firmware support mailbox power limits commands. */ if (xe_hwmon_pcode_read_power_limit(hwmon, PL1_HWMON_ATTR, CHANNEL_CARD, &hwmon->pl1_on_boot[CHANNEL_CARD]) | > > > Thanks, > -/Mallesh > >> + return 0; >> case hwmon_power_max: >> case hwmon_power_cap: >> return xe_hwmon_power_max_read(hwmon, attr, channel, val); ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-11-23 10:23 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-19 10:40 [PATCH] drm/xe/hwmon: Expose powerX_cap_max Karthik Poosa 2026-11-19 10:47 ` sashiko-bot 2026-11-19 15:24 ` Poosa, Karthik 2026-11-20 22:32 ` Vivi, Rodrigo 2026-11-23 6:56 ` Poosa, Karthik 2026-11-23 10:23 ` Poosa, Karthik 2026-11-21 13:23 ` Mallesh, Koujalagi 2026-11-23 9:49 ` Poosa, Karthik
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox