[PATCH v4 1/1] drm/xe/pf: Use an explicit check to see if the device has LMTT

Upadhyay, Tejas tejas.upadhyay at intel.com
Fri Feb 7 13:37:05 UTC 2025



> -----Original Message-----
> From: Intel-xe <intel-xe-bounces at lists.freedesktop.org> On Behalf Of
> Piórkowski, Piotr
> Sent: Friday, February 7, 2025 5:01 PM
> To: intel-xe at lists.freedesktop.org
> Cc: Piorkowski, Piotr <piotr.piorkowski at intel.com>; Wajdeczko, Michal
> <Michal.Wajdeczko at intel.com>; Winiarski, Michal
> <michal.winiarski at intel.com>; K V P, Satyanarayana
> <satyanarayana.k.v.p at intel.com>
> Subject: [PATCH v4 1/1] drm/xe/pf: Use an explicit check to see if the device
> has LMTT
> 
> From: Piotr Piórkowski <piotr.piorkowski at intel.com>
> 
> So far, the main condition for using LMTT has been to check that the device is a
> discrete gfx.
> Let's add a dedicated function to check if the device supports LMTT as not all
> future discrete GPU platforms will require LMTT.
> 
> v2:
>  - use xe_has_device_lmtt only when necessary - leave IS_DGFX for other
>    things related to LMEM provisioning
> v3:
>  - remove IS_SRIOV_PF condition from xe_device_has_lmtt (Michal
>    Wajdeczko)
>  - keep IS_SRIOV_PF asserts in LMTT-related code (Michal Wajdeczko)
> v4:
>  - update commit description
> 

Change LGTM,
Reviewed-by: Tejas Upadhyay <tejas.upadhyay at intel.com>

> Signed-off-by: Piotr Piórkowski <piotr.piorkowski at intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Michał Winiarski <michal.winiarski at intel.com>
> Cc: Satyanarayana K V P <satyanarayana.k.v.p at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_device.h             |  5 +++++
>  drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 21 +++++++++++++--------
>  drivers/gpu/drm/xe/xe_lmtt.c               |  4 ++--
>  3 files changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_device.h
> b/drivers/gpu/drm/xe/xe_device.h index fc3c2af3fb7f..0bc3bc8e6803
> 100644
> --- a/drivers/gpu/drm/xe/xe_device.h
> +++ b/drivers/gpu/drm/xe/xe_device.h
> @@ -170,6 +170,11 @@ static inline bool xe_device_uses_memirq(struct
> xe_device *xe)
>  	return xe_device_has_memirq(xe) && (IS_SRIOV_VF(xe) ||
> xe_device_has_msix(xe));  }
> 
> +static inline bool xe_device_has_lmtt(struct xe_device *xe) {
> +	return IS_DGFX(xe);
> +}
> +
>  u32 xe_device_ccs_bytes(struct xe_device *xe, u64 size);
> 
>  void xe_device_snapshot_print(struct xe_device *xe, struct drm_printer *p);
> 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 b1d994d65589..5c3e9e5bd051 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> @@ -1336,7 +1336,7 @@ 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, xe_device_has_lmtt(xe));
>  	xe_assert(xe, IS_SRIOV_PF(xe));
> 
>  	for_each_tile(tile, xe, tid) {
> @@ -1357,7 +1357,7 @@ 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, xe_device_has_lmtt(xe));
>  	xe_assert(xe, IS_SRIOV_PF(xe));
> 
>  	total = 0;
> @@ -1434,7 +1434,8 @@ static int pf_provision_vf_lmem(struct xe_gt *gt,
> unsigned int vfid, u64 size)
>  		if (unlikely(err))
>  			return err;
> 
> -		pf_reset_vf_lmtt(xe, vfid);
> +		if (xe_device_has_lmtt(xe))
> +			pf_reset_vf_lmtt(xe, vfid);
>  		pf_release_vf_config_lmem(gt, config);
>  	}
>  	xe_gt_assert(gt, !config->lmem_obj);
> @@ -1454,9 +1455,11 @@ static int pf_provision_vf_lmem(struct xe_gt *gt,
> unsigned int vfid, u64 size)
> 
>  	config->lmem_obj = bo;
> 
> -	err = pf_update_vf_lmtt(xe, vfid);
> -	if (unlikely(err))
> -		goto release;
> +	if (xe_device_has_lmtt(xe)) {
> +		err = pf_update_vf_lmtt(xe, vfid);
> +		if (unlikely(err))
> +			goto release;
> +	}
> 
>  	err = pf_push_vf_cfg_lmem(gt, vfid, bo->size);
>  	if (unlikely(err))
> @@ -1467,7 +1470,8 @@ static int pf_provision_vf_lmem(struct xe_gt *gt,
> unsigned int vfid, u64 size)
>  	return 0;
> 
>  reset_lmtt:
> -	pf_reset_vf_lmtt(xe, vfid);
> +	if (xe_device_has_lmtt(xe))
> +		pf_reset_vf_lmtt(xe, vfid);
>  release:
>  	pf_release_vf_config_lmem(gt, config);
>  	return err;
> @@ -1981,7 +1985,8 @@ static void pf_release_vf_config(struct xe_gt *gt,
> unsigned int vfid)
>  		pf_release_vf_config_ggtt(gt, config);
>  		if (IS_DGFX(xe)) {
>  			pf_release_vf_config_lmem(gt, config);
> -			pf_update_vf_lmtt(xe, vfid);
> +			if (xe_device_has_lmtt(xe))
> +				pf_update_vf_lmtt(xe, vfid);
>  		}
>  	}
>  	pf_release_config_ctxs(gt, config);
> diff --git a/drivers/gpu/drm/xe/xe_lmtt.c b/drivers/gpu/drm/xe/xe_lmtt.c
> index a60ceae4c6dd..89393dcb53d9 100644
> --- a/drivers/gpu/drm/xe/xe_lmtt.c
> +++ b/drivers/gpu/drm/xe/xe_lmtt.c
> @@ -164,7 +164,7 @@ int xe_lmtt_init(struct xe_lmtt *lmtt)
>  	lmtt_assert(lmtt, IS_SRIOV_PF(xe));
>  	lmtt_assert(lmtt, !lmtt->ops);
> 
> -	if (!IS_DGFX(xe))
> +	if (!xe_device_has_lmtt(xe))
>  		return 0;
> 
>  	if (xe_has_multi_level_lmtt(xe))
> @@ -486,7 +486,7 @@ u64 xe_lmtt_estimate_pt_size(struct xe_lmtt *lmtt,
> u64 size)
>  	u64 pt_size;
> 
>  	lmtt_assert(lmtt, IS_SRIOV_PF(lmtt_to_xe(lmtt)));
> -	lmtt_assert(lmtt, IS_DGFX(lmtt_to_xe(lmtt)));
> +	lmtt_assert(lmtt, xe_device_has_lmtt(lmtt_to_xe(lmtt)));
>  	lmtt_assert(lmtt, lmtt->ops);
> 
>  	pt_size = PAGE_ALIGN(lmtt->ops->lmtt_pte_size(level) *
> --
> 2.34.1



More information about the Intel-xe mailing list