Skip to contentSkip to conversation

drm/i915/mtl: Disable stolen memory backed FB for A0

PATCH Superseded Nirmoy Das 2 participants 2 messages Mar 9, 2023

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Nirmoy Das

author
#0 lore raw

PATCH 1/1 drm/i915/mtl: Disable stolen memory backed FB for A0

Stolen memory is not usable for MTL A0 stepping beyond certain access size and we have no control over userspace access size of /dev/fb which can be backed by stolen memory. So disable stolen memory backed fb by setting i915->dsm.usable_size to zero.

Cc Matthew Auld <[email protected]>
Cc Andi Shyti <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Lucas De Marchi <[email protected]>
---
 drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/gem/i915_gem_stolen.c +10 -0
index d8e06e783e30..56ccfcbdbce1 100644
@@ -535,6 +535,16 @@ static int i915_gem_init_stolen(struct intel_memory_region *mem)
 	/* Basic memrange allocator for stolen space. */
 	drm_mm_init(&i915->mm.stolen, 0, i915->dsm.usable_size);
 
+	/*
+	 * Access to stolen lmem beyond certain size for MTL A0 stepping
+	 * would crash the machine. Disable stolen lmem for userspace access
+	 * by setting usable_size to zero.
+	 * hsdes: 22016134735
+	 */
+	if (IS_MTL_GRAPHICS_STEP(i915, M, STEP_A0, STEP_B0) ||
+	    IS_MTL_GRAPHICS_STEP(i915, P, STEP_A0, STEP_B0))
+		i915->dsm.usable_size = 0;
+
 	return 0;
 }
 
Signature · 1 line
2.39.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Nirmoy,

Quoted 11 lines · Nirmoy Das

Stolen memory is not usable for MTL A0 stepping beyond certain access size and we have no control over userspace access size of /dev/fb which can be backed by stolen memory. So disable stolen memory backed fb by setting i915->dsm.usable_size to zero.

Cc Matthew Auld <[email protected]>
Cc Andi Shyti <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Lucas De Marchi <[email protected]>

Can you please remove this blank line from the tag space?

Quoted 10 lines
---
 drivers/gpu/drm/i915/gem/i915_gem_stolen.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/gem/i915_gem_stolen.c +0 -0
index d8e06e783e30..56ccfcbdbce1 100644

drivers/gpu/drm/i915/gem/i915_gem_stolen.c static int i915_gem_init_stolen(struct intel_memory_region *mem) · line 542

Quoted 8 lines
drivers/gpu/drm/i915/gem/i915_gem_stolen.c +5 -0
@@ -535,6 +535,16 @@ static int i915_gem_init_stolen(struct intel_memory_region *mem)
 	/* Basic memrange allocator for stolen space. */
 	drm_mm_init(&i915->mm.stolen, 0, i915->dsm.usable_size);
 
+	/*
+	 * Access to stolen lmem beyond certain size for MTL A0 stepping
+	 * would crash the machine. Disable stolen lmem for userspace access
+	 * by setting usable_size to zero.
+	 * hsdes: 22016134735

Please, remove this reference, as well.

With the above:

Thanks,
Andi

Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_stolen.c +5 -0
+	 */
+	if (IS_MTL_GRAPHICS_STEP(i915, M, STEP_A0, STEP_B0) ||
+	    IS_MTL_GRAPHICS_STEP(i915, P, STEP_A0, STEP_B0))
+		i915->dsm.usable_size = 0;
+
 	return 0;
 }
 
Signature · 1 line
2.39.0