sgx.h 878 B

12345678910111213141516171819202122232425262728293031323334
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __KVM_X86_SGX_H
  3. #define __KVM_X86_SGX_H
  4. #include <linux/kvm_host.h>
  5. #include "capabilities.h"
  6. #include "vmx_ops.h"
  7. #ifdef CONFIG_X86_SGX_KVM
  8. extern bool __read_mostly enable_sgx;
  9. int handle_encls(struct kvm_vcpu *vcpu);
  10. void setup_default_sgx_lepubkeyhash(void);
  11. void vcpu_setup_sgx_lepubkeyhash(struct kvm_vcpu *vcpu);
  12. void vmx_write_encls_bitmap(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12);
  13. #else
  14. #define enable_sgx 0
  15. static inline void setup_default_sgx_lepubkeyhash(void) { }
  16. static inline void vcpu_setup_sgx_lepubkeyhash(struct kvm_vcpu *vcpu) { }
  17. static inline void vmx_write_encls_bitmap(struct kvm_vcpu *vcpu,
  18. struct vmcs12 *vmcs12)
  19. {
  20. /* Nothing to do if hardware doesn't support SGX */
  21. if (cpu_has_vmx_encls_vmexit())
  22. vmcs_write64(ENCLS_EXITING_BITMAP, -1ull);
  23. }
  24. #endif
  25. #endif /* __KVM_X86_SGX_H */