Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
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     /* Nothing to do if hardware doesn't support SGX */
0029     if (cpu_has_vmx_encls_vmexit())
0030         vmcs_write64(ENCLS_EXITING_BITMAP, -1ull);
0031 }
0032 #endif
0033 
0034 #endif /* __KVM_X86_SGX_H */