drm/xe/pf: Expose LMTT page size

The underlying LMTT implementation already provides the info about
the page size it is using.  There is no need to have a separate
helper function that is making assumption about the required size.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Piotr Piórkowski <piotr.piorkowski@intel.com>
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Link: https://patch.msgid.link/20260218205553.3561-2-michal.wajdeczko@intel.com
This commit is contained in:
Michal Wajdeczko
2026-02-18 21:55:43 +01:00
parent c2366539d3
commit 2d892455f3
3 changed files with 19 additions and 2 deletions

View File

@@ -1451,8 +1451,7 @@ int xe_gt_sriov_pf_config_set_fair_dbs(struct xe_gt *gt, unsigned int vfid,
static u64 pf_get_lmem_alignment(struct xe_gt *gt)
{
/* this might be platform dependent */
return SZ_2M;
return xe_lmtt_page_size(&gt->tile->sriov.pf.lmtt);
}
static u64 pf_get_min_spare_lmem(struct xe_gt *gt)

View File

@@ -57,6 +57,23 @@ static u64 lmtt_page_size(struct xe_lmtt *lmtt)
return BIT_ULL(lmtt->ops->lmtt_pte_shift(0));
}
/**
* xe_lmtt_page_size() - Get LMTT page size.
* @lmtt: the &xe_lmtt
*
* This function shall be called only by PF.
*
* Return: LMTT page size.
*/
u64 xe_lmtt_page_size(struct xe_lmtt *lmtt)
{
lmtt_assert(lmtt, IS_SRIOV_PF(lmtt_to_xe(lmtt)));
lmtt_assert(lmtt, xe_device_has_lmtt(lmtt_to_xe(lmtt)));
lmtt_assert(lmtt, lmtt->ops);
return lmtt_page_size(lmtt);
}
static struct xe_lmtt_pt *lmtt_pt_alloc(struct xe_lmtt *lmtt, unsigned int level)
{
unsigned int num_entries = level ? lmtt->ops->lmtt_pte_num(level) : 0;

View File

@@ -20,6 +20,7 @@ int xe_lmtt_prepare_pages(struct xe_lmtt *lmtt, unsigned int vfid, u64 range);
int xe_lmtt_populate_pages(struct xe_lmtt *lmtt, unsigned int vfid, struct xe_bo *bo, u64 offset);
void xe_lmtt_drop_pages(struct xe_lmtt *lmtt, unsigned int vfid);
u64 xe_lmtt_estimate_pt_size(struct xe_lmtt *lmtt, u64 size);
u64 xe_lmtt_page_size(struct xe_lmtt *lmtt);
#else
static inline int xe_lmtt_init(struct xe_lmtt *lmtt) { return 0; }
static inline void xe_lmtt_init_hw(struct xe_lmtt *lmtt) { }