Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: intel-xe <intel-xe@lists.freedesktop.org>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>,
	Francois Dugast <francois.dugast@intel.com>,
	Riana Tauro <riana.tauro@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: [PATCH v4 2/3] drm/xe: Set survivability mode before heci init
Date: Thu, 13 Mar 2025 13:41:00 -0700	[thread overview]
Message-ID: <20250313-fix-survivability-v4-2-5e90efdede99@intel.com> (raw)
In-Reply-To: <20250313-fix-survivability-v4-0-5e90efdede99@intel.com>

Commit d40f275d96e8 ("drm/xe: Move survivability entirely to xe_pci")
tried to follow the logic: initialize everything needed and if
everything succeeds, set the flag that it's enabled. While it fixed some
corner cases of those calls failing, it was wrong for setting the flag
after the call to xe_heci_gsc_init(): that function does a different
initialization for survivability mode.

Fix that and add comments about this being done on purpose.

Suggested-by: Riana Tauro <riana.tauro@intel.com>
Fixes: d40f275d96e8 ("drm/xe: Move survivability entirely to xe_pci")
Reviewed-by: Riana Tauro <riana.tauro@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/xe/xe_survivability_mode.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_survivability_mode.c b/drivers/gpu/drm/xe/xe_survivability_mode.c
index 0d57ad1596edf..359d5b961c750 100644
--- a/drivers/gpu/drm/xe/xe_survivability_mode.c
+++ b/drivers/gpu/drm/xe/xe_survivability_mode.c
@@ -155,13 +155,21 @@ static int enable_survivability_mode(struct pci_dev *pdev)
 	if (ret)
 		return ret;
 
+	/* Make sure xe_heci_gsc_init() knows about survivability mode */
+	survivability->mode = true;
+
 	ret = xe_heci_gsc_init(xe);
-	if (ret)
+	if (ret) {
+		/*
+		 * But if it fails, device can't enter survivability
+		 * so move it back for correct error handling
+		 */
+		survivability->mode = false;
 		return ret;
+	}
 
 	xe_vsec_init(xe);
 
-	survivability->mode = true;
 	dev_err(dev, "In Survivability Mode\n");
 
 	return 0;

-- 
2.48.1


  parent reply	other threads:[~2025-03-13 20:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13 20:40 [PATCH v4 0/3] drm/xe: Fix survivability Lucas De Marchi
2025-03-13 20:40 ` [PATCH v4 1/3] drm/xe: Move survivability back to xe Lucas De Marchi
2025-03-17  5:24   ` Riana Tauro
2025-03-13 20:41 ` Lucas De Marchi [this message]
2025-03-13 20:41 ` [PATCH v4 3/3] drm/xe: Allow to inject error in early probe Lucas De Marchi
2025-03-13 20:48 ` ✓ CI.Patch_applied: success for drm/xe: Fix survivability (rev4) Patchwork
2025-03-13 20:48 ` ✓ CI.checkpatch: " Patchwork
2025-03-13 20:49 ` ✓ CI.KUnit: " Patchwork
2025-03-13 21:06 ` ✓ CI.Build: " Patchwork
2025-03-13 21:08 ` ✓ CI.Hooks: " Patchwork
2025-03-13 21:10 ` ✓ CI.checksparse: " Patchwork
2025-03-14 12:07 ` ✓ Xe.CI.BAT: " Patchwork
2025-03-14 12:47 ` ✓ CI.Patch_applied: success for drm/xe: Fix survivability (rev6) Patchwork
2025-03-14 12:48 ` ✓ CI.checkpatch: " Patchwork
2025-03-14 12:49 ` ✓ CI.KUnit: " Patchwork
2025-03-14 13:19 ` ✓ CI.Build: " Patchwork
2025-03-14 13:21 ` ✓ CI.Hooks: " Patchwork
2025-03-14 13:23 ` ✓ CI.checksparse: " Patchwork
2025-03-14 13:44 ` ✓ Xe.CI.BAT: " Patchwork
2025-03-14 20:45 ` ✓ Xe.CI.Full: " Patchwork
2025-03-18 15:50 ` [PATCH v4 0/3] drm/xe: Fix survivability Raag Jadav

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=20250313-fix-survivability-v4-2-5e90efdede99@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=francois.dugast@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@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