From: sashiko-bot@kernel.org
To: "Michael J. Ruhl" <michael.j.ruhl@intel.com>,
intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v13 14/16] drm/xe/vsec: Update PMT internal access
Date: Mon, 02 Nov 2026 22:35:16 +0000 [thread overview]
Message-ID: <sashiko-outbox-194292@kernel.org> (raw)
In-Reply-To: <20261102221314.119028-32-michael.j.ruhl@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/xe/vsec: missing wait_for_fw() and invalid caching in xe_vsec_get_guid()
--
commit ff1f060a60a0a4bf5c3f7818992f8347fb84bca2
Author: Michael J. Ruhl <michael.j.ruhl@intel.com>
drm/xe/vsec: Update PMT internal access
This commit updates read_residency_counter(), xe_hwmon_energy_get(), and
xe_get_pcode_version() to retrieve the device-specific PMT telemetry GUID via
xe_vsec_get_guid() instead of reading BMG_PUNIT_TELEMETRY_GUID directly.
> diff --git a/drivers/gpu/drm/xe/xe_pcode.c b/drivers/gpu/drm/xe/xe_pcode.c
> index 8c901e54f3847..fa9f45d565cb9 100644
> --- a/drivers/gpu/drm/xe/xe_pcode.c
> +++ b/drivers/gpu/drm/xe/xe_pcode.c
> @@ -365,11 +365,17 @@ ALLOW_ERROR_INJECTION(xe_pcode_probe_early, ERRNO); /* See xe_pci_probe */
> int xe_get_pcode_version(struct xe_device *xe, struct xe_pcode_version *version)
> {
> int ret = 0;
> + u32 guid;
>
> guard(xe_pm_runtime)(xe);
>
> - ret = xe_pmt_telem_read(xe->drm.dev,
> - xe_mmio_read32(xe_root_tile_mmio(xe), BMG_PUNIT_TELEMETRY_GUID),
> + ret = xe_vsec_get_guid(xe, &guid);
> + if (ret) {
> + xe_warn(xe, "PMT device is not available: %d\n", ret);
> + return ret;
> + }
> +
> + ret = xe_pmt_telem_read(xe->drm.dev, guid,
> (u64 *)version, PUNIT_VERSION_OFFSET, sizeof(*version));
[Severity: Medium]
On XE_CRESCENTISLAND, can calling xe_vsec_get_guid() before xe_pmt_telem_read()
access the CRI PMT discovery window before OOBMSM firmware is ready and
corrupt punit_guid_cache?
In xe_debugfs_register(), pcode_info is registered on both XE_BATTLEMAGE and
XE_CRESCENTISLAND, and reading it invokes:
pcode_info() -> xe_get_pcode_version() -> xe_vsec_get_guid()
Unlike xe_pmt_telem_read(), xe_pmt_read_reg(), and xe_pmt_write_reg(),
xe_vsec_get_guid() in drivers/gpu/drm/xe/xe_vsec.c does not call wait_for_fw()
before programming the SoC remapper and reading CRI_PUNIT_TELEMETRY_GUID:
drivers/gpu/drm/xe/xe_vsec.c:xe_vsec_get_guid() {
...
case XE_CRESCENTISLAND:
xe->soc_remapper.set_telem_region(xe, CRI_IDX_TELEM_DISCOVERY);
*guid = xe_mmio_read32(mmio, CRI_PUNIT_TELEMETRY_GUID);
break;
...
/* the GUID is static, read once and cache for all requests */
if (*guid)
xe->pmt.punit_guid_cache = *guid;
}
If pcode_info (or read_residency_counter()) is read while late-bound OOBMSM
firmware is not yet ready (for example during initial probe while
cri_late_bind_probe_work is polling, or after runtime resume from D3cold),
reading CRI_PUNIT_TELEMETRY_GUID before wait_for_fw() has two failure modes:
1. If the premature read returns 0, xe_vsec_get_guid() still returns 0 with
*guid == 0, and xe_pmt_telem_read() then fails immediately in
xe_guid_decode() with -ENODEV before reaching its own wait_for_fw() check:
drivers/gpu/drm/xe/xe_vsec.c:xe_pmt_telem_read() {
...
ret = xe_guid_decode(guid, &mem_region, &offset);
if (ret)
goto dev_exit;
...
if (!wait_for_fw(xe)) {
ret = -ENODATA;
goto runtime_exit;
}
}
2. If the premature read returns a non-zero uninitialized or all-ones value
(such as 0xffffffff), xe_vsec_get_guid() caches it in
xe->pmt.punit_guid_cache permanently, causing all subsequent calls to
xe_vsec_get_guid(), xe_get_pcode_version(), and read_residency_counter() to
fail even after OOBMSM firmware becomes ready.
Should xe_vsec_get_guid() call wait_for_fw(xe) before reading the GUID (and
validate the GUID before caching it)?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261102221314.119028-18-michael.j.ruhl@intel.com?part=14
next prev parent reply other threads:[~2026-11-02 22:35 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 22:13 [PATCH v13 00/16] Crescent Island PMT support Michael J. Ruhl
2026-11-02 22:13 ` [PATCH v13 01/16] drm/xe/vsec: Do not register BMG PMT for VF Michael J. Ruhl
2026-11-02 22:23 ` sashiko-bot
2026-11-02 22:13 ` [PATCH v13 02/16] drm/xe/vsec: Correct locking order Michael J. Ruhl
2026-11-02 22:13 ` [PATCH v13 03/16] drm/xe/vsec: Use correct pm state get Michael J. Ruhl
2026-11-02 22:13 ` [PATCH v13 04/16] drm/xe/vsec: Add DOC text for VSEC Michael J. Ruhl
2026-11-02 22:13 ` [PATCH v13 05/16] drm/xe/vsec: Support possible hotplug exit Michael J. Ruhl
2026-11-02 22:13 ` [PATCH v13 06/16] drm/xe/vsec: Refactor BattleMage PMT defines Michael J. Ruhl
2026-11-02 22:13 ` [PATCH v13 07/16] drm/xe/vsec: Update VSEC probe order Michael J. Ruhl
2026-11-02 22:13 ` [PATCH v13 08/16] drm/xe/vsec: Add base_offset to allow for more flexibilty Michael J. Ruhl
2026-11-02 22:13 ` [PATCH v13 09/16] drm/xe/vsec: Support Crescent Island PMT Michael J. Ruhl
2026-11-02 22:13 ` [PATCH v13 10/16] drm/xe/vsec: Crescent Island PMT decode Michael J. Ruhl
2026-11-02 22:13 ` [PATCH v13 11/16] drm/xe/vsec: Crescent Island PMT callbacks Michael J. Ruhl
2026-11-02 22:38 ` sashiko-bot
2026-11-02 22:13 ` [PATCH v13 12/16] drm/xe/vsec: Support late bind fw information Michael J. Ruhl
2026-11-02 22:46 ` sashiko-bot
2026-11-02 22:13 ` [PATCH v13 13/16] drm/xe/vsec: Add PMT GUID internal access Michael J. Ruhl
2026-11-02 22:39 ` sashiko-bot
2026-11-02 22:13 ` [PATCH v13 14/16] drm/xe/vsec: Update PMT " Michael J. Ruhl
2026-11-02 22:35 ` sashiko-bot [this message]
2026-11-02 22:13 ` [PATCH v13 15/16] drm/xe/vsec: Refactor platform check Michael J. Ruhl
2026-11-02 22:46 ` sashiko-bot
2026-11-02 22:13 ` [PATCH v13 16/16] drm/xe/vsec: Support survivability mode for CRI Michael J. Ruhl
2026-11-02 22:39 ` sashiko-bot
2026-11-02 22:49 ` ✗ CI.checkpatch: warning for Crescent Island PMT support (rev15) Patchwork
2026-11-02 22:51 ` ✓ CI.KUnit: success " Patchwork
2026-11-02 23:23 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-03 1:00 ` ✓ Xe.CI.FULL: " 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=sashiko-outbox-194292@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=michael.j.ruhl@intel.com \
--cc=sashiko-reviews@lists.linux.dev \
/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