Commit 8ca52cc3 authored by Sean Christopherson's avatar Sean Christopherson Committed by Borislav Petkov
Browse files

x86/sgx: Expose SGX architectural definitions to the kernel



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. Also update MAINTAINERS to include asm/sgx.h.

Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
Co-developed-by: default avatarKai Huang <kai.huang@intel.com>
Signed-off-by: default avatarKai Huang <kai.huang@intel.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Acked-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
Acked-by: default avatarDave Hansen <dave.hansen@intel.com>
Link: https://lkml.kernel.org/r/6bf47acd91ab4d709e66ad1692c7803e4c9063a0.1616136308.git.kai.huang@intel.com
parent faa7d3e6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9274,6 +9274,7 @@ Q: https://patchwork.kernel.org/project/intel-sgx/list/
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/sgx
F:	Documentation/x86/sgx.rst
F:	arch/x86/entry/vdso/vsgx.S
F:	arch/x86/include/asm/sgx.h
F:	arch/x86/include/uapi/asm/sgx.h
F:	arch/x86/kernel/cpu/sgx/*
F:	tools/testing/selftests/sgx/*
+15 −5
Original line number Diff line number Diff line
@@ -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
 * comment!
 */

#endif /* _ASM_X86_SGX_H */
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
#include <linux/shmem_fs.h>
#include <linux/suspend.h>
#include <linux/sched/mm.h>
#include "arch.h"
#include <asm/sgx.h>
#include "encl.h"
#include "encls.h"
#include "sgx.h"
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
#include <linux/rwsem.h>
#include <linux/types.h>
#include <asm/asm.h>
#include "arch.h"
#include <asm/sgx.h>

#undef pr_fmt
#define pr_fmt(fmt) "sgx: " fmt
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
#define __aligned(x) __attribute__((__aligned__(x)))
#define __packed __attribute__((packed))

#include "../../../../arch/x86/kernel/cpu/sgx/arch.h"
#include "../../../../arch/x86/include/asm/sgx.h"
#include "../../../../arch/x86/include/asm/enclu.h"
#include "../../../../arch/x86/include/uapi/asm/sgx.h"