Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Michael J. Ruhl" <michael.j.ruhl@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v16 14/17] drm/xe/vsec: Add PMT GUID internal access
Date: Mon, 16 Nov 2026 15:31:12 +0000	[thread overview]
Message-ID: <sashiko-outbox-217283@kernel.org> (raw)
In-Reply-To: <20261116150649.368686-33-michael.j.ruhl@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/xe/vsec: missing wait_for_fw() and invalid GUID handling
  in xe_vsec_get_guid()
--

commit 632d26eff21d3d09eabbe9a46ad322beb8f8346c
Author: Michael J. Ruhl <michael.j.ruhl@intel.com>

drm/xe/vsec: Add PMT GUID internal access

This commit renames theBattlemage telemetry guid macro to include the
platform prefix, defines the Crescent Island telemetry guid register, and
adds xe_vsec_get_guid() to read and cache the punit guid per platform.

> diff --git a/drivers/gpu/drm/xe/xe_vsec.c b/drivers/gpu/drm/xe/xe_vsec.c
> index fe3d8338cfc98..7695bd6b6bc87 100644
> --- a/drivers/gpu/drm/xe/xe_vsec.c
> +++ b/drivers/gpu/drm/xe/xe_vsec.c
> @@ -571,6 +571,61 @@ static void cri_late_bind_probe(struct xe_device *xe)
>  	intel_vsec_register(dev, info);
>  }
>  
> +/**
> + * xe_vsec_get_guid - Get and cache the PUNIT guid value
> + * @xe: valid xe device
> + * @guid: returned guid
> + *
> + * Return:
> + * * -ENODATA device is not active
> + * * -EINVAL unsupported platform
> + * * 0 success
> + */
> +int xe_vsec_get_guid(struct xe_device *xe, u32 *guid)
> +{
> +	struct xe_mmio *mmio = xe_root_tile_mmio(xe);
> +	int ret = 0;
> +
> +	xe_assert(xe, !IS_SRIOV_VF(xe));
> +
> +	if (!xe_pm_runtime_get_if_active(xe))
> +		return -ENODATA;
> +
> +	mutex_lock(&xe->pmt.lock);
> +
> +	if (xe->pmt.punit_guid_cache) {
> +		*guid = xe->pmt.punit_guid_cache;
> +		goto unlock;
> +	}
> +
> +	switch (xe->info.platform) {
> +	case XE_BATTLEMAGE:
> +		*guid = xe_mmio_read32(mmio, BMG_PUNIT_TELEMETRY_GUID);
> +		break;
> +
> +	case XE_CRESCENTISLAND:
> +		xe->soc_remapper.set_telem_region(xe, CRI_IDX_TELEM_DISCOVERY);
> +		*guid = xe_mmio_read32(mmio, CRI_PUNIT_TELEMETRY_GUID);
> +		break;
> +
> +	default:
> +		*guid = 0;
> +		drm_err(&xe->drm, "Unsupported platform: %u\n", xe->info.platform);
> +		ret = -EINVAL;
> +		break;
> +	}
> +
> +	/* the GUID is static, read once and cache for all requests */
> +	if (*guid)
> +		xe->pmt.punit_guid_cache = *guid;
> +
> +unlock:
> +	mutex_unlock(&xe->pmt.lock);
> +	xe_pm_runtime_put(xe);
> +
> +	return ret;
> +}

[Severity: Medium]
Does xe_vsec_get_guid() need to call wait_for_fw(xe) before reading the
discovery table on Crescent Island?

As introduced in commit "drm/xe/vsec: Support late bind fw information",
the discovery window on Crescent Island is populated asynchronously on
power-on by late-bound firmware, so xe_pmt_telem_read(), xe_pmt_read_reg()
and xe_pmt_write_reg() all check wait_for_fw(xe) before taking xe->pmt.lock
and accessing the discovery or telemetry regions.  During probe and the
late-bind polling window, xe_pm_runtime_get_if_active() succeeds while the
firmware is not yet ready, so xe_vsec_get_guid() reads an uninitialized
discovery window.

Also, if the register read returns 0, xe_vsec_get_guid() skips caching it
but still returns 0 (success) with *guid set to 0, whereas if an
uninitialized or failed read returns a non-zero bogus value such as
0xffffffff, xe->pmt.punit_guid_cache caches it for the lifetime of the
device and causes all subsequent telemetry reads to fail in
xe_guid_decode().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116150649.368686-19-michael.j.ruhl@intel.com?part=14

  reply	other threads:[~2026-11-16 15:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 15:06 [PATCH v16 00/17] Crescent Island PMT support Michael J. Ruhl
2026-11-16 15:06 ` [PATCH v16 01/17] drm/xe/vsec: VSEC requires soc-remapper Michael J. Ruhl
2026-11-16 15:06 ` [PATCH v16 02/17] drm/xe/vsec: Do not register BMG PMT for VF Michael J. Ruhl
2026-11-16 15:06 ` [PATCH v16 03/17] drm/xe/vsec: Correct locking order Michael J. Ruhl
2026-11-16 15:06 ` [PATCH v16 04/17] drm/xe/vsec: Use correct pm state get Michael J. Ruhl
2026-11-16 15:06 ` [PATCH v16 05/17] drm/xe/vsec: Add DOC text for VSEC Michael J. Ruhl
2026-11-16 15:06 ` [PATCH v16 06/17] drm/xe/vsec: Support possible hotplug exit Michael J. Ruhl
2026-11-16 15:06 ` [PATCH v16 07/17] drm/xe/vsec: Refactor BattleMage PMT defines Michael J. Ruhl
2026-11-16 15:06 ` [PATCH v16 08/17] drm/xe/vsec: Update VSEC probe order Michael J. Ruhl
2026-11-16 15:06 ` [PATCH v16 09/17] drm/xe/vsec: Add base_offset to allow for more flexibilty Michael J. Ruhl
2026-11-16 15:06 ` [PATCH v16 10/17] drm/xe/vsec: Support Crescent Island PMT Michael J. Ruhl
2026-11-16 15:07 ` [PATCH v16 11/17] drm/xe/vsec: Crescent Island PMT decode Michael J. Ruhl
2026-11-16 15:07 ` [PATCH v16 12/17] drm/xe/vsec: Crescent Island PMT callbacks Michael J. Ruhl
2026-11-16 15:07 ` [PATCH v16 13/17] drm/xe/vsec: Support late bind fw information Michael J. Ruhl
2026-11-16 15:39   ` sashiko-bot
2026-11-16 15:07 ` [PATCH v16 14/17] drm/xe/vsec: Add PMT GUID internal access Michael J. Ruhl
2026-11-16 15:31   ` sashiko-bot [this message]
2026-11-16 15:07 ` [PATCH v16 15/17] drm/xe/vsec: Update PMT " Michael J. Ruhl
2026-11-16 15:07 ` [PATCH v16 16/17] drm/xe/vsec: Refactor platform check Michael J. Ruhl
2026-11-16 15:07 ` [PATCH v16 17/17] drm/xe/vsec: Support survivability mode for CRI Michael J. Ruhl

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-217283@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