mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Andryuk <jason.andryuk@amd.com>
To: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>, <x86@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Mario Limonciello <mario.limonciello@amd.com>,
	Yazen Ghannam <yazen.ghannam@amd.com>
Cc: <xen-devel@lists.xenproject.org>,
	Ariadne Conill <ariadne@ariadne.space>,
	Sean Christopherson <seanjc@google.com>,
	Juergen Gross <jgross@suse.com>,
	Jason Andryuk <jason.andryuk@amd.com>, <stable@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] x86/CPU/AMD: Don't print reset reason in VMs
Date: Tue, 3 Nov 2026 20:30:25 -0500	[thread overview]
Message-ID: <20261104013026.185392-1-jason.andryuk@amd.com> (raw)

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.

Fixes: ab8131028710 ("x86/CPU/AMD: Print the reason for the last reset")
Cc: stable@vger.kernel.org
Suggested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
---
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(-)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 40463bad1078..580ccc2ce5fc 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -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));
-- 
2.34.1


             reply	other threads:[~2026-11-04  1:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04  1:30 Jason Andryuk [this message]
2026-11-04  8:20 ` Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261104013026.185392-1-jason.andryuk@amd.com \
    --to=jason.andryuk@amd.com \
    --cc=ariadne@ariadne.space \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=seanjc@google.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=yazen.ghannam@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®