Skip to content

Commit 210b3b3

Browse files
Xiaojie Yuanalexdeucher
authored andcommitted
drm/amdgpu/gfx10: re-init clear state buffer after gpu reset
This patch fixes 2nd baco reset failure with gfxoff enabled on navi1x. clear state buffer (resides in vram) is corrupted after 1st baco reset, upon gfxoff exit, CPF gets garbage header in CSIB and hangs. Signed-off-by: Xiaojie Yuan <[email protected]> Reviewed-by: Hawking Zhang <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent a351132 commit 210b3b3

File tree

1 file changed

+37
-6
lines changed

1 file changed

+37
-6
lines changed

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,27 +1785,52 @@ static void gfx_v10_0_enable_gui_idle_interrupt(struct amdgpu_device *adev,
17851785
WREG32_SOC15(GC, 0, mmCP_INT_CNTL_RING0, tmp);
17861786
}
17871787

1788-
static void gfx_v10_0_init_csb(struct amdgpu_device *adev)
1788+
static int gfx_v10_0_init_csb(struct amdgpu_device *adev)
17891789
{
1790+
int r;
1791+
1792+
if (adev->in_gpu_reset) {
1793+
r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
1794+
if (r)
1795+
return r;
1796+
1797+
r = amdgpu_bo_kmap(adev->gfx.rlc.clear_state_obj,
1798+
(void **)&adev->gfx.rlc.cs_ptr);
1799+
if (!r) {
1800+
adev->gfx.rlc.funcs->get_csb_buffer(adev,
1801+
adev->gfx.rlc.cs_ptr);
1802+
amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
1803+
}
1804+
1805+
amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
1806+
if (r)
1807+
return r;
1808+
}
1809+
17901810
/* csib */
17911811
WREG32_SOC15(GC, 0, mmRLC_CSIB_ADDR_HI,
17921812
adev->gfx.rlc.clear_state_gpu_addr >> 32);
17931813
WREG32_SOC15(GC, 0, mmRLC_CSIB_ADDR_LO,
17941814
adev->gfx.rlc.clear_state_gpu_addr & 0xfffffffc);
17951815
WREG32_SOC15(GC, 0, mmRLC_CSIB_LENGTH, adev->gfx.rlc.clear_state_size);
1816+
1817+
return 0;
17961818
}
17971819

1798-
static void gfx_v10_0_init_pg(struct amdgpu_device *adev)
1820+
static int gfx_v10_0_init_pg(struct amdgpu_device *adev)
17991821
{
18001822
int i;
1823+
int r;
18011824

1802-
gfx_v10_0_init_csb(adev);
1825+
r = gfx_v10_0_init_csb(adev);
1826+
if (r)
1827+
return r;
18031828

18041829
for (i = 0; i < adev->num_vmhubs; i++)
18051830
amdgpu_gmc_flush_gpu_tlb(adev, 0, i, 0);
18061831

18071832
/* TODO: init power gating */
1808-
return;
1833+
return 0;
18091834
}
18101835

18111836
void gfx_v10_0_rlc_stop(struct amdgpu_device *adev)
@@ -1907,7 +1932,10 @@ static int gfx_v10_0_rlc_resume(struct amdgpu_device *adev)
19071932
r = gfx_v10_0_wait_for_rlc_autoload_complete(adev);
19081933
if (r)
19091934
return r;
1910-
gfx_v10_0_init_pg(adev);
1935+
1936+
r = gfx_v10_0_init_pg(adev);
1937+
if (r)
1938+
return r;
19111939

19121940
/* enable RLC SRM */
19131941
gfx_v10_0_rlc_enable_srm(adev);
@@ -1933,7 +1961,10 @@ static int gfx_v10_0_rlc_resume(struct amdgpu_device *adev)
19331961
return r;
19341962
}
19351963

1936-
gfx_v10_0_init_pg(adev);
1964+
r = gfx_v10_0_init_pg(adev);
1965+
if (r)
1966+
return r;
1967+
19371968
adev->gfx.rlc.funcs->start(adev);
19381969

19391970
if (adev->firmware.load_type == AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO) {

0 commit comments

Comments
 (0)