Re: [PATCH v5 11/11] intel_sgx: driver documentation

From: Sean Christopherson
Date: Mon Nov 27 2017 - 14:46:16 EST


+ Cc: KVM, Paolo and Radim

On Mon, 2017-11-27 at 09:03 -0800, Sean Christopherson wrote:
> On Tue, 2017-11-21 at 01:08 +0200, Jarkko Sakkinen wrote:
> >
> > On Sat, Nov 18, 2017 at 12:34:33AM +0100, Thomas Gleixner wrote:
> > >
> > >
> > > This is architecural. From the cursory read of that series it seems there
> > > are two parts to it:
> > >
> > > Â 1) The actual core handling, which should be in arch/x86 because that
> > > ÂÂÂÂÂhardly qualifies as a 'platform' device driver.
> > >
> > > Â 2) The user space interface, which can be separated out perhaps.
> > >
> > > I don't know how intertwingled they are, but that's hard to tell from the
> > > actual patches w/o doing a deep inspection. Jarkko should be able to
> > > answer
> > > that.
> > >
> > > Thanks,
> > >
> > > tglx
> > Darren, tglx,
> >
> > You can leave user space device as separate module as sgx_ioctl.c merely
> > calls stuff that I have inside sgx_encl.c. VMA creation is bound to file
> > operations.
> >
> > My questions would be:
> >
> > 1. What is your recommendation on the deployment under arch/x86?
> > 2. Which parts should be compilable as a LKM? Only the user interface
> > ÂÂÂor both parts?
> >
> > /Jarkko
> To enable KVM and a cgroup for EPC accounting, at a minimum arch/x86 needs to
> manage the EPC pages (alloc/free/lrus/reclaim/etc...) and LE hash MSRs. ÂIMO,
> ideally everything else would be left in the device driver, e.g. anything
> involving ENCLS. ÂKeeping the majority of the driver out of arch/x86 minimizes
> the footprint in arch/x86 and thereby the size of KVM's dependency required to
> virtualize SGX, and allows the various SGX pieces, e.g. arch, driver and KVM,
> to evolve more independently.
>
> Preferably theÂarch/x86 code would not be a loadable module, e.g. to simplify
> KVM support.
>
> I have aÂbranch based on Jarkko's patches (I believe it's up-to-date with v5)
> that implements what I described. ÂI'd be happy to send RFC patches if that
> would help.
>
>
> Branches for those interested:
>
> https://github.com/sean-jc/linux.gitÂsgx/arch  - move core EPC to arch/x86
> https://github.com/sean-jc/linux.gitÂsgx/kvm  Â- KVM support for SGX
> https://github.com/sean-jc/linux.gitÂsgx/lc   - KVM support for Launch
> Control
> https://github.com/sean-jc/linux.gitÂsgx/cgroup - EPC cgroup
>
>
> branch relationships:
>
> Â Â Jarkko's patches
> ÂÂÂÂÂÂÂÂÂÂÂÂ|
> ÂÂÂÂÂÂÂÂÂÂÂÂ|
> ÂÂÂÂÂÂÂÂÂsgx/arch
> ÂÂÂÂÂÂÂÂ/ÂÂÂÂÂÂÂÂ\
> ÂÂÂÂÂsgx/kvmÂÂÂÂsgx/cgroup
> ÂÂÂÂÂÂ/
> ÂÂÂsgx/lc