]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe/pf: Prep for multiple exec quantums and preemption timeouts
authorDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Thu, 18 Dec 2025 22:38:55 +0000 (14:38 -0800)
committerDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Mon, 22 Dec 2025 18:22:12 +0000 (10:22 -0800)
Each scheduler group can be independently configured with its own exec
quantum and preemption timeouts. The existing KLVs to configure those
parameters will apply the value to all groups (even if they're not
enabled at the moment).

When scheduler groups are disabled, the GuC uses the values from Group 0.

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patch.msgid.link/20251218223846.1146344-23-daniele.ceraolospurio@intel.com
drivers/gpu/drm/xe/abi/guc_klvs_abi.h
drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
drivers/gpu/drm/xe/xe_gt_sriov_pf_config_types.h

index 39dee685a92c714a460258b1ee5973664b59fd7c..60758c034bf71136e644d92e72ce458b69f6688b 100644 (file)
@@ -297,6 +297,10 @@ enum  {
  *      it to take effect. Such cases might typically happen on a 1PF+1VF
  *      Virtualization config enabled for heavier workloads like AI/ML.
  *
+ *      If scheduling groups are supported, the provided value is applied to all
+ *      groups (even if they've not yet been enabled). Support for this feature
+ *      is available from GuC 70.53.0.
+ *
  *      The max value for this KLV is 100 seconds, anything exceeding that
  *      will be clamped to the max.
  *
@@ -319,6 +323,10 @@ enum  {
  *      on a 1PF+1VF Virtualization config enabled for heavier workloads like
  *      AI/ML.
  *
+ *      If scheduling groups are supported, the provided value is applied to all
+ *      groups (even if they've not yet been enabled). Support for this feature
+ *      is available from GuC 70.53.0.
+ *
  *      The max value for this KLV is 100 seconds, anything exceeding that
  *      will be clamped to the max.
  *
index 6e8507c24986ffc546c14e2d86e0c171cd3439ce..3e36a3c479a0082bfdef6c11e9f54391fd1810f0 100644 (file)
@@ -299,10 +299,10 @@ static u32 encode_config(struct xe_gt *gt, u32 *cfg, const struct xe_gt_sriov_co
        }
 
        cfg[n++] = PREP_GUC_KLV_TAG(VF_CFG_EXEC_QUANTUM);
-       cfg[n++] = config->exec_quantum;
+       cfg[n++] = config->exec_quantum[0];
 
        cfg[n++] = PREP_GUC_KLV_TAG(VF_CFG_PREEMPT_TIMEOUT);
-       cfg[n++] = config->preempt_timeout;
+       cfg[n++] = config->preempt_timeout[0];
 
 #define encode_threshold_config(TAG, NAME, VER...) ({                                  \
        if (IF_ARGS(GUC_FIRMWARE_VER_AT_LEAST(&gt->uc.guc, VER), true, VER)) {          \
@@ -1860,12 +1860,15 @@ static int pf_provision_exec_quantum(struct xe_gt *gt, unsigned int vfid,
 {
        struct xe_gt_sriov_config *config = pf_pick_vf_config(gt, vfid);
        int err;
+       int i;
 
        err = pf_push_vf_cfg_exec_quantum(gt, vfid, &exec_quantum);
        if (unlikely(err))
                return err;
 
-       config->exec_quantum = exec_quantum;
+       for (i = 0; i < ARRAY_SIZE(config->exec_quantum); i++)
+               config->exec_quantum[i] = exec_quantum;
+
        return 0;
 }
 
@@ -1873,7 +1876,7 @@ static u32 pf_get_exec_quantum(struct xe_gt *gt, unsigned int vfid)
 {
        struct xe_gt_sriov_config *config = pf_pick_vf_config(gt, vfid);
 
-       return config->exec_quantum;
+       return config->exec_quantum[0];
 }
 
 /**
@@ -1990,12 +1993,14 @@ static int pf_provision_preempt_timeout(struct xe_gt *gt, unsigned int vfid,
 {
        struct xe_gt_sriov_config *config = pf_pick_vf_config(gt, vfid);
        int err;
+       int i;
 
        err = pf_push_vf_cfg_preempt_timeout(gt, vfid, &preempt_timeout);
        if (unlikely(err))
                return err;
 
-       config->preempt_timeout = preempt_timeout;
+       for (i = 0; i < ARRAY_SIZE(config->preempt_timeout); i++)
+               config->preempt_timeout[i] = preempt_timeout;
 
        return 0;
 }
@@ -2004,7 +2009,7 @@ static u32 pf_get_preempt_timeout(struct xe_gt *gt, unsigned int vfid)
 {
        struct xe_gt_sriov_config *config = pf_pick_vf_config(gt, vfid);
 
-       return config->preempt_timeout;
+       return config->preempt_timeout[0];
 }
 
 /**
@@ -2183,10 +2188,14 @@ u32 xe_gt_sriov_pf_config_get_sched_priority(struct xe_gt *gt, unsigned int vfid
 
 static void pf_reset_config_sched(struct xe_gt *gt, struct xe_gt_sriov_config *config)
 {
+       int i;
+
        lockdep_assert_held(xe_gt_sriov_pf_master_mutex(gt));
 
-       config->exec_quantum = 0;
-       config->preempt_timeout = 0;
+       for (i = 0; i < ARRAY_SIZE(config->exec_quantum); i++) {
+               config->exec_quantum[i] = 0;
+               config->preempt_timeout[i] = 0;
+       }
 }
 
 static int pf_provision_threshold(struct xe_gt *gt, unsigned int vfid,
index 686c7b3b6d7a52ee77aff0d856d9e196ab6c35b4..75a48d0fa8592c7edd42db91f56b16d75d495ffb 100644 (file)
@@ -6,6 +6,7 @@
 #ifndef _XE_GT_SRIOV_PF_CONFIG_TYPES_H_
 #define _XE_GT_SRIOV_PF_CONFIG_TYPES_H_
 
+#include "abi/guc_scheduler_abi.h"
 #include "xe_ggtt_types.h"
 #include "xe_guc_klv_thresholds_set_types.h"
 
@@ -30,9 +31,9 @@ struct xe_gt_sriov_config {
        /** @begin_db: start index of GuC doorbell ID range. */
        u16 begin_db;
        /** @exec_quantum: execution-quantum in milliseconds. */
-       u32 exec_quantum;
+       u32 exec_quantum[GUC_MAX_SCHED_GROUPS];
        /** @preempt_timeout: preemption timeout in microseconds. */
-       u32 preempt_timeout;
+       u32 preempt_timeout[GUC_MAX_SCHED_GROUPS];
        /** @sched_priority: scheduling priority. */
        u32 sched_priority;
        /** @thresholds: GuC thresholds for adverse events notifications. */