anv: Fix some mismatches of canonical and regular addresses around anv_bo_vma_alloc_or_close()

anv_vma_alloc() returns a canonical address, but explicit_address is a
regular address. This mismatch can potentially cause issues.

So here making bo->offset as always canonical address by converting it
in the explicit case and fixing the only caller that was caling
anv_bo_vma_alloc_or_close() with a canonical address.

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23977>
This commit is contained in:
José Roberto de Souza
2023-07-03 09:38:10 -07:00
committed by Marge Bot
parent f948393005
commit 2fa4fe2c85
2 changed files with 4 additions and 4 deletions

View File

@@ -436,7 +436,7 @@ anv_block_pool_expand_range(struct anv_block_pool *pool, uint32_t size)
pool->name,
new_bo_size,
pool->bo_alloc_flags,
pool->start_address + pool->size,
intel_48b_address(pool->start_address + pool->size),
&new_bo);
if (result != VK_SUCCESS)
return result;
@@ -1422,7 +1422,7 @@ anv_bo_vma_alloc_or_close(struct anv_device *device,
if (alloc_flags & ANV_BO_ALLOC_FIXED_ADDRESS) {
bo->has_fixed_address = true;
bo->offset = explicit_address;
bo->offset = intel_canonical_address(explicit_address);
} else {
bo->offset = anv_vma_alloc(device, bo->size + bo->_ccs_size,
align, alloc_flags, explicit_address,

View File

@@ -419,7 +419,7 @@ struct anv_bo {
/* Last known offset. This value is provided by the kernel when we
* execbuf and is used as the presumed offset for the next bunch of
* relocations.
* relocations, in canonical address format.
*/
uint64_t offset;
@@ -596,7 +596,7 @@ struct anv_block_pool {
uint64_t size;
/* The address where the start of the pool is pinned. The various bos that
/* The canonical address where the start of the pool is pinned. The various bos that
* are created as the pool grows will have addresses in the range
* [start_address, start_address + BLOCK_POOL_MEMFD_SIZE).
*/