Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/msm: fix msm_gem_vma_new() allocations for managed GPUVMs

Since commit 3309323241fb ("drm/gpuvm: Kill drm_gpuva_init()") MSM
driver fails to init, failing with "[drm:msm_gpu_init] *ERROR* could not
allocate memptrs: -22" errors. The mentioned commit reworked the
function, but didn't take into account that op_map is initialized at the
top of the function, while ranges might change if GPUVM is managed by
the kernel.

Move op_mode initialization after finalizing all addresses and right
before the drm_gpuva_init_from_op() call.

Reported-by: Danct12 <danct12@disroot.org>
Fixes: 3309323241fb ("drm/gpuvm: Kill drm_gpuva_init()")
Suggested-by: Rob Clark <robin.clark@oss.qualcomm.com>
Reviewed-by: Rob Clark <robin.clark@oss.qualcomm.com>
Acked-by: Rob Clark <robin.clark@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250823-msm-fix-gpuvm-init-v1-1-e199cd5b1983@oss.qualcomm.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

+7 -6
+7 -6
drivers/gpu/drm/msm/msm_gem_vma.c
··· 371 371 msm_gem_vma_new(struct drm_gpuvm *gpuvm, struct drm_gem_object *obj, 372 372 u64 offset, u64 range_start, u64 range_end) 373 373 { 374 - struct drm_gpuva_op_map op_map = { 375 - .va.addr = range_start, 376 - .va.range = range_end - range_start, 377 - .gem.obj = obj, 378 - .gem.offset = offset, 379 - }; 380 374 struct msm_gem_vm *vm = to_msm_vm(gpuvm); 381 375 struct drm_gpuvm_bo *vm_bo; 382 376 struct msm_gem_vma *vma; ··· 398 404 399 405 if (obj) 400 406 GEM_WARN_ON((range_end - range_start) > obj->size); 407 + 408 + struct drm_gpuva_op_map op_map = { 409 + .va.addr = range_start, 410 + .va.range = range_end - range_start, 411 + .gem.obj = obj, 412 + .gem.offset = offset, 413 + }; 401 414 402 415 drm_gpuva_init_from_op(&vma->base, &op_map); 403 416 vma->mapped = false;