[Intel-xe] [PATCH v3 16/20] drm/xe/uc: Extract xe_uc_sanitize_reset
Matthew Brost
matthew.brost at intel.com
Thu Nov 16 12:56:41 UTC 2023
On Tue, Nov 14, 2023 at 02:02:27PM +0100, Michał Winiarski wrote:
> Earlier GuC load will require more fine-grained control over reset.
> Extract it outside of xe_uc_init_hw.
>
> Signed-off-by: Michał Winiarski <michal.winiarski at intel.com>
Reviewed-by: Matthew Brost <matthew.brost at intel.com>
> ---
> drivers/gpu/drm/xe/xe_gt.c | 4 ++++
> drivers/gpu/drm/xe/xe_uc.c | 14 ++++++++------
> drivers/gpu/drm/xe/xe_uc.h | 2 +-
> 3 files changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
> index c8e2689873c37..d0962e0cc27e9 100644
> --- a/drivers/gpu/drm/xe/xe_gt.c
> +++ b/drivers/gpu/drm/xe/xe_gt.c
> @@ -537,6 +537,10 @@ static int do_gt_restart(struct xe_gt *gt)
> for_each_hw_engine(hwe, gt, id)
> xe_hw_engine_enable_ring(hwe);
>
> + err = xe_uc_sanitize_reset(>->uc);
> + if (err)
> + return err;
> +
> err = xe_uc_init_hw(>->uc);
> if (err)
> return err;
> diff --git a/drivers/gpu/drm/xe/xe_uc.c b/drivers/gpu/drm/xe/xe_uc.c
> index 784f53c5f282f..13e76e6805ca1 100644
> --- a/drivers/gpu/drm/xe/xe_uc.c
> +++ b/drivers/gpu/drm/xe/xe_uc.c
> @@ -69,10 +69,16 @@ int xe_uc_init(struct xe_uc *uc)
> */
> int xe_uc_init_post_hwconfig(struct xe_uc *uc)
> {
> + int ret;
> +
> /* GuC submission not enabled, nothing to do */
> if (!xe_device_uc_enabled(uc_to_xe(uc)))
> return 0;
>
> + ret = xe_uc_sanitize_reset(uc);
> + if (ret)
> + return ret;
> +
> return xe_guc_init_post_hwconfig(&uc->guc);
> }
>
> @@ -90,13 +96,13 @@ static int uc_reset(struct xe_uc *uc)
> return 0;
> }
>
> -void xe_uc_sanitize(struct xe_uc *uc)
> +static void xe_uc_sanitize(struct xe_uc *uc)
> {
> xe_huc_sanitize(&uc->huc);
> xe_guc_sanitize(&uc->guc);
> }
>
> -static int xe_uc_sanitize_reset(struct xe_uc *uc)
> +int xe_uc_sanitize_reset(struct xe_uc *uc)
> {
> xe_uc_sanitize(uc);
>
> @@ -136,10 +142,6 @@ int xe_uc_init_hw(struct xe_uc *uc)
> if (!xe_device_uc_enabled(uc_to_xe(uc)))
> return 0;
>
> - ret = xe_uc_sanitize_reset(uc);
> - if (ret)
> - return ret;
> -
> ret = xe_huc_upload(&uc->huc);
> if (ret)
> return ret;
> diff --git a/drivers/gpu/drm/xe/xe_uc.h b/drivers/gpu/drm/xe/xe_uc.h
> index 4109ae7028af5..5d5110c0c834b 100644
> --- a/drivers/gpu/drm/xe/xe_uc.h
> +++ b/drivers/gpu/drm/xe/xe_uc.h
> @@ -19,6 +19,6 @@ void xe_uc_stop_prepare(struct xe_uc *uc);
> int xe_uc_stop(struct xe_uc *uc);
> int xe_uc_start(struct xe_uc *uc);
> int xe_uc_suspend(struct xe_uc *uc);
> -void xe_uc_sanitize(struct xe_uc *uc);
> +int xe_uc_sanitize_reset(struct xe_uc *uc);
>
> #endif
> --
> 2.42.1
>
More information about the Intel-xe
mailing list