From: Alex Deucher alexander.deucher@amd.com
[ Upstream commit be7652c23d833d1ab2c67b16e173b1a4e69d1ae6 ]
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. Here's my detailed analysis: ## Bug Analysis The commit fixes a critical bug in the `gfx_v7_0_get_csb_buffer()` function in `/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c`. The bug is on lines 3909-3911 where the function has: ```c } else { return; // BUG: Early return prevents completion of CSB buffer } ``` The fix removes the early `return` statement, changing it to: ```c } ``` ## What the Bug Does 1. **CSB (Clear State Buffer)** is a critical GPU initialization buffer that contains register programming sequences needed to properly initialize the graphics hardware on GFX7 generation AMD GPUs (Bonaire, Kaveri, Kabini, Mullins, Hawaii). 2. **The Bug**: When iterating through clear state sections, if the function encounters any section that is NOT `SECT_CONTEXT`, it immediately returns, **preventing the completion of the CSB buffer initialization**. 3. **Missing Critical Code**: After the early return, the function skips: - Setting `PA_SC_RASTER_CONFIG` register (lines 3915-3939) - critical for rasterization configuration - Adding `PACKET3_PREAMBLE_END_CLEAR_STATE` (lines 3941-3942) - proper command stream termination - Adding `PACKET3_CLEAR_STATE` command (lines 3944-3945) - final clear state execution ## Impact Assessment This is a **hardware initialization bug** that affects: - **Affected Hardware**: All GFX7 AMD GPUs (Bonaire, Kaveri, Kabini, Mullins, Hawaii chips) - **Scope**: Fundamental GPU initialization during driver load - **Symptoms**: Incomplete GPU state initialization, potential rendering issues, GPU hangs, or system instability ## Why This Should Be Backported 1. **Fixes Important Hardware Bug**: This addresses a fundamental hardware initialization issue that can cause GPU malfunction. 2. **Small, Contained Fix**: The change is minimal (removing 2 lines) with no architectural implications. 3. **Clear Bug with Clear Fix**: The commit message explains exactly what's wrong ("We shouldn't return after the last section. We need to update the rest of the CSIB"). 4. **Critical Subsystem**: GPU initialization is a critical path that must work correctly for stable system operation. 5. **Matches Stable Criteria**: - Important bugfix ✓ - Minimal risk ✓ - Small change ✓ - No new features ✓ - Confined to one subsystem ✓ 6. **Historical Pattern**: Looking at the provided similar commits, the fix pattern matches "Similar Commit #4" which was marked as "Backport Status: YES" - it fixes a functional bug in AMDGPU command submission handling. 7. **User Impact**: Users with GFX7 AMD hardware could experience graphics instability or initialization failures due to incomplete CSB programming. The fix ensures that the CSB buffer is properly completed with all necessary register programming and command stream termination, which is essential for stable GPU operation.
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c index 37b4a3db63602..b6e5599c8b3cd 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c @@ -4005,8 +4005,6 @@ static void gfx_v7_0_get_csb_buffer(struct amdgpu_device *adev, buffer[count++] = cpu_to_le32(ext->reg_index - PACKET3_SET_CONTEXT_REG_START); for (i = 0; i < ext->reg_count; i++) buffer[count++] = cpu_to_le32(ext->extent[i]); - } else { - return; } } }