]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe/pf: Reprovision scheduling to default when no VFs
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Thu, 2 Apr 2026 19:17:23 +0000 (21:17 +0200)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Sun, 12 Apr 2026 08:32:54 +0000 (10:32 +0200)
Once we have disabled VFs there is no point in keeping potentially
limited PF scheduling provisioning as we want to complete a cleanup
of the VFs resources and return to the pure native mode, the same
as before VFs were enabled, as soon as possible.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Link: https://patch.msgid.link/20260402191726.4932-11-michal.wajdeczko@intel.com
drivers/gpu/drm/xe/xe_pci_sriov.c
drivers/gpu/drm/xe/xe_sriov_pf_provision.c
drivers/gpu/drm/xe/xe_sriov_pf_provision.h

index 3fd22034f03e24d1cfe12216d00fa8bb270344d7..35e6b53e18ce231fc9a0abba5366d4e5fbafce10 100644 (file)
@@ -191,6 +191,8 @@ static int pf_disable_vfs(struct xe_device *xe)
 
        pci_disable_sriov(pdev);
 
+       xe_sriov_pf_reprovision_default(xe);
+
        pf_reset_vfs(xe, num_vfs);
 
        xe_sriov_pf_unprovision_vfs(xe, num_vfs);
index abe3677d33edfbbd393783e08b0829ac3859210c..e11874d689fa0fa152971914c08861685c5935d8 100644 (file)
@@ -103,6 +103,45 @@ int xe_sriov_pf_unprovision_vfs(struct xe_device *xe, unsigned int num_vfs)
        return 0;
 }
 
+static int pf_reprovision_default(struct xe_device *xe)
+{
+       struct xe_gt *gt;
+       unsigned int id;
+       int result = 0;
+       int err;
+
+       guard(mutex)(xe_sriov_pf_master_mutex(xe));
+
+       for_each_gt(gt, xe, id) {
+               err = xe_gt_sriov_pf_policy_set_sched_if_idle_locked(gt, false);
+               result = result ?: err;
+               err = xe_gt_sriov_pf_config_set_exec_quantum_locked(gt, PFID, 0);
+               result = result ?: err;
+               err = xe_gt_sriov_pf_config_set_preempt_timeout_locked(gt, PFID, 0);
+               result = result ?: err;
+       }
+
+       return result;
+}
+
+/**
+ * xe_sriov_pf_reprovision_default() - Reprovision default PF in auto-mode.
+ * @xe: the PF &xe_device
+ *
+ * This function can only be called on PF.
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int xe_sriov_pf_reprovision_default(struct xe_device *xe)
+{
+       xe_assert(xe, IS_SRIOV_PF(xe));
+
+       if (!pf_auto_provisioning_mode(xe))
+               return 0;
+
+       return pf_reprovision_default(xe);
+}
+
 /**
  * xe_sriov_pf_provision_set_mode() - Change VFs provision mode.
  * @xe: the PF &xe_device
index f26f49539697bfd1a8b421d9f385baeeb94547c2..b15e4d7ad9404b10c6d6af041e20f4216e394262 100644 (file)
@@ -30,6 +30,7 @@ int xe_sriov_pf_provision_query_vf_vram(struct xe_device *xe, unsigned int vfid,
 
 int xe_sriov_pf_provision_vfs(struct xe_device *xe, unsigned int num_vfs);
 int xe_sriov_pf_unprovision_vfs(struct xe_device *xe, unsigned int num_vfs);
+int xe_sriov_pf_reprovision_default(struct xe_device *xe);
 
 int xe_sriov_pf_provision_set_mode(struct xe_device *xe, enum xe_sriov_provisioning_mode mode);