Re: [PATCH v11 09/13] x86, sgx: basic routines for enclave page cache

From: Sean Christopherson
Date: Tue Jun 19 2018 - 11:59:32 EST


On Tue, Jun 19, 2018 at 05:57:53PM +0300, Jarkko Sakkinen wrote:
> On Fri, Jun 08, 2018 at 11:24:12AM -0700, Dave Hansen wrote:
> > On 06/08/2018 10:09 AM, Jarkko Sakkinen wrote:
> > > +static __init bool sgx_is_enabled(bool *lc_enabled)
> > > {
> > > unsigned long fc;
> > >
> > > @@ -41,12 +466,26 @@ static __init bool sgx_is_enabled(void)
> > > if (!(fc & FEATURE_CONTROL_SGX_ENABLE))
> > > return false;
> > >
> > > + *lc_enabled = !!(fc & FEATURE_CONTROL_SGX_LE_WR);
> > > +
> > > return true;
> > > }
> >
> > I'm baffled why lc_enabled is connected to the enclave page cache.
>
> KVM works only with writable MSRs. Driver works both with writable
> and read-only MSRs.

That's not true, KVM can/will support SGX regardless of whether or not
Launch Control (LC) is available and/or enabled. KVM does need to
know whether or not LC is enabled.

Back to Dave's question, LC isn't connected to the EPC management,
the LC code should be split into a separate patch.

> Thanks, I'll try my best to deal with all this :-)
>
> /Jarkko