• Lancelot SIX's avatar
    drm/amdkfd: save and restore barrier state for gfx12 · 450abfe4
    Lancelot SIX authored
    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: default avatarLancelot SIX <lancelot.six@amd.com>
    Reviewed-by: default avatarJay Cornwall <jay.cornwall@amd.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    450abfe4
cwsr_trap_handler_gfx10.asm 57.9 KB