drm/xe: Allow VRAM BO allocations aligned to 64K
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Wed, 13 Mar 2024 10:41:30 +0000 (11:41 +0100)
committerMichał Winiarski <michal.winiarski@intel.com>
Fri, 15 Mar 2024 21:20:52 +0000 (22:20 +0100)
While today we are getting VRAM allocations aligned to 64K as the
XE_VRAM_FLAGS_NEED64K flag could be set, we shouldn't only rely on
that flag and we should also allow caller to specify required 64K
alignment explicitly.  Define new XE_BO_NEEDS_64K flag for that.

Cc: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240313104132.1045-2-michal.wajdeczko@intel.com
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
drivers/gpu/drm/xe/xe_bo.c
drivers/gpu/drm/xe/xe_bo.h

index d7e0deb1b869960aa703caa25e51f4099497c32d..8383c56c99602ec8d38da179814781598322d457 100644 (file)
@@ -1217,7 +1217,8 @@ struct xe_bo *___xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo,
 
        if (flags & (XE_BO_CREATE_VRAM_MASK | XE_BO_CREATE_STOLEN_BIT) &&
            !(flags & XE_BO_CREATE_IGNORE_MIN_PAGE_SIZE_BIT) &&
-           xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K) {
+           ((xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K) ||
+            (flags & XE_BO_NEEDS_64K))) {
                aligned_size = ALIGN(size, SZ_64K);
                if (type != ttm_bo_type_device)
                        size = ALIGN(size, SZ_64K);
index c59ad15961ce5508763dd6aa7862ef574ed05556..87ae8ee7c3162583256f7df156f28d902e9eae5c 100644 (file)
@@ -45,6 +45,7 @@
 #define XE_BO_PAGETABLE                        BIT(12)
 #define XE_BO_NEEDS_CPU_ACCESS         BIT(13)
 #define XE_BO_NEEDS_UC                 BIT(14)
+#define XE_BO_NEEDS_64K                        BIT(15)
 /* this one is trigger internally only */
 #define XE_BO_INTERNAL_TEST            BIT(30)
 #define XE_BO_INTERNAL_64K             BIT(31)