@@ -511,20 +511,31 @@ void intel_ggtt_unbind_vma(struct i915_address_space *vm,
511
511
vm -> clear_range (vm , vma_res -> start , vma_res -> vma_size );
512
512
}
513
513
514
+ /*
515
+ * Reserve the top of the GuC address space for firmware images. Addresses
516
+ * beyond GUC_GGTT_TOP in the GuC address space are inaccessible by GuC,
517
+ * which makes for a suitable range to hold GuC/HuC firmware images if the
518
+ * size of the GGTT is 4G. However, on a 32-bit platform the size of the GGTT
519
+ * is limited to 2G, which is less than GUC_GGTT_TOP, but we reserve a chunk
520
+ * of the same size anyway, which is far more than needed, to keep the logic
521
+ * in uc_fw_ggtt_offset() simple.
522
+ */
523
+ #define GUC_TOP_RESERVE_SIZE (SZ_4G - GUC_GGTT_TOP)
524
+
514
525
static int ggtt_reserve_guc_top (struct i915_ggtt * ggtt )
515
526
{
516
- u64 size ;
527
+ u64 offset ;
517
528
int ret ;
518
529
519
530
if (!intel_uc_uses_guc (& ggtt -> vm .gt -> uc ))
520
531
return 0 ;
521
532
522
- GEM_BUG_ON (ggtt -> vm .total <= GUC_GGTT_TOP );
523
- size = ggtt -> vm .total - GUC_GGTT_TOP ;
533
+ GEM_BUG_ON (ggtt -> vm .total <= GUC_TOP_RESERVE_SIZE );
534
+ offset = ggtt -> vm .total - GUC_TOP_RESERVE_SIZE ;
524
535
525
- ret = i915_gem_gtt_reserve (& ggtt -> vm , NULL , & ggtt -> uc_fw , size ,
526
- GUC_GGTT_TOP , I915_COLOR_UNEVICTABLE ,
527
- PIN_NOEVICT );
536
+ ret = i915_gem_gtt_reserve (& ggtt -> vm , NULL , & ggtt -> uc_fw ,
537
+ GUC_TOP_RESERVE_SIZE , offset ,
538
+ I915_COLOR_UNEVICTABLE , PIN_NOEVICT );
528
539
if (ret )
529
540
drm_dbg (& ggtt -> vm .i915 -> drm ,
530
541
"Failed to reserve top of GGTT for GuC\n" );
0 commit comments