Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] drm/xe: Register drm device at the end of probe
@ 2026-10-23  3:04 Raag Jadav
  2026-10-23  3:14 ` ✓ CI.KUnit: success for " Patchwork
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Raag Jadav @ 2026-10-23  3:04 UTC (permalink / raw)
  To: intel-xe
  Cc: matthew.brost, thomas.hellstrom, jani.nikula, rodrigo.vivi,
	Raag Jadav

Call drm_dev_register() to advertice the device to user space and register
it with other core subsystems. As per documentation, this should be done
last in the device initialization sequence to make sure userspace can't
access an inconsistent state. Also reflect this reordering in driver
remove sequence.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
 drivers/gpu/drm/xe/xe_device.c | 8 --------
 drivers/gpu/drm/xe/xe_pci.c    | 7 +++++++
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index a07655b4c7a9..6fbcc06c0e45 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -1052,10 +1052,6 @@ int xe_device_probe(struct xe_device *xe)
 	if (err)
 		return err;
 
-	err = drm_dev_register(&xe->drm, 0);
-	if (err)
-		return err;
-
 	xe_display_register(xe);
 
 	err = xe_oa_register(xe);
@@ -1099,8 +1095,6 @@ int xe_device_probe(struct xe_device *xe)
 
 err_unregister_display:
 	xe_display_unregister(xe);
-	drm_dev_unregister(&xe->drm);
-
 	return err;
 }
 
@@ -1108,8 +1102,6 @@ void xe_device_remove(struct xe_device *xe)
 {
 	xe_display_unregister(xe);
 
-	drm_dev_unplug(&xe->drm);
-
 	xe_bo_pci_dev_remove_all(xe);
 }
 
diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index 605c452a9c33..e71e48ad1564 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -1119,6 +1119,8 @@ static void xe_pci_remove(struct pci_dev *pdev)
 {
 	struct xe_device *xe = pdev_to_xe_device(pdev);
 
+	drm_dev_unplug(&xe->drm);
+
 	if (IS_SRIOV_PF(xe))
 		xe_pci_sriov_configure(pdev, 0);
 
@@ -1297,6 +1299,11 @@ static int __xe_pci_probe(struct pci_dev *pdev, const struct xe_device_desc *des
 	if (err)
 		goto err_driver_cleanup;
 
+	/* Must be last */
+	err = drm_dev_register(&xe->drm, 0);
+	if (err)
+		goto err_driver_cleanup;
+
 	return 0;
 
 err_driver_cleanup:
-- 
2.43.0


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

end of thread, other threads:[~2026-10-23  7:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-23  3:04 [PATCH v1] drm/xe: Register drm device at the end of probe Raag Jadav
2026-10-23  3:14 ` ✓ CI.KUnit: success for " Patchwork
2026-10-23  3:27 ` [PATCH v1] " sashiko-bot
2026-10-23  3:44 ` ✗ Xe.CI.BAT: failure for " Patchwork
2026-10-23  5:31 ` ✗ Xe.CI.FULL: " Patchwork
2026-10-23  7:26 ` [PATCH v1] " Jani Nikula
2026-10-23  7:55 ` ✗ 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