mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-21 16:57:20 +00:00
hv: vmx: add vpid support
Enable VMX vpid ctrl and assign an unique vpid to each vcpu so that VMX transitions are not required to invalidate any linear mappings or combined mappings. SDM Vol 3 - 28.3.3.3 If EPT is in use, the logical processor associates all mappings it creates with the value of bits 51:12 of current EPTP. If a VMM uses different EPTP values for different guests, it may use the same VPID for those guests. Doing so cannot result in one guest using translations that pertain to the other. In our UOS, the trusty world and normal world are using different EPTP. So we can use the same VPID for it. Signed-off-by: Li, Fei1 <fei1.li@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -47,6 +47,7 @@ int get_req_info(char *str, int str_max);
|
||||
#define ACRN_REQUEST_TMR_UPDATE 4
|
||||
#define ACRN_REQUEST_EPT_FLUSH 5
|
||||
#define ACRN_REQUEST_TRP_FAULT 6
|
||||
#define ACRN_REQUEST_VPID_FLUSH 7 /* flush vpid tlb */
|
||||
|
||||
#define E820_MAX_ENTRIES 32
|
||||
|
||||
|
@@ -172,6 +172,7 @@ struct vcpu_arch {
|
||||
|
||||
/* A pointer to the VMCS for this CPU. */
|
||||
void *vmcs;
|
||||
int vpid;
|
||||
|
||||
/* Holds the information needed for IRQ/exception handling. */
|
||||
struct {
|
||||
|
@@ -303,6 +303,9 @@ int unmap_mem(struct map_params *map_params, void *paddr, void *vaddr,
|
||||
int modify_mem(struct map_params *map_params, void *paddr, void *vaddr,
|
||||
uint64_t size, uint32_t flags);
|
||||
int check_vmx_mmu_cap(void);
|
||||
int allocate_vpid(void);
|
||||
void flush_vpid_single(int vpid);
|
||||
void flush_vpid_global(void);
|
||||
void invept(struct vcpu *vcpu);
|
||||
bool check_continuous_hpa(struct vm *vm, uint64_t gpa, uint64_t size);
|
||||
int obtain_last_page_table_entry(struct map_params *map_params,
|
||||
|
@@ -314,6 +314,14 @@
|
||||
#define VMX_EPT_INVEPT_SINGLE_CONTEXT (1 << 25)
|
||||
#define VMX_EPT_INVEPT_GLOBAL_CONTEXT (1 << 26)
|
||||
|
||||
#define VMX_MIN_NR_VPID 1
|
||||
#define VMX_MAX_NR_VPID (1 << 5)
|
||||
|
||||
#define VMX_VPID_TYPE_INDIVIDUAL_ADDR 0
|
||||
#define VMX_VPID_TYPE_SINGLE_CONTEXT 1
|
||||
#define VMX_VPID_TYPE_ALL_CONTEXT 2
|
||||
#define VMX_VPID_TYPE_SINGLE_NON_GLOBAL 3
|
||||
|
||||
#define VMX_VPID_INVVPID (1 << 0) /* (32 - 32) */
|
||||
#define VMX_VPID_INVVPID_INDIVIDUAL_ADDR (1 << 8) /* (40 - 32) */
|
||||
#define VMX_VPID_INVVPID_SINGLE_CONTEXT (1 << 9) /* (41 - 32) */
|
||||
|
Reference in New Issue
Block a user