RE: [RFC PATCH v5 08/26] x86/sgx: Expose SGX architectural definitions to the kernel

Huang, Kai
2021-02-16T10:30:59Z

>
> On Sun, Feb 14, 2021 at 02:29:10AM +1300, Kai Huang wrote:
> > From: Sean Christopherson <sean.j.christopherson@intel.com>
> >
> > Expose SGX architectural structures, as KVM will use many of the
> > architectural constants and structs to virtualize SGX.
> >
> > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> > Acked-by: Dave Hansen <dave.hansen@intel.com>
> > Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
> > Signed-off-by: Kai Huang <kai.huang@intel.com>
> > ---
> > arch/x86/{kernel/cpu/sgx/arch.h => include/asm/sgx_arch.h} | 0
> > arch/x86/kernel/cpu/sgx/encl.c | 2 +-
> > arch/x86/kernel/cpu/sgx/sgx.h | 2 +-
> > tools/testing/selftests/sgx/defines.h | 2 +-
> > 4 files changed, 3 insertions(+), 3 deletions(-) rename
> > arch/x86/{kernel/cpu/sgx/arch.h => include/asm/sgx_arch.h} (100%)
> >
> > diff --git a/arch/x86/kernel/cpu/sgx/arch.h
> > b/arch/x86/include/asm/sgx_arch.h similarity index 100% rename from
> > arch/x86/kernel/cpu/sgx/arch.h rename to
> > arch/x86/include/asm/sgx_arch.h
>
> Why not just sgx.h? The postfix is useless.

Because those contents are *architectural*. They are defined in SDM.

And patch 13 (x86/sgx: Add helpers to expose ECREATE and EINIT to KVM) will introduce arch/x86/include/asm/sgx.h, where non-architectural functions will be declared.