]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe/pf: Expose LMTT page size
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Wed, 18 Feb 2026 20:55:43 +0000 (21:55 +0100)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Fri, 20 Feb 2026 14:49:58 +0000 (15:49 +0100)
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
drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
drivers/gpu/drm/xe/xe_lmtt.c
drivers/gpu/drm/xe/xe_lmtt.h

index 888193e1d2c5073f8db1fd1131b8905aa8f507c1..e06baf12e1089ed20615240f509330c9a0ffcbfe 100644 (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)
index 2077e1ef8b43401f6b0fdc69ae8d986e8d6bfa2f..b583e0f20183785d4e28b00d7009c0d9452e6d6e 100644 (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;
index 75a234fbf36706118e805efa67abe620f3b7f37f..8fa387b38c52016c416f1553689775af211d3561 100644 (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) { }