AMD General

drop this patch. It is only needed on the amd-unified-interface branch, which 
is missing a prerequisite change; the latest amd-staging-drm-next does not need 
it.


> -----Original Message-----
> From: Jesse Zhang <[email protected]>
> Sent: Monday, November 16, 2026 11:23 AM
> To: [email protected]
> Cc: Deucher, Alexander <[email protected]>; Koenig, Christian
> <[email protected]>; SHANMUGAM, SRINIVASAN
> <[email protected]>; Lazar, Lijo <[email protected]>;
> Zhang, Jesse(Jie) <[email protected]>
> Subject: [PATCH] drm/amdgpu: look up the L2 trap handler mappings by GPU
> page
>
> amdgpu_trap_validate_user_addr() passes the byte address of the second
> level TBA and TMA to amdgpu_vm_bo_lookup_mapping(), but the VM
> mappings are indexed by GPU page number, like every other caller of it does
> and like the range check right after it assumes. The lookup never finds the
> mapping, so SET_L2_TRAP fails with -EINVAL for any valid TBA/TMA.
>
> On navi48 with the VM ioctl SET_L2_TRAP added, the IGT slth-* tests map the
> TBA at 0x100000000 and the lookup of 0x100000000 returns NULL, while
> the mapping is at page 0x100000. With the page number the lookup finds the
> mapping and slth-{gfx,comp}-kq-vgpr-proof, slth-gfx-umq-vgpr-proof and
> slth-comp-kq-returnproof pass.
>
> Look the mapping up by page number.
>
> CC:[email protected]
> CC:Christian Koenig <[email protected]> CC:Lijo Lazar
> <[email protected]> CC:Srinivasan Shanmugam
> <[email protected]>
>
> Fixes: 1a6f95d4a5d7 ("drm/amdgpu: Add second-level trap handler
> infrastructure")
> Signed-off-by: Jesse Zhang <[email protected]>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_trap.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_trap.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_trap.c
> index 3660f94a0929..52e4d30e63fa 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_trap.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_trap.c
> @@ -622,17 +622,14 @@ static int amdgpu_trap_validate_user_addr(struct
> amdgpu_device *adev,
>       if (check_add_overflow(start, (u64)usr_addr->size - 1, &end))
>               return -EINVAL;
>
> -     /*
> -      * amdgpu_vm_bo_lookup_mapping() expects a GPU VA,
> -      * not a page-shifted address.
> -      */
> -     va_map = amdgpu_vm_bo_lookup_mapping(vm, start);
> -     if (!va_map)
> -             return -EINVAL;
> -
>       addr = start >> AMDGPU_GPU_PAGE_SHIFT;
>       last = end >> AMDGPU_GPU_PAGE_SHIFT;
>
> +     /* The VM mappings are indexed by GPU page number */
> +     va_map = amdgpu_vm_bo_lookup_mapping(vm, addr);
> +     if (!va_map)
> +             return -EINVAL;
> +
>       if (addr < va_map->start || last > va_map->last)
>               return -EINVAL;
>
> --
> 2.50.1

Reply via email to