lkml.org 
[lkml]   [2021]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 08/25] x86/sgx: Expose SGX architectural definitions to the kernel
On Tue, Mar 09, 2021, 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.
>
> Name the new header file as asm/sgx.h, rather than asm/sgx_arch.h, to
> have single header to provide SGX facilities to share with other kernel
> componments.
>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> Co-developed-by: Kai Huang <kai.huang@intel.com>
> Acked-by: Dave Hansen <dave.hansen@intel.com>

Same checkpatch warning. Probably doesn't matter.

> Signed-off-by: Kai Huang <kai.huang@intel.com>
> ---
> .../cpu/sgx/arch.h => include/asm/sgx.h} | 20 ++++++++++++++-----
> 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, 18 insertions(+), 8 deletions(-)
> rename arch/x86/{kernel/cpu/sgx/arch.h => include/asm/sgx.h} (95%)
>
> diff --git a/arch/x86/kernel/cpu/sgx/arch.h b/arch/x86/include/asm/sgx.h
> similarity index 95%
> rename from arch/x86/kernel/cpu/sgx/arch.h
> rename to arch/x86/include/asm/sgx.h
> index abf99bb71fdc..d4ad35f6319a 100644
> --- a/arch/x86/kernel/cpu/sgx/arch.h
> +++ b/arch/x86/include/asm/sgx.h
> @@ -2,15 +2,20 @@
> /**
> * Copyright(c) 2016-20 Intel Corporation.
> *
> - * Contains data structures defined by the SGX architecture. Data structures
> - * defined by the Linux software stack should not be placed here.
> + * Intel Software Guard Extensions (SGX) support.
> */
> -#ifndef _ASM_X86_SGX_ARCH_H
> -#define _ASM_X86_SGX_ARCH_H
> +#ifndef _ASM_X86_SGX_H
> +#define _ASM_X86_SGX_H
>
> #include <linux/bits.h>
> #include <linux/types.h>
>
> +/*
> + * This file contains both data structures defined by SGX architecture and Linux
> + * defined software data structures and functions. The two should not be mixed
> + * together for better readibility. The architectural definitions come first.
> + */
> +
> /* The SGX specific CPUID function. */
> #define SGX_CPUID 0x12
> /* EPC enumeration. */
> @@ -337,4 +342,9 @@ struct sgx_sigstruct {
>
> #define SGX_LAUNCH_TOKEN_SIZE 304
>
> -#endif /* _ASM_X86_SGX_ARCH_H */
> +/*
> + * Do not put any hardware-defined SGX structure representations below this
> + * line!

Heh, which line? Yep, it's Friday afternoon...

> + */

\
 
 \ /
  Last update: 2021-03-12 22:59    [W:0.394 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site