From 35063c776480156f97de9ed6819b7d1b1713fd50 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: (cherry picked from commit 4ae12cc6ff1e3cad5e255bd42aa98bdb937ca2be) --- .pick_status.json | 2 +- src/panfrost/vulkan/panvk_vX_device.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 150bc62ced4..703b4e07e7c 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -314,7 +314,7 @@ "description": "panvk: Initialize device virtual address space after the VM creation", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "53fb1d99cac9ab318c251aa3e448d26e0c94641c", "notes": null diff --git a/src/panfrost/vulkan/panvk_vX_device.c b/src/panfrost/vulkan/panvk_vX_device.c index d747b25074a..0ddcba404e3 100644 --- a/src/panfrost/vulkan/panvk_vX_device.c +++ b/src/panfrost/vulkan/panvk_vX_device.c @@ -286,10 +286,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); @@ -299,6 +295,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