hv: monir modify for flush ept tlb to compatible with vpid

We need know which tlb to flush: ept or vpid.
1. error handle for invept.
  it's the same with invvpid error handle.
  change its name to compatible with vpid.
2. the macro name for flush ept tlb request.

Signed-off-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Li, Fei1 2018-05-23 15:34:54 +08:00 committed by lijinxia
parent 3c09933aa1
commit c34f72a0bc
4 changed files with 8 additions and 7 deletions

View File

@ -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 ",

View File

@ -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))

View File

@ -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;
}

View File

@ -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