Re: [PATCH v3 2/2] x86/sev-es: Include XSS value in GHCB CPUID request

From: John Allen

Date: Fri Sep 26 2025 - 15:23:15 EST


On Wed, Sep 24, 2025 at 04:02:11PM -0700, Dave Hansen wrote:
> On 9/24/25 13:08, John Allen wrote:
> > + if (has_cpuflag(X86_FEATURE_SHSTK) && regs->ax == 0xd && regs->cx == 1) {
> > + struct msr m;
> > +
> > + raw_rdmsr(MSR_IA32_XSS, &m);
> > + ghcb_set_xss(ghcb, m.q);
> > + }
>
> Is there a reason this is open-coding CPUID_LEAF_XSTATE?

That's a good question. This patch was adapted from an old SNP patch
from years ago so if I had to guess, maybe there was some issue bringing
in the old pre-split cpuid header into the early boot/shared
environment. It looks like including asm/cpuid/types.h and using
CPUID_LEAF_XSTATE works here and now so I'll include it in the next
version.

Thanks,
John