]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe/migrate: Allow xe_migrate_vram() also on non-pagefault capable devices
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Wed, 26 Mar 2025 08:05:50 +0000 (09:05 +0100)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Thu, 27 Mar 2025 11:08:33 +0000 (12:08 +0100)
The drm_pagemap functionality does not depend on the device having
recoverable pagefaults available. So allow xe_migrate_vram() also for
such devices. Even if this will have little use in practice, it's
beneficial for testin multi-device SVM, since a memory provider could
be a non-pagefault capable gpu.

Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://lore.kernel.org/r/20250326080551.40201-5-thomas.hellstrom@linux.intel.com
drivers/gpu/drm/xe/xe_migrate.c

index d364c9f458e792b3a4619f0d696dfcb8a8bacc86..f17234533504f450df3d92396a3cd66388f55b94 100644 (file)
@@ -1609,6 +1609,7 @@ static struct dma_fence *xe_migrate_vram(struct xe_migrate *m,
 {
        struct xe_gt *gt = m->tile->primary_gt;
        struct xe_device *xe = gt_to_xe(gt);
+       bool use_usm_batch = xe->info.has_usm;
        struct dma_fence *fence = NULL;
        u32 batch_size = 2;
        u64 src_L0_ofs, dst_L0_ofs;
@@ -1625,7 +1626,7 @@ static struct dma_fence *xe_migrate_vram(struct xe_migrate *m,
        batch_size += pte_update_cmd_size(round_update_size);
        batch_size += EMIT_COPY_DW;
 
-       bb = xe_bb_new(gt, batch_size, true);
+       bb = xe_bb_new(gt, batch_size, use_usm_batch);
        if (IS_ERR(bb)) {
                err = PTR_ERR(bb);
                return ERR_PTR(err);
@@ -1650,7 +1651,7 @@ static struct dma_fence *xe_migrate_vram(struct xe_migrate *m,
                  XE_PAGE_SIZE);
 
        job = xe_bb_create_migration_job(m->q, bb,
-                                        xe_migrate_batch_base(m, true),
+                                        xe_migrate_batch_base(m, use_usm_batch),
                                         update_idx);
        if (IS_ERR(job)) {
                err = PTR_ERR(job);