All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe/display: Use the GGTT PTE to find the initial FB in stolen
@ 2026-11-16 10:53 Eriksen Xie
  2026-11-16 11:26 ` sashiko-bot
  2026-11-16 11:42 ` Ville Syrjälä
  0 siblings, 2 replies; 4+ messages in thread
From: Eriksen Xie @ 2026-11-16 10:53 UTC (permalink / raw)
  To: intel-xe, intel-gfx; +Cc: jani.nikula, rodrigo.vivi, ville.syrjala, Eriksen Xie

On integrated platforms initial_plane_bo() passes the GGTT address of
the initial plane as is to xe_bo_create_pin_map_at_novm() as the offset
into stolen. That is only correct if the BIOS maps stolen 1:1 into the
GGTT.

On Nova Lake the BIOS puts the initial FB at GGTT address 0xff800000
instead. Its PTE (0x800003) points to the start of stolen memory (the
stolen base is 0x800000), but using the GGTT address as the stolen
offset is far beyond the 120 MiB of stolen, so the BO creation fails and
the driver can't take over the BIOS FB:

 xe 0000:00:02.0: [drm:xe_alloc_initial_plane_obj [xe]] Failed to create bo phys_base=0x00000000ff800000 size 8294400 with flags 430: -12

Get the physical address from the PTE and convert it to an offset into
stolen, similarly to what is done for the dGPU case. Keep using the
GGTT address if the PTE doesn't point into stolen.

Tested on a Nova Lake platform: the BIOS FB is now taken over as the
initial FB.

Signed-off-by: Eriksen Xie <xiaolu.xie@intel.com>
---
 drivers/gpu/drm/xe/display/xe_initial_plane.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/display/xe_initial_plane.c b/drivers/gpu/drm/xe/display/xe_initial_plane.c
index 0f86b7303..f69532b3a 100644
--- a/drivers/gpu/drm/xe/display/xe_initial_plane.c
+++ b/drivers/gpu/drm/xe/display/xe_initial_plane.c
@@ -85,7 +85,7 @@ initial_plane_bo(struct xe_device *xe,
 			    &phys_base);
 	} else {
 		struct ttm_resource_manager *stolen;
-		u64 pte;
+		u64 pte, pte_addr, stolen_base;
 
 		stolen = ttm_manager_type(&xe->ttm, XE_PL_STOLEN);
 		if (!stolen) {
@@ -100,7 +100,23 @@ initial_plane_bo(struct xe_device *xe,
 			return NULL;
 		}
 
+		/*
+		 * The plane surface is a GGTT address, which equals the offset
+		 * into stolen only if the BIOS maps stolen 1:1 into the GGTT.
+		 * Get the offset from the PTE instead, and fall back to the
+		 * GGTT address if the PTE doesn't point into stolen.
+		 */
 		phys_base = base;
+		stolen_base = xe_ttm_stolen_gpu_offset(xe);
+		pte_addr = pte & XE_PAGE_ADDR_MASK(XE_PTE_SHIFT);
+		if (pte_addr >= stolen_base &&
+		    pte_addr - stolen_base < (u64)stolen->size << PAGE_SHIFT)
+			phys_base = pte_addr - stolen_base;
+
+		drm_dbg_kms(&xe->drm,
+			    "Initial plane GGTT address 0x%x, PTE 0x%llx -> stolen offset %pa\n",
+			    base, pte, &phys_base);
+
 		flags |= XE_BO_FLAG_STOLEN;
 
 		if (IS_ENABLED(CONFIG_FRAMEBUFFER_CONSOLE) &&
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-16 12:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 10:53 [PATCH] drm/xe/display: Use the GGTT PTE to find the initial FB in stolen Eriksen Xie
2026-11-16 11:26 ` sashiko-bot
2026-11-16 11:42 ` Ville Syrjälä
2026-11-16 12:31   ` Maarten Lankhorst

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.