<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 1/20/2025 21:34, Marcin Bernatowicz
wrote:<br>
</div>
<blockquote type="cite" cite="mid:20250120203445.16285-3-marcin.bernatowicz@linux.intel.com">
<pre wrap="" class="moz-quote-pre">Introduce a function to validate default SR-IOV scheduling attributes
for VFs and PF. This function skips the test if non-default attributes
are detected. The default attributes verified include:
- exec_quantum_ms set to 0 (infinite execution quantum)
- preempt_timeout_us set to 0 (infinite preemption timeout)
- sched_if_idle set to false
- reset_engine set to false
- sched_priority set to XE_SRIOV_SCHED_PRIORITY_LOW
Signed-off-by: Marcin Bernatowicz <a class="moz-txt-link-rfc2396E" href="mailto:marcin.bernatowicz@linux.intel.com"><marcin.bernatowicz@linux.intel.com></a>
Cc: Adam Miszczak <a class="moz-txt-link-rfc2396E" href="mailto:adam.miszczak@linux.intel.com"><adam.miszczak@linux.intel.com></a>
Cc: Jakub Kolakowski <a class="moz-txt-link-rfc2396E" href="mailto:jakub1.kolakowski@intel.com"><jakub1.kolakowski@intel.com></a>
Cc: Lukasz Laguna <a class="moz-txt-link-rfc2396E" href="mailto:lukasz.laguna@intel.com"><lukasz.laguna@intel.com></a>
Cc: Michał Wajdeczko <a class="moz-txt-link-rfc2396E" href="mailto:michal.wajdeczko@intel.com"><michal.wajdeczko@intel.com></a>
Cc: Michał Winiarski <a class="moz-txt-link-rfc2396E" href="mailto:michal.winiarski@intel.com"><michal.winiarski@intel.com></a>
Cc: Narasimha C V <a class="moz-txt-link-rfc2396E" href="mailto:narasimha.c.v@intel.com"><narasimha.c.v@intel.com></a>
Cc: Piotr Piórkowski <a class="moz-txt-link-rfc2396E" href="mailto:piotr.piorkowski@intel.com"><piotr.piorkowski@intel.com></a>
Cc: Satyanarayana K V P <a class="moz-txt-link-rfc2396E" href="mailto:satyanarayana.k.v.p@intel.com"><satyanarayana.k.v.p@intel.com></a>
Cc: Tomasz Lis <a class="moz-txt-link-rfc2396E" href="mailto:tomasz.lis@intel.com"><tomasz.lis@intel.com></a>
---
lib/xe/xe_sriov_provisioning.c | 42 ++++++++++++++++++++++++++++++++++
lib/xe/xe_sriov_provisioning.h | 1 +
2 files changed, 43 insertions(+)
diff --git a/lib/xe/xe_sriov_provisioning.c b/lib/xe/xe_sriov_provisioning.c
index 4e3fbaae2..da580144d 100644
--- a/lib/xe/xe_sriov_provisioning.c
+++ b/lib/xe/xe_sriov_provisioning.c
@@ -663,3 +663,45 @@ void xe_sriov_set_sched_priority(int pf, unsigned int vf_num, unsigned int gt_nu
{
igt_fail_on(__xe_sriov_set_sched_priority(pf, vf_num, gt_num, value));
}
+
+/**
+ * xe_sriov_require_default_scheduling_attributes - Ensure default SR-IOV scheduling attributes
+ * @pf_fd: PF device file descriptor
+ *
+ * Skips the current test if non-default SR-IOV scheduling attributes are set.
+ *
+ * Default scheduling attributes are as follows for each VF and PF:
+ * - exec_quantum_ms equals zero (meaning infinity)
+ * - preempt_timeout_us equals zero (meaning infinity)
+ * - sched_if_idle equals false
+ * - reset_engine equals false
+ * - sched_priority equals XE_SRIOV_SCHED_PRIORITY_LOW
+ */
+void xe_sriov_require_default_scheduling_attributes(int pf)
+{
+ unsigned int totalvfs = igt_sriov_get_total_vfs(pf);
+ enum xe_sriov_sched_priority sched_priority;
+ bool sched_if_idle, reset_engine;
+ uint32_t eq, pt;
+ unsigned int gt;
+
+ xe_for_each_gt(pf, gt) {
+ igt_skip_on(__xe_sriov_get_sched_if_idle(pf, gt, &sched_if_idle));
+ igt_require_f(!sched_if_idle, "sched_if_idle != false on gt%u\n", gt);
+ igt_skip_on(__xe_sriov_get_engine_reset(pf, gt, &reset_engine));
+ igt_require_f(!reset_engine, "reset_engine != false on gt%u\n", gt);
+
+ for (unsigned int vf_num = 0; vf_num <= totalvfs; ++vf_num) {
+ igt_skip_on(__xe_sriov_get_exec_quantum_ms(pf, vf_num, gt, &eq));
+ igt_require_f(eq == 0, "exec_quantum_ms != 0 on gt%u/VF%u\n", gt, vf_num);
+
+ igt_skip_on(__xe_sriov_get_preempt_timeout_us(pf, vf_num, gt, &pt));
+ igt_require_f(pt == 0, "preempt_timeout_us != 0 on gt%u/VF%u\n",
+ gt, vf_num);
+
+ igt_skip_on(__xe_sriov_get_sched_priority(pf, vf_num, gt, &sched_priority));
+ igt_require_f(sched_priority == XE_SRIOV_SCHED_PRIORITY_LOW,
+ "sched_priority != LOW on gt%u/VF%u\n", gt, vf_num);
+ }
+ }
+}
diff --git a/lib/xe/xe_sriov_provisioning.h b/lib/xe/xe_sriov_provisioning.h
index b22f96d88..4382f528f 100644
--- a/lib/xe/xe_sriov_provisioning.h
+++ b/lib/xe/xe_sriov_provisioning.h
@@ -142,5 +142,6 @@ int __xe_sriov_set_sched_priority(int pf, unsigned int vf_num, unsigned int gt_n
enum xe_sriov_sched_priority value);
void xe_sriov_set_sched_priority(int pf, unsigned int vf_num, unsigned int gt_num,
enum xe_sriov_sched_priority value);
+void xe_sriov_require_default_scheduling_attributes(int pf);
#endif /* __XE_SRIOV_PROVISIONING_H__ */</pre>
</blockquote>
<br>
LGTM,<br>
Reviewed-by: Lukasz Laguna <a class="moz-txt-link-rfc2396E" href="mailto:lukasz.laguna@intel.com"><lukasz.laguna@intel.com></a><br>
<br>
<br>
<span style="white-space: pre-wrap">
</span>
</body>
</html>