[PATCH v2 7/7] drm/xe/sriov: support non-contig VRAM provisioning

K V P, Satyanarayana satyanarayana.k.v.p at intel.com
Thu Jan 23 09:30:20 UTC 2025


> -----Original Message-----
> From: Auld, Matthew <matthew.auld at intel.com>
> Sent: Wednesday, December 18, 2024 5:49 PM
> To: intel-xe at lists.freedesktop.org
> Cc: K V P, Satyanarayana <satyanarayana.k.v.p at intel.com>; Thomas Hellström
> <thomas.hellstrom at linux.intel.com>; Brost, Matthew
> <matthew.brost at intel.com>
> Subject: [PATCH v2 7/7] drm/xe/sriov: support non-contig VRAM provisioning
> 
> Currently we can run into issues with provisioning VRAM region, due to
> requiring contig VRAM BO underneath. We sometimes see that allocation
> (multiple GB) can fail even when there is enough free space.  We don't
> need CPU access to the buffer in the first place, so can forgo pin_map
> and therefore also the contig requirement. Keep the same behavior with
> save and restore during suspend/resume (which can now be done with
> blitter).  We also need the VRAM to occupy the same pages so we don't
> need to re-program the LMTT, so should still remain pinned (also we
> don't want something to try evict it). With that covert over to plain
> pinned kernel object.
> 
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> Cc: Satyanarayana K V P <satyanarayana.k.v.p at intel.com>
> Cc: Thomas Hellström <thomas.hellstrom at linux.intel.com>
> Cc: Matthew Brost <matthew.brost at intel.com>
> ---
Reviewed-by: Satyanarayana K V P <satyanarayana.k.v.p at intel.com>
>  drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 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 65082f12f1a8..56a178aca0d4 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> @@ -1409,15 +1409,22 @@ static int pf_provision_vf_lmem(struct xe_gt
> *gt, unsigned int vfid, u64 size)
>  		return 0;
> 
>  	xe_gt_assert(gt, pf_get_lmem_alignment(gt) == SZ_2M);
> -	bo = xe_bo_create_pin_map(xe, tile, NULL,
> -				  ALIGN(size, PAGE_SIZE),
> -				  ttm_bo_type_kernel,
> -				  XE_BO_FLAG_VRAM_IF_DGFX(tile) |
> -				  XE_BO_FLAG_NEEDS_2M |
> -				  XE_BO_FLAG_PINNED);
> +	bo = xe_bo_create_locked(xe, tile, NULL,
> +				 ALIGN(size, PAGE_SIZE),
> +				 ttm_bo_type_kernel,
> +				 XE_BO_FLAG_VRAM_IF_DGFX(tile) |
> +				 XE_BO_FLAG_NEEDS_2M |
> +				 XE_BO_FLAG_PINNED);
>  	if (IS_ERR(bo))
>  		return PTR_ERR(bo);
> 
> +	err = xe_bo_pin(bo);
> +	xe_bo_unlock(bo);
> +	if (unlikely(err)) {
> +		xe_bo_put(bo);
> +		return err;
> +	}
> +
>  	config->lmem_obj = bo;
> 
>  	err = pf_update_vf_lmtt(xe, vfid);
> --
> 2.47.1



More information about the Intel-xe mailing list