Skip to content

Commit de94c64

Browse files
author
CKI KWF Bot
committed
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 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: 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>
2 parents e231b96 + ace9bf7 commit de94c64

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

12441244
static __init int print_s5_reset_status_mmio(void)
12451245
{
1246-
unsigned long value;
12471246
void __iomem *addr;
1247+
u32 value;
12481248
int i;
12491249

12501250
if (!cpu_feature_enabled(X86_FEATURE_ZEN))
@@ -1257,12 +1257,16 @@ static __init int print_s5_reset_status_mmio(void)
12571257
value = ioread32(addr);
12581258
iounmap(addr);
12591259

1260+
/* Value with "all bits set" is an error response and should be ignored. */
1261+
if (value == U32_MAX)
1262+
return 0;
1263+
12601264
for (i = 0; i < ARRAY_SIZE(s5_reset_reason_txt); i++) {
12611265
if (!(value & BIT(i)))
12621266
continue;
12631267

12641268
if (s5_reset_reason_txt[i]) {
1265-
pr_info("x86/amd: Previous system reset reason [0x%08lx]: %s\n",
1269+
pr_info("x86/amd: Previous system reset reason [0x%08x]: %s\n",
12661270
value, s5_reset_reason_txt[i]);
12671271
}
12681272
}

0 commit comments

Comments
 (0)