From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Pratik Vishwakarma <Pratik.Vishwakarma@amd.com>,
Prathyushi Nangia <prathyushi.nangia@amd.com>,
Yazen Ghannam <yazen.ghannam@amd.com>,
Juergen Gross <jgross@suse.com>
Subject: Re: [PATCH] x86/CPU/AMD: fix booting on Xen PV domU
Date: Mon, 16 Nov 2026 02:45:09 +0100 [thread overview]
Message-ID: <avpgJcmTVQcHf8QB@mail-itl> (raw)
In-Reply-To: <20261116014057.7409-1-marmarek@invisiblethingslab.com>
[-- Attachment #1: Type: text/plain, Size: 3538 bytes --]
On Mon, Nov 16, 2026 at 02:40:00AM +0100, Marek Marczykowski-Górecki wrote:
> Reading the FCH_PM_S5_RESET_STATUS register doesn't make sense in a VM,
> as it's about reporting last hardware reset reason and VM has no access
> to it. On most hypervisors, reading it will simply return all-ones, but
> unfortunately Xen PV domU is (again) special and trying to read not
> allowed MMIO space results in a panic:
>
> 1 of 1 multicall(s) failed: cpu 1
> call 1: op=1 arg=[ffff88801851b010] result=-22
> BUG: unable to handle page fault for address: ffffc9004002d3c0
> #PF: supervisor read access in kernel mode
> #PF: error_code(0x0000) - not-present page
> PGD 18f1b067 P4D 18f1b067 PUD 3e8f067 PMD 3e90067 PTE 0
> Oops: Oops: 0000 [#1] SMP NOPTI
> CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Tainted: G W 6.18.62-1.qubes.28.fc41.x86_64 #1 PREEMPT(full)
> Tainted: [W]=WARN
> RIP: e030:ioread32+0x32/0x60
> Code: ff 03 00 77 25 48 81 ff 00 00 01 00 76 08 89 fa ed e9 72 04 8c 00 8b 05 cc 62 88 01 85 c0 75 11 b8 ff ff ff ff e9 5e 04 8c 00 <8b> 07 e9 57 04 8c 00 83 e8 01 48 89 fe 48 c7 c2 67 db 14 82 48 c7
> RSP: e02b:ffffc9004000be00 EFLAGS: 00010292
> RAX: 43fa5d3f578e48f3 RBX: 928a59081d78a1d7 RCX: 00000000fed803c3
> RDX: 00000000039fffff RSI: 00000000fed803c0 RDI: ffffc9004002d3c0
> RBP: ffffc9004000be38 R08: 0000000000000000 R09: 00000000000fed80
> R10: 00000000000fed80 R11: 0720072007200720 R12: ffff888005118800
> R13: ffffc9004002d3c0 R14: 000000000000017a R15: ffffffff832a78cc
> FS: 0000000000000000(0000) GS:ffff888094f59000(0000) knlGS:0000000000000000
> CS: e030 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: ffffc9004002d3c0 CR3: 000000000242c000 CR4: 0000000000050660
> Call Trace:
> <TASK>
> print_s5_reset_status_mmio+0x75/0x1c0
> ? __pfx_print_s5_reset_status_mmio+0x10/0x10
> do_one_initcall+0x5a/0x310
> do_initcalls+0x1ef/0x240
> kernel_init_freeable+0x18a/0x210
> ? __pfx_kernel_init+0x10/0x10
> kernel_init+0x1a/0x140
> ret_from_fork+0x158/0x170
> ? __pfx_kernel_init+0x10/0x10
> ret_from_fork_asm+0x1a/0x30
> </TASK>
> Modules linked in:
> CR2: ffffc9004002d3c0
>
> Fix this by skipping the read when running in a VM, except Xen dom0
> (which technically is a VM, but does have full access to the hardware).
>
I forgot about:
Fixes: ab8131028710 "x86/CPU/AMD: Print the reason for the last reset"
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> ---
> arch/x86/kernel/cpu/amd.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> index 15286b71e9bf..fe3fe545608e 100644
> --- a/arch/x86/kernel/cpu/amd.c
> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -26,6 +26,7 @@
> #include <asm/resctrl.h>
> #include <asm/msr.h>
> #include <asm/sev.h>
> +#include <xen/xen.h>
>
> #ifdef CONFIG_X86_64
> # include <asm/mmconfig.h>
> @@ -1370,6 +1371,10 @@ static __init int print_s5_reset_status_mmio(void)
> if (!cpu_feature_enabled(X86_FEATURE_ZEN))
> return 0;
>
> + if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR) &&
> + !xen_initial_domain())
> + return 0;
> +
> addr = ioremap(FCH_PM_BASE + FCH_PM_S5_RESET_STATUS, sizeof(value));
> if (!addr)
> return 0;
> --
> 2.56.0
>
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2026-11-16 1:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 1:40 [PATCH] x86/CPU/AMD: fix booting on Xen PV domU Marek Marczykowski-Górecki
2026-11-16 1:45 ` Marek Marczykowski-Górecki [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=avpgJcmTVQcHf8QB@mail-itl \
--to=marmarek@invisiblethingslab.com \
--cc=Pratik.Vishwakarma@amd.com \
--cc=andrew.cooper3@citrix.com \
--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=mingo@redhat.com \
--cc=prathyushi.nangia@amd.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.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