Lines Matching full:gsc

18 	struct intel_gsc_uc *gsc = container_of(work, typeof(*gsc), work);  in gsc_work()  local
19 struct intel_gt *gt = gsc_uc_to_gt(gsc); in gsc_work()
27 actions = gsc->gsc_work_actions; in gsc_work()
28 gsc->gsc_work_actions = 0; in gsc_work()
32 ret = intel_gsc_uc_fw_upload(gsc); in gsc_work()
47 * first and do proxy later. The GSC will ack the HuC auth and in gsc_work()
50 * Note that we can only do the GSC auth if the GuC auth was in gsc_work()
59 if (!intel_gsc_uc_fw_init_done(gsc)) { in gsc_work()
60 gt_err(gt, "Proxy request received with GSC not loaded!\n"); in gsc_work()
64 ret = intel_gsc_proxy_request_handler(gsc); in gsc_work()
69 * step has failed so mark GSC as not usable after this in gsc_work()
71 gt_err(gt, "GSC proxy handler failed to init\n"); in gsc_work()
72 intel_uc_fw_change_status(&gsc->fw, INTEL_UC_FIRMWARE_LOAD_FAIL); in gsc_work()
77 /* mark the GSC FW init as done the first time we run this */ in gsc_work()
80 * If there is a proxy establishment error, the GSC might still in gsc_work()
84 if (intel_gsc_uc_fw_proxy_init_done(gsc, false)) { in gsc_work()
85 gt_dbg(gt, "GSC Proxy initialized\n"); in gsc_work()
86 intel_uc_fw_change_status(&gsc->fw, INTEL_UC_FIRMWARE_RUNNING); in gsc_work()
88 gt_err(gt, "GSC status reports proxy init not complete\n"); in gsc_work()
89 intel_uc_fw_change_status(&gsc->fw, INTEL_UC_FIRMWARE_LOAD_FAIL); in gsc_work()
118 void intel_gsc_uc_init_early(struct intel_gsc_uc *gsc) in intel_gsc_uc_init_early() argument
120 struct intel_gt *gt = gsc_uc_to_gt(gsc); in intel_gsc_uc_init_early()
123 * GSC FW needs to be copied to a dedicated memory allocations for in intel_gsc_uc_init_early()
124 * loading (see gsc->local), so we don't need to GGTT map the FW image in intel_gsc_uc_init_early()
127 intel_uc_fw_init_early(&gsc->fw, INTEL_UC_FW_TYPE_GSC, false); in intel_gsc_uc_init_early()
128 INIT_WORK(&gsc->work, gsc_work); in intel_gsc_uc_init_early()
135 intel_uc_fw_change_status(&gsc->fw, INTEL_UC_FIRMWARE_NOT_SUPPORTED); in intel_gsc_uc_init_early()
139 gsc->wq = alloc_ordered_workqueue("i915_gsc", 0); in intel_gsc_uc_init_early()
140 if (!gsc->wq) { in intel_gsc_uc_init_early()
141 gt_err(gt, "failed to allocate WQ for GSC, disabling FW\n"); in intel_gsc_uc_init_early()
142 intel_uc_fw_change_status(&gsc->fw, INTEL_UC_FIRMWARE_NOT_SUPPORTED); in intel_gsc_uc_init_early()
146 static int gsc_allocate_and_map_vma(struct intel_gsc_uc *gsc, u32 size) in gsc_allocate_and_map_vma() argument
148 struct intel_gt *gt = gsc_uc_to_gt(gsc); in gsc_allocate_and_map_vma()
155 * The GSC FW doesn't immediately suspend after becoming idle, so there in gsc_allocate_and_map_vma()
164 * way to do so is to use stolen memory for the GSC memory allocation, in gsc_allocate_and_map_vma()
167 * it must be if the GSC is awake). in gsc_allocate_and_map_vma()
188 gsc->local = vma; in gsc_allocate_and_map_vma()
189 gsc->local_vaddr = vaddr; in gsc_allocate_and_map_vma()
198 static void gsc_unmap_and_free_vma(struct intel_gsc_uc *gsc) in gsc_unmap_and_free_vma() argument
200 struct i915_vma *vma = fetch_and_zero(&gsc->local); in gsc_unmap_and_free_vma()
205 gsc->local_vaddr = NULL; in gsc_unmap_and_free_vma()
210 int intel_gsc_uc_init(struct intel_gsc_uc *gsc) in intel_gsc_uc_init() argument
213 struct intel_gt *gt = gsc_uc_to_gt(gsc); in intel_gsc_uc_init()
218 err = intel_uc_fw_init(&gsc->fw); in intel_gsc_uc_init()
222 err = gsc_allocate_and_map_vma(gsc, SZ_4M); in intel_gsc_uc_init()
230 gt_err(gt, "failed to create GSC CS ctx for FW communication\n"); in intel_gsc_uc_init()
235 gsc->ce = ce; in intel_gsc_uc_init()
237 /* if we fail to init proxy we still want to load GSC for PM */ in intel_gsc_uc_init()
238 intel_gsc_proxy_init(gsc); in intel_gsc_uc_init()
240 intel_uc_fw_change_status(&gsc->fw, INTEL_UC_FIRMWARE_LOADABLE); in intel_gsc_uc_init()
245 gsc_unmap_and_free_vma(gsc); in intel_gsc_uc_init()
247 intel_uc_fw_fini(&gsc->fw); in intel_gsc_uc_init()
249 gt_probe_error(gt, "GSC init failed %pe\n", ERR_PTR(err)); in intel_gsc_uc_init()
253 void intel_gsc_uc_fini(struct intel_gsc_uc *gsc) in intel_gsc_uc_fini() argument
255 if (!intel_uc_fw_is_loadable(&gsc->fw)) in intel_gsc_uc_fini()
258 flush_work(&gsc->work); in intel_gsc_uc_fini()
259 if (gsc->wq) { in intel_gsc_uc_fini()
260 destroy_workqueue(gsc->wq); in intel_gsc_uc_fini()
261 gsc->wq = NULL; in intel_gsc_uc_fini()
264 intel_gsc_proxy_fini(gsc); in intel_gsc_uc_fini()
266 if (gsc->ce) in intel_gsc_uc_fini()
267 intel_engine_destroy_pinned_context(fetch_and_zero(&gsc->ce)); in intel_gsc_uc_fini()
269 gsc_unmap_and_free_vma(gsc); in intel_gsc_uc_fini()
271 intel_uc_fw_fini(&gsc->fw); in intel_gsc_uc_fini()
274 void intel_gsc_uc_flush_work(struct intel_gsc_uc *gsc) in intel_gsc_uc_flush_work() argument
276 if (!intel_uc_fw_is_loadable(&gsc->fw)) in intel_gsc_uc_flush_work()
279 flush_work(&gsc->work); in intel_gsc_uc_flush_work()
282 void intel_gsc_uc_resume(struct intel_gsc_uc *gsc) in intel_gsc_uc_resume() argument
284 if (!intel_uc_fw_is_loadable(&gsc->fw)) in intel_gsc_uc_resume()
288 * we only want to start the GSC worker from here in the actual resume in intel_gsc_uc_resume()
289 * flow and not during driver load. This is because GSC load is slow and in intel_gsc_uc_resume()
292 * intel_gsc_uc_load_start will ensure that the GSC is loaded during in intel_gsc_uc_resume()
295 if (!gsc_uc_to_gt(gsc)->engine[GSC0]->default_state) in intel_gsc_uc_resume()
298 intel_gsc_uc_load_start(gsc); in intel_gsc_uc_resume()
301 void intel_gsc_uc_load_start(struct intel_gsc_uc *gsc) in intel_gsc_uc_load_start() argument
303 struct intel_gt *gt = gsc_uc_to_gt(gsc); in intel_gsc_uc_load_start()
305 if (!intel_uc_fw_is_loadable(&gsc->fw) || intel_uc_fw_is_in_error(&gsc->fw)) in intel_gsc_uc_load_start()
308 if (intel_gsc_uc_fw_init_done(gsc)) in intel_gsc_uc_load_start()
312 gsc->gsc_work_actions |= GSC_ACTION_FW_LOAD; in intel_gsc_uc_load_start()
315 queue_work(gsc->wq, &gsc->work); in intel_gsc_uc_load_start()
318 void intel_gsc_uc_load_status(struct intel_gsc_uc *gsc, struct drm_printer *p) in intel_gsc_uc_load_status() argument
320 struct intel_gt *gt = gsc_uc_to_gt(gsc); in intel_gsc_uc_load_status()
324 if (!intel_gsc_uc_is_supported(gsc)) { in intel_gsc_uc_load_status()
325 drm_printf(p, "GSC not supported\n"); in intel_gsc_uc_load_status()
329 if (!intel_gsc_uc_is_wanted(gsc)) { in intel_gsc_uc_load_status()
330 drm_printf(p, "GSC disabled\n"); in intel_gsc_uc_load_status()
334 drm_printf(p, "GSC firmware: %s\n", gsc->fw.file_selected.path); in intel_gsc_uc_load_status()
335 if (gsc->fw.file_selected.path != gsc->fw.file_wanted.path) in intel_gsc_uc_load_status()
336 drm_printf(p, "GSC firmware wanted: %s\n", gsc->fw.file_wanted.path); in intel_gsc_uc_load_status()
337 drm_printf(p, "\tstatus: %s\n", intel_uc_fw_status_repr(gsc->fw.status)); in intel_gsc_uc_load_status()
340 gsc->release.major, gsc->release.minor, in intel_gsc_uc_load_status()
341 gsc->release.patch, gsc->release.build); in intel_gsc_uc_load_status()
344 gsc->fw.file_selected.ver.major, gsc->fw.file_selected.ver.minor, in intel_gsc_uc_load_status()
345 gsc->fw.file_wanted.ver.major, gsc->fw.file_wanted.ver.minor); in intel_gsc_uc_load_status()
347 drm_printf(p, "SVN: %u\n", gsc->security_version); in intel_gsc_uc_load_status()