Skip to content

Commit a2ca1d5

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 3c86e7b commit a2ca1d5

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,26 @@ static int gen8_gmch_probe(struct i915_ggtt *ggtt)
12371237
ggtt->gmadr = pci_resource(pdev, GEN4_GMADR_BAR);
12381238
ggtt->mappable_end = resource_size(&ggtt->gmadr);
12391239
}
1240+
#ifdef __FreeBSD__
1241+
/*
1242+
* We need to initialize GMADR on freebsd in order to use shmem
1243+
* framebuffers. We are falling back to shmem framebuffers on freebsd
1244+
* because the Wa_22018444074 mtl hardware workaround disabled using stolen
1245+
* memory on mtl. Unlike on linux, when this happens we end up passing an
1246+
* invalid phys address to register_fictitious_range which causes a panic.
1247+
* Because GMADR is not valid we end up with a value such as 0x2000 instead
1248+
* of a valid pointer.
1249+
*/
1250+
else if (HAS_LMEMBAR_SMEM_STOLEN(i915)) {
1251+
/* MTL has LMEMBAR for stolen but still needs GMADR for shmem objects */
1252+
if (i915_pci_resource_valid(pdev, GEN4_GMADR_BAR)) {
1253+
ggtt->gmadr = pci_resource(pdev, GEN4_GMADR_BAR);
1254+
ggtt->mappable_end = resource_size(&ggtt->gmadr);
1255+
drm_dbg(&i915->drm, "GMADR: %pR (size %lluM)\n",
1256+
&ggtt->gmadr, resource_size(&ggtt->gmadr) >> 20);
1257+
}
1258+
}
1259+
#endif
12401260

12411261
pci_read_config_word(pdev, SNB_GMCH_CTRL, &snb_gmch_ctl);
12421262
if (IS_CHERRYVIEW(i915))

0 commit comments

Comments
 (0)