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

drm/xe/vf: Start post-migration fixups with provisioning query

During post-migration recovery, only MMIO communication to GuC is
allowed. The VF KMD needs to use that channel to ask for the new
provisioning, which includes a new GGTT range assigned to the VF.

v2: query config only instead of handshake; no need to get pm ref as
it's now kept through whole recovery (Michal)
v3: switched names of 'err' and 'ret' (Michal)

Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241104213449.1455694-5-tomasz.lis@intel.com
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>

authored by

Tomasz Lis and committed by
Michal Wajdeczko
4be3fca2 1255954d

+36
+36
drivers/gpu/drm/xe/xe_sriov_vf.c
··· 132 132 INIT_WORK(&xe->sriov.vf.migration.worker, migration_worker_func); 133 133 } 134 134 135 + /** 136 + * vf_post_migration_requery_guc - Re-query GuC for current VF provisioning. 137 + * @xe: the &xe_device struct instance 138 + * 139 + * After migration, we need to re-query all VF configuration to make sure 140 + * they match previous provisioning. Note that most of VF provisioning 141 + * shall be the same, except GGTT range, since GGTT is not virtualized per-VF. 142 + * 143 + * Returns: 0 if the operation completed successfully, or a negative error 144 + * code otherwise. 145 + */ 146 + static int vf_post_migration_requery_guc(struct xe_device *xe) 147 + { 148 + struct xe_gt *gt; 149 + unsigned int id; 150 + int err, ret = 0; 151 + 152 + for_each_gt(gt, xe, id) { 153 + err = xe_gt_sriov_vf_query_config(gt); 154 + ret = ret ?: err; 155 + } 156 + 157 + return ret; 158 + } 159 + 135 160 /* 136 161 * Notify all GuCs about resource fixups apply finished. 137 162 */ ··· 172 147 173 148 static void vf_post_migration_recovery(struct xe_device *xe) 174 149 { 150 + int err; 151 + 175 152 drm_dbg(&xe->drm, "migration recovery in progress\n"); 176 153 xe_pm_runtime_get(xe); 154 + err = vf_post_migration_requery_guc(xe); 155 + if (unlikely(err)) 156 + goto fail; 157 + 177 158 /* FIXME: add the recovery steps */ 178 159 vf_post_migration_notify_resfix_done(xe); 179 160 xe_pm_runtime_put(xe); 180 161 drm_notice(&xe->drm, "migration recovery ended\n"); 162 + return; 163 + fail: 164 + xe_pm_runtime_put(xe); 165 + drm_err(&xe->drm, "migration recovery failed (%pe)\n", ERR_PTR(err)); 166 + xe_device_declare_wedged(xe); 181 167 } 182 168 183 169 static void migration_worker_func(struct work_struct *w)