summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorHimal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>2025-11-25 10:56:26 +0300
committerHimal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>2025-11-26 13:12:33 +0300
commit0ae006dc48f3748fdee675052bc0e5e87b856ac2 (patch)
treedd6cecdfee719a2d853a15c74fb92ccffb18c789 /drivers/gpu/drm
parent4a938d3886d6dd29a54a2e6ebc03b6c2b7509ebf (diff)
downloadlinux-0ae006dc48f3748fdee675052bc0e5e87b856ac2.tar.xz
drm/xe/svm: Extend MAP range to reduce vma fragmentation
When DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR is set during VM_BIND_OP_MAP, the mapping logic now checks adjacent cpu_addr_mirror VMAs with default attributes and expands the mapping range accordingly. This ensures that bo_unmap operations ideally target the same area and helps reduce fragmentation by coalescing nearby compatible VMAs into a single mapping. Cc: Matthew Brost <matthew.brost@intel.com> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://patch.msgid.link/20251125075628.1182481-4-himal.prasad.ghimiray@intel.com Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/xe/xe_vm.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index fc11a1a6f979..2681039f3221 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -2233,6 +2233,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_vma_ops *vops,
struct drm_gpuva_ops *ops;
struct drm_gpuva_op *__op;
struct drm_gpuvm_bo *vm_bo;
+ u64 range_start = addr;
u64 range_end = addr + range;
int err;
@@ -2245,10 +2246,14 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_vma_ops *vops,
switch (operation) {
case DRM_XE_VM_BIND_OP_MAP:
+ if (flags & DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR)
+ xe_vm_find_cpu_addr_mirror_vma_range(vm, &range_start, &range_end);
+
+ fallthrough;
case DRM_XE_VM_BIND_OP_MAP_USERPTR: {
struct drm_gpuvm_map_req map_req = {
- .map.va.addr = addr,
- .map.va.range = range,
+ .map.va.addr = range_start,
+ .map.va.range = range_end - range_start,
.map.gem.obj = obj,
.map.gem.offset = bo_offset_or_userptr,
};