]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe/pf: Enable per-function engine activity stats
authorRiana Tauro <riana.tauro@intel.com>
Tue, 11 Mar 2025 07:17:59 +0000 (12:47 +0530)
committerLucas De Marchi <lucas.demarchi@intel.com>
Tue, 25 Mar 2025 14:14:32 +0000 (07:14 -0700)
Enable per-function engine activity stats when VF's are enabled
and disable when VF's are disabled

v2: fix commit message
    remove reset stats from pf config (Michal)

Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Riana Tauro <riana.tauro@intel.com>
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250311071759.2117211-4-riana.tauro@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/xe_pci_sriov.c

index 09ee8a06fe2ed35ccd03f9455bbdb82963cf06ac..d69b6b2a30615f3a9b16b45c912259126d09bf49 100644 (file)
@@ -7,6 +7,7 @@
 #include "xe_device.h"
 #include "xe_gt_sriov_pf_config.h"
 #include "xe_gt_sriov_pf_control.h"
+#include "xe_guc_engine_activity.h"
 #include "xe_pci_sriov.h"
 #include "xe_pm.h"
 #include "xe_sriov.h"
@@ -111,6 +112,20 @@ static void pf_link_vfs(struct xe_device *xe, int num_vfs)
        }
 }
 
+static void pf_engine_activity_stats(struct xe_device *xe, unsigned int num_vfs, bool enable)
+{
+       struct xe_gt *gt;
+       unsigned int id;
+       int ret = 0;
+
+       for_each_gt(gt, xe, id) {
+               ret = xe_guc_engine_activity_function_stats(&gt->uc.guc, num_vfs, enable);
+               if (ret)
+                       xe_sriov_info(xe, "Failed to %s engine activity function stats (%pe)\n",
+                                     str_enable_disable(enable), ERR_PTR(ret));
+       }
+}
+
 static int pf_enable_vfs(struct xe_device *xe, int num_vfs)
 {
        struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
@@ -145,6 +160,9 @@ static int pf_enable_vfs(struct xe_device *xe, int num_vfs)
 
        xe_sriov_info(xe, "Enabled %u of %u VF%s\n",
                      num_vfs, total_vfs, str_plural(total_vfs));
+
+       pf_engine_activity_stats(xe, num_vfs, true);
+
        return num_vfs;
 
 failed:
@@ -168,6 +186,8 @@ static int pf_disable_vfs(struct xe_device *xe)
        if (!num_vfs)
                return 0;
 
+       pf_engine_activity_stats(xe, num_vfs, false);
+
        pci_disable_sriov(pdev);
 
        pf_reset_vfs(xe, num_vfs);