]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe: allow non-contig VRAM kernel BO
authorMatthew Auld <matthew.auld@intel.com>
Thu, 3 Apr 2025 10:24:47 +0000 (11:24 +0100)
committerMatthew Auld <matthew.auld@intel.com>
Fri, 4 Apr 2025 10:41:10 +0000 (11:41 +0100)
If the kernel bo doesn't care about vmap(), either directly or
indirectly with save/restore then we don't need to force contig for such
buffers.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Link: https://lore.kernel.org/r/20250403102440.266113-15-matthew.auld@intel.com
drivers/gpu/drm/xe/xe_bo.c

index 29e5849a9ae3275cf4f8080df035e1a91425627a..c337790c81ae13e02e983e43521602d7ed1d658d 100644 (file)
@@ -191,11 +191,18 @@ static void try_add_system(struct xe_device *xe, struct xe_bo *bo,
 
 static bool force_contiguous(u32 bo_flags)
 {
+       if (bo_flags & XE_BO_FLAG_STOLEN)
+               return true; /* users expect this */
+       else if (bo_flags & XE_BO_FLAG_PINNED &&
+                !(bo_flags & XE_BO_FLAG_PINNED_LATE_RESTORE))
+               return true; /* needs vmap */
+
        /*
         * For eviction / restore on suspend / resume objects pinned in VRAM
         * must be contiguous, also only contiguous BOs support xe_bo_vmap.
         */
-       return bo_flags & (XE_BO_FLAG_PINNED | XE_BO_FLAG_GGTT);
+       return bo_flags & XE_BO_FLAG_NEEDS_CPU_ACCESS &&
+              bo_flags & XE_BO_FLAG_PINNED;
 }
 
 static void add_vram(struct xe_device *xe, struct xe_bo *bo,