From: "Jesse.Zhang" Jesse.Zhang@amd.com
[ Upstream commit ad7c088e31f026d71fe87fd09473fafb7d6ed006 ]
The mes_v11_0_reset_hw_queue and mes_v12_0_reset_hw_queue functions were using the wrong union type (MESAPI__REMOVE_QUEUE) when getting the offset for api_status. Since these functions handle queue reset operations, they should use MESAPI__RESET union instead.
This fixes the polling of API status during hardware queue reset operations in the MES for both v11 and v12 versions.
Signed-off-by: Jesse Zhang jesse.zhang@amd.com Reviewed-By: Shaoyun.liu Shaoyun.liu@amd.com Reviewed-by: Prike Liang Prike.Liang@amd.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 based on the following analysis: ## Bug Analysis The commit fixes a clear functional bug where `mes_v11_0_reset_hw_queue()` and `mes_v12_0_reset_hw_queue()` functions were using the wrong union type (`MESAPI__REMOVE_QUEUE`) to get the API status offset for polling completion. Since these functions handle **reset** operations, they should use the `MESAPI__RESET` union instead. ## Code Changes Assessment 1. **Small and contained**: The fix changes only 2 lines across 2 files: - `mes_v11_0.c:480`: `offsetof(union MESAPI__REMOVE_QUEUE, api_status)` → `offsetof(union MESAPI__RESET, api_status)` - `mes_v12_0.c:500`: Same change 2. **Logical correctness**: The functions create `union MESAPI__RESET mes_reset_queue_pkt` packets but were polling using the wrong union offset. This is a clear mismatch that could cause incorrect polling behavior. 3. **No architectural changes**: This is purely a bug fix that aligns the API status polling with the correct packet type. ## Impact Assessment - **Affects GPU queue management**: MES (Micro Engine Scheduler) queue reset is a critical operation for AMD GPUs - **Potential for silent failures**: Wrong offset polling could lead to improper completion detection - **User-visible impact**: Could cause GPU hangs or incorrect queue state management - **Low regression risk**: The fix aligns the code with its intended design ## Comparison with Similar Commits All 5 provided similar commits were marked "NO" for backporting because they: - Added new APIs/features (commits #1, #2) - Made functional changes to queue reset behavior (commits #3, #4, #5) In contrast, this commit: - Fixes an existing bug without adding features - Maintains existing behavior while correcting implementation - Follows the stable tree rule of "important bugfixes with minimal risk" ## Stable Tree Criteria Met ✅ **Important bugfix**: Fixes incorrect API status polling in GPU queue reset ✅ **Minimal risk**: Two-line change with clear logic ✅ **No new features**: Pure correctness fix ✅ **Contained change**: Limited to MES driver subsystem ✅ **Clear side effects**: Improves reliability of queue reset operations This commit represents exactly the type of focused bug fix that stable trees are designed to include.
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c index ef9538fbbf537..480283da18454 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c @@ -480,7 +480,7 @@ static int mes_v11_0_reset_hw_queue(struct amdgpu_mes *mes,
return mes_v11_0_submit_pkt_and_poll_completion(mes, &mes_reset_queue_pkt, sizeof(mes_reset_queue_pkt), - offsetof(union MESAPI__REMOVE_QUEUE, api_status)); + offsetof(union MESAPI__RESET, api_status)); }
static int mes_v11_0_map_legacy_queue(struct amdgpu_mes *mes, diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c index e6ab617b9a404..624c6b4e452c8 100644 --- a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c @@ -500,7 +500,7 @@ static int mes_v12_0_reset_hw_queue(struct amdgpu_mes *mes,
return mes_v12_0_submit_pkt_and_poll_completion(mes, pipe, &mes_reset_queue_pkt, sizeof(mes_reset_queue_pkt), - offsetof(union MESAPI__REMOVE_QUEUE, api_status)); + offsetof(union MESAPI__RESET, api_status)); }
static int mes_v12_0_map_legacy_queue(struct amdgpu_mes *mes,