lkml.org 
[lkml]   [2018]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v11 09/13] x86, sgx: basic routines for enclave page cache
On Mon, Jun 25, 2018 at 12:21:22PM +0300, Jarkko Sakkinen wrote:
> On Wed, 2018-06-20 at 06:21 -0700, Sean Christopherson wrote:
> > On Fri, 2018-06-08 at 19:09 +0200, Jarkko Sakkinen wrote:
> > > SGX has a set of data structures to maintain information about the enclaves
> > > and their security properties. BIOS reserves a fixed size region of
> > > physical memory for these structures by setting Processor Reserved Memory
> > > Range Registers (PRMRR). This memory area is called Enclave Page Cache
> > > (EPC).
> > >
> > > This commit implements the basic routines to allocate and free pages from
> > > different EPC banks. There is also a swapper thread ksgxswapd for EPC pages
> > > that gets woken up by sgx_alloc_page() when we run below the low watermark.
> > > The swapper thread continues swapping pages up until it reaches the high
> > > watermark.
> > >
> > > Each subsystem that uses SGX must provide a set of callbacks for EPC
> > > pages that are used to reclaim, block and write an EPC page. Kernel
> > > takes the responsibility of maintaining LRU cache for them.
> > >
> > > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> > > ---
> > > arch/x86/include/asm/sgx.h | 67 +++++
> > > arch/x86/include/asm/sgx_arch.h | 224 ++++++++++++++++
> > > arch/x86/kernel/cpu/intel_sgx.c | 443 +++++++++++++++++++++++++++++++-
> > > 3 files changed, 732 insertions(+), 2 deletions(-)
> > > create mode 100644 arch/x86/include/asm/sgx_arch.h
> >
> > ...
> >
> > > +struct sgx_pcmd {
> > > + struct sgx_secinfo secinfo;
> > > + uint64_t enclave_id;
> > > + uint8_t reserved[40];
> > > + uint8_t mac[16];
> > > +};
> >
> > sgx_pcmd has a 128-byte alignment requirement. I think it's
> > worth specifying here as sgx_pcmd is small enough that it could
> > be put on the stack, e.g. by KVM when trapping and executing
> > ELD* on behalf of a guest VM.
> >
> > In fact, it probably makes sense to add alightment attributes
> > to all SGX structs for self-documentation purposes, even though
> > many of them will never be allocated statically or on the stack.
>
> I agree with this. It also documents stuff so that you don't have
> to look it up from the SDM.
>
> Neil: this should also clear your concerns.
>
Agreed
Neil

> /Jarkko

\
 
 \ /
  Last update: 2018-06-25 18:14    [W:0.173 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site