Skip to content

Commit 55bbbf2

Browse files
committed
x86/CPU/AMD: Ignore invalid reset reason value
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>
1 parent 09e34b3 commit 55bbbf2

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
@@ -1249,8 +1249,8 @@ static const char * const s5_reset_reason_txt[] = {
12491249

12501250
static __init int print_s5_reset_status_mmio(void)
12511251
{
1252-
unsigned long value;
12531252
void __iomem *addr;
1253+
u32 value;
12541254
int i;
12551255

12561256
if (!cpu_feature_enabled(X86_FEATURE_ZEN))
@@ -1263,12 +1263,16 @@ static __init int print_s5_reset_status_mmio(void)
12631263
value = ioread32(addr);
12641264
iounmap(addr);
12651265

1266+
/* Value with "all bits set" is an error response and should be ignored. */
1267+
if (value == U32_MAX)
1268+
return 0;
1269+
12661270
for (i = 0; i < ARRAY_SIZE(s5_reset_reason_txt); i++) {
12671271
if (!(value & BIT(i)))
12681272
continue;
12691273

12701274
if (s5_reset_reason_txt[i]) {
1271-
pr_info("x86/amd: Previous system reset reason [0x%08lx]: %s\n",
1275+
pr_info("x86/amd: Previous system reset reason [0x%08x]: %s\n",
12721276
value, s5_reset_reason_txt[i]);
12731277
}
12741278
}

0 commit comments

Comments
 (0)