x86/CPU/AMD: Don't print reset reason in VMs
Subsystems (2)
PATCH 1/1 x86/CPU/AMD: Don't print reset reason in VMs
print_s5_reset_status_mmio() expects to read FCH MMIO on baremetal. VMs don't have emulated FCH registers, so there is nothing to check. Add an early exit when running on a hypervisor.
The real motivation is Xen PV domUs can't boot on Zen CPUs. PV domUs PTE contain system physical addresses - they don't have concept of guest physical addresses. domUs can only map physical addresses they are assigned, so a domU fails to map the FCH MMIO addresses. However set_pte() does not return failure, so ioremap() returns a pointer while the PTEs are unpopulated. print_s5_reset_status_mmio() faults when reading through the pointer, breaking the boot. This change fixes Xen PV domUs booting on Zen CPUs.
dom0 can map the FCH MMIO, but it has X86_FEATURE_HYPERVISOR set. With this change, it no longer prints the reset reason.
---
dom0 could work, but that would require a xen_initial_domain() check.
I've wondered about a different approach: We can't directly check for a device for the FCH_PM_BASE memory, but maybe we could check for a PCI ISA Bridge with PCI_VENDOR_ID_AMD. That might be close enough to indicate real hardware? But it would still be a heuristic, so I'm not sure how much better that would be.
--- arch/x86/kernel/cpu/amd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/amd.c +2 -1
@@ -1357,7 +1357,8 @@ static __init int print_s5_reset_status_mmio(void)u32 value;int i; -if (!cpu_feature_enabled (X86_FEATURE_ZEN )) +if (!cpu_feature_enabled (X86_FEATURE_ZEN ) || +cpu_feature_enabled (X86_FEATURE_HYPERVISOR ))return 0 ; addr =ioremap (FCH_PM_BASE +FCH_PM_S5_RESET_STATUS ,sizeof (value));
Signature · 1 line
2.34.1
Quoted 13 lines · Jason Andryuk
print_s5_reset_status_mmio()expects to read FCH MMIO on baremetal. VMs don't have emulated FCH registers, so there is nothing to check. Add an early exit when running on a hypervisor.The real motivation is Xen PV domUs can't boot on Zen CPUs. PV domUs PTE contain system physical addresses - they don't have concept of guest physical addresses. domUs can only map physical addresses they are assigned, so a domU fails to map the FCH MMIO addresses. However
set_pte()does not return failure, soioremap()returns a pointer while the PTEs are unpopulated.print_s5_reset_status_mmio()faults when reading through the pointer, breaking the boot. This change fixes Xen PV domUs booting on Zen CPUs.
Quoted 7 lines
dom0 can map the FCH MMIO, but it has
X86_FEATURE_HYPERVISORset. With this change, it no longer prints the reset reason.Fixes ab8131028710 ("x86/CPU/AMD: Print the reason for the last reset")Suggested-by Borislav Petkov <[email protected]>Signed-off-by Jason Andryuk <[email protected]>
Juergen
Quoted 20 lines · Jason Andryuk
print_s5_reset_status_mmio()expects to read FCH MMIO on baremetal. VMs don't have emulated FCH registers, so there is nothing to check. Add an early exit when running on a hypervisor.The real motivation is Xen PV domUs can't boot on Zen CPUs. PV domUs PTE contain system physical addresses - they don't have concept of guest physical addresses. domUs can only map physical addresses they are assigned, so a domU fails to map the FCH MMIO addresses. However
set_pte()does not return failure, soioremap()returns a pointer while the PTEs are unpopulated.print_s5_reset_status_mmio()faults when reading through the pointer, breaking the boot. This change fixes Xen PV domUs booting on Zen CPUs.dom0 can map the FCH MMIO, but it has
X86_FEATURE_HYPERVISORset. With this change, it no longer prints the reset reason.Fixes ab8131028710 ("x86/CPU/AMD: Print the reason for the last reset")Suggested-by Borislav Petkov <[email protected]>Signed-off-by Jason Andryuk <[email protected]>
Quoted 8 lines
---
dom0 could work, but that would require axen_initial_domain()check.I've wondered about a different approach: We can't directly check for a device for the
FCH_PM_BASEmemory, but maybe we could check for a PCI ISA Bridge withPCI_VENDOR_ID_AMD. That might be close enough to indicate real hardware? But it would still be a heuristic, so I'm not sure how much better that would be.
Maybe, I had an older version that used the smbus device / i2c driver.
https://lore.kernel.org/all/[email protected]/
Is this available in dom0?
Quoted 10 lines
--- arch/x86/kernel/cpu/amd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/x86/kernel/cpu/amd.c +0
-0
arch/x86/kernel/cpu/amd.c static __init int print_s5_reset_status_mmio(void) · line 1364
Quoted 9 lines
arch/x86/kernel/cpu/amd.c +2
-1@@ -1357,7 +1357,8 @@ static __init int print_s5_reset_status_mmio(void)u32 value;int i; -if (!cpu_feature_enabled (X86_FEATURE_ZEN )) +if (!cpu_feature_enabled (X86_FEATURE_ZEN ) || +cpu_feature_enabled (X86_FEATURE_HYPERVISOR ))return 0 ; addr =ioremap (FCH_PM_BASE +FCH_PM_S5_RESET_STATUS ,sizeof (value));
Thanks,
Yazen
Quoted 30 lines · Yazen Ghannam
Quoted 20 lines · Jason Andryuk
print_s5_reset_status_mmio()expects to read FCH MMIO on baremetal. VMs don't have emulated FCH registers, so there is nothing to check. Add an early exit when running on a hypervisor.The real motivation is Xen PV domUs can't boot on Zen CPUs. PV domUs PTE contain system physical addresses - they don't have concept of guest physical addresses. domUs can only map physical addresses they are assigned, so a domU fails to map the FCH MMIO addresses. However
set_pte()does not return failure, soioremap()returns a pointer while the PTEs are unpopulated.print_s5_reset_status_mmio()faults when reading through the pointer, breaking the boot. This change fixes Xen PV domUs booting on Zen CPUs.dom0 can map the FCH MMIO, but it has
X86_FEATURE_HYPERVISORset. With this change, it no longer prints the reset reason.Fixes ab8131028710 ("x86/CPU/AMD: Print the reason for the last reset")Suggested-by Borislav Petkov <[email protected]>Signed-off-by Jason Andryuk <[email protected]>Quoted 8 lines
---
dom0 could work, but that would require axen_initial_domain()check.I've wondered about a different approach: We can't directly check for a device for the
FCH_PM_BASEmemory, but maybe we could check for a PCI ISA Bridge withPCI_VENDOR_ID_AMD. That might be close enough to indicate real hardware? But it would still be a heuristic, so I'm not sure how much better that would be.
Quoted 4 lines
Maybe, I had an older version that used the smbus device / i2c driver.
https://lore.kernel.org/all/[email protected]/Is this available in dom0?
lspci shows 00:14.0 FCH SMBus Controller
Kernel driver in use: piix4_smbus
Kernel modules: i2c_piix4, sp5100_tco
so, yes, it seems so.
Quoted 17 lines
Quoted 17 lines
--- arch/x86/kernel/cpu/amd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/x86/kernel/cpu/amd.c +2
-1@@ -1357,7 +1357,8 @@ static __init int print_s5_reset_status_mmio(void)u32 value;int i; -if (!cpu_feature_enabled (X86_FEATURE_ZEN )) +if (!cpu_feature_enabled (X86_FEATURE_ZEN ) || +cpu_feature_enabled (X86_FEATURE_HYPERVISOR ))return 0 ;
Quoted 4 lines
arch/x86/kernel/cpu/amd.c static __init int print_s5_reset_status_mmio(void) · line 1364
Quoted 2 lines
arch/x86/kernel/cpu/amd.c +0
-0addr =ioremap (FCH_PM_BASE +FCH_PM_S5_RESET_STATUS ,sizeof (value));Reviewed-by Yazen Ghannam <[email protected]>
Thanks,
Jason
Quoted 37 lines · Jason Andryuk
print_s5_reset_status_mmio()expects to read FCH MMIO on baremetal. VMs don't have emulated FCH registers, so there is nothing to check. Add an early exit when running on a hypervisor.The real motivation is Xen PV domUs can't boot on Zen CPUs. PV domUs PTE contain system physical addresses - they don't have concept of guest physical addresses. domUs can only map physical addresses they are assigned, so a domU fails to map the FCH MMIO addresses. However
set_pte()does not return failure, soioremap()returns a pointer while the PTEs are unpopulated.print_s5_reset_status_mmio()faults when reading through the pointer, breaking the boot. This change fixes Xen PV domUs booting on Zen CPUs.dom0 can map the FCH MMIO, but it has
X86_FEATURE_HYPERVISORset. With this change, it no longer prints the reset reason.Fixes ab8131028710 ("x86/CPU/AMD: Print the reason for the last reset")Suggested-by Borislav Petkov <[email protected]>Signed-off-by Jason Andryuk <[email protected]>---
dom0 could work, but that would require axen_initial_domain()check.I've wondered about a different approach: We can't directly check for a device for the
FCH_PM_BASEmemory, but maybe we could check for a PCI ISA Bridge withPCI_VENDOR_ID_AMD. That might be close enough to indicate real hardware? But it would still be a heuristic, so I'm not sure how much better that would be.--- arch/x86/kernel/cpu/amd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/x86/kernel/cpu/amd.c +0
-0
arch/x86/kernel/cpu/amd.c static __init int print_s5_reset_status_mmio(void) · line 1364
Quoted 9 lines
arch/x86/kernel/cpu/amd.c +2
-1@@ -1357,7 +1357,8 @@ static __init int print_s5_reset_status_mmio(void)u32 value;int i; -if (!cpu_feature_enabled (X86_FEATURE_ZEN )) +if (!cpu_feature_enabled (X86_FEATURE_ZEN ) || +cpu_feature_enabled (X86_FEATURE_HYPERVISOR ))return 0 ; addr =ioremap (FCH_PM_BASE +FCH_PM_S5_RESET_STATUS ,sizeof (value));
The following commit has been merged into the x86/urgent branch of tip:
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: ea51d1a4c31fc8320c34f897dc5296a0bfc5c7ca Gitweb: https://git.kernel.org/tip/ea51d1a4c31fc8320c34f897dc5296a0bfc5c7ca Author: Jason Andryuk <[email protected]> AuthorDate: Tue, 03 Nov 2026 20:30:25 -05:00 Committer: Borislav Petkov (AMD) <[email protected]> CommitterDate: Sun, 08 Nov 2026 23:25:40 -08:00
x86/CPU/AMD: Don't print reset reason in VMs
print_s5_reset_status_mmio() expects to read FCH MMIO on baremetal. VMs don't have emulated FCH registers, so there is nothing to check. Add an early exit when running on a hypervisor.
The real motivation is Xen PV domUs can't boot on Zen CPUs. PV domUs PTEs contain system physical addresses - they don't have the concept of guest physical addresses. domUs can only map physical addresses they are assigned, so a domU fails to map the FCH MMIO addresses.
However set_pte() does not return failure, so ioremap() returns a pointer while the PTEs are unpopulated. print_s5_reset_status_mmio() faults when reading through the pointer, breaking the boot.
Limit the reset reason printing to baremetal only where it actually makes sense.
[ bp: Massage commit message. ]
--- arch/x86/kernel/cpu/amd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/amd.c +2 -1
@@ -1362,7 +1362,8 @@ static __init int print_s5_reset_status_mmio(void)u32 value;int i; -if (!cpu_feature_enabled (X86_FEATURE_ZEN )) +if (!cpu_feature_enabled (X86_FEATURE_ZEN ) || +cpu_feature_enabled (X86_FEATURE_HYPERVISOR ))return 0 ; addr =ioremap (FCH_PM_BASE +FCH_PM_S5_RESET_STATUS ,sizeof (value));