Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe/pf: Adjust scheduling priority based on policy change

Local values of scheduling priorities need to be adjusted when
changing the schedule_if_idle policy as those are related.

Disabling schedule_if_idle policy forces the low priority, and
enabling schedule_if_idle policy forces the normal priority.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Lukasz Laguna <lukasz.laguna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241106151301.2079-6-michal.wajdeczko@intel.com

+23 -4
+23 -4
drivers/gpu/drm/xe/xe_gt_sriov_pf_policy.c
··· 135 135 return 0; 136 136 } 137 137 138 - static int pf_provision_sched_if_idle(struct xe_gt *gt, bool enable) 138 + static void pf_bulk_reset_sched_priority(struct xe_gt *gt, u32 priority) 139 139 { 140 + unsigned int total_vfs = 1 + xe_gt_sriov_pf_get_totalvfs(gt); 141 + unsigned int n; 142 + 140 143 xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt))); 141 144 lockdep_assert_held(xe_gt_sriov_pf_master_mutex(gt)); 142 145 143 - return pf_update_policy_bool(gt, GUC_KLV_VGT_POLICY_SCHED_IF_IDLE_KEY, 144 - &gt->sriov.pf.policy.guc.sched_if_idle, 145 - enable); 146 + for (n = 0; n < total_vfs; n++) 147 + gt->sriov.pf.vfs[n].config.sched_priority = priority; 148 + } 149 + 150 + static int pf_provision_sched_if_idle(struct xe_gt *gt, bool enable) 151 + { 152 + int err; 153 + 154 + xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt))); 155 + lockdep_assert_held(xe_gt_sriov_pf_master_mutex(gt)); 156 + 157 + err = pf_update_policy_bool(gt, GUC_KLV_VGT_POLICY_SCHED_IF_IDLE_KEY, 158 + &gt->sriov.pf.policy.guc.sched_if_idle, 159 + enable); 160 + 161 + if (!err) 162 + pf_bulk_reset_sched_priority(gt, enable ? GUC_SCHED_PRIORITY_NORMAL : 163 + GUC_SCHED_PRIORITY_LOW); 164 + return err; 146 165 } 147 166 148 167 static int pf_reprovision_sched_if_idle(struct xe_gt *gt)