]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe/sriov: support non-contig VRAM provisioning
authorMatthew Auld <matthew.auld@intel.com>
Thu, 3 Apr 2025 10:24:48 +0000 (11:24 +0100)
committerMatthew Auld <matthew.auld@intel.com>
Fri, 4 Apr 2025 10:41:11 +0000 (11:41 +0100)
Currently we can run into issues with provisioning VRAM region, due to
requiring contig VRAM BO underneath. We sometimes see that allocation
(multiple GB) can fail even when there is enough free space.  We don't
need CPU access to the buffer in the first place, so can forgo pin_map
and therefore also the contig requirement. Keep the same behavior with
save and restore during suspend/resume (which can now be done with
blitter).  We also need the VRAM to occupy the same pages so we don't
need to re-program the LMTT, so should still remain pinned (also we
don't want something to try evict it). With that covert over to plain
pinned kernel object.

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-16-matthew.auld@intel.com
drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c

index 10be109bf357fffd3b5b713848e89d00ef35c842..2420a548cacc1c558a9f79d741cede94834d4851 100644 (file)
@@ -1444,15 +1444,23 @@ static int pf_provision_vf_lmem(struct xe_gt *gt, unsigned int vfid, u64 size)
                return 0;
 
        xe_gt_assert(gt, pf_get_lmem_alignment(gt) == SZ_2M);
-       bo = xe_bo_create_pin_map(xe, tile, NULL,
-                                 ALIGN(size, PAGE_SIZE),
-                                 ttm_bo_type_kernel,
-                                 XE_BO_FLAG_VRAM_IF_DGFX(tile) |
-                                 XE_BO_FLAG_NEEDS_2M |
-                                 XE_BO_FLAG_PINNED);
+       bo = xe_bo_create_locked(xe, tile, NULL,
+                                ALIGN(size, PAGE_SIZE),
+                                ttm_bo_type_kernel,
+                                XE_BO_FLAG_VRAM_IF_DGFX(tile) |
+                                XE_BO_FLAG_NEEDS_2M |
+                                XE_BO_FLAG_PINNED |
+                                XE_BO_FLAG_PINNED_LATE_RESTORE);
        if (IS_ERR(bo))
                return PTR_ERR(bo);
 
+       err = xe_bo_pin(bo);
+       xe_bo_unlock(bo);
+       if (unlikely(err)) {
+               xe_bo_put(bo);
+               return err;
+       }
+
        config->lmem_obj = bo;
 
        if (xe_device_has_lmtt(xe)) {