All of 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 v13 16/16] drm/xe/vsec: Support survivability mode for CRI
Date: Mon, 02 Nov 2026 22:39:20 +0000	[thread overview]
Message-ID: <sashiko-outbox-194294@kernel.org> (raw)
In-Reply-To: <20261102221314.119028-34-michael.j.ruhl@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/xe/vsec: NULL sc->mmio dereference in wait_for_fw() on survivability error
--

commit 6e126caaac7b556b33b3c1891921257efd2a418a
Author: Michael J. Ruhl <michael.j.ruhl@intel.com>

drm/xe/vsec: Support survivability mode for CRI

This commit adds a VSEC configuration for Crescent Island in survivability
mode to expose the PUNIT crashlog PMT capability and initializes the SoC
remapper during boot survivability mode.

> diff --git a/drivers/gpu/drm/xe/xe_survivability_mode.c b/drivers/gpu/drm/xe/xe_survivability_mode.c
> index d73cdad0b3a9c..4ce84bafcbf57 100644
> --- a/drivers/gpu/drm/xe/xe_survivability_mode.c
> +++ b/drivers/gpu/drm/xe/xe_survivability_mode.c
[ ... ]
> @@ -352,6 +353,7 @@ static int enable_boot_survivability_mode(struct pci_dev *pdev)
>  
>  	xe_heci_gsc_init(xe);
>  
> +	xe_soc_remapper_init(xe);
>  	xe_vsec_init(xe);
>  
>  	if (survivability->fdo_mode) {
> diff --git a/drivers/gpu/drm/xe/xe_vsec.c b/drivers/gpu/drm/xe/xe_vsec.c
> index 1ed904ec14965..6d4ef9cb9f60f 100644
> --- a/drivers/gpu/drm/xe/xe_vsec.c
> +++ b/drivers/gpu/drm/xe/xe_vsec.c
[ ... ]
> @@ -316,9 +336,10 @@ static void cri_late_bind_probe_work(struct work_struct *work)
>  
>  static bool wait_for_fw(struct xe_device *xe)
>  {
> +	struct xe_survivability *survivability = &xe->survivability;
>  	int retries = VSEC_LATE_BIND_RETRY;  /* wait up to 20 secs */
>  
> -	if (xe->info.platform != XE_CRESCENTISLAND)
> +	if (xe->info.platform != XE_CRESCENTISLAND || survivability->mode)
>  		return true;
>  
>  	while (retries--) {

[Severity: Medium]
Can this dereference a NULL xe->sc.mmio pointer and lock an uninitialized
xe->sc.cmd_lock mutex if enable_boot_survivability_mode() fails after
xe_vsec_init()?

During early probe in xe_device_probe_early(), xe_sysctrl_init() has not run
yet, so xe->sc.cmd_lock is uninitialized and xe->sc.mmio is NULL.
enable_boot_survivability_mode() sets survivability->mode = true and calls
xe_vsec_init(xe), which registers the crashlog auxiliary device via
intel_vsec_register() with devm-managed cleanup:

drivers/gpu/drm/xe/xe_survivability_mode.c:enable_boot_survivability_mode() {
	...
	survivability->mode = true;

	xe_heci_gsc_init(xe);

	xe_soc_remapper_init(xe);
	xe_vsec_init(xe);

	if (survivability->fdo_mode) {
		ret = xe_nvm_init(xe);
		if (ret)
			goto failed;
	}

	ret = xe_i2c_probe(xe);
	if (ret)
		goto failed;
	...
failed:
	xe_log_err_fatal(pdev, SURVIVABILITY, ret, "Failed to enable Boot Mode!\n");
	survivability->mode = false;
	return ret;
}

If xe_nvm_init() or xe_i2c_probe() fails, survivability->mode is reset to
false while the VSEC crashlog device and its sysfs attributes remain
registered until PCI probe teardown runs devres_release_all().

If userspace reads the crashlog sysfs attributes during that teardown window,
xe_pmt_telem_read() or xe_pmt_read_reg() calls wait_for_fw(xe), which sees
survivability->mode == false and calls:

  wait_for_fw(xe)
    -> xe_sysctrl_is_oobmsm_fw_ready(xe)
      -> xe_sysctrl_send_command(xe, ...)
        -> guard(mutex)(&sc->cmd_lock)
        -> sysctrl_send_command(sc, ...)

Because xe_sysctrl_init() was never called, would this lock the uninitialized
sc->cmd_lock and dereference the NULL sc->mmio pointer?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261102221314.119028-18-michael.j.ruhl@intel.com?part=16

  reply	other threads:[~2026-11-02 22:39 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
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 [this message]
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-194294@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.