Skip to content

Commit 1e32ffb

Browse files
committed
drm/xe/sriov: support non-contig VRAM provisioning
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
1 parent 52a36e7 commit 1e32ffb

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,15 +1444,23 @@ static int pf_provision_vf_lmem(struct xe_gt *gt, unsigned int vfid, u64 size)
14441444
return 0;
14451445

14461446
xe_gt_assert(gt, pf_get_lmem_alignment(gt) == SZ_2M);
1447-
bo = xe_bo_create_pin_map(xe, tile, NULL,
1448-
ALIGN(size, PAGE_SIZE),
1449-
ttm_bo_type_kernel,
1450-
XE_BO_FLAG_VRAM_IF_DGFX(tile) |
1451-
XE_BO_FLAG_NEEDS_2M |
1452-
XE_BO_FLAG_PINNED);
1447+
bo = xe_bo_create_locked(xe, tile, NULL,
1448+
ALIGN(size, PAGE_SIZE),
1449+
ttm_bo_type_kernel,
1450+
XE_BO_FLAG_VRAM_IF_DGFX(tile) |
1451+
XE_BO_FLAG_NEEDS_2M |
1452+
XE_BO_FLAG_PINNED |
1453+
XE_BO_FLAG_PINNED_LATE_RESTORE);
14531454
if (IS_ERR(bo))
14541455
return PTR_ERR(bo);
14551456

1457+
err = xe_bo_pin(bo);
1458+
xe_bo_unlock(bo);
1459+
if (unlikely(err)) {
1460+
xe_bo_put(bo);
1461+
return err;
1462+
}
1463+
14561464
config->lmem_obj = bo;
14571465

14581466
if (xe_device_has_lmtt(xe)) {

0 commit comments

Comments
 (0)