Skip to content

Commit 9c9dc9b

Browse files
committed
drm/xe/pxp: Fail the load if PXP fails to initialize
The PXP implementation mimics the i915 approach of allowing the load to continue even if PXP init has failed. On Xe however we're taking an harder stance on boot error and only allowing the load to complete if everything is working, so update the code to fail if anything goes wrong during PXP init. While at it, update the return code in case of PXP not supported to be 0 instead of EOPNOTSUPP, to follow the standard of functions called by xe_device_probe where every non-zero value means failure. Suggested-by: Lucas De Marchi <[email protected]> Signed-off-by: Daniele Ceraolo Spurio <[email protected]> Cc: Lucas De Marchi <[email protected]> Cc: John Harrison <[email protected]> Reviewed-by: Lucas De Marchi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 4597777 commit 9c9dc9b

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

drivers/gpu/drm/xe/xe_device.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,8 +864,8 @@ int xe_device_probe(struct xe_device *xe)
864864

865865
/* A PXP init failure is not fatal */
866866
err = xe_pxp_init(xe);
867-
if (err && err != -EOPNOTSUPP)
868-
drm_err(&xe->drm, "PXP initialization failed: %pe\n", ERR_PTR(err));
867+
if (err)
868+
goto err_fini_display;
869869

870870
err = drm_dev_register(&xe->drm, 0);
871871
if (err)

drivers/gpu/drm/xe/xe_pxp.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ static void pxp_fini(void *arg)
372372
* are performed asynchronously as part of the GSC init. PXP can only be used
373373
* after both this function and the async worker have completed.
374374
*
375-
* Returns -EOPNOTSUPP if PXP is not supported, 0 if PXP initialization is
376-
* successful, other errno value if there is an error during the init.
375+
* Returns 0 if PXP is not supported or if PXP initialization is successful,
376+
* other errno value if there is an error during the init.
377377
*/
378378
int xe_pxp_init(struct xe_device *xe)
379379
{
@@ -382,26 +382,28 @@ int xe_pxp_init(struct xe_device *xe)
382382
int err;
383383

384384
if (!xe_pxp_is_supported(xe))
385-
return -EOPNOTSUPP;
385+
return 0;
386386

387387
/* we only support PXP on single tile devices with a media GT */
388388
if (xe->info.tile_count > 1 || !gt)
389-
return -EOPNOTSUPP;
389+
return 0;
390390

391391
/* The GSCCS is required for submissions to the GSC FW */
392392
if (!(gt->info.engine_mask & BIT(XE_HW_ENGINE_GSCCS0)))
393-
return -EOPNOTSUPP;
393+
return 0;
394394

395395
/* PXP requires both GSC and HuC firmwares to be available */
396396
if (!xe_uc_fw_is_loadable(&gt->uc.gsc.fw) ||
397397
!xe_uc_fw_is_loadable(&gt->uc.huc.fw)) {
398398
drm_info(&xe->drm, "skipping PXP init due to missing FW dependencies");
399-
return -EOPNOTSUPP;
399+
return 0;
400400
}
401401

402402
pxp = drmm_kzalloc(&xe->drm, sizeof(struct xe_pxp), GFP_KERNEL);
403-
if (!pxp)
404-
return -ENOMEM;
403+
if (!pxp) {
404+
err = -ENOMEM;
405+
goto out;
406+
}
405407

406408
INIT_LIST_HEAD(&pxp->queues.list);
407409
spin_lock_init(&pxp->queues.lock);
@@ -448,6 +450,8 @@ int xe_pxp_init(struct xe_device *xe)
448450
destroy_workqueue(pxp->irq.wq);
449451
out_free:
450452
drmm_kfree(&xe->drm, pxp);
453+
out:
454+
drm_err(&xe->drm, "PXP initialization failed: %pe\n", ERR_PTR(err));
451455
return err;
452456
}
453457

0 commit comments

Comments
 (0)