summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/xe_bo.c
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2023-06-19 14:00:20 +0300
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-21 19:35:00 +0300
commit513e82627931d0ac6b74b9c2595008b3573a5158 (patch)
tree3cdcf68affcb821e14db4a83b11f97d6213fc47b /drivers/gpu/drm/xe/xe_bo.c
parent83ee6699b5964ff3b904a7064a61b453236296d6 (diff)
downloadlinux-513e82627931d0ac6b74b9c2595008b3573a5158.tar.xz
drm/xe/bo: consider bo->flags in xe_bo_migrate()
For VRAM allocations the bo->flags can control some characteristics of the underlying memory, like whether it needs to be contiguous, and in the future whether it needs to be in the CPU visible portion. Rather use add_vram() in xe_bo_migrate() which should take care of such things for us. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Cc: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_bo.c')
-rw-r--r--drivers/gpu/drm/xe/xe_bo.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index ad0ea3014bfe..f54fb7bd184a 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -1852,6 +1852,7 @@ static void xe_place_from_ttm_type(u32 mem_type, struct ttm_place *place)
*/
int xe_bo_migrate(struct xe_bo *bo, u32 mem_type)
{
+ struct xe_device *xe = ttm_to_xe_device(bo->ttm.bdev);
struct ttm_operation_ctx ctx = {
.interruptible = true,
.no_wait_gpu = false,
@@ -1876,6 +1877,18 @@ int xe_bo_migrate(struct xe_bo *bo, u32 mem_type)
placement.placement = &requested;
placement.busy_placement = &requested;
+ /*
+ * Stolen needs to be handled like below VRAM handling if we ever need
+ * to support it.
+ */
+ drm_WARN_ON(&xe->drm, mem_type == XE_PL_STOLEN);
+
+ if (mem_type_is_vram(mem_type)) {
+ u32 c = 0;
+
+ add_vram(xe, bo, &requested, bo->flags, mem_type, &c);
+ }
+
return ttm_bo_validate(&bo->ttm, &placement, &ctx);
}