From: Daniele Ceraolo Spurio Date: Thu, 18 Dec 2025 22:38:55 +0000 (-0800) Subject: drm/xe/pf: Prep for multiple exec quantums and preemption timeouts X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=627508b391ea53eaacf1185e19998b287f69e5c0;p=thirdparty%2Fkernel%2Flinux.git drm/xe/pf: Prep for multiple exec quantums and preemption timeouts 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 Cc: Michal Wajdeczko Reviewed-by: Michal Wajdeczko Link: https://patch.msgid.link/20251218223846.1146344-23-daniele.ceraolospurio@intel.com --- diff --git a/drivers/gpu/drm/xe/abi/guc_klvs_abi.h b/drivers/gpu/drm/xe/abi/guc_klvs_abi.h index 39dee685a92c..60758c034bf7 100644 --- a/drivers/gpu/drm/xe/abi/guc_klvs_abi.h +++ b/drivers/gpu/drm/xe/abi/guc_klvs_abi.h @@ -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. * diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c index 6e8507c24986..3e36a3c479a0 100644 --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c @@ -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(>->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, diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config_types.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config_types.h index 686c7b3b6d7a..75a48d0fa859 100644 --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config_types.h +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config_types.h @@ -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. */