diff --git a/hypervisor/arch/x86/ept.c b/hypervisor/arch/x86/ept.c index d2929432c..b40683063 100644 --- a/hypervisor/arch/x86/ept.c +++ b/hypervisor/arch/x86/ept.c @@ -450,7 +450,6 @@ int ept_misconfig_vmexit_handler(__unused struct vcpu *vcpu) return status; } - int ept_mmap(struct vm *vm, uint64_t hpa, uint64_t gpa, uint64_t size, uint32_t type, uint32_t prot) { @@ -481,7 +480,7 @@ int ept_mmap(struct vm *vm, uint64_t hpa, ASSERT(0, "unknown map type"); foreach_vcpu(i, vm, vcpu) { - vcpu_make_request(vcpu, ACRN_REQUEST_TLB_FLUSH); + vcpu_make_request(vcpu, ACRN_REQUEST_EPT_FLUSH); } dev_dbg(ACRN_DBG_EPT, "ept map: %s hpa: 0x%016llx gpa: 0x%016llx ", diff --git a/hypervisor/arch/x86/interrupt.c b/hypervisor/arch/x86/interrupt.c index d6762153b..ea6200259 100644 --- a/hypervisor/arch/x86/interrupt.c +++ b/hypervisor/arch/x86/interrupt.c @@ -372,7 +372,7 @@ int acrn_handle_pending_request(struct vcpu *vcpu) return -EFAULT; } - if (bitmap_test_and_clear(ACRN_REQUEST_TLB_FLUSH, pending_req_bits)) + if (bitmap_test_and_clear(ACRN_REQUEST_EPT_FLUSH, pending_req_bits)) invept(vcpu); if (bitmap_test_and_clear(ACRN_REQUEST_TMR_UPDATE, pending_req_bits)) diff --git a/hypervisor/arch/x86/mmu.c b/hypervisor/arch/x86/mmu.c index e33ffefd3..e3b42911b 100644 --- a/hypervisor/arch/x86/mmu.c +++ b/hypervisor/arch/x86/mmu.c @@ -46,7 +46,7 @@ static struct vmx_capability { #define INVEPT_TYPE_SINGLE_CONTEXT 1UL #define INVEPT_TYPE_ALL_CONTEXTS 2UL -#define INVEPT_SET_ERROR_CODE \ +#define VMFAIL_INVALID_EPT_VPID \ " jnc 1f\n" \ " mov $1, %0\n" /* CF: error = 1 */ \ " jmp 3f\n" \ @@ -66,7 +66,7 @@ static inline void _invept(uint64_t type, struct invept_desc desc) int error = 0; asm volatile ("invept %1, %2\n" - INVEPT_SET_ERROR_CODE + VMFAIL_INVALID_EPT_VPID : "=r" (error) : "m" (desc), "r" (type) : "memory"); @@ -103,7 +103,9 @@ int check_vmx_mmu_cap(void) return -ENODEV; } - if (!cpu_has_vmx_vpid_cap(VMX_VPID_INVVPID)) { + if (!cpu_has_vmx_vpid_cap(VMX_VPID_INVVPID) || + !cpu_has_vmx_vpid_cap(VMX_VPID_INVVPID_SINGLE_CONTEXT) || + !cpu_has_vmx_vpid_cap(VMX_VPID_INVVPID_GLOBAL_CONTEXT)) { pr_fatal("%s, invvpid not supported\n", __func__); return -ENODEV; } diff --git a/hypervisor/include/arch/x86/guest/guest.h b/hypervisor/include/arch/x86/guest/guest.h index 4329f8107..b749962fa 100644 --- a/hypervisor/include/arch/x86/guest/guest.h +++ b/hypervisor/include/arch/x86/guest/guest.h @@ -45,7 +45,7 @@ int get_req_info(char *str, int str_max); #define ACRN_REQUEST_EXTINT 2 #define ACRN_REQUEST_NMI 3 #define ACRN_REQUEST_TMR_UPDATE 4 -#define ACRN_REQUEST_TLB_FLUSH 5 +#define ACRN_REQUEST_EPT_FLUSH 5 #define ACRN_REQUEST_TRP_FAULT 6 #define E820_MAX_ENTRIES 32