drm/amdgpu/gfx11: Implement the GFX11 KGQ pipe reset
Subsystems (2)
PATCH v2 1/4 drm/amdgpu/gfx11: Implement the GFX11 KGQ pipe reset
Implement the kernel graphics queue pipe reset,and the driver will fallback to pipe reset when the queue reset fails. However, the ME FW hasn't fully supported pipe reset yet so disable the KGQ pipe reset temporarily.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 2 + drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 71 ++++++++++++++++++++++- 2 files changed, 71 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +2 -0
@@ -25,6 +25,8 @@#include "amdgpu_socbb.h" +#define RS64_FW_UC_START_ADDR_LO 0x3000 +struct common_firmware_header {uint32_t size_bytes;/* size of the entire header+image(s) in bytes */ uint32_t header_size_bytes;/* size of just the header in bytes */
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +69 -2
83 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v2 2/4 drm/amdgpu/gfx11: Implement the GFX11 KCQ pipe reset
Implement the GFX11 compute pipe reset. As the GFX11 CPFW still hasn't fully supported pipe reset yet, therefore disable the KCQ pipe reset temporarily.
--- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 135 ++++++++++++++++++++++++- 1 file changed, 133 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +133 -2
@@ -6758,6 +6758,135 @@ static int gfx_v11_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)return amdgpu_ring_test_ring (ring); } +static int gfx_v11_0_reset_compute_pipe (struct amdgpu_ring *ring) +{ + +struct amdgpu_device *adev = ring->adev; +uint32_t reset_pipe =0 , clean_pipe =0 ; +int r; + +if (!gfx_v11_pipe_reset_support (adev)) +return -EOPNOTSUPP ; + +gfx_v11_0_set_safe_mode (adev,0 ); +mutex_lock (&adev->srbm_mutex); +soc21_grbm_select (adev, ring->me, ring->pipe, ring->queue,0 ); + + reset_pipe =RREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL); + clean_pipe = reset_pipe; + +if (adev->gfx.rs64_enable) { + +switch (ring->pipe) { +case 0 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE0_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE0_RESET ,0 ); +break ; +case 1 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE1_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE1_RESET ,0 ); +break ; +case 2 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE2_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE2_RESET ,0 ); +break ; +case 3 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE3_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE3_RESET ,0 ); +break ; +default : +break ; + } +WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL, clean_pipe); + r = (RREG32_SOC15 (GC ,0 , regCP_MEC_RS64_INSTR_PNTR) <<2 ) -RS64_FW_UC_START_ADDR_LO ; + }else { +if (ring->me ==1 ) { +switch (ring->pipe) { +case 0 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_CNTL , +MEC_ME1_PIPE0_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_CNTL , +MEC_ME1_PIPE0_RESET ,0 ); +break ; +case 1 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_CNTL , +MEC_ME1_PIPE1_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_CNTL , +MEC_ME1_PIPE1_RESET ,0 ); +break ; +case 2 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_CNTL , +MEC_ME1_PIPE2_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_CNTL , +MEC_ME1_PIPE2_RESET ,0 ); +break ; +case 3 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_CNTL , +MEC_ME1_PIPE3_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_CNTL , +MEC_ME1_PIPE3_RESET ,0 ); +break ; +default : +break ; + } +/* mec1 fw pc: CP_MEC1_INSTR_PNTR */ + }else { +switch (ring->pipe) { +case 0 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_CNTL , +MEC_ME2_PIPE0_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_CNTL , +MEC_ME2_PIPE0_RESET ,0 ); +break ; +case 1 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_CNTL , +MEC_ME2_PIPE1_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_CNTL , +MEC_ME2_PIPE1_RESET ,0 ); +break ; +case 2 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_CNTL , +MEC_ME2_PIPE2_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_CNTL , +MEC_ME2_PIPE2_RESET ,0 ); +break ; +case 3 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_CNTL , +MEC_ME2_PIPE3_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_CNTL , +MEC_ME2_PIPE3_RESET ,0 ); +break ; +default : +break ; + } +/* mec2 fw pc: CP:CP_MEC2_INSTR_PNTR */ + } +WREG32_SOC15 (GC ,0 , regCP_MEC_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_MEC_CNTL, clean_pipe); + r =RREG32 (SOC15_REG_OFFSET (GC ,0 , regCP_MEC1_INSTR_PNTR)); + } + +soc21_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +gfx_v11_0_unset_safe_mode (adev,0 ); + +dev_info (adev->dev,"The ring %s pipe resets to MEC FW start PC: %s\n" , ring->name, + r ==0 ?"successfully" :"failed" ); +/*FIXME:Sometimes driver can't cache the MEC firmware start PC correctly, so the pipe +* reset status relies on the compute ring test result. +*/ +return 0 ; +} +static int gfx_v11_0_reset_kcq (struct amdgpu_ring *ring,unsigned int vmid) {struct amdgpu_device *adev = ring->adev;
@@ -6768,8 +6897,10 @@ static int gfx_v11_0_reset_kcq(struct amdgpu_ring *ring, unsigned int vmid) r =amdgpu_mes_reset_legacy_queue (ring->adev, ring, vmid, true);if (r) { -dev_err (adev->dev,"reset via MMIO failed %d\n" , r); -return r; +dev_warn (adev->dev,"fail(%d) to reset kcq and try pipe reset\n" , r); + r =gfx_v11_0_reset_compute_pipe (ring); +if (r) +return r; } r =amdgpu_bo_reserve (ring->mqd_obj, false);
Signature · 1 line
2.34.1
PATCH v2 3/4 drm/amdgpu/gfx12: Implement the gfx12 kgq pipe reset
In reply to Prike LiangImplement the GFX12 kgq pipe reset, and temporarily disable the GFX12 pipe reset untill the CPFW fully support it.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 68 +++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +66 -2
@@ -5248,6 +5248,68 @@ static void gfx_v12_ip_dump(struct amdgpu_ip_block *ip_block)amdgpu_gfx_off_ctrl (adev, true); } +static bool gfx_v12_pipe_reset_support (struct amdgpu_device *adev) +{ +/* Disable the pipe reset until the CPFW fully support it.*/ +dev_warn_once (adev->dev,"The CPFW hasn't support pipe reset yet.\n" ); +return false; +} + +static int gfx_v12_reset_gfx_pipe (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; +uint32_t reset_pipe =0 , clean_pipe =0 ; +int r; + +if (!gfx_v12_pipe_reset_support (adev)) +return -EOPNOTSUPP ; + +gfx_v12_0_set_safe_mode (adev,0 ); +mutex_lock (&adev->srbm_mutex); +soc24_grbm_select (adev, ring->me, ring->pipe, ring->queue,0 ); + +switch (ring->pipe) { +case 0 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_ME_CNTL , +PFP_PIPE0_RESET ,1 ); + reset_pipe =REG_SET_FIELD (reset_pipe,CP_ME_CNTL , +ME_PIPE0_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_ME_CNTL , +PFP_PIPE0_RESET ,0 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_ME_CNTL , +ME_PIPE0_RESET ,0 ); +break ; +case 1 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_ME_CNTL , +PFP_PIPE1_RESET ,1 ); + reset_pipe =REG_SET_FIELD (reset_pipe,CP_ME_CNTL , +ME_PIPE1_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_ME_CNTL , +PFP_PIPE1_RESET ,0 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_ME_CNTL , +ME_PIPE1_RESET ,0 ); +break ; +default : +break ; + } + +WREG32_SOC15 (GC ,0 , regCP_ME_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_ME_CNTL, clean_pipe); + + r = (RREG32 (SOC15_REG_OFFSET (GC ,0 , regCP_GFX_RS64_INSTR_PNTR1)) <<2 ) -RS64_FW_UC_START_ADDR_LO ; +soc24_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +gfx_v12_0_unset_safe_mode (adev,0 ); + +dev_info (adev->dev,"The ring %s pipe reset: %s\n" , ring->name, + r ==0 ?"successfuly" :"failed" ); +/* Sometimes the ME start pc counter can't cache correctly, so the +* PC check only as a reference and pipe reset result rely on the +* later ring test. +*/ +return 0 ; +} +static int gfx_v12_0_reset_kgq (struct amdgpu_ring *ring,unsigned int vmid) {struct amdgpu_device *adev = ring->adev;
@@ -5258,8 +5320,10 @@ static int gfx_v12_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid) r =amdgpu_mes_reset_legacy_queue (ring->adev, ring, vmid, false);if (r) { -dev_err (adev->dev,"reset via MES failed %d\n" , r); -return r; +dev_warn (adev->dev,"reset via MES failed and try pipe reset %d\n" , r); + r =gfx_v12_reset_gfx_pipe (ring); +if (r) +return r; } r =amdgpu_bo_reserve (ring->mqd_obj, false);
Signature · 1 line
2.34.1
PATCH v2 4/4 drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe reset
In reply to Prike LiangImplement the GFX12 KCQ pipe reset, and disable the GFX12 kernel compute queue until the CPFW fully supports it.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 90 +++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +88 -2
@@ -5352,6 +5352,90 @@ static int gfx_v12_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)return amdgpu_ring_test_ring (ring); } +static int gfx_v12_0_reset_compute_pipe (struct amdgpu_ring *ring) +{ + +struct amdgpu_device *adev = ring->adev; +uint32_t reset_pipe =0 , clean_pipe =0 ; +int r; + +if (!gfx_v12_pipe_reset_support (adev)) +return -EOPNOTSUPP ; + +gfx_v12_0_set_safe_mode (adev,0 ); +mutex_lock (&adev->srbm_mutex); +soc24_grbm_select (adev, ring->me, ring->pipe, ring->queue,0 ); + + reset_pipe =RREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL); + clean_pipe = reset_pipe; + +if (adev->gfx.rs64_enable) { + +switch (ring->pipe) { +case 0 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE0_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE0_RESET ,0 ); +break ; +case 1 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE1_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE1_RESET ,0 ); +break ; +case 2 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE2_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE2_RESET ,0 ); +break ; +case 3 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE3_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE3_RESET ,0 ); +break ; +default : +break ; + } +WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL, clean_pipe); + r = (RREG32_SOC15 (GC ,0 , regCP_MEC_RS64_INSTR_PNTR) <<2 ) -RS64_FW_UC_START_ADDR_LO ; + }else { +switch (ring->pipe) { +case 0 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_CNTL , +MEC_ME1_PIPE0_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_CNTL , +MEC_ME1_PIPE0_RESET ,0 ); +break ; +case 1 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_CNTL , +MEC_ME1_PIPE1_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_CNTL , +MEC_ME1_PIPE1_RESET ,0 ); +break ; +default : +break ; + } +WREG32_SOC15 (GC ,0 , regCP_MEC_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_MEC_CNTL, clean_pipe); +/* Doesn't find the F32 MEC instruction pointer register, and suppose +* the driver won't run into the F32 mode. +*/ + } + +soc24_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +gfx_v12_0_unset_safe_mode (adev,0 ); + +dev_info (adev->dev,"The ring %s pipe resets: %s\n" , ring->name, + r ==0 ?"successfully" :"failed" ); +/* Need the ring test to verify the pipe reset result.*/ +return 0 ; + +}static int gfx_v12_0_reset_kcq (struct amdgpu_ring *ring,unsigned int vmid) {struct amdgpu_device *adev = ring->adev;
@@ -5362,8 +5446,10 @@ static int gfx_v12_0_reset_kcq(struct amdgpu_ring *ring, unsigned int vmid) r =amdgpu_mes_reset_legacy_queue (ring->adev, ring, vmid, true);if (r) { -dev_err (adev->dev,"reset via MMIO failed %d\n" , r); -return r; +dev_warn (adev->dev,"fail(%d) to reset kcq and try pipe reset\n" , r); + r =gfx_v12_0_reset_compute_pipe (ring); +if (r) +return r; } r =amdgpu_bo_reserve (ring->mqd_obj, false);
Signature · 1 line
2.34.1
RE: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe reset
[AMD Official Use Only - AMD Internal Distribution Only]
Please review the series patch to catch up the gfx latest base and to avoid the commit merged problem.
Regards,
Prike
Quoted 143 lines
-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Friday, February 21, 2025 9:01 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe resetImplement the GFX12 KCQ pipe reset, and disable the GFX12 kernel compute queue until the CPFW fully supports it.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 90 +++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +27
-0@@ -5352,6 +5352,90 @@ static int gfx_v12_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)return amdgpu_ring_test_ring (ring); } +static int gfx_v12_0_reset_compute_pipe (struct amdgpu_ring *ring) { + +struct amdgpu_device *adev = ring->adev; +uint32_t reset_pipe =0 , clean_pipe =0 ; +int r; + +if (!gfx_v12_pipe_reset_support (adev)) +return -EOPNOTSUPP ; + +gfx_v12_0_set_safe_mode (adev,0 ); +mutex_lock (&adev->srbm_mutex); +soc24_grbm_select (adev, ring->me, ring->pipe, ring->queue,0 ); + + reset_pipe =RREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL); + clean_pipe = reset_pipe; + +if (adev->gfx.rs64_enable) { + +switch (ring->pipe) { +case 0 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE0_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE0_RESET ,0 ); +break ; +case 1 : + reset_pipe = REG_SET_FIELD(reset_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2
-0+ MEC_PIPE1_RESET, 1); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-0+ MEC_PIPE1_RESET, 0); +break ; +case 2 : + reset_pipe = REG_SET_FIELD(reset_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2
-0+ MEC_PIPE2_RESET, 1); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-0+ MEC_PIPE2_RESET, 0); +break ; +case 3 : + reset_pipe = REG_SET_FIELD(reset_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2
-0+ MEC_PIPE3_RESET, 1); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +8
-0+ MEC_PIPE3_RESET, 0); +break ; +default : +break ; + } +WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL, clean_pipe); + r = (RREG32_SOC15(GC, 0, regCP_MEC_RS64_INSTR_PNTR)<< 2) -
RS64_FW_UC_START_ADDR_LO;drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +5
-0+ }else { +switch (ring->pipe) { +case 0 : + reset_pipe = REG_SET_FIELD(reset_pipe, CP_MEC_CNTL, + MEC_ME1_PIPE0_RESET,1);
+clean_pipe= REG_SET_FIELD(clean_pipe,CP_MEC_CNTL,
+MEC_ME1_PIPE0_RESET,
0);drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-0+break ; +case 1 : + reset_pipe = REG_SET_FIELD(reset_pipe, CP_MEC_CNTL, + MEC_ME1_PIPE1_RESET,1);
+clean_pipe= REG_SET_FIELD(clean_pipe,CP_MEC_CNTL,
+MEC_ME1_PIPE1_RESET,
0);drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +7
-0+break ; +default : +break ; + } +WREG32_SOC15 (GC ,0 , regCP_MEC_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_MEC_CNTL, clean_pipe); +/* Doesn't find the F32 MEC instruction pointer register, and suppose
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +14
-0+* the driver won't run into the F32 mode. +*/ + } + +soc24_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +gfx_v12_0_unset_safe_mode (adev,0 ); + +dev_info (adev->dev,"The ring %s pipe resets: %s\n" , ring->name, + r ==0 ?"successfully" :"failed" ); +/* Need the ring test to verify the pipe reset result.*/ +return 0 ; + +}static int gfx_v12_0_reset_kcq (struct amdgpu_ring *ring,unsigned int vmid) { struct amdgpu_device *adev = ring->adev; @@ -5362,8 +5446,10 @@static int
gfx_v12_0_reset_kcq(struct amdgpu_ring *ring, unsigned int vmid)r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, true); if (r) {drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-3-dev_err (adev->dev,"reset via MMIO failed %d\n" , r); -return r; +dev_warn (adev->dev,"fail(%d) to reset kcq and try pipe reset\n" , r); + r =gfx_v12_0_reset_compute_pipe (ring); +if (r) +return r; } r =amdgpu_bo_reserve (ring->mqd_obj, false); --2.34.1
Re: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe reset
Quoted 4 lines · Prike
[AMD Official Use Only - AMD Internal Distribution Only]
Please review the series patch to catch up the gfx latest base and to avoid the commit merged problem.
See my comment on patch 1:
#define RS64_FW_UC_START_ADDR_LO 0x3000
Will this potentially change in future firmware versions or is it fixed? If it will change, then let's just read it back from registers and store it in adev->gfx.rs64_fw_use_start_addr_lo so
that it will be correct if the user has a mix of GPUs in the system. Other than those comments, the series looks good to me.
Alex
Quoted 148 lines
Regards,
PrikeQuoted 143 lines
-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Friday, February 21, 2025 9:01 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe resetImplement the GFX12 KCQ pipe reset, and disable the GFX12 kernel compute queue until the CPFW fully supports it.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 90 +++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +27
-0@@ -5352,6 +5352,90 @@ static int gfx_v12_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)return amdgpu_ring_test_ring (ring); } +static int gfx_v12_0_reset_compute_pipe (struct amdgpu_ring *ring) { + +struct amdgpu_device *adev = ring->adev; +uint32_t reset_pipe =0 , clean_pipe =0 ; +int r; + +if (!gfx_v12_pipe_reset_support (adev)) +return -EOPNOTSUPP ; + +gfx_v12_0_set_safe_mode (adev,0 ); +mutex_lock (&adev->srbm_mutex); +soc24_grbm_select (adev, ring->me, ring->pipe, ring->queue,0 ); + + reset_pipe =RREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL); + clean_pipe = reset_pipe; + +if (adev->gfx.rs64_enable) { + +switch (ring->pipe) { +case 0 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE0_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE0_RESET ,0 ); +break ; +case 1 : + reset_pipe = REG_SET_FIELD(reset_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2
-0+ MEC_PIPE1_RESET, 1); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-0+ MEC_PIPE1_RESET, 0); +break ; +case 2 : + reset_pipe = REG_SET_FIELD(reset_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2
-0+ MEC_PIPE2_RESET, 1); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-0+ MEC_PIPE2_RESET, 0); +break ; +case 3 : + reset_pipe = REG_SET_FIELD(reset_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2
-0+ MEC_PIPE3_RESET, 1); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +8
-0+ MEC_PIPE3_RESET, 0); +break ; +default : +break ; + } +WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL, clean_pipe); + r = (RREG32_SOC15(GC, 0, regCP_MEC_RS64_INSTR_PNTR)<< 2) -
RS64_FW_UC_START_ADDR_LO;drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +5
-0+ }else { +switch (ring->pipe) { +case 0 : + reset_pipe = REG_SET_FIELD(reset_pipe, CP_MEC_CNTL, + MEC_ME1_PIPE0_RESET,1);
+clean_pipe= REG_SET_FIELD(clean_pipe,CP_MEC_CNTL,
+MEC_ME1_PIPE0_RESET,
0);drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-0+break ; +case 1 : + reset_pipe = REG_SET_FIELD(reset_pipe, CP_MEC_CNTL, + MEC_ME1_PIPE1_RESET,1);
+clean_pipe= REG_SET_FIELD(clean_pipe,CP_MEC_CNTL,
+MEC_ME1_PIPE1_RESET,
0);drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +7
-0+break ; +default : +break ; + } +WREG32_SOC15 (GC ,0 , regCP_MEC_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_MEC_CNTL, clean_pipe); +/* Doesn't find the F32 MEC instruction pointer register, and suppose
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +14
-0+* the driver won't run into the F32 mode. +*/ + } + +soc24_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +gfx_v12_0_unset_safe_mode (adev,0 ); + +dev_info (adev->dev,"The ring %s pipe resets: %s\n" , ring->name, + r ==0 ?"successfully" :"failed" ); +/* Need the ring test to verify the pipe reset result.*/ +return 0 ; + +}static int gfx_v12_0_reset_kcq (struct amdgpu_ring *ring,unsigned int vmid) { struct amdgpu_device *adev = ring->adev; @@ -5362,8 +5446,10 @@static int
gfx_v12_0_reset_kcq(struct amdgpu_ring *ring, unsigned int vmid)r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, true); if (r) {drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-3-dev_err (adev->dev,"reset via MMIO failed %d\n" , r); -return r; +dev_warn (adev->dev,"fail(%d) to reset kcq and try pipe reset\n" , r); + r =gfx_v12_0_reset_compute_pipe (ring); +if (r) +return r; } r =amdgpu_bo_reserve (ring->mqd_obj, false); --2.34.1
RE: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe reset
[Public]
Thank you for the input. I have confirmed with the firmware team that the CP FW _start instruction address will be kept consistent. Could we move this patch series forward now?
Regards,
Prike
Quoted 183 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, February 27, 2025 10:38 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe resetQuoted 4 lines · Prike
[AMD Official Use Only - AMD Internal Distribution Only]
Please review the series patch to catch up the gfx latest base and to avoid the
commit merged problem.
See my comment on patch 1:
#define
RS64_FW_UC_START_ADDR_LO0x3000Will this potentially change in future firmware versions or is it fixed? If it will change, then let's just read it back from registers and store it in adev-
Quoted 1 line
gfx.rs64_fw_use_start_addr_lo so that it will be correct if the user has a mix of
GPUs in the system.
Other than those comments, the series looks good to me.Alex
Quoted 154 lines
Regards,
PrikeQuoted 149 lines
-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Friday, February 21, 2025 9:01 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe resetImplement the GFX12 KCQ pipe reset, and disable the GFX12 kernel compute queue until the CPFW fully supports it.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 90 +++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +29
-0@@ -5352,6 +5352,90 @@ static int gfx_v12_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid) return amdgpu_ring_test_ring(ring); } +static int gfx_v12_0_reset_compute_pipe (struct amdgpu_ring *ring) { + +struct amdgpu_device *adev = ring->adev; +uint32_t reset_pipe =0 , clean_pipe =0 ; +int r; + +if (!gfx_v12_pipe_reset_support (adev)) +return -EOPNOTSUPP ; + +gfx_v12_0_set_safe_mode (adev,0 ); +mutex_lock (&adev->srbm_mutex); +soc24_grbm_select (adev, ring->me, ring->pipe, ring->queue,0 ); + + reset_pipe =RREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL); + clean_pipe = reset_pipe; + +if (adev->gfx.rs64_enable) { + +switch (ring->pipe) { +case 0 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE0_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE0_RESET ,0 ); +break ; +case 1 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE1_RESET ,1 ); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-0+ MEC_PIPE1_RESET, 0); +break ; +case 2 : + reset_pipe = REG_SET_FIELD(reset_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2
-0+ MEC_PIPE2_RESET, 1); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-0+ MEC_PIPE2_RESET, 0); +break ; +case 3 : + reset_pipe = REG_SET_FIELD(reset_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2
-0+ MEC_PIPE3_RESET, 1); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +8
-0+ MEC_PIPE3_RESET, 0); +break ; +default : +break ; + } +WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL, clean_pipe); + r = (RREG32_SOC15(GC, 0, regCP_MEC_RS64_INSTR_PNTR)<< 2) -
RS64_FW_UC_START_ADDR_LO;drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +6
-0+ }else { +switch (ring->pipe) { +case 0 : + reset_pipe = REG_SET_FIELD(reset_pipe, CP_MEC_CNTL, + + MEC_ME1_PIPE0_RESET,1);
+clean_pipe= REG_SET_FIELD(clean_pipe,CP_MEC_CNTL,
+
+MEC_ME1_PIPE0_RESET,
0);drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +5
-0+break ; +case 1 : + reset_pipe = REG_SET_FIELD(reset_pipe, CP_MEC_CNTL, + + MEC_ME1_PIPE1_RESET,1);
+clean_pipe= REG_SET_FIELD(clean_pipe,CP_MEC_CNTL,
+
+MEC_ME1_PIPE1_RESET,
0);drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +8
-0+break ; +default : +break ; + } +WREG32_SOC15 (GC ,0 , regCP_MEC_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_MEC_CNTL, clean_pipe); +/* Doesn't find the F32 MEC instruction pointer +register, and suppose
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +14
-0+* the driver won't run into the F32 mode. +*/ + } + +soc24_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +gfx_v12_0_unset_safe_mode (adev,0 ); + +dev_info (adev->dev,"The ring %s pipe resets: %s\n" , ring->name, + r ==0 ?"successfully" :"failed" ); +/* Need the ring test to verify the pipe reset result.*/ +return 0 ; + +}static int gfx_v12_0_reset_kcq (struct amdgpu_ring *ring,unsigned int vmid) { struct amdgpu_device *adev = ring->adev; @@ -5362,8 +5446,10@@ static int
gfx_v12_0_reset_kcq(struct amdgpu_ring *ring, unsigned int vmid)r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, true); if (r) {drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-3-dev_err (adev->dev,"reset via MMIO failed %d\n" , r); -return r; +dev_warn (adev->dev,"fail(%d) to reset kcq and try pipe reset\n" , r); + r =gfx_v12_0_reset_compute_pipe (ring); +if (r) +return r; } r =amdgpu_bo_reserve (ring->mqd_obj, false); --2.34.1
RE: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe reset
[Public]
It seems there still requires implementing the gfx11/gfx12 pipe reset from the project perspective, so please help review the patch series.
Regards,
Prike
Quoted 213 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Liang, Prike
Sent: Monday, March 3, 2025 7:23 PM
To: Alex Deucher <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: RE: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe reset[Public]
[Public]
Thank you for the input. I have confirmed with the firmware team that the CP FW
_startinstruction address will be kept consistent.
Could we move this patch series forward now?Regards,
PrikeQuoted 164 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, February 27, 2025 10:38 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe resetQuoted 5 lines · Prike
[AMD Official Use Only - AMD Internal Distribution Only]
Please review the series patch to catch up the gfx latest base and to avoid the
commit merged problem.
See my comment on patch 1:
#define
RS64_FW_UC_START_ADDR_LO0x3000Will this potentially change in future firmware versions or is it fixed? If it will change, then let's just read it back from registers and store it in adev-
Quoted 2 lines
gfx.rs64_fw_use_start_addr_lo so that it will be correct if the user has a mix of
GPUs in the system.
Other than those comments, the series looks good to me.Alex
Quoted 132 lines
Regards,
PrikeQuoted 128 lines
-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Friday, February 21, 2025 9:01 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe resetImplement the GFX12 KCQ pipe reset, and disable the GFX12 kernel compute queue until the CPFW fully supports it.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 90 +++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +31
-0@@ -5352,6 +5352,90 @@ static int gfx_v12_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid) return amdgpu_ring_test_ring(ring); } +static int gfx_v12_0_reset_compute_pipe (struct amdgpu_ring *ring) +{ + +struct amdgpu_device *adev = ring->adev; +uint32_t reset_pipe =0 , clean_pipe =0 ; +int r; + +if (!gfx_v12_pipe_reset_support (adev)) +return -EOPNOTSUPP ; + +gfx_v12_0_set_safe_mode (adev,0 ); +mutex_lock (&adev->srbm_mutex); +soc24_grbm_select (adev, ring->me, ring->pipe, ring->queue, +0 ); + + reset_pipe =RREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL); + clean_pipe = reset_pipe; + +if (adev->gfx.rs64_enable) { + +switch (ring->pipe) { +case 0 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE0_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE0_RESET ,0 ); +break ; +case 1 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE1_RESET ,1 ); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-0+ MEC_PIPE1_RESET, 0); +break ; +case 2 : + reset_pipe = REG_SET_FIELD(reset_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2
-0+ MEC_PIPE2_RESET, 1); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-0+ MEC_PIPE2_RESET, 0); +break ; +case 3 : + reset_pipe = REG_SET_FIELD(reset_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2
-0+ MEC_PIPE3_RESET, 1); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +8
-0+ MEC_PIPE3_RESET, 0); +break ; +default : +break ; + } +WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL, clean_pipe); + r = (RREG32_SOC15(GC, 0, regCP_MEC_RS64_INSTR_PNTR)<< 2) -
RS64_FW_UC_START_ADDR_LO;drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +7
-0+ }else { +switch (ring->pipe) { +case 0 : + reset_pipe = REG_SET_FIELD(reset_pipe, + CP_MEC_CNTL, + + MEC_ME1_PIPE0_RESET,1);
+clean_pipe= REG_SET_FIELD(clean_pipe,CP_MEC_CNTL,
+
+MEC_ME1_PIPE0_RESET,
0);drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +6
-0+break ; +case 1 : + reset_pipe = REG_SET_FIELD(reset_pipe, + CP_MEC_CNTL, + + MEC_ME1_PIPE1_RESET,1);
+clean_pipe= REG_SET_FIELD(clean_pipe,CP_MEC_CNTL,
+
+MEC_ME1_PIPE1_RESET,
0);drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +8
-0+break ; +default : +break ; + } +WREG32_SOC15 (GC ,0 , regCP_MEC_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_MEC_CNTL, clean_pipe); +/* Doesn't find the F32 MEC instruction pointer +register, and suppose
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +7
-0+* the driver won't run into the F32 mode. +*/ + } + +soc24_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +gfx_v12_0_unset_safe_mode (adev,0 );Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c static int gfx_v12_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid) · line 5439
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +7
-0+ +dev_info (adev->dev,"The ring %s pipe resets: %s\n" , ring->name, + r ==0 ?"successfully" :"failed" ); +/* Need the ring test to verify the pipe reset result.*/ +return 0 ; + +}static int gfx_v12_0_reset_kcq (struct amdgpu_ring *ring,unsigned int vmid){
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c static int gfx_v12_0_reset_kcq(struct amdgpu_ring *ring, unsigned int vmid)
Quoted 9 lines
struct amdgpu_device *adev = ring->adev; @@ -5362,8 +5446,10@@ static int
gfx_v12_0_reset_kcq(struct amdgpu_ring *ring, unsigned int vmid)r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, true); if (r) {drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +1
-2-dev_err (adev->dev,"reset via MMIO failed %d\n" , r); -return r; + dev_warn(adev->dev,"fail(%d) to reset kcq and try pipe reset\n",r);
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +3
-1+ r =gfx_v12_0_reset_compute_pipe (ring); +if (r) +return r; } r =amdgpu_bo_reserve (ring->mqd_obj, false); --2.34.1
Alex Deucher
Acked-byRe: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe reset
Quoted 4 lines · Prike
[Public]
It seems there still requires implementing the gfx11/gfx12 pipe reset from the project perspective, so please help review the patch series.
See my latest comments on patch 1. With those addressed the series is:
Quoted 217 lines
Regards,
PrikeQuoted 213 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Liang, Prike
Sent: Monday, March 3, 2025 7:23 PM
To: Alex Deucher <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: RE: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe reset[Public]
[Public]
Thank you for the input. I have confirmed with the firmware team that the CP FW
_startinstruction address will be kept consistent.
Could we move this patch series forward now?Regards,
PrikeQuoted 164 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, February 27, 2025 10:38 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe resetQuoted 5 lines · Prike
[AMD Official Use Only - AMD Internal Distribution Only]
Please review the series patch to catch up the gfx latest base and to avoid the
commit merged problem.
See my comment on patch 1:
#define
RS64_FW_UC_START_ADDR_LO0x3000Will this potentially change in future firmware versions or is it fixed? If it will change, then let's just read it back from registers and store it in adev-
Quoted 2 lines
gfx.rs64_fw_use_start_addr_lo so that it will be correct if the user has a mix of
GPUs in the system.
Other than those comments, the series looks good to me.Alex
Quoted 132 lines
Regards,
PrikeQuoted 128 lines
-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Friday, February 21, 2025 9:01 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe resetImplement the GFX12 KCQ pipe reset, and disable the GFX12 kernel compute queue until the CPFW fully supports it.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 90 +++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +31
-0@@ -5352,6 +5352,90 @@ static int gfx_v12_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid) return amdgpu_ring_test_ring(ring); } +static int gfx_v12_0_reset_compute_pipe (struct amdgpu_ring *ring) +{ + +struct amdgpu_device *adev = ring->adev; +uint32_t reset_pipe =0 , clean_pipe =0 ; +int r; + +if (!gfx_v12_pipe_reset_support (adev)) +return -EOPNOTSUPP ; + +gfx_v12_0_set_safe_mode (adev,0 ); +mutex_lock (&adev->srbm_mutex); +soc24_grbm_select (adev, ring->me, ring->pipe, ring->queue, +0 ); + + reset_pipe =RREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL); + clean_pipe = reset_pipe; + +if (adev->gfx.rs64_enable) { + +switch (ring->pipe) { +case 0 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE0_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE0_RESET ,0 ); +break ; +case 1 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE1_RESET ,1 ); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-0+ MEC_PIPE1_RESET, 0); +break ; +case 2 : + reset_pipe = REG_SET_FIELD(reset_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2
-0+ MEC_PIPE2_RESET, 1); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-0+ MEC_PIPE2_RESET, 0); +break ; +case 3 : + reset_pipe = REG_SET_FIELD(reset_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2
-0+ MEC_PIPE3_RESET, 1); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +8
-0+ MEC_PIPE3_RESET, 0); +break ; +default : +break ; + } +WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL, clean_pipe); + r = (RREG32_SOC15(GC, 0, regCP_MEC_RS64_INSTR_PNTR)<< 2) -
RS64_FW_UC_START_ADDR_LO;drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +7
-0+ }else { +switch (ring->pipe) { +case 0 : + reset_pipe = REG_SET_FIELD(reset_pipe, + CP_MEC_CNTL, + + MEC_ME1_PIPE0_RESET,1);
+clean_pipe= REG_SET_FIELD(clean_pipe,CP_MEC_CNTL,
+
+MEC_ME1_PIPE0_RESET,
0);drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +6
-0+break ; +case 1 : + reset_pipe = REG_SET_FIELD(reset_pipe, + CP_MEC_CNTL, + + MEC_ME1_PIPE1_RESET,1);
+clean_pipe= REG_SET_FIELD(clean_pipe,CP_MEC_CNTL,
+
+MEC_ME1_PIPE1_RESET,
0);drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +8
-0+break ; +default : +break ; + } +WREG32_SOC15 (GC ,0 , regCP_MEC_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_MEC_CNTL, clean_pipe); +/* Doesn't find the F32 MEC instruction pointer +register, and suppose
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +7
-0+* the driver won't run into the F32 mode. +*/ + } + +soc24_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +gfx_v12_0_unset_safe_mode (adev,0 );Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c static int gfx_v12_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid) · line 5439
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +7
-0+ +dev_info (adev->dev,"The ring %s pipe resets: %s\n" , ring->name, + r ==0 ?"successfully" :"failed" ); +/* Need the ring test to verify the pipe reset result.*/ +return 0 ; + +}static int gfx_v12_0_reset_kcq (struct amdgpu_ring *ring,unsigned int vmid){
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c static int gfx_v12_0_reset_kcq(struct amdgpu_ring *ring, unsigned int vmid)
Quoted 9 lines
struct amdgpu_device *adev = ring->adev; @@ -5362,8 +5446,10@@ static int
gfx_v12_0_reset_kcq(struct amdgpu_ring *ring, unsigned int vmid)r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, true); if (r) {drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +1
-2-dev_err (adev->dev,"reset via MMIO failed %d\n" , r); -return r; + dev_warn(adev->dev,"fail(%d) to reset kcq and try pipe reset\n",r);
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +3
-1+ r =gfx_v12_0_reset_compute_pipe (ring); +if (r) +return r; } r =amdgpu_bo_reserve (ring->mqd_obj, false); --2.34.1
RE: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe reset
[Public]
Quoted 10 lines
From: Alex Deucher <[email protected]>
Sent: Monday, March 24, 2025 10:20 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe resetQuoted 1 line · Prike
Quoted 8 lines
Quoted 3 lines
[Public]
It seems there still requires implementing the gfx11/gfx12 pipe reset from the
project perspective, so please help review the patch series.
See my latest comments on patch 1. With those addressed the series is:
Acked-by Alex Deucher <[email protected]>
Thank you for the review. According to the firmware team, the GFX engine FW start PC will be kept as 0x3000 consistently.
Thanks,
Prike
Quoted 223 lines
Quoted 35 lines
Regards,
PrikeQuoted 31 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Liang, Prike
Sent: Monday, March 3, 2025 7:23 PM
To: Alex Deucher <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: RE: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe reset[Public]
[Public]
Thank you for the input. I have confirmed with the firmware team that the CP FW
_startinstruction address will be kept consistent. Could we move this patch series forward now?Regards,
PrikeQuoted 10 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, February 27, 2025 10:38 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe resetOn Thu, Feb 27, 2025 at 7:36 AM Liang, Prike <[email protected]>
Quoted 102 lines · wrote:
Quoted 102 lines
Quoted 102 lines
Quoted 5 lines
[AMD Official Use Only - AMD Internal Distribution Only]
Please review the series patch to catch up the gfx latest base and to avoid the
commit merged problem.
See my comment on patch 1:
#define
RS64_FW_UC_START_ADDR_LO0x3000Will this potentially change in future firmware versions or is it fixed? If it will change, then let's just read it back from registers and store it in adev-
Quoted 2 lines
gfx.rs64_fw_use_start_addr_lo so that it will be correct if the user has a mix of
GPUs in the system.
Other than those comments, the series looks good to me.Alex
Quoted 80 lines
Regards,
PrikeQuoted 76 lines
-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Friday, February 21, 2025 9:01 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH v2 4/4] drm/amdgpu/gfx12: Implement the GFX12 KCQ pipe resetImplement the GFX12 KCQ pipe reset, and disable the GFX12 kernel compute queue until the CPFW fully supports it.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 90 +++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +31
-0@@ -5352,6 +5352,90 @@ static int gfx_v12_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid) return amdgpu_ring_test_ring(ring); } +static int gfx_v12_0_reset_compute_pipe (struct amdgpu_ring +*ring) { + +struct amdgpu_device *adev = ring->adev; +uint32_t reset_pipe =0 , clean_pipe =0 ; +int r; + +if (!gfx_v12_pipe_reset_support (adev)) +return -EOPNOTSUPP ; + +gfx_v12_0_set_safe_mode (adev,0 ); +mutex_lock (&adev->srbm_mutex); +soc24_grbm_select (adev, ring->me, ring->pipe, + ring->queue,0 ); + + reset_pipe =RREG32_SOC15 (GC ,0 , regCP_MEC_RS64_CNTL); + clean_pipe = reset_pipe; + +if (adev->gfx.rs64_enable) { + +switch (ring->pipe) { +case 0 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE0_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE0_RESET ,0 ); +break ; +case 1 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_MEC_RS64_CNTL , +MEC_PIPE1_RESET ,1 ); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-0+ MEC_PIPE1_RESET, 0); +break ; +case 2 : + reset_pipe = REG_SET_FIELD(reset_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2
-0+ MEC_PIPE2_RESET, 1); + clean_pipe = REG_SET_FIELD(clean_pipe,
CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +4
-0+ MEC_PIPE2_RESET, 0); +break ; +case 3 : + reset_pipe = REG_SET_FIELD(reset_pipe,
CP_MEC_RS64_CNTL,
+MEC_PIPE3_RESET, 1);Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c static int gfx_v12_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)
Quoted 8 lines
+
clean_pipe= REG_SET_FIELD(clean_pipe,CP_MEC_RS64_CNTL,drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +6
-0+ MEC_PIPE3_RESET, 0); +break ; +default : +break ; + } + WREG32_SOC15(GC, 0, regCP_MEC_RS64_CNTL,
reset_pipe);Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ WREG32_SOC15(GC, 0,
regCP_MEC_RS64_CNTL,
clean_pipe);Quoted 74 lines
Quoted 74 lines
Quoted 45 lines
Quoted 45 lines
Quoted 45 lines
+ r = (RREG32_SOC15(GC, 0,
+regCP_MEC_RS64_INSTR_PNTR)
<< 2) -RS64_FW_UC_START_ADDR_LO;drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +7
-0+ }else { +switch (ring->pipe) { +case 0 : + reset_pipe = REG_SET_FIELD(reset_pipe, + CP_MEC_CNTL, + + MEC_ME1_PIPE0_RESET,1);
+clean_pipe= REG_SET_FIELD(clean_pipe,CP_MEC_CNTL,
+
+MEC_ME1_PIPE0_RESET,
0);drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +6
-0+break ; +case 1 : + reset_pipe = REG_SET_FIELD(reset_pipe, + CP_MEC_CNTL, + + MEC_ME1_PIPE1_RESET,1);
+clean_pipe= REG_SET_FIELD(clean_pipe,CP_MEC_CNTL,
+
+MEC_ME1_PIPE1_RESET,
0);drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +8
-0+break ; +default : +break ; + } +WREG32_SOC15 (GC ,0 , regCP_MEC_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_MEC_CNTL, clean_pipe); +/* Doesn't find the F32 MEC instruction pointer +register, and suppose
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +8
-0+* the driver won't run into the F32 mode. +*/ + } + +soc24_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +gfx_v12_0_unset_safe_mode (adev,0 ); +Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +6
-0+dev_info (adev->dev,"The ring %s pipe resets: %s\n" , ring->name, + r ==0 ?"successfully" :"failed" ); +/* Need the ring test to verify the pipe reset result.*/ +return 0 ; + +} static int gfx_v12_0_reset_kcq(struct amdgpu_ring *ring,unsigned int vmid)
{
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c static int gfx_v12_0_reset_kcq(struct amdgpu_ring *ring, unsigned int vmid)
Quoted 10 lines
struct amdgpu_device *adev = ring->adev; @@ -5362,8+5446,10 @@ static int
gfx_v12_0_reset_kcq(struct amdgpu_ring *ring, unsigned int vmid)r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, true); if (r) {drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2
-2-dev_err (adev->dev,"reset via MMIO failed %d\n" , r); -return r; + dev_warn(adev->dev,"fail(%d) to reset kcq and + try pipe reset\n",r);
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +3
-1+ r =gfx_v12_0_reset_compute_pipe (ring); +if (r) +return r; } r =amdgpu_bo_reserve (ring->mqd_obj, false); --2.34.1
Quoted 17 lines · Prike Liang
Implement the kernel graphics queue pipe reset,and the driver will fallback to pipe reset when the queue reset fails. However, the ME FW hasn't fully supported pipe reset yet so disable the KGQ pipe reset temporarily.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 2 + drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 71 ++++++++++++++++++++++- 2 files changed, 71 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h line 28
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +1
-0@@ -25,6 +25,8 @@#include "amdgpu_socbb.h" +#define RS64_FW_UC_START_ADDR_LO 0x3000
Will this potentially change in future firmware versions or is it fixed? If it will change, then let's just read it back from registers and store it in adev->gfx.rs64_fw_use_start_addr_lo or something so that it will be correct if the user has a mix of GPUs in the system. Other than those comments, the series looks good to me.
Alex
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +1
-0+struct common_firmware_header {uint32_t size_bytes;/* size of the entire header+image(s) in bytes */ uint32_t header_size_bytes;/* size of just the header in bytes */ drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0
-0
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static void gfx_v11_0_emit_mem_sync(struct amdgpu_ring *ring) · line 6659
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +4
-0@@ -6653,6 +6653,68 @@ static void gfx_v11_0_emit_mem_sync(struct amdgpu_ring *ring)amdgpu_ring_write (ring, gcr_cntl);/* GCR_CNTL */ } +static bool gfx_v11_pipe_reset_support (struct amdgpu_device *adev) +{ +/* Disable the pipe reset until the CPFW fully support it.*/ +dev_warn_once (adev->dev,"The CPFW hasn't support pipe reset yet.\n" );
I think we can drop this warning. It will just confuse users. Maybe make it debug if you want to keep it.
Quoted 80 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +65
-3+return false; +} + + +static int gfx_v11_reset_gfx_pipe (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; +uint32_t reset_pipe =0 , clean_pipe =0 ; +int r; + +if (!gfx_v11_pipe_reset_support (adev)) +return -EOPNOTSUPP ; + +gfx_v11_0_set_safe_mode (adev,0 ); +mutex_lock (&adev->srbm_mutex); +soc21_grbm_select (adev, ring->me, ring->pipe, ring->queue,0 ); + +switch (ring->pipe) { +case 0 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_ME_CNTL , +PFP_PIPE0_RESET ,1 ); + reset_pipe =REG_SET_FIELD (reset_pipe,CP_ME_CNTL , +ME_PIPE0_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_ME_CNTL , +PFP_PIPE0_RESET ,0 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_ME_CNTL , +ME_PIPE0_RESET ,0 ); +break ; +case 1 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_ME_CNTL , +PFP_PIPE1_RESET ,1 ); + reset_pipe =REG_SET_FIELD (reset_pipe,CP_ME_CNTL , +ME_PIPE1_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_ME_CNTL , +PFP_PIPE1_RESET ,0 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_ME_CNTL , +ME_PIPE1_RESET ,0 ); +break ; +default : +break ; + } + +WREG32_SOC15 (GC ,0 , regCP_ME_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_ME_CNTL, clean_pipe); + + r = (RREG32 (SOC15_REG_OFFSET (GC ,0 , regCP_GFX_RS64_INSTR_PNTR1)) <<2 ) -RS64_FW_UC_START_ADDR_LO ; +soc21_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +gfx_v11_0_unset_safe_mode (adev,0 ); + +dev_info (adev->dev,"The ring %s pipe reset to the ME firmware start PC: %s\n" , ring->name, + r ==0 ?"successfuly" :"failed" ); +/* FIXME: Sometimes driver can't cache the ME firmware start PC correctly, so the pipe reset status +* relies on the later gfx ring test result. +*/ +return 0 ; +} +static int gfx_v11_0_reset_kgq (struct amdgpu_ring *ring,unsigned int vmid) {struct amdgpu_device *adev = ring->adev;@@ -6662,8 +6724,13 @@ static int gfx_v11_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)return -EINVAL ; r =amdgpu_mes_reset_legacy_queue (ring->adev, ring, vmid, false); -if (r) -return r; +if (r) { + +dev_warn (adev->dev,"reset via MES failed and try pipe reset %d\n" , r); + r =gfx_v11_reset_gfx_pipe (ring); +if (r) +return r; + } r =amdgpu_bo_reserve (ring->mqd_obj, false);if (unlikely (r !=0 )) { --2.34.1
Quoted 30 lines · Prike Liang
Implement the kernel graphics queue pipe reset,and the driver will fallback to pipe reset when the queue reset fails. However, the ME FW hasn't fully supported pipe reset yet so disable the KGQ pipe reset temporarily.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 2 + drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 71 ++++++++++++++++++++++- 2 files changed, 71 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +2
-0@@ -25,6 +25,8 @@#include "amdgpu_socbb.h" +#define RS64_FW_UC_START_ADDR_LO 0x3000 +struct common_firmware_header {uint32_t size_bytes;/* size of the entire header+image(s) in bytes */ uint32_t header_size_bytes;/* size of just the header in bytes */ drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0
-0
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static void gfx_v11_0_emit_mem_sync(struct amdgpu_ring *ring) · line 6659
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +4
-0@@ -6653,6 +6653,68 @@ static void gfx_v11_0_emit_mem_sync(struct amdgpu_ring *ring)amdgpu_ring_write (ring, gcr_cntl);/* GCR_CNTL */ } +static bool gfx_v11_pipe_reset_support (struct amdgpu_device *adev) +{ +/* Disable the pipe reset until the CPFW fully support it.*/ +dev_warn_once (adev->dev,"The CPFW hasn't support pipe reset yet.\n" );
I'd drop these or make them debug only for now. Same for gfx12. With that fixed, the series is:
Quoted 80 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +65
-3+return false; +} + + +static int gfx_v11_reset_gfx_pipe (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; +uint32_t reset_pipe =0 , clean_pipe =0 ; +int r; + +if (!gfx_v11_pipe_reset_support (adev)) +return -EOPNOTSUPP ; + +gfx_v11_0_set_safe_mode (adev,0 ); +mutex_lock (&adev->srbm_mutex); +soc21_grbm_select (adev, ring->me, ring->pipe, ring->queue,0 ); + +switch (ring->pipe) { +case 0 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_ME_CNTL , +PFP_PIPE0_RESET ,1 ); + reset_pipe =REG_SET_FIELD (reset_pipe,CP_ME_CNTL , +ME_PIPE0_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_ME_CNTL , +PFP_PIPE0_RESET ,0 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_ME_CNTL , +ME_PIPE0_RESET ,0 ); +break ; +case 1 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_ME_CNTL , +PFP_PIPE1_RESET ,1 ); + reset_pipe =REG_SET_FIELD (reset_pipe,CP_ME_CNTL , +ME_PIPE1_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_ME_CNTL , +PFP_PIPE1_RESET ,0 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_ME_CNTL , +ME_PIPE1_RESET ,0 ); +break ; +default : +break ; + } + +WREG32_SOC15 (GC ,0 , regCP_ME_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_ME_CNTL, clean_pipe); + + r = (RREG32 (SOC15_REG_OFFSET (GC ,0 , regCP_GFX_RS64_INSTR_PNTR1)) <<2 ) -RS64_FW_UC_START_ADDR_LO ; +soc21_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +gfx_v11_0_unset_safe_mode (adev,0 ); + +dev_info (adev->dev,"The ring %s pipe reset to the ME firmware start PC: %s\n" , ring->name, + r ==0 ?"successfuly" :"failed" ); +/* FIXME: Sometimes driver can't cache the ME firmware start PC correctly, so the pipe reset status +* relies on the later gfx ring test result. +*/ +return 0 ; +} +static int gfx_v11_0_reset_kgq (struct amdgpu_ring *ring,unsigned int vmid) {struct amdgpu_device *adev = ring->adev;@@ -6662,8 +6724,13 @@ static int gfx_v11_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)return -EINVAL ; r =amdgpu_mes_reset_legacy_queue (ring->adev, ring, vmid, false); -if (r) -return r; +if (r) { + +dev_warn (adev->dev,"reset via MES failed and try pipe reset %d\n" , r); + r =gfx_v11_reset_gfx_pipe (ring); +if (r) +return r; + } r =amdgpu_bo_reserve (ring->mqd_obj, false);if (unlikely (r !=0 )) { --2.34.1
Quoted 35 lines · Alex Deucher
Quoted 33 lines · Prike Liang
Implement the kernel graphics queue pipe reset,and the driver will fallback to pipe reset when the queue reset fails. However, the ME FW hasn't fully supported pipe reset yet so disable the KGQ pipe reset temporarily.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 2 + drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 71 ++++++++++++++++++++++- 2 files changed, 71 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +2
-0@@ -25,6 +25,8 @@#include "amdgpu_socbb.h" +#define RS64_FW_UC_START_ADDR_LO 0x3000 +struct common_firmware_header {uint32_t size_bytes;/* size of the entire header+image(s) in bytes */ uint32_t header_size_bytes;/* size of just the header in bytes */ drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0
-0@@ -6653,6 +6653,68 @@ static void gfx_v11_0_emit_mem_sync(struct amdgpu_ring *ring)amdgpu_ring_write (ring, gcr_cntl);/* GCR_CNTL */ }
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c static void gfx_v11_0_emit_mem_sync(struct amdgpu_ring *ring) · line 6659
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +4
-0+static bool gfx_v11_pipe_reset_support (struct amdgpu_device *adev) +{ +/* Disable the pipe reset until the CPFW fully support it.*/ +dev_warn_once (adev->dev,"The CPFW hasn't support pipe reset yet.\n" );I'd drop these or make them debug only for now. Same for gfx12. With that fixed, the series is:
Acked-by Alex Deucher <[email protected]>
Just in case you missed my reply. See above ^^^^
Alex
Quoted 82 lines
Quoted 82 lines
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +65
-3+return false; +} + + +static int gfx_v11_reset_gfx_pipe (struct amdgpu_ring *ring) +{ +struct amdgpu_device *adev = ring->adev; +uint32_t reset_pipe =0 , clean_pipe =0 ; +int r; + +if (!gfx_v11_pipe_reset_support (adev)) +return -EOPNOTSUPP ; + +gfx_v11_0_set_safe_mode (adev,0 ); +mutex_lock (&adev->srbm_mutex); +soc21_grbm_select (adev, ring->me, ring->pipe, ring->queue,0 ); + +switch (ring->pipe) { +case 0 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_ME_CNTL , +PFP_PIPE0_RESET ,1 ); + reset_pipe =REG_SET_FIELD (reset_pipe,CP_ME_CNTL , +ME_PIPE0_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_ME_CNTL , +PFP_PIPE0_RESET ,0 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_ME_CNTL , +ME_PIPE0_RESET ,0 ); +break ; +case 1 : + reset_pipe =REG_SET_FIELD (reset_pipe,CP_ME_CNTL , +PFP_PIPE1_RESET ,1 ); + reset_pipe =REG_SET_FIELD (reset_pipe,CP_ME_CNTL , +ME_PIPE1_RESET ,1 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_ME_CNTL , +PFP_PIPE1_RESET ,0 ); + clean_pipe =REG_SET_FIELD (clean_pipe,CP_ME_CNTL , +ME_PIPE1_RESET ,0 ); +break ; +default : +break ; + } + +WREG32_SOC15 (GC ,0 , regCP_ME_CNTL, reset_pipe); +WREG32_SOC15 (GC ,0 , regCP_ME_CNTL, clean_pipe); + + r = (RREG32 (SOC15_REG_OFFSET (GC ,0 , regCP_GFX_RS64_INSTR_PNTR1)) <<2 ) -RS64_FW_UC_START_ADDR_LO ; +soc21_grbm_select (adev,0 ,0 ,0 ,0 ); +mutex_unlock (&adev->srbm_mutex); +gfx_v11_0_unset_safe_mode (adev,0 ); + +dev_info (adev->dev,"The ring %s pipe reset to the ME firmware start PC: %s\n" , ring->name, + r ==0 ?"successfuly" :"failed" ); +/* FIXME: Sometimes driver can't cache the ME firmware start PC correctly, so the pipe reset status +* relies on the later gfx ring test result. +*/ +return 0 ; +} +static int gfx_v11_0_reset_kgq (struct amdgpu_ring *ring,unsigned int vmid) {struct amdgpu_device *adev = ring->adev;@@ -6662,8 +6724,13 @@ static int gfx_v11_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)return -EINVAL ; r =amdgpu_mes_reset_legacy_queue (ring->adev, ring, vmid, false); -if (r) -return r; +if (r) { + +dev_warn (adev->dev,"reset via MES failed and try pipe reset %d\n" , r); + r =gfx_v11_reset_gfx_pipe (ring); +if (r) +return r; + } r =amdgpu_bo_reserve (ring->mqd_obj, false);if (unlikely (r !=0 )) { --2.34.1