0001
0002 #ifndef __KVM_X86_SGX_H
0003 #define __KVM_X86_SGX_H
0004
0005 #include <linux/kvm_host.h>
0006
0007 #include "capabilities.h"
0008 #include "vmx_ops.h"
0009
0010 #ifdef CONFIG_X86_SGX_KVM
0011 extern bool __read_mostly enable_sgx;
0012
0013 int handle_encls(struct kvm_vcpu *vcpu);
0014
0015 void setup_default_sgx_lepubkeyhash(void);
0016 void vcpu_setup_sgx_lepubkeyhash(struct kvm_vcpu *vcpu);
0017
0018 void vmx_write_encls_bitmap(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12);
0019 #else
0020 #define enable_sgx 0
0021
0022 static inline void setup_default_sgx_lepubkeyhash(void) { }
0023 static inline void vcpu_setup_sgx_lepubkeyhash(struct kvm_vcpu *vcpu) { }
0024
0025 static inline void vmx_write_encls_bitmap(struct kvm_vcpu *vcpu,
0026 struct vmcs12 *vmcs12)
0027 {
0028
0029 if (cpu_has_vmx_encls_vmexit())
0030 vmcs_write64(ENCLS_EXITING_BITMAP, -1ull);
0031 }
0032 #endif
0033
0034 #endif