[PATCH 2/4] drm/xe/huc: Realloc HuC FW in vram for post-hwconfig
Matthew Brost
matthew.brost at intel.com
Thu Feb 1 17:41:12 UTC 2024
On Mon, Jan 29, 2024 at 02:03:06PM +0100, Michał Winiarski wrote:
> Similar to GuC, we're using system memory for the initial stage, and
> move the image to vram when it's available for subsequent loads (e.g.
> after reset).
>
This patch LGTM but same question as in [1] - should we release the
system memory for the HuC once the VRAM is allocated?
Matt
[1] https://patchwork.freedesktop.org/patch/576287/?series=129268&rev=1
> Signed-off-by: Michał Winiarski <michal.winiarski at intel.com>
> ---
> drivers/gpu/drm/xe/xe_huc.c | 19 +++++++++++++++++++
> drivers/gpu/drm/xe/xe_huc.h | 1 +
> drivers/gpu/drm/xe/xe_uc.c | 4 ++++
> 3 files changed, 24 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_huc.c b/drivers/gpu/drm/xe/xe_huc.c
> index eca109791c6ae..b545f850087cd 100644
> --- a/drivers/gpu/drm/xe/xe_huc.c
> +++ b/drivers/gpu/drm/xe/xe_huc.c
> @@ -112,6 +112,25 @@ int xe_huc_init(struct xe_huc *huc)
> return ret;
> }
>
> +int xe_huc_init_post_hwconfig(struct xe_huc *huc)
> +{
> + struct xe_tile *tile = gt_to_tile(huc_to_gt(huc));
> + struct xe_device *xe = huc_to_xe(huc);
> + int ret;
> +
> + if (!IS_DGFX(huc_to_xe(huc)))
> + return 0;
> +
> + if (!xe_uc_fw_is_loadable(&huc->fw))
> + return 0;
> +
> + ret = xe_managed_bo_reinit_in_vram(xe, tile, &huc->fw.bo);
> + if (ret)
> + return ret;
> +
> + return 0;
> +}
> +
> int xe_huc_upload(struct xe_huc *huc)
> {
> if (!xe_uc_fw_is_loadable(&huc->fw))
> diff --git a/drivers/gpu/drm/xe/xe_huc.h b/drivers/gpu/drm/xe/xe_huc.h
> index 532017230287f..3ab56cc14b00a 100644
> --- a/drivers/gpu/drm/xe/xe_huc.h
> +++ b/drivers/gpu/drm/xe/xe_huc.h
> @@ -17,6 +17,7 @@ enum xe_huc_auth_types {
> };
>
> int xe_huc_init(struct xe_huc *huc);
> +int xe_huc_init_post_hwconfig(struct xe_huc *huc);
> int xe_huc_upload(struct xe_huc *huc);
> int xe_huc_auth(struct xe_huc *huc, enum xe_huc_auth_types type);
> bool xe_huc_is_authenticated(struct xe_huc *huc, enum xe_huc_auth_types type);
> diff --git a/drivers/gpu/drm/xe/xe_uc.c b/drivers/gpu/drm/xe/xe_uc.c
> index 8f37a809525fb..d62137306d280 100644
> --- a/drivers/gpu/drm/xe/xe_uc.c
> +++ b/drivers/gpu/drm/xe/xe_uc.c
> @@ -94,6 +94,10 @@ int xe_uc_init_post_hwconfig(struct xe_uc *uc)
> if (err)
> return err;
>
> + err = xe_huc_init_post_hwconfig(&uc->huc);
> + if (err)
> + return err;
> +
> return xe_gsc_init_post_hwconfig(&uc->gsc);
> }
>
> --
> 2.43.0
>
More information about the Intel-xe
mailing list