From 7704f32c93cff69d8d0e842638f30e4dc9d93b2a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Winiarski?= Date: Tue, 5 Dec 2023 02:33:07 +0100 Subject: [PATCH] drm/xe/uc: Extract xe_uc_sanitize_reset MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Earlier GuC load will require more fine-grained control over reset. Extract it outside of xe_uc_init_hw. Signed-off-by: Michał Winiarski Reviewed-by: Matthew Brost Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/xe/xe_gt.c | 4 ++++ drivers/gpu/drm/xe/xe_uc.c | 12 ++++++------ drivers/gpu/drm/xe/xe_uc.h | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c index 4db94344bbde..a9c71da985d3 100644 --- a/drivers/gpu/drm/xe/xe_gt.c +++ b/drivers/gpu/drm/xe/xe_gt.c @@ -542,6 +542,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 15dcd1f91e9c..72a7b3c2577d 100644 --- a/drivers/gpu/drm/xe/xe_uc.c +++ b/drivers/gpu/drm/xe/xe_uc.c @@ -80,6 +80,10 @@ int xe_uc_init_post_hwconfig(struct xe_uc *uc) if (!xe_device_uc_enabled(uc_to_xe(uc))) return 0; + err = xe_uc_sanitize_reset(uc); + if (err) + return err; + err = xe_guc_init_post_hwconfig(&uc->guc); if (err) return err; @@ -101,13 +105,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); @@ -147,10 +151,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 4109ae7028af..5d5110c0c834 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.39.5