From 4ae12cc6ff1e3cad5e255bd42aa98bdb937ca2be Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Mon, 10 Feb 2025 14:01:07 +0100 Subject: [PATCH] panvk: Initialize device virtual address space after the VM creation Make sure we're not lacking a lock/heap destroy when we fail to create the VM. Fixes: 53fb1d99cac9 ("panvk: Transition to explicit VA assignment on v10+") Reported-by: Lars-Ivar Hesselberg Simonsen Signed-off-by: Boris Brezillon Reviewed-by: Lars-Ivar Hesselberg Simonsen Part-of: --- src/panfrost/vulkan/panvk_vX_device.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/panfrost/vulkan/panvk_vX_device.c b/src/panfrost/vulkan/panvk_vX_device.c index 9c7a66933af..97d6ea552e7 100644 --- a/src/panfrost/vulkan/panvk_vX_device.c +++ b/src/panfrost/vulkan/panvk_vX_device.c @@ -304,10 +304,6 @@ panvk_per_arch(create_device)(struct panvk_physical_device *physical_device, panfrost_clamp_to_usable_va_range(device->kmod.dev, 1ull << 32); uint32_t vm_flags = PAN_ARCH <= 7 ? PAN_KMOD_VM_FLAG_AUTO_VA : 0; - simple_mtx_init(&device->as.lock, mtx_plain); - util_vma_heap_init(&device->as.heap, user_va_start, - user_va_end - user_va_start); - device->kmod.vm = pan_kmod_vm_create(device->kmod.dev, vm_flags, user_va_start, user_va_end - user_va_start); @@ -317,6 +313,10 @@ panvk_per_arch(create_device)(struct panvk_physical_device *physical_device, goto err_destroy_kdev; } + simple_mtx_init(&device->as.lock, mtx_plain); + util_vma_heap_init(&device->as.heap, user_va_start, + user_va_end - user_va_start); + panvk_device_init_mempools(device); #if PAN_ARCH <= 9