From: Ville Syrjälä <[email protected]>

Do the PTE local memory bit check also for the case when
the initial FB lives in stolen. We have two cases to worry about
here: MTL+ with LMEMBAR, and pre-MTL with stolen being just
(slightly special) physical memory.

Signed-off-by: Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/xe/display/xe_initial_plane.c | 15 ++++++++++++++-
 1 file changed, 14 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 0dabc5709d01..d0a9f8599096 100644
--- a/drivers/gpu/drm/xe/display/xe_initial_plane.c
+++ b/drivers/gpu/drm/xe/display/xe_initial_plane.c
@@ -26,9 +26,14 @@ static bool is_pte_local(u64 pte)
        return pte & XE_GGTT_PTE_DM;
 }
 
+static bool has_lmembar(struct xe_device *xe)
+{
+       return GRAPHICS_VERx100(xe) >= 1270;
+}
+
 static bool need_pte_local(struct xe_device *xe)
 {
-       return IS_DGFX(xe);
+       return IS_DGFX(xe) || has_lmembar(xe);
 }
 
 static struct xe_bo *
@@ -79,6 +84,7 @@ initial_plane_bo(struct xe_device *xe,
                            &phys_base);
        } else {
                struct ttm_resource_manager *stolen;
+               u64 pte;
 
                stolen = ttm_manager_type(&xe->ttm, XE_PL_STOLEN);
                if (!stolen) {
@@ -86,6 +92,13 @@ initial_plane_bo(struct xe_device *xe,
                        return NULL;
                }
 
+               pte = xe_ggtt_read_pte(tile0->mem.ggtt, base);
+
+               if (is_pte_local(pte) != need_pte_local(xe)) {
+                       drm_err(&xe->drm, "Initial plane PTE has bad local 
memory bit\n");
+                       return NULL;
+               }
+
                phys_base = base;
                flags |= XE_BO_FLAG_STOLEN;
        }
-- 
2.52.0

Reply via email to