From: David Laight <david.laight.linux@gmail.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Sean Rhodes <sean@starlabs.systems>,
Mario Limonciello <mario.limonciello@amd.com>,
x86@kernel.org, "Rafael J. Wysocki" <rafael@kernel.org>,
Pavel Machek <pavel@kernel.org>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/pm: Save AMD CPUID leaf 7 across S3
Date: Wed, 12 Aug 2026 08:42:28 +0100 [thread overview]
Message-ID: <20260812084228.66e7a3dd@pumpkin> (raw)
In-Reply-To: <20260804184920.GBanI0MCMbnglz7Ncc@fat_crate.local>
On Tue, 4 Aug 2026 11:49:20 -0700
Borislav Petkov <bp@alien8.de> wrote:
> + Mario.
>
> On Tue, Aug 04, 2026 at 11:13:41AM +0100, Sean Rhodes wrote:
> > Some AMD systems return from S3 with the boot CPU CPUID leaf 7
> > override MSR reset. On Byte/Cezanne, CPUID leaf 7 EBX becomes
> > 0x219c9fb9 on CPU0 after S3 even though XTEST still raises #UD.
> > Userspace can then select RTM-optimised glibc paths and fault after
> > resume.
>
> Do you have the latest BIOS on that machine?
>
> > The x86 suspend code already has a small MSR save/restore list for
> > firmware-modified MSRs and restores it after resume microcode has been
> > loaded. Add MSR_AMD64_CPUID_FN_7 for the AMD families that can modify
> > this MSR during CPU init so the pre-suspend CPUID mask is restored
> > before tasks are thawed.
> >
> > This covers family 17h, 19h, and 1Ah:
>
> Why?
>
> > family 17h has the Cyan Skillfish
> > RDSEED leaf-7 quirk, family 19h covers the observed Cezanne issue, and
> > family 1Ah has the Zen5 RDSEED leaf-7 quirk.
>
> Those RDSEED quirks need more details as to why they need to be applied here.
>
> > Tested on StarBook Mk V (Byte/Cezanne, 26.07 firmware):
> > - without this restore, dmesg showed "ACPI: PM: Low-level resume complete"
> > and "PM: suspend exit"; the post-S3 CPUID probe showed CPU0 leaf 7 EBX
> > 0x219c9fb9 with hle=1 rtm=1 while XTEST still raised #UD.
> > - a temporary PM resume hook clearing the same MSR logged
> > "CPU0 MSR_AMD64_CPUID_FN_7 0x219c9fb9 -> 0x219c97a9"; the post-S3 probe
> > showed hle=0 rtm=0 on all CPUs.
> > - this patch booted on Byte and registered the MSR save path; dmesg showed
> > "x86/pm: AMD family 0x19 CPU detected"; pm_test freezer/devices/platform/
> > processors/core passed with the same boot ID.
>
> For future patches: testing goes...
>
> >
> > Tested-by: Sean Rhodes <sean@starlabs.systems>
> > Signed-off-by: Sean Rhodes <sean@starlabs.systems>
> > ---
>
> <-- here, under that line.
>
> > arch/x86/power/cpu.c | 15 +++++++++++++++
> > 1 file changed, 15 insertions(+)
> >
> > diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c
> > index 702f30eaf9c4..b85061f4cee4 100644
> > --- a/arch/x86/power/cpu.c
> > +++ b/arch/x86/power/cpu.c
> > @@ -467,9 +467,24 @@ static int msr_save_cpuid_features(const struct x86_cpu_id *c)
> > return msr_build_context(cpuid_msr_id, ARRAY_SIZE(cpuid_msr_id));
> > }
> >
> > +static int msr_save_amd_leaf7_cpuid_features(const struct x86_cpu_id *c)
> > +{
> > + u32 cpuid_msr_id[] = {
> > + MSR_AMD64_CPUID_FN_7,
> > + };
> > +
> > + pr_info("x86/pm: AMD family %#x CPU detected, saving CPUID leaf 7 MSR across suspend.\n",
>
> I guess pr_info_once() is fine here.
Would be more informative in the restore path if the value is wrong.
David
>
> Thx.
>
prev parent reply other threads:[~2026-08-12 7:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 10:13 [PATCH] x86/pm: Save AMD CPUID leaf 7 across S3 Sean Rhodes
2026-08-04 18:49 ` Borislav Petkov
2026-08-04 19:22 ` Sean Rhodes
2026-08-06 1:29 ` Borislav Petkov
2026-08-10 18:31 ` Mario Limonciello
2026-08-10 19:42 ` Sean Rhodes
2026-08-10 20:07 ` Mario Limonciello
2026-08-10 21:33 ` Borislav Petkov
2026-08-11 18:25 ` Mario Limonciello
2026-08-11 18:40 ` Borislav Petkov
2026-08-11 18:45 ` Mario Limonciello
2026-08-12 7:42 ` David Laight [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=20260812084228.66e7a3dd@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=mingo@redhat.com \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
--cc=sean@starlabs.systems \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.