From: Sean Christopherson <seanjc@google.com>
To: Teddy Astie <teddy.astie@vates.tech>
Cc: Ariadne Conill <ariadne@ariadne.space>,
linux-kernel@vger.kernel.org, mario.limonciello@amd.com,
darwi@linutronix.de, sandipan.das@amd.com, kai.huang@intel.com,
me@mixaill.net, yazen.ghannam@amd.com, riel@surriel.com,
peterz@infradead.org, hpa@zytor.com, x86@kernel.org,
tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, xen-devel@lists.xenproject.org,
stable@vger.kernel.org
Subject: Re: [PATCH] x86/CPU/AMD: avoid printing reset reasons on Xen domU
Date: Mon, 22 Dec 2025 07:46:44 -0800 [thread overview]
Message-ID: <aUln5DdCMcvhJzl9@google.com> (raw)
In-Reply-To: <190f226a-a92f-4dab-ad7a-f7ea22e6a976@vates.tech>
On Sat, Dec 20, 2025, Teddy Astie wrote:
> Le 19/12/2025 à 18:40, Sean Christopherson a écrit :
> > On Fri, Dec 19, 2025, Teddy Astie wrote:
> >>> @@ -1333,6 +1335,10 @@ static __init int print_s5_reset_status_mmio(void)
> >>> if (!cpu_feature_enabled(X86_FEATURE_ZEN))
> >>> return 0;
> >>>
> >>> + /* Xen PV domU cannot access hardware directly, so bail for domU case */
> >>> + if (cpu_feature_enabled(X86_FEATURE_XENPV) && !xen_initial_domain())
> >>> + return 0;
> >>> +
> >>> addr = ioremap(FCH_PM_BASE + FCH_PM_S5_RESET_STATUS, sizeof(value));
> >>> if (!addr)
> >>> return 0;
> >>
> >> Such MMIO only has a meaning in a physical machine, but the feature
> >> check is bogus as being on Zen arch is not enough for ensuring this.
> >>
> >> I think this also translates in most hypervisors with odd reset codes
> >> being reported; without being specific to Xen PV (Zen CPU is
> >> unfortunately not enough to ensuring such MMIO exists).
> >>
> >> Aside that, attempting unexpected MMIO in a SEV-ES/SNP guest can cause
> >> weird problems since they may not handled MMIO-NAE and could lead the
> >> hypervisor to crash the guest instead (unexpected NPF).
> >
> > IMO, terminating an SEV-ES+ guest because it accesses an unknown MMIO range is
> > unequivocally a hypervisor bug.
>
> Terminating may be a bit excessive, but the hypervisor can respond #GP
> to either unexpected MMIO-NAE and NPF-AE if it doesn't know how to deal
> with this MMIO/NPF (xAPIC has a similar behavior when it is disabled).
Maybe with a very liberal interpretation of AMD specs, e.g. to mimic the reserved
HyperTransport region behavior. Defining a virtual platform/bus that #GPs on
accesses to any "unknown" MMIO region would be incredibly hostile behavior for
a hypervisor.
> > The right behavior there is to configure a reserved NPT entry
> > to reflect the access into the guest as a #VC.
>
> I'm not sure this is the best approach, that would allow the guest to
> trick the hypervisor into making a unbounded amount of reserved entries.
No, the maximum number of reserved entries is bounded by the number of vCPUs in
the VM, because each reserved entry only needs to exist long enough to refect
the access into the guest. Recycling NPT page tables after every MMIO-NAE would
be comically agressively, but it's very doable for a hypervisor to set a reasonable
limit on the number of NPT page tables it creates for a VM.
prev parent reply other threads:[~2025-12-22 15:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-19 1:01 [PATCH] x86/CPU/AMD: avoid printing reset reasons on Xen domU Ariadne Conill
2025-12-19 3:56 ` Borislav Petkov
2025-12-19 16:09 ` Sean Christopherson
2025-12-19 16:26 ` Andrew Cooper
2025-12-19 17:36 ` Sean Christopherson
2025-12-19 23:14 ` Borislav Petkov
2025-12-19 23:16 ` Borislav Petkov
2025-12-19 23:19 ` Ariadne Conill
2025-12-19 16:32 ` Teddy Astie
2025-12-19 17:38 ` Sean Christopherson
2025-12-20 1:44 ` Teddy Astie
2025-12-22 15:46 ` Sean Christopherson [this message]
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=aUln5DdCMcvhJzl9@google.com \
--to=seanjc@google.com \
--cc=ariadne@ariadne.space \
--cc=bp@alien8.de \
--cc=darwi@linutronix.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kai.huang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=me@mixaill.net \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=riel@surriel.com \
--cc=sandipan.das@amd.com \
--cc=stable@vger.kernel.org \
--cc=teddy.astie@vates.tech \
--cc=tglx@linutronix.de \
--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