User queues get their first-level TBA and TMA from MES/KIQ when the queue is created. Kernel-managed VMIDs do not use this path, so program their trap registers from the gfxhub setup path.
Get the reserved first-level TBA and TMA virtual addresses and program them for kernel-managed VMIDs. User-queue VMIDs continue to receive their trap state through the existing MES/KIQ programming path. The trap registers use the SRBM selector, so keep the programming under srbm_mutex and restore the VMID selector after the registers are updated. Trap enablement differs across GPU generations. On GFX9, enable traps for user-queue VMIDs through the debug trap configuration and program kernel-managed VMIDs through the gfxhub path. On GFX9.4.3, enable the per-VMID trap control on each XCC. On generations where trap enable is encoded in SQ_SHADER_TBA_HI, program TRAP_EN together with the TBA address. Mask the TBA and TMA address fields before writing the registers. Keep TRAP_EN disabled on the affected GFX11 ASICs to preserve the existing trap workaround. On multi-XCC hardware, program the requested XCCs and restore the VMID selector on each XCC afterwards. Keep the first-level trap VA layout inside amdgpu_trap. The gfxhub code only needs the final TBA and TMA addresses. Suggested-by: Christian König <[email protected]> Suggested-by: Alex Deucher <[email protected]> Suggested-by: Lijo Lazar <[email protected]> Cc: Felix Kuehling <[email protected]> Cc: Lancelot Six <[email protected]> Cc: James Zhu <[email protected]> Cc: Samuel Pitoiset <[email protected]> Cc: Natalie Vock <[email protected]> Cc: Timur Kristóf <[email protected]> Cc: Pierre-Eric Pelloux-Prayer <[email protected]> Signed-off-by: Srinivasan Shanmugam <[email protected]> Acked-by: Christian König <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu_trap.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_trap.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_trap.c index cb3e5f26ee23..8eec379bfb3b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_trap.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_trap.c @@ -63,7 +63,14 @@ static inline uint64_t amdgpu_trap_tba_vaddr(struct amdgpu_device *adev) return addr; } -static inline bool amdgpu_trap_is_supported(struct amdgpu_device *adev) +void amdgpu_trap_get_l1_addr(struct amdgpu_device *adev, + u64 *tba_addr, u64 *tma_addr) +{ + *tba_addr = amdgpu_trap_tba_vaddr(adev); + *tma_addr = *tba_addr + AMDGPU_TRAP_TMA_OFFSET; +} + +bool amdgpu_trap_is_supported(struct amdgpu_device *adev) { u32 gc_ver = amdgpu_ip_version(adev, GC_HWIP, 0); -- 2.34.1
