Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe: Check for dead config space on reading all 1s
@ 2026-05-12  6:01 Arun R Murthy
  2026-05-12 11:12 ` ✓ CI.KUnit: success for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Arun R Murthy @ 2026-05-12  6:01 UTC (permalink / raw)
  To: intel-xe; +Cc: rodrigo.vivi, lucas.demarchi, Arun R Murthy

Reading the VF_CAP returns all 1s when the config space is dead leading
to missdetection of VF and confusing the GuC.
Check for all 1s and pci device detect can act as a sanity.

Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/7941
Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
---
 drivers/gpu/drm/xe/xe_sriov.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_sriov.c b/drivers/gpu/drm/xe/xe_sriov.c
index f3835867fce5..40e142d78924 100644
--- a/drivers/gpu/drm/xe/xe_sriov.c
+++ b/drivers/gpu/drm/xe/xe_sriov.c
@@ -4,6 +4,7 @@
  */
 
 #include <linux/fault-inject.h>
+#include <linux/pci.h>
 
 #include <drm/drm_managed.h>
 
@@ -39,8 +40,21 @@ const char *xe_sriov_mode_to_string(enum xe_sriov_mode mode)
 
 static bool test_is_vf(struct xe_device *xe)
 {
+	struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
 	u32 value = xe_mmio_read32(xe_root_tile_mmio(xe), VF_CAP_REG);
 
+	/*
+	 * If the device is inaccessible (e.g. parent bridge stuck in D3cold,
+	 * fatal AER Errors) MMIO reads returns all-ones, 0xffff.
+	 * VF_CAP would appear set and would misdetect as VF mode.
+	 * Sanity check PCI presence before trusting the read.
+	 */
+	if (value == U32_MAX && !pci_device_is_present(pdev)) {
+		drm_err(&xe->drm,
+			"VF_CAP_REG returned all 1s, config space looks to be dead, skipping SR-IOV mode detection\n");
+		return false;
+	}
+
 	return value & VF_CAP;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-05-12 22:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12  6:01 [PATCH] drm/xe: Check for dead config space on reading all 1s Arun R Murthy
2026-05-12 11:12 ` ✓ CI.KUnit: success for " Patchwork
2026-05-12 11:55 ` [PATCH] " Michal Wajdeczko
2026-05-12 12:32 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-05-12 22:28 ` ✗ Xe.CI.FULL: failure " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox