KVM
sgx.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __KVM_X86_SGX_H
3 #define __KVM_X86_SGX_H
4 
5 #include <linux/kvm_host.h>
6 
7 #include "capabilities.h"
8 #include "vmx_ops.h"
9 
10 #ifdef CONFIG_X86_SGX_KVM
11 extern bool __read_mostly enable_sgx;
12 
13 int handle_encls(struct kvm_vcpu *vcpu);
14 
16 void vcpu_setup_sgx_lepubkeyhash(struct kvm_vcpu *vcpu);
17 
18 void vmx_write_encls_bitmap(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12);
19 #else
20 #define enable_sgx 0
21 
22 static inline void setup_default_sgx_lepubkeyhash(void) { }
23 static inline void vcpu_setup_sgx_lepubkeyhash(struct kvm_vcpu *vcpu) { }
24 
25 static inline void vmx_write_encls_bitmap(struct kvm_vcpu *vcpu,
26  struct vmcs12 *vmcs12)
27 {
28  /* Nothing to do if hardware doesn't support SGX */
30  vmcs_write64(ENCLS_EXITING_BITMAP, -1ull);
31 }
32 #endif
33 
34 #endif /* __KVM_X86_SGX_H */
static bool cpu_has_vmx_encls_vmexit(void)
Definition: capabilities.h:235
u32 kvm_cpu_caps[NR_KVM_CPU_CAPS] __read_mostly
Definition: cpuid.c:36
int handle_encls(struct kvm_vcpu *vcpu)
Definition: sgx.c:381
static void setup_default_sgx_lepubkeyhash(void)
Definition: sgx.h:22
#define enable_sgx
Definition: sgx.h:20
static void vcpu_setup_sgx_lepubkeyhash(struct kvm_vcpu *vcpu)
Definition: sgx.h:23
static void vmx_write_encls_bitmap(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
Definition: sgx.h:25
Definition: vmcs12.h:27
static __always_inline void vmcs_write64(unsigned long field, u64 value)
Definition: vmx_ops.h:246