[PATCH] drm/xe/pf: Assert LMEM provisioning is done only on DGFX

Rodrigo Vivi rodrigo.vivi at intel.com
Fri Jun 7 16:08:58 UTC 2024


On Fri, Jun 07, 2024 at 05:31:55PM +0200, Michal Wajdeczko wrote:
> The Local Memory (aka VRAM) is only available on DGFX platforms.
> We shouldn't attempt to provision VFs with LMEM or attempt to
> update the LMTT on non-DGFX platforms. Add missing asserts that
> would enforce that and fix release code that could crash on iGFX
> due to uninitialized LMTT.
> 

Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

> Fixes: c063cce7df3a ("drm/xe/pf: Update the LMTT when freeing VF GT config")
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Piotr Piórkowski <piotr.piorkowski at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> index f49fc2917f93..694671497f6e 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> @@ -1290,6 +1290,9 @@ static void pf_reset_vf_lmtt(struct xe_device *xe, unsigned int vfid)
>  	struct xe_tile *tile;
>  	unsigned int tid;
>  
> +	xe_assert(xe, IS_DGFX(xe));
> +	xe_assert(xe, IS_SRIOV_PF(xe));
> +
>  	for_each_tile(tile, xe, tid) {
>  		lmtt = &tile->sriov.pf.lmtt;
>  		xe_lmtt_drop_pages(lmtt, vfid);
> @@ -1308,6 +1311,9 @@ static int pf_update_vf_lmtt(struct xe_device *xe, unsigned int vfid)
>  	unsigned int tid;
>  	int err;
>  
> +	xe_assert(xe, IS_DGFX(xe));
> +	xe_assert(xe, IS_SRIOV_PF(xe));
> +
>  	total = 0;
>  	for_each_tile(tile, xe, tid)
>  		total += pf_get_vf_config_lmem(tile->primary_gt, vfid);
> @@ -1353,6 +1359,7 @@ static int pf_update_vf_lmtt(struct xe_device *xe, unsigned int vfid)
>  
>  static void pf_release_vf_config_lmem(struct xe_gt *gt, struct xe_gt_sriov_config *config)
>  {
> +	xe_gt_assert(gt, IS_DGFX(gt_to_xe(gt)));
>  	xe_gt_assert(gt, !xe_gt_is_media_type(gt));
>  	lockdep_assert_held(xe_gt_sriov_pf_master_mutex(gt));
>  
> @@ -1371,6 +1378,7 @@ static int pf_provision_vf_lmem(struct xe_gt *gt, unsigned int vfid, u64 size)
>  	int err;
>  
>  	xe_gt_assert(gt, vfid);
> +	xe_gt_assert(gt, IS_DGFX(xe));
>  	xe_gt_assert(gt, !xe_gt_is_media_type(gt));
>  
>  	size = round_up(size, pf_get_lmem_alignment(gt));
> @@ -1838,11 +1846,14 @@ u32 xe_gt_sriov_pf_config_get_threshold(struct xe_gt *gt, unsigned int vfid,
>  static void pf_release_vf_config(struct xe_gt *gt, unsigned int vfid)
>  {
>  	struct xe_gt_sriov_config *config = pf_pick_vf_config(gt, vfid);
> +	struct xe_device *xe = gt_to_xe(gt);
>  
>  	if (!xe_gt_is_media_type(gt)) {
>  		pf_release_vf_config_ggtt(gt, config);
> -		pf_release_vf_config_lmem(gt, config);
> -		pf_update_vf_lmtt(gt_to_xe(gt), vfid);
> +		if (IS_DGFX(xe)) {
> +			pf_release_vf_config_lmem(gt, config);
> +			pf_update_vf_lmtt(xe, vfid);
> +		}
>  	}
>  	pf_release_config_ctxs(gt, config);
>  	pf_release_config_dbs(gt, config);
> -- 
> 2.43.0
> 


More information about the Intel-xe mailing list