[PATCH v7 2/2] drm/xe/sysctrl: Add helper to check oCode firmware readiness
"Anoop, Vijay" <[email protected]>
| Newsgroups | org.freedesktop.lists.intel-xe |
|---|---|
| Message-ID | <[email protected]> |
From: Anoop Vijay <[email protected]> Add xe_sysctrl_is_oobmsm_fw_ready(), a convenience wrapper around xe_sysctrl_check_app_status() to check oCode application readiness. Signed-off-by: Anoop Vijay <[email protected]> --- v6: - New patch — split oCode application readiness helper out of the original patch into its own commit v7: (Umesh) - Clarify xe_sysctrl_is_oobmsm_fw_ready() comment for sysctrl-less platforms - Add XE_SYSCTRL_APP_OCODE to enum xe_sysctrl_app_id in xe_sysctrl.c --- drivers/gpu/drm/xe/xe_sysctrl.c | 23 +++++++++++++++++++++++ drivers/gpu/drm/xe/xe_sysctrl.h | 1 + 2 files changed, 24 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_sysctrl.c b/drivers/gpu/drm/xe/xe_sysctrl.c index c53a26af3189..488e30b3d075 100644 --- a/drivers/gpu/drm/xe/xe_sysctrl.c +++ b/drivers/gpu/drm/xe/xe_sysctrl.c @@ -42,6 +42,7 @@ * application ID. */ enum xe_sysctrl_app_id { + XE_SYSCTRL_APP_OCODE = 0x0C, XE_SYSCTRL_APP_DIAG = 0x0D, }; @@ -189,6 +190,28 @@ xe_sysctrl_check_app_status(struct xe_device *xe, enum xe_sysctrl_app_id app_id) return XE_SYSCTRL_FIRMWARE_APP_INITIALIZED; } +/** + * xe_sysctrl_is_oobmsm_fw_ready() - Check if oCode firmware is fully initialized + * @xe: xe device instance + * + * Returns true if oCode firmware has reached the initialized state, indicating + * it is ready to handle requests. On platforms without System Controller + * support there is no System Controller mailbox to gate on, so oCode firmware + * readiness is not tracked through this path; the function unconditionally + * returns true so callers are not blocked by this check on such platforms. + * + * Return: true if oCode firmware is initialized, or if System Controller is + * not present on this platform; false otherwise + */ +bool xe_sysctrl_is_oobmsm_fw_ready(struct xe_device *xe) +{ + enum xe_sysctrl_fw_status status = + xe_sysctrl_check_app_status(xe, XE_SYSCTRL_APP_OCODE); + + return status == XE_SYSCTRL_FIRMWARE_APP_INITIALIZED || + status == XE_SYSCTRL_FIRMWARE_APP_NOTSUPP; +} + /** * xe_sysctrl_is_diag_fw_ready() - Check if diag firmware is fully initialized * @xe: xe device instance diff --git a/drivers/gpu/drm/xe/xe_sysctrl.h b/drivers/gpu/drm/xe/xe_sysctrl.h index 8dc576796890..b69a3f474236 100644 --- a/drivers/gpu/drm/xe/xe_sysctrl.h +++ b/drivers/gpu/drm/xe/xe_sysctrl.h @@ -20,6 +20,7 @@ void xe_sysctrl_event(struct xe_sysctrl *sc); int xe_sysctrl_init(struct xe_device *xe); void xe_sysctrl_irq_handler(struct xe_device *xe, u32 master_ctl); void xe_sysctrl_pm_resume(struct xe_device *xe); +bool xe_sysctrl_is_oobmsm_fw_ready(struct xe_device *xe); bool xe_sysctrl_is_diag_fw_ready(struct xe_device *xe); #endif -- 2.43.0