]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/xe/pf: Skip LMTT update if no LMEM was provisioned
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Fri, 1 Aug 2025 14:44:18 +0000 (16:44 +0200)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Fri, 1 Aug 2025 19:14:45 +0000 (21:14 +0200)
During VF unprovisioning, if VF was not provisioned with LMEM,
there is no need to trigger LMTT update, as VF LMTT was never
set. This will spare us sending full TLB invalidation requests.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Link: https://lore.kernel.org/r/20250801144418.180584-1-michal.wajdeczko@intel.com
drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c

index f00cce81f1ff5f72e78c1c59ac1f013e29807aa7..c8f0320d032fc0761d52fda12f178409194518fa 100644 (file)
@@ -1434,7 +1434,8 @@ fail:
        return err;
 }
 
-static void pf_release_vf_config_lmem(struct xe_gt *gt, struct xe_gt_sriov_config *config)
+/* Return: %true if there was an LMEM provisioned, %false otherwise */
+static bool pf_release_vf_config_lmem(struct xe_gt *gt, struct xe_gt_sriov_config *config)
 {
        xe_gt_assert(gt, IS_DGFX(gt_to_xe(gt)));
        xe_gt_assert(gt, xe_gt_is_main_type(gt));
@@ -1443,7 +1444,9 @@ static void pf_release_vf_config_lmem(struct xe_gt *gt, struct xe_gt_sriov_confi
        if (config->lmem_obj) {
                xe_bo_unpin_map_no_vm(config->lmem_obj);
                config->lmem_obj = NULL;
+               return true;
        }
+       return false;
 }
 
 static int pf_provision_vf_lmem(struct xe_gt *gt, unsigned int vfid, u64 size)
@@ -2021,12 +2024,13 @@ static void pf_release_vf_config(struct xe_gt *gt, unsigned int vfid)
 {
        struct xe_gt_sriov_config *config = pf_pick_vf_config(gt, vfid);
        struct xe_device *xe = gt_to_xe(gt);
+       bool released;
 
        if (xe_gt_is_main_type(gt)) {
                pf_release_vf_config_ggtt(gt, config);
                if (IS_DGFX(xe)) {
-                       pf_release_vf_config_lmem(gt, config);
-                       if (xe_device_has_lmtt(xe))
+                       released = pf_release_vf_config_lmem(gt, config);
+                       if (released && xe_device_has_lmtt(xe))
                                pf_update_vf_lmtt(xe, vfid);
                }
        }