@@ -154,6 +154,30 @@ __wait_gsc_proxy_completed(struct drm_i915_private *i915)
154
154
pr_warn (DRIVER_NAME "Timed out waiting for gsc_proxy_completion!\n" );
155
155
}
156
156
157
+ static void
158
+ __wait_gsc_huc_load_completed (struct drm_i915_private * i915 )
159
+ {
160
+ /* this only applies to DG2, so we only care about GT0 */
161
+ struct intel_huc * huc = & to_gt (i915 )-> uc .huc ;
162
+ bool need_to_wait = (IS_ENABLED (CONFIG_INTEL_MEI_PXP ) &&
163
+ intel_huc_wait_required (huc ));
164
+ /*
165
+ * The GSC and PXP mei bringup depends on the kernel boot ordering, so
166
+ * to account for the worst case scenario the HuC code waits for up to
167
+ * 10s for the GSC driver to load and then another 5s for the PXP
168
+ * component to bind before giving up, even though those steps normally
169
+ * complete in less than a second from the i915 load. We match that
170
+ * timeout here, but we expect to bail early due to the fence being
171
+ * signalled even in a failure case, as it is extremely unlikely that
172
+ * both components will use their full timeout.
173
+ */
174
+ unsigned long timeout_ms = 15000 ;
175
+
176
+ if (need_to_wait &&
177
+ wait_for (i915_sw_fence_done (& huc -> delayed_load .fence ), timeout_ms ))
178
+ pr_warn (DRIVER_NAME "Timed out waiting for huc load via GSC!\n" );
179
+ }
180
+
157
181
static int __run_selftests (const char * name ,
158
182
struct selftest * st ,
159
183
unsigned int count ,
@@ -228,14 +252,16 @@ int i915_mock_selftests(void)
228
252
229
253
int i915_live_selftests (struct pci_dev * pdev )
230
254
{
255
+ struct drm_i915_private * i915 = pdev_to_i915 (pdev );
231
256
int err ;
232
257
233
258
if (!i915_selftest .live )
234
259
return 0 ;
235
260
236
- __wait_gsc_proxy_completed (pdev_to_i915 (pdev ));
261
+ __wait_gsc_proxy_completed (i915 );
262
+ __wait_gsc_huc_load_completed (i915 );
237
263
238
- err = run_selftests (live , pdev_to_i915 ( pdev ) );
264
+ err = run_selftests (live , i915 );
239
265
if (err ) {
240
266
i915_selftest .live = err ;
241
267
return err ;
@@ -251,14 +277,16 @@ int i915_live_selftests(struct pci_dev *pdev)
251
277
252
278
int i915_perf_selftests (struct pci_dev * pdev )
253
279
{
280
+ struct drm_i915_private * i915 = pdev_to_i915 (pdev );
254
281
int err ;
255
282
256
283
if (!i915_selftest .perf )
257
284
return 0 ;
258
285
259
- __wait_gsc_proxy_completed (pdev_to_i915 (pdev ));
286
+ __wait_gsc_proxy_completed (i915 );
287
+ __wait_gsc_huc_load_completed (i915 );
260
288
261
- err = run_selftests (perf , pdev_to_i915 ( pdev ) );
289
+ err = run_selftests (perf , i915 );
262
290
if (err ) {
263
291
i915_selftest .perf = err ;
264
292
return err ;
0 commit comments