diff --git a/src/panfrost/vulkan/panvk_physical_device.c b/src/panfrost/vulkan/panvk_physical_device.c index 29c7e0bf2f1..f63472cb845 100644 --- a/src/panfrost/vulkan/panvk_physical_device.c +++ b/src/panfrost/vulkan/panvk_physical_device.c @@ -316,6 +316,11 @@ get_device_heaps(struct panvk_physical_device *device, host_cached_not_coherent_type; } + const uint64_t request_va = + PANVK_DEBUG(NO_EXTENDED_VA_RANGE) ? 1ull << 32 : 1ull << 48; + device->memory.max_supported_va = + pan_clamp_to_usable_va_range(device->kmod.dev, request_va); + return VK_SUCCESS; } diff --git a/src/panfrost/vulkan/panvk_physical_device.h b/src/panfrost/vulkan/panvk_physical_device.h index 14d0f9a687f..4bed947f7a9 100644 --- a/src/panfrost/vulkan/panvk_physical_device.h +++ b/src/panfrost/vulkan/panvk_physical_device.h @@ -63,6 +63,8 @@ struct panvk_physical_device { VkMemoryType types[4]; uint32_t type_count; + + uint64_t max_supported_va; } memory; struct vk_sync_type drm_syncobj_type; diff --git a/src/panfrost/vulkan/panvk_vX_device.c b/src/panfrost/vulkan/panvk_vX_device.c index ae0b400d0a7..7556ddb5696 100644 --- a/src/panfrost/vulkan/panvk_vX_device.c +++ b/src/panfrost/vulkan/panvk_vX_device.c @@ -408,14 +408,11 @@ panvk_per_arch(create_device)(struct panvk_physical_device *physical_device, if (PANVK_DEBUG(TRACE) || PANVK_DEBUG(SYNC) || PANVK_DEBUG(DUMP)) device->debug.decode_ctx = pandecode_create_context(false); - /* 48bit address space, with the lower 32MB reserved. We clamp - * things so it matches kmod VA range limitations. - */ + /* 48bit address space clamped by the physical device limits, with the lower + * 32MB reserved. */ uint64_t user_va_start = pan_clamp_to_usable_va_range( device->kmod.dev, PANVK_VA_RESERVE_BOTTOM); - const uint64_t user_va_bits = PANVK_DEBUG(NO_EXTENDED_VA_RANGE) ? 32 : 48; - uint64_t user_va_end = - pan_clamp_to_usable_va_range(device->kmod.dev, 1ull << user_va_bits); + uint64_t user_va_end = physical_device->memory.max_supported_va; uint32_t vm_flags = PAN_ARCH < 10 ? PAN_KMOD_VM_FLAG_AUTO_VA : 0; device->kmod.vm =