Skip to content

Commit bf6cb06

Browse files
rtauro1895lucasdemarchi
authored andcommitted
drm/xe/pf: Enable per-function engine activity stats
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 <[email protected]> Signed-off-by: Riana Tauro <[email protected]> Reviewed-by: Umesh Nerlige Ramappa <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Lucas De Marchi <[email protected]>
1 parent 8a4339f commit bf6cb06

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/gpu/drm/xe/xe_pci_sriov.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "xe_device.h"
88
#include "xe_gt_sriov_pf_config.h"
99
#include "xe_gt_sriov_pf_control.h"
10+
#include "xe_guc_engine_activity.h"
1011
#include "xe_pci_sriov.h"
1112
#include "xe_pm.h"
1213
#include "xe_sriov.h"
@@ -111,6 +112,20 @@ static void pf_link_vfs(struct xe_device *xe, int num_vfs)
111112
}
112113
}
113114

115+
static void pf_engine_activity_stats(struct xe_device *xe, unsigned int num_vfs, bool enable)
116+
{
117+
struct xe_gt *gt;
118+
unsigned int id;
119+
int ret = 0;
120+
121+
for_each_gt(gt, xe, id) {
122+
ret = xe_guc_engine_activity_function_stats(&gt->uc.guc, num_vfs, enable);
123+
if (ret)
124+
xe_sriov_info(xe, "Failed to %s engine activity function stats (%pe)\n",
125+
str_enable_disable(enable), ERR_PTR(ret));
126+
}
127+
}
128+
114129
static int pf_enable_vfs(struct xe_device *xe, int num_vfs)
115130
{
116131
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)
145160

146161
xe_sriov_info(xe, "Enabled %u of %u VF%s\n",
147162
num_vfs, total_vfs, str_plural(total_vfs));
163+
164+
pf_engine_activity_stats(xe, num_vfs, true);
165+
148166
return num_vfs;
149167

150168
failed:
@@ -168,6 +186,8 @@ static int pf_disable_vfs(struct xe_device *xe)
168186
if (!num_vfs)
169187
return 0;
170188

189+
pf_engine_activity_stats(xe, num_vfs, false);
190+
171191
pci_disable_sriov(pdev);
172192

173193
pf_reset_vfs(xe, num_vfs);

0 commit comments

Comments
 (0)