]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe/pf: Use an explicit check to see if the device has LMTT
authorPiotr Piórkowski <piotr.piorkowski@intel.com>
Fri, 7 Feb 2025 11:31:11 +0000 (12:31 +0100)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Mon, 10 Feb 2025 10:10:14 +0000 (11:10 +0100)
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

Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Cc: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Reviewed-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
Reviewed-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250207113111.853821-2-piotr.piorkowski@intel.com
drivers/gpu/drm/xe/xe_device.h
drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
drivers/gpu/drm/xe/xe_lmtt.c

index fc3c2af3fb7fd186ee559c44e142543ec33bddee..0bc3bc8e680309319261140122c02974547066d7 100644 (file)
@@ -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);
index b1d994d65589639c15058ca40a96f981bfd5833b..5c3e9e5bd05191bc9cd9207650e9765610379600 100644 (file)
@@ -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);
index a60ceae4c6dd2adc232245fe886efbd646700ff3..89393dcb53d9d639e309245b2f49b2e276231eae 100644 (file)
@@ -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) *