Skip to content

Commit 1db2148

Browse files
committed
intel: initialize GMADR on meteorlake and newer on freebsd
This fixes issues with the smem_start being nonzero but invalid, which caused panics on meteorlake. The problem is that the GMADR was not getting initialized on mtl which we need in order to use shmem framebuffers. We are falling back to shmem framebuffers on freebsd because the Wa_22018444074 mtl hardware workaround disabled using stolen memory on mtl. We end up trying to use shmem but due to Wa_22018444074 GMADR is not valid so we end up with a value such as 0x2000 instead of a valid pointer. This change initializes GMADR on meteorlake. Linux has likely not run into this as they do not actually consume the physical address in smem_start like we do when we pass it to register_fictitious_range. See freebsd#324
1 parent 1781ef1 commit 1db2148

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

drivers/gpu/drm/i915/gt/intel_ggtt.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,22 @@ static int gen8_gmch_probe(struct i915_ggtt *ggtt)
12291229
unsigned int size;
12301230
u16 snb_gmch_ctl;
12311231

1232+
#ifdef __linux__
12321233
if (!HAS_LMEM(i915) && !HAS_LMEMBAR_SMEM_STOLEN(i915)) {
1234+
#elif defined(__FreeBSD__)
1235+
/*
1236+
* We need to initialize GMADR on freebsd in order to use shmem
1237+
* framebuffers. We are falling back to shmem framebuffers on freebsd
1238+
* because the Wa_22018444074 mtl hardware workaround disabled using stolen
1239+
* memory on mtl. Unlike on linux, when this happens we end up passing an
1240+
* invalid phys address to register_fictitious_range which causes a panic.
1241+
* Because GMADR is not valid we end up with a value such as 0x2000 instead
1242+
* of a valid pointer.
1243+
* MTL has LMEMBAR for stolen but still needs GMADR for shmem objects.
1244+
*/
1245+
if ((!HAS_LMEM(i915) && !HAS_LMEMBAR_SMEM_STOLEN(i915))
1246+
|| HAS_LMEMBAR_SMEM_STOLEN(i915)) {
1247+
#endif
12331248
if (!i915_pci_resource_valid(pdev, GEN4_GMADR_BAR))
12341249
return -ENXIO;
12351250

0 commit comments

Comments
 (0)