Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] drm/xe/pcode: Allow checking for mailbox command support during driver probe
@ 2025-11-13  4:44 Raag Jadav
  2025-11-13  5:37 ` Poosa, Karthik
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Raag Jadav @ 2025-11-13  4:44 UTC (permalink / raw)
  To: lucas.demarchi, rodrigo.vivi, jani.nikula
  Cc: intel-xe, riana.tauro, matthew.brost, michal.wajdeczko,
	badal.nilawar, ville.syrjala, karthik.poosa, Raag Jadav

If the device is running older pcode firmware, it is possible that newer
mailbox commands are not supported by it. The respective functionality
isn't useful in that case but nor is error logging, since it doesn't
particularly signify anything wrong with pcode firmware or device as a
whole. Log such failures as debug messages during driver probe which allows
the caller to check for mailbox command support without it being reported
as an error. This is useful in cases where we want to make a decision on
driver functionality based on pcode return codes and a relatively simpler
design choice compared to other solutions like checking pcode firmware
version, which comes with additional complexity of binding every single
command to a specific version and deems pcode commands useless in case the
driver fails to obtain it for reasons unrelated to pcode.

This only silences command related failures and still reports other
failures as errors, so we don't end up hiding the genuine ones.

v2: Split unsupported command cases
v3: Add device bound check

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---

I've not followed the documented device_lock() rule here because

1. It'll deadlock in ->probe() path.
2. I don't know the code well enough to tell if it's really needed for
   our case.

So feel free to weigh in.

 drivers/gpu/drm/xe/xe_device.h | 7 +++++++
 drivers/gpu/drm/xe/xe_pcode.c  | 8 ++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_device.h b/drivers/gpu/drm/xe/xe_device.h
index 32cc6323b7f6..e8f997546ae1 100644
--- a/drivers/gpu/drm/xe/xe_device.h
+++ b/drivers/gpu/drm/xe/xe_device.h
@@ -12,6 +12,13 @@
 #include "xe_gt_types.h"
 #include "xe_sriov.h"
 
+static inline bool xe_is_bound(struct xe_device *xe)
+{
+	struct device *dev = xe->drm.dev;
+
+	return device_is_bound(dev);
+}
+
 static inline struct xe_device *to_xe_device(const struct drm_device *dev)
 {
 	return container_of(dev, struct xe_device, drm);
diff --git a/drivers/gpu/drm/xe/xe_pcode.c b/drivers/gpu/drm/xe/xe_pcode.c
index 0d33c14ea0cf..0f1edf5155c4 100644
--- a/drivers/gpu/drm/xe/xe_pcode.c
+++ b/drivers/gpu/drm/xe/xe_pcode.c
@@ -57,8 +57,12 @@ static int pcode_mailbox_status(struct xe_tile *tile)
 	}
 
 	if (err) {
-		drm_err(&tile_to_xe(tile)->drm, "PCODE Mailbox failed: %d %s",
-			err_decode, err_str);
+		if (err_decode == -ENXIO && !xe_is_bound(tile_to_xe(tile)))
+			drm_dbg(&tile_to_xe(tile)->drm, "PCODE Mailbox unsupported: %d %s",
+				err_decode, err_str);
+		else
+			drm_err(&tile_to_xe(tile)->drm, "PCODE Mailbox failed: %d %s",
+				err_decode, err_str);
 
 		return err_decode;
 	}
-- 
2.43.0


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

end of thread, other threads:[~2025-11-20  6:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-13  4:44 [PATCH v3] drm/xe/pcode: Allow checking for mailbox command support during driver probe Raag Jadav
2025-11-13  5:37 ` Poosa, Karthik
2025-11-13  5:43   ` Poosa, Karthik
2025-11-13  5:43 ` ✓ CI.KUnit: success for " Patchwork
2025-11-13  6:24 ` ✓ Xe.CI.BAT: " Patchwork
2025-11-13  8:11 ` [PATCH v3] " Nilawar, Badal
2025-11-20  6:09   ` Poosa, Karthik
2025-11-13 13:50 ` ✗ Xe.CI.Full: failure for " Patchwork

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