From: Alex Deucher alexander.deucher@amd.com
[ Upstream commit a9a8bccaa3ba64d509cf7df387cf0b5e1cd06499 ]
We shouldn't return after the last section. We need to update the rest of the CSIB.
Reviewed-by: Rodrigo Siqueira siqueira@igalia.com Signed-off-by: Alex Deucher alexander.deucher@amd.com Signed-off-by: Sasha Levin sashal@kernel.org ---
**YES** This commit should be backported to stable kernel trees. ## Analysis ### Code Change Analysis The commit fixes a **critical bug in CSIB (Clear State Init Buffer) handling** in the GFX11 AMD GPU driver. The problematic code in `gfx_v11_0_get_csb_buffer()` at line 861 contained: ```c } else { return; // This was the bug! } ``` This early return statement prevented the function from completing the CSIB setup when encountering non-SECT_CONTEXT sections. The fix removes this premature return, allowing the function to continue and properly complete the buffer initialization with: 1. **PA_SC_TILE_STEERING_OVERRIDE register setup** (lines 866-870) 2. **PACKET3_PREAMBLE_END_CLEAR_STATE** (lines 872-873) 3. **PACKET3_CLEAR_STATE** (lines 875-876) ### Why This Qualifies for Backporting 1. **Fixes Important Hardware Initialization Bug**: CSIB is critical for GPU state management. Incomplete initialization can cause GPU hangs, rendering artifacts, or system instability. 2. **Small, Contained Fix**: The change removes only 2 lines (`} else { return; }`) - minimal and low-risk. 3. **No Architectural Changes**: This is a pure bugfix with no new features or major code restructuring. 4. **Critical Subsystem**: Graphics drivers are essential for system functionality, and GPU state corruption can cause severe user-visible issues. 5. **Pattern Consistency**: Looking at similar sections across different GFX versions (v10, v9, etc.), they all handle non-SECT_CONTEXT sections by continuing rather than returning early, confirming this was indeed a bug. ### Historical Context Support From examining the codebase, this pattern is consistent across all GFX generations: - **gfx_v10_0.c:4227** and **gfx_v10_0.c:4266**: Handle SECT_CONTEXT but continue for other sections - **gfx_v9_0.c:1609** and **gfx_v9_0.c:1645**: Same pattern - **gfx_v8_0.c**, **gfx_v7_0.c**, **gfx_v6_0.c**: All follow the same approach The previous GFX10 CSIB fix (commit 4905880b4515) shows AMD's commitment to ensuring proper CSIB initialization across GPU generations, reinforcing the importance of this subsystem. ### Risk Assessment - **Regression Risk**: Extremely low - only removes incorrect early termination - **Testing Surface**: Affects GFX11 GPU initialization, easily testable - **Side Effects**: None - only allows completion of intended initialization sequence This is a textbook example of a stable-worthy fix: important bug, minimal change, no regression risk, and affects critical hardware functionality.
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index 61e869839641e..d0ebc00215b13 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -645,8 +645,6 @@ static void gfx_v11_0_get_csb_buffer(struct amdgpu_device *adev, PACKET3_SET_CONTEXT_REG_START); for (i = 0; i < ext->reg_count; i++) buffer[count++] = cpu_to_le32(ext->extent[i]); - } else { - return; } } }