[PATCH] drm/xe/pf: Don't allow LMEM provisioning if LMTT isn't available on the device
Michal Wajdeczko
michal.wajdeczko at intel.com
Tue Apr 15 10:32:47 UTC 2025
On 28.03.2025 11:23, Piórkowski, Piotr wrote:
> From: Piotr Piórkowski <piotr.piorkowski at intel.com>
>
> Currently, LMEM provisioning is fully dependent on LMTT, and we are
> unable to make useful LMEM provisioning without LMTT.
> Let's don't allow LMEM provisioning if LMTT is not available on the
> device.
maybe shorter:
"The LMEM provisioning is applicable only on platforms with LMTT.
>
> Signed-off-by: Piotr Piórkowski <piotr.piorkowski at intel.com>
> ---
> drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 8 +++++---
> drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c | 2 +-
> 2 files changed, 6 insertions(+), 4 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 10be109bf357..265e58c55c6d 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> @@ -1513,7 +1513,9 @@ int xe_gt_sriov_pf_config_set_lmem(struct xe_gt *gt, unsigned int vfid, u64 size
> int err;
>
> mutex_lock(xe_gt_sriov_pf_master_mutex(gt));
> - if (vfid)
> + if (!xe_device_has_lmtt(gt_to_xe(gt)))
> + err = -EROFS;
do we need this? if there is no lmtt then we shouldn't use/expose lmem
configuration in the first place
maybe xe_gt_assert will be sufficient?
> + else if (vfid)
> err = pf_provision_vf_lmem(gt, vfid, size);
> else
> err = pf_set_spare_lmem(gt, size);
> @@ -1621,7 +1623,7 @@ int xe_gt_sriov_pf_config_set_fair_lmem(struct xe_gt *gt, unsigned int vfid,
> xe_gt_assert(gt, num_vfs);
> xe_gt_assert(gt, !xe_gt_is_media_type(gt));
>
> - if (!IS_DGFX(gt_to_xe(gt)))
> + if (!xe_device_has_lmtt(gt_to_xe(gt)))
> return 0;
>
> mutex_lock(xe_gt_sriov_pf_master_mutex(gt));
> @@ -2155,7 +2157,7 @@ static int pf_validate_vf_config(struct xe_gt *gt, unsigned int vfid)
> valid_all = valid_all && valid_ggtt;
> valid_any = valid_any || (valid_ggtt && is_primary);
>
> - if (IS_DGFX(xe)) {
> + if (xe_device_has_lmtt(xe)) {
> bool valid_lmem = pf_get_vf_config_lmem(primary_gt, vfid);
>
> valid_any = valid_any || (valid_lmem && is_primary);
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c
> index b2521dd6ec42..5f41381df860 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c
> @@ -286,7 +286,7 @@ static void pf_add_config_attrs(struct xe_gt *gt, struct dentry *parent, unsigne
> if (!xe_gt_is_media_type(gt)) {
> debugfs_create_file_unsafe(vfid ? "ggtt_quota" : "ggtt_spare",
> 0644, parent, parent, &ggtt_fops);
> - if (IS_DGFX(gt_to_xe(gt)))
> + if (xe_device_has_lmtt(gt_to_xe(gt)))
> debugfs_create_file_unsafe(vfid ? "lmem_quota" : "lmem_spare",
> 0644, parent, parent, &lmem_fops);
> }
btw, this needs to be rebased and take into account the pf_lmem_info
attributes introduced recently
More information about the Intel-xe
mailing list