Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stuart Summers <stuart.summers@intel.com>
Cc: joonas.lahtinen@linux.intel.com, aravind.iddamsetty@intel.com,
	intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH 1/1] drm/i915: Add support for sbr and flr as a fallback
Date: Thu,  9 Sep 2021 11:56:48 -0700	[thread overview]
Message-ID: <20210909185648.23683-1-stuart.summers@intel.com> (raw)

In the event engine or GT reset fails, fall back to function
level reset and then secondary bus reset. If nothing works,
wedge the device.

Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Aravind Iddamsetty <aravind.iddamsetty@intel.com>
Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_reset.c | 52 +++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c
index 91200c43951f7..939d1c63224ef 100644
--- a/drivers/gpu/drm/i915/gt/intel_reset.c
+++ b/drivers/gpu/drm/i915/gt/intel_reset.c
@@ -594,6 +594,45 @@ static void gen8_engine_reset_cancel(struct intel_engine_cs *engine)
 			      _MASKED_BIT_DISABLE(RESET_CTL_REQUEST_RESET));
 }
 
+enum pcie_reset_type {
+	PCIE_RESET_TYPE_FLR,
+	PCIE_RESET_TYPE_SBR
+};
+
+static int gen12_pcie_reset(struct drm_i915_private *i915,
+			    enum pcie_reset_type type)
+{
+	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
+	int ret;
+
+	ret = pci_save_state(pdev);
+	if (!ret)
+		goto out;
+
+	switch (type) {
+	case PCIE_RESET_TYPE_FLR:
+		ret = pcie_has_flr(pdev);
+		if (ret)
+			goto out;
+		ret = pcie_flr(pdev);
+		break;
+	case PCIE_RESET_TYPE_SBR:
+		if (!IS_DGFX(i915))
+			return -ENODEV;
+		ret = pci_bridge_secondary_bus_reset(pdev->bus->self);
+		break;
+	default:
+		goto out;
+	}
+	if (ret)
+		goto out;
+
+	pci_restore_state(pdev);
+
+out:
+	return ret;
+}
+
 static int gen8_reset_engines(struct intel_gt *gt,
 			      intel_engine_mask_t engine_mask,
 			      unsigned int retry)
@@ -628,6 +667,19 @@ static int gen8_reset_engines(struct intel_gt *gt,
 	else
 		ret = gen6_reset_engines(gt, engine_mask, retry);
 
+	if (ret && engine_mask == ALL_ENGINES) {
+		/*
+		 * If the full GT reset fails, try the bigger hammer with
+		 * FLR and SBR if available. Capability checks happen
+		 * in the called functions.
+		 */
+		if (ret)
+			ret = gen12_pcie_reset(gt->i915, PCIE_RESET_TYPE_FLR);
+
+		if (ret)
+			ret = gen12_pcie_reset(gt->i915, PCIE_RESET_TYPE_SBR);
+	}
+
 skip_reset:
 	for_each_engine_masked(engine, gt, engine_mask, tmp)
 		gen8_engine_reset_cancel(engine);
-- 
2.29.2


             reply	other threads:[~2021-09-09 18:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09 18:56 Stuart Summers [this message]
2021-09-09 19:55 ` [Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [1/1] drm/i915: Add support for sbr and flr as a fallback Patchwork
2021-09-09 21:07 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=20210909185648.23683-1-stuart.summers@intel.com \
    --to=stuart.summers@intel.com \
    --cc=aravind.iddamsetty@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=joonas.lahtinen@linux.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