[PATCH 3/3] drm/xe/pf: Enable per-function engine activity stats

Umesh Nerlige Ramappa umesh.nerlige.ramappa at intel.com
Fri Mar 7 00:08:56 UTC 2025


On Tue, Mar 04, 2025 at 03:27:43PM +0530, Riana Tauro wrote:
>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 at intel.com>
>Signed-off-by: Riana Tauro <riana.tauro at intel.com>

lgtm,

Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>

Thanks,
Umesh
>---
> drivers/gpu/drm/xe/xe_pci_sriov.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
>diff --git a/drivers/gpu/drm/xe/xe_pci_sriov.c b/drivers/gpu/drm/xe/xe_pci_sriov.c
>index b9ac3b4e0497..d78e57070931 100644
>--- a/drivers/gpu/drm/xe/xe_pci_sriov.c
>+++ b/drivers/gpu/drm/xe/xe_pci_sriov.c
>@@ -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"
>@@ -120,6 +121,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);
>@@ -154,6 +169,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:
>@@ -177,6 +195,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);
>-- 
>2.47.1
>


More information about the Intel-xe mailing list