]> www.infradead.org Git - users/dwmw2/linux.git/commit
drm/amdkfd: save and restore barrier state for gfx12
authorLancelot SIX <lancelot.six@amd.com>
Wed, 3 Jan 2024 12:50:19 +0000 (12:50 +0000)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 2 May 2024 20:18:12 +0000 (16:18 -0400)
commit450abfe4330a4131a02bd0682b1f742c424c30f3
tree4c8be6feefa4be015b5860da4470331c019fce71
parentf2810033360503989dee81c5a04cd4c4904ad231
drm/amdkfd: save and restore barrier state for gfx12

Add support to save and restore the work group barrier state in gfx12
CWSR trap handler.

There is no support to directly restore the signal count of a barrier
state, so instead this patch repeatedly calls s_barrier_signal to
increment the signal count to the desired value.

In this patch, I have implemented the logic to restore the barrier at
the end of the block restoring the HWREGs.  This process needs to be
done by exactly 1 wave per work group.  To achieve this, the initial
value of s_restore_spi_init_hi (containing a FIRST_WAVE bit) needs to be
saved up until that point.  An alternative could be restore the barrier
earlier in the process (around when LDS is restored, as the same wave
does both).  Doing this would break the pattern that the restore
procedure follows the CWSR area layout.

Before restoring the barrier, this patch checks if the barrier was whose
state was saved has the "valid" bit set, even if I don't think this
barrier can be in an invalid state during context save.  I expect this
test to always be true.

Signed-off-by: Lancelot SIX <lancelot.six@amd.com>
Reviewed-by: Jay Cornwall <jay.cornwall@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm