]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
drm/imagination: vm: fix drm_gpuvm reference count
authorDanilo Krummrich <dakr@redhat.com>
Fri, 24 Nov 2023 23:36:38 +0000 (00:36 +0100)
committerMaxime Ripard <mripard@kernel.org>
Tue, 28 Nov 2023 12:57:46 +0000 (13:57 +0100)
commit0d3abd456be45369235dd75793ce26f07900044c
tree49baf411450557a160b2cb6beee5d1d2750b03e6
parent4550d66d08b2257a1b2d3ce339d68ca33177f4b9
drm/imagination: vm: fix drm_gpuvm reference count

The driver specific reference count indicates whether the VM should be
teared down, whereas GPUVM's reference count indicates whether the VM
structure can finally be freed.

Hence, free the VM structure in pvr_gpuvm_free() and drop the last
GPUVM reference after tearing down the VM. Generally, this prevents
lifetime issues such as the VM being freed as long as drm_gpuvm_bo
structures still hold references to the VM.

Fixes: ff5f643de0bf ("drm/imagination: Add GEM and VM related code")
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Reviewed-by: Donald Robson <donald.robson@imgtec.com>
Tested-by: Frank Binns <frank.binns@imgtec.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20231124233650.152653-4-dakr@redhat.com
drivers/gpu/drm/imagination/pvr_vm.c