[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABgObfaGT6MBX_0XHmmJzDxFo4pRHED6-U=oGrH24PAqDGrk1A@mail.gmail.com>
Date: Tue, 19 Mar 2024 20:47:58 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Michael Roth <michael.roth@....com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
isaku.yamahata@...el.com, seanjc@...gle.com,
Dave Hansen <dave.hansen@...ux.intel.com>
Subject: Re: [PATCH v4 09/15] KVM: SEV: sync FPU and AVX state at
LAUNCH_UPDATE_VMSA time
On Tue, Mar 19, 2024 at 2:42 PM Michael Roth <michael.roth@....com> wrote:
> > Since the XSAVE state for AVX is the first, it does not need the
> > compacted-state handling of get_xsave_addr(). However, there are other
> > parts of XSAVE state in the VMSA that currently are not handled, and
> > the validation logic of get_xsave_addr() is pointless to duplicate
> > in KVM, so move get_xsave_addr() to public FPU API; it is really just
> > a facility to operate on XSAVE state and does not expose any internal
> > details of arch/x86/kernel/fpu.
> >
> > Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> > Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
> > ---
> > arch/x86/include/asm/fpu/api.h | 3 +++
> > arch/x86/kernel/fpu/xstate.h | 2 --
> > arch/x86/kvm/svm/sev.c | 36 ++++++++++++++++++++++++++++++++++
> > arch/x86/kvm/svm/svm.c | 8 --------
> > 4 files changed, 39 insertions(+), 10 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/fpu/api.h b/arch/x86/include/asm/fpu/api.h
> > index a2be3aefff9f..f86ad3335529 100644
> > --- a/arch/x86/include/asm/fpu/api.h
> > +++ b/arch/x86/include/asm/fpu/api.h
> > @@ -143,6 +143,9 @@ extern void fpstate_clear_xstate_component(struct fpstate *fps, unsigned int xfe
> >
> > extern u64 xstate_get_guest_group_perm(void);
> >
> > +extern void *get_xsave_addr(struct xregs_state *xsave, int xfeature_nr);
>
> I get a linker error if I don't add an EXPORT_SYMBOL_GPL(get_xsave_addr)
Indeed, and also the format for the 10-byte x87 registers is... unusual.
I sent a follow up at the end of this thread that includes a fixup for
this patch and the FPU/XSAVE test for SEV-ES.
Paolo
Powered by blists - more mailing lists