Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Ruhl, Michael J" <michael.j.ruhl@intel.com>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"Gupta,  Anshuman" <anshuman.gupta@intel.com>,
	"Poosa, Karthik" <karthik.poosa@intel.com>
Subject: Re: [PATCH 03/15] drm/xe/hwmon: Use xe_pmt_read() for the PMT telemetry
Date: Fri, 4 Dec 2026 10:17:55 -0500	[thread overview]
Message-ID: <axLZo_u9I90ajBzA@intel.com> (raw)
In-Reply-To: <CH3PR11MB046149C487FC41AA93629CB25FC14B2@CH3PR11MB046149.namprd11.prod.outlook.com>

On Thu, Dec 03, 2026 at 04:57:43PM -0500, Ruhl, Michael J wrote:
> 
> 
> >-----Original Message-----
> >From: Vivi, Rodrigo <rodrigo.vivi@intel.com>
> >Sent: Thursday, December 3, 2026 3:10 PM
> >To: intel-xe@lists.freedesktop.org
> >Cc: Gupta, Anshuman <anshuman.gupta@intel.com>; Poosa, Karthik
> ><karthik.poosa@intel.com>; Ruhl, Michael J <michael.j.ruhl@intel.com>; Vivi,
> >Rodrigo <rodrigo.vivi@intel.com>
> >Subject: [PATCH 03/15] drm/xe/hwmon: Use xe_pmt_read() for the PMT
> >telemetry
> >
> >Read the BMG energy and fan PWM from the PUNIT telemetry with
> >xe_pmt_read(), instead of getting the GUID first with
> >xe_vsec_get_guid() and then calling xe_pmt_telem_read().
> >
> >No functional change.
> >
> >Cc: Karthik Poosa <karthik.poosa@intel.com>
> >Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> >---
> > drivers/gpu/drm/xe/xe_hwmon.c | 23 +++++------------------
> > 1 file changed, 5 insertions(+), 18 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/xe/xe_hwmon.c
> >b/drivers/gpu/drm/xe/xe_hwmon.c
> >index 152699801e05..e7406337e39e 100644
> >--- a/drivers/gpu/drm/xe/xe_hwmon.c
> >+++ b/drivers/gpu/drm/xe/xe_hwmon.c
> >@@ -805,16 +805,9 @@ xe_hwmon_energy_get(struct xe_hwmon *hwmon,
> >int channel, long *energy)
> >
> > 	if (hwmon->xe->info.platform == XE_BATTLEMAGE) {
> > 		u64 pmt_val;
> >-		u32 guid;
> >
> >-		ret = xe_vsec_get_guid(hwmon->xe, &guid);
> >-		if (ret) {
> >-			drm_warn(&hwmon->xe->drm, "PMT device is not
> >available: %d\n", ret);
> >-			*energy = 0;
> >-			return ret;
> >-		}
> >-		ret = xe_pmt_telem_read(hwmon->xe->drm.dev, guid,
> >-					&pmt_val,
> >BMG_ENERGY_STATUS_PMT_OFFSET,	sizeof(pmt_val));
> >+		ret = xe_pmt_read(hwmon->xe, XE_PMT_PUNIT, 0,
> >BMG_ENERGY_STATUS_PMT_OFFSET,
> >+				  &pmt_val, sizeof(pmt_val));
> > 		if (ret != sizeof(pmt_val)) {
> > 			drm_warn(&hwmon->xe->drm, "energy read from pmt
> >failed, ret %d\n", ret);
> > 			*energy = 0;
> >@@ -2633,7 +2626,7 @@ static int xe_hwmon_get_active_table_pwm(struct
> >xe_hwmon *hwmon, int channel, lo
> > static int xe_hwmon_get_pwm_from_pmt(struct xe_hwmon *hwmon, int
> >channel, long *val)
> > {
> > 	u64 pmt_val;
> >-	u32 guid, pwm;
> >+	u32 pwm;
> > 	int ret;
> >
> > 	lockdep_assert_held(&hwmon->hwmon_lock);
> >@@ -2641,14 +2634,8 @@ static int xe_hwmon_get_pwm_from_pmt(struct
> >xe_hwmon *hwmon, int channel, long *
> > 	if (hwmon->xe->info.platform != XE_BATTLEMAGE)
> > 		return -EOPNOTSUPP;
> >
> >-	ret = xe_vsec_get_guid(hwmon->xe, &guid);
> >-	if (ret) {
> >-		xe_warn(hwmon->xe, "failed to read pwm, PMT unavailable:
> >%d\n", ret);
> >-		return ret;
> >-	}
> >-
> >-	ret = xe_pmt_telem_read(hwmon->xe->drm.dev, guid, &pmt_val,
> >-				BMG_FAN_PWM_PMT_OFFSET, sizeof(pmt_val));
> 
> >+	ret = xe_pmt_read(hwmon->xe, XE_PMT_PUNIT, 0, BMG_FAN_PWM_PMT_OFFSET,
> >+			  &pmt_val, sizeof(pmt_val));
> 
> Is this BMG only, or is the same for CRI?

BMG only, as before: xe_hwmon_get_pwm_from_pmt() returns -EOPNOTSUPP on
other platforms, and this patch does not change that.

I'm addressing all your comments and going to resend a v2 next week.
Thank you

> 
> M
> 
> > 	if (ret != sizeof(pmt_val)) {
> > 		xe_warn(hwmon->xe, "pwm read from PMT failed: %d\n", ret);
> > 		return ret < 0 ? ret : -EIO;
> >--
> >2.56.0
> 

  reply	other threads:[~2026-12-04 15:18 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 20:10 [PATCH 00/15] drm/xe: Read the PMT telemetry samples as defined per GUID Rodrigo Vivi
2026-12-03 20:10 ` [PATCH 01/15] drm/xe/vsec: Move the PMT record IDs to xe_vsec.h Rodrigo Vivi
2026-12-03 21:32   ` Ruhl, Michael J
2026-12-03 21:47     ` Ruhl, Michael J
2026-12-03 20:10 ` [PATCH 02/15] drm/xe/vsec: Add xe_pmt_read() to read a PMT telemetry region Rodrigo Vivi
2026-12-03 21:50   ` Ruhl, Michael J
2026-12-03 20:10 ` [PATCH 03/15] drm/xe/hwmon: Use xe_pmt_read() for the PMT telemetry Rodrigo Vivi
2026-12-03 21:57   ` Ruhl, Michael J
2026-12-04 15:17     ` Rodrigo Vivi [this message]
2026-12-03 20:10 ` [PATCH 04/15] drm/xe/pcode: Use xe_pmt_read() for the pcode version Rodrigo Vivi
2026-12-03 21:58   ` Ruhl, Michael J
2026-12-03 20:10 ` [PATCH 05/15] drm/xe/debugfs: Use xe_pmt_read() for the residencies Rodrigo Vivi
2026-12-03 21:58   ` Ruhl, Michael J
2026-12-03 20:10 ` [PATCH 06/15] drm/xe/vsec: Remove xe_vsec_get_guid() Rodrigo Vivi
2026-12-03 21:59   ` Ruhl, Michael J
2026-12-03 20:10 ` [PATCH 07/15] drm/xe/vsec: Add the PMT telemetry samples per GUID Rodrigo Vivi
2026-12-03 20:10 ` [PATCH 08/15] drm/xe/hwmon: Read the BMG energy and fan PWM as PMT samples Rodrigo Vivi
2026-12-03 20:10 ` [PATCH 09/15] drm/xe/pcode: Read the pcode version as a PMT sample Rodrigo Vivi
2026-12-03 20:10 ` [PATCH 10/15] drm/xe/debugfs: Read the residencies as PMT samples Rodrigo Vivi
2026-12-03 20:10 ` [PATCH 11/15] drm/xe/vsec: Make xe_pmt_read() static Rodrigo Vivi
2026-12-03 20:10 ` [PATCH 12/15] drm/xe/hwmon: Do not read the BMG energy where the PMT telemetry has none Rodrigo Vivi
2026-12-03 20:10 ` [PATCH 13/15] drm/xe/debugfs: Only show the BMG G7 residency where the PMT telemetry has it Rodrigo Vivi
2026-12-03 20:10 ` [PATCH 14/15] drm/xe/pcode: Read the pcode version as defined in the PMT telemetry Rodrigo Vivi
2026-12-03 20:10 ` [PATCH 15/15] drm/xe/debugfs: Read the CRI residencies at their offsets Rodrigo Vivi
2026-12-03 20:19 ` ✗ CI.checkpatch: warning for drm/xe: Read the PMT telemetry samples as defined per GUID Patchwork
2026-12-03 20:21 ` ✓ CI.KUnit: success " Patchwork
2026-12-03 20:56 ` ✓ Xe.CI.BAT: " Patchwork
2026-12-04 20:16 ` ✗ Xe.CI.FULL: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=axLZo_u9I90ajBzA@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=karthik.poosa@intel.com \
    --cc=michael.j.ruhl@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox