Skip to content

Commit 276cdc8

Browse files
amshaferemaste
authored andcommitted
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 99ea4c0 commit 276cdc8

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

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

0 commit comments

Comments
 (0)