Merge: x86/CPU/AMD: Ignore invalid reset reason value
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7283 JIRA: https://issues.redhat.com/browse/RHEL-103591 commit e9576e078220c50ace9e9087355423de23e25fa5 Author: Yazen Ghannam <yazen.ghannam@amd.com> Date: Mon Jul 21 18:11:54 2025 +0000 x86/CPU/AMD: Ignore invalid reset reason value The reset reason value may be "all bits set", e.g. 0xFFFFFFFF. This is a commonly used error response from hardware. This may occur due to a real hardware issue or when running in a VM. The user will see all reset reasons reported in this case. Check for an error response value and return early to avoid decoding invalid data. Also, adjust the data variable type to match the hardware register size. Fixes: ab8131028710 ("x86/CPU/AMD: Print the reason for the last reset") Reported-by: Libing He <libhe@redhat.com> Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/20250721181155.3536023-1-yazen.ghannam@amd.com Signed-off-by: David Arcari <darcari@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: Lenny Szubowicz <lszubowi@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
This commit is contained in:
commit
de94c64c86
|
@ -1243,8 +1243,8 @@ static const char * const s5_reset_reason_txt[] = {
|
|||
|
||||
static __init int print_s5_reset_status_mmio(void)
|
||||
{
|
||||
unsigned long value;
|
||||
void __iomem *addr;
|
||||
u32 value;
|
||||
int i;
|
||||
|
||||
if (!cpu_feature_enabled(X86_FEATURE_ZEN))
|
||||
|
@ -1257,12 +1257,16 @@ static __init int print_s5_reset_status_mmio(void)
|
|||
value = ioread32(addr);
|
||||
iounmap(addr);
|
||||
|
||||
/* Value with "all bits set" is an error response and should be ignored. */
|
||||
if (value == U32_MAX)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(s5_reset_reason_txt); i++) {
|
||||
if (!(value & BIT(i)))
|
||||
continue;
|
||||
|
||||
if (s5_reset_reason_txt[i]) {
|
||||
pr_info("x86/amd: Previous system reset reason [0x%08lx]: %s\n",
|
||||
pr_info("x86/amd: Previous system reset reason [0x%08x]: %s\n",
|
||||
value, s5_reset_reason_txt[i]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue