[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bbebb1b782ace1b4b9ba17cb4cefacead97d73b0.camel@intel.com>
Date: Tue, 02 Mar 2021 13:34:46 +1300
From: Kai Huang <kai.huang@...el.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: kvm@...r.kernel.org, linux-sgx@...r.kernel.org, x86@...nel.org,
linux-kernel@...r.kernel.org, jarkko@...nel.org, luto@...nel.org,
dave.hansen@...el.com, rick.p.edgecombe@...el.com,
haitao.huang@...el.com, pbonzini@...hat.com, bp@...en8.de,
tglx@...utronix.de, mingo@...hat.com, hpa@...or.com
Subject: Re: [PATCH 12/25] x86/sgx: Add helper to update SGX_LEPUBKEYHASHn
MSRs
On Mon, 2021-03-01 at 08:57 -0800, Sean Christopherson wrote:
> On Mon, Mar 01, 2021, Kai Huang wrote:
> > diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c
> > index 8c922e68274d..276220d0e4b5 100644
> > --- a/arch/x86/kernel/cpu/sgx/main.c
> > +++ b/arch/x86/kernel/cpu/sgx/main.c
> > @@ -696,6 +696,21 @@ static bool __init sgx_page_cache_init(void)
> > return true;
> > }
> >
> >
> >
> >
> > +
> > +/*
> > + * Update the SGX_LEPUBKEYHASH MSRs to the values specified by caller.
> > + * Bare-metal driver requires to update them to hash of enclave's signer
> > + * before EINIT. KVM needs to update them to guest's virtual MSR values
> > + * before doing EINIT from guest.
> > + */
> > +void sgx_update_lepubkeyhash(u64 *lepubkeyhash)
> > +{
> > + int i;
>
> Probably worth adding:
>
> WARN_ON_ONCE(preemptible());
Agreed. Will do.
>
> > +
> > + for (i = 0; i < 4; i++)
> > + wrmsrl(MSR_IA32_SGXLEPUBKEYHASH0 + i, lepubkeyhash[i]);
> > +}
> > +
> > static int __init sgx_init(void)
> > {
> > int ret;
Powered by blists - more mailing lists