Skip to content

Commit 4ab8c81

Browse files
committed
Merge: x86/CPU/AMD: Ignore invalid reset reason value
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1366 JIRA: https://issues.redhat.com/browse/RHEL-101301 commit e9576e0 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: ab81310 ("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: Steve Best <sbest@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: Lenny Szubowicz <lszubowi@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Scott Weaver <scweaver@redhat.com>
2 parents 2f9b489 + 55bbbf2 commit 4ab8c81

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

arch/x86/kernel/cpu/amd.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,8 +1254,8 @@ static const char * const s5_reset_reason_txt[] = {
12541254

12551255
static __init int print_s5_reset_status_mmio(void)
12561256
{
1257-
unsigned long value;
12581257
void __iomem *addr;
1258+
u32 value;
12591259
int i;
12601260

12611261
if (!cpu_feature_enabled(X86_FEATURE_ZEN))
@@ -1268,12 +1268,16 @@ static __init int print_s5_reset_status_mmio(void)
12681268
value = ioread32(addr);
12691269
iounmap(addr);
12701270

1271+
/* Value with "all bits set" is an error response and should be ignored. */
1272+
if (value == U32_MAX)
1273+
return 0;
1274+
12711275
for (i = 0; i < ARRAY_SIZE(s5_reset_reason_txt); i++) {
12721276
if (!(value & BIT(i)))
12731277
continue;
12741278

12751279
if (s5_reset_reason_txt[i]) {
1276-
pr_info("x86/amd: Previous system reset reason [0x%08lx]: %s\n",
1280+
pr_info("x86/amd: Previous system reset reason [0x%08x]: %s\n",
12771281
value, s5_reset_reason_txt[i]);
12781282
}
12791283
}

0 commit comments

Comments
 (0)