From: Xiang Liu xiang.liu@amd.com
[ Upstream commit 8e8e08c831f088ed581444c58a635c49ea1222ab ]
Avoid GFX poison consumption errors logged when fatal error occurs.
Signed-off-by: Xiang Liu xiang.liu@amd.com Reviewed-by: Tao Zhou tao.zhou1@amd.com Signed-off-by: Alex Deucher alexander.deucher@amd.com Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
YES
- What it fixes - The change filters out non-UMC ACA banks that only indicate “poison” when processing the UE (uncorrectable error) channel, which avoids spurious “GFX poison consumption” errors being logged during fatal errors. This directly addresses noisy/misleading error reporting that affects users during GPU fatal error scenarios.
- Key code changes - In `aca_smu_get_valid_aca_banks` (drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c:135), a new conditional skip is added inside the per‑bank loop: - Conditions: `type == ACA_SMU_TYPE_UE`, `ACA_REG__STATUS__POISON(bank.regs[ACA_REG_IDX_STATUS])`, and `!aca_bank_hwip_is_matched(&bank, ACA_HWIP_TYPE_UMC)`. - Effect: For UE processing, ACA banks with the POISON bit set that are not from UMC are skipped (not logged/processed). This is the core behavioral fix. - The helper `aca_bank_hwip_is_matched` is moved above to allow its use in that function (no behavioral change; just reordering). In trees where it’s defined later (e.g., drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c:183), either move it up or add a static prototype to avoid implicit declaration errors. - The rest of the diff context (e.g., extra logging such as SCRUB) is not central to this fix and does not alter the backport’s intent.
- Why it’s correct and minimal - “Poison” originates from memory (UMC). When a fatal UE occurs, other IPs may reflect poison consumption but should not be counted/logged as distinct UE sources; this commit ensures only UMC poison is considered in the UE path. - The change is localized to one function and one driver file. It does not alter SMU programming, scheduling, or broader recovery flow. - It only reduces false positives: non-UMC banks with POISON on the UE channel are dropped early; non-POISON or UMC banks continue to be processed as before.
- Risk and side effects - Low risk: The filter applies only when `type == ACA_SMU_TYPE_UE` and the POISON bit is set, and only for non‑UMC hardware IPs. It does not hide non‑poison UE errors, nor any UMC-origin errors. - It reduces misleading GFX-side logs and counters, which can otherwise trigger unnecessary investigations or misleading event paths. - No architectural changes; no API changes; no new features.
- Stable/backport suitability - Important bug fix: prevents spurious/misleading error logs during fatal events. - Small and contained change to a single driver file. - No new interfaces; purely defensive filtering logic. - Dependencies exist in stable trees: - `ACA_REG__STATUS__POISON` is defined (drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h:48). - `ACA_HWIP_TYPE_UMC` and `aca_bank_hwip_is_matched` exist (drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c:183 for the helper; may require moving it above or adding a forward declaration). - The new check uses the `type` argument already present in `aca_smu_get_valid_aca_banks`; it does not depend on newer struct fields (e.g., `smu_err_type`) for this logic. - No evidence of required follow-ups or reverts for this particular behavior. The change is orthogonal to other ACA fixes already in stable (e.g., boundary checks).
- Backport note - When applying to trees where `aca_bank_hwip_is_matched` is defined after `aca_smu_get_valid_aca_banks` (drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c:183), either move the helper above or add `static bool aca_bank_hwip_is_matched(struct aca_bank *, enum aca_hwip_type);` before use to satisfy kernel build rules (no implicit declarations).
Conclusion: This is a targeted, low-risk bugfix that reduces false poison consumption logging during fatal UEs. It fits stable criteria well and should be backported.
drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 51 +++++++++++++++---------- 1 file changed, 30 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c index cbc40cad581b4..d1e431818212d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c @@ -130,6 +130,27 @@ static void aca_smu_bank_dump(struct amdgpu_device *adev, int idx, int total, st RAS_EVENT_LOG(adev, event_id, HW_ERR "hardware error logged by the scrubber\n"); }
+static bool aca_bank_hwip_is_matched(struct aca_bank *bank, enum aca_hwip_type type) +{ + + struct aca_hwip *hwip; + int hwid, mcatype; + u64 ipid; + + if (!bank || type == ACA_HWIP_TYPE_UNKNOW) + return false; + + hwip = &aca_hwid_mcatypes[type]; + if (!hwip->hwid) + return false; + + ipid = bank->regs[ACA_REG_IDX_IPID]; + hwid = ACA_REG__IPID__HARDWAREID(ipid); + mcatype = ACA_REG__IPID__MCATYPE(ipid); + + return hwip->hwid == hwid && hwip->mcatype == mcatype; +} + static int aca_smu_get_valid_aca_banks(struct amdgpu_device *adev, enum aca_smu_type type, int start, int count, struct aca_banks *banks, struct ras_query_context *qctx) @@ -168,6 +189,15 @@ static int aca_smu_get_valid_aca_banks(struct amdgpu_device *adev, enum aca_smu_
bank.smu_err_type = type;
+ /* + * Poison being consumed when injecting a UE while running background workloads, + * which are unexpected. + */ + if (type == ACA_SMU_TYPE_UE && + ACA_REG__STATUS__POISON(bank.regs[ACA_REG_IDX_STATUS]) && + !aca_bank_hwip_is_matched(&bank, ACA_HWIP_TYPE_UMC)) + continue; + aca_smu_bank_dump(adev, i, count, &bank, qctx);
ret = aca_banks_add_bank(banks, &bank); @@ -178,27 +208,6 @@ static int aca_smu_get_valid_aca_banks(struct amdgpu_device *adev, enum aca_smu_ return 0; }
-static bool aca_bank_hwip_is_matched(struct aca_bank *bank, enum aca_hwip_type type) -{ - - struct aca_hwip *hwip; - int hwid, mcatype; - u64 ipid; - - if (!bank || type == ACA_HWIP_TYPE_UNKNOW) - return false; - - hwip = &aca_hwid_mcatypes[type]; - if (!hwip->hwid) - return false; - - ipid = bank->regs[ACA_REG_IDX_IPID]; - hwid = ACA_REG__IPID__HARDWAREID(ipid); - mcatype = ACA_REG__IPID__MCATYPE(ipid); - - return hwip->hwid == hwid && hwip->mcatype == mcatype; -} - static bool aca_bank_is_valid(struct aca_handle *handle, struct aca_bank *bank, enum aca_smu_type type) { const struct aca_bank_ops *bank_ops = handle->bank_ops;