mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 13:37:10 +00:00
hv: check vmx unrestricted guest capability
Signed-off-by: Binbin Wu <binbin.wu@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Acked-by: Xu, Anthony <anthony.xu@intel.com>
This commit is contained in:
parent
37db817c03
commit
417cff5049
@ -211,6 +211,11 @@ static int hardware_detect_support(void)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!cpu_has_vmx_unrestricted_guest_cap()) {
|
||||||
|
pr_fatal("%s, unrestricted guest not supported\n", __func__);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
ret = check_vmx_mmu_cap();
|
ret = check_vmx_mmu_cap();
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -390,6 +390,8 @@
|
|||||||
/* CR4 bits hv want to trap to track status change */
|
/* CR4 bits hv want to trap to track status change */
|
||||||
#define CR4_TRAP_MASK (CR4_PSE | CR4_PAE)
|
#define CR4_TRAP_MASK (CR4_PSE | CR4_PAE)
|
||||||
|
|
||||||
|
#define VMX_SUPPORT_UNRESTRICTED_GUEST (1<<5)
|
||||||
|
|
||||||
/* External Interfaces */
|
/* External Interfaces */
|
||||||
int exec_vmxon_instr(void);
|
int exec_vmxon_instr(void);
|
||||||
uint64_t exec_vmread(uint32_t field);
|
uint64_t exec_vmread(uint32_t field);
|
||||||
@ -410,11 +412,15 @@ static inline uint8_t get_vcpu_mode(struct vcpu *vcpu)
|
|||||||
return vcpu->arch_vcpu.cpu_mode;
|
return vcpu->arch_vcpu.cpu_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool cpu_has_vmx_unrestricted_guest_cap(void)
|
||||||
|
{
|
||||||
|
return !!(msr_read(MSR_IA32_VMX_MISC) & VMX_SUPPORT_UNRESTRICTED_GUEST);
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct _descriptor_table_{
|
typedef struct _descriptor_table_{
|
||||||
uint16_t limit;
|
uint16_t limit;
|
||||||
uint64_t base;
|
uint64_t base;
|
||||||
}__attribute__((packed)) descriptor_table;
|
}__attribute__((packed)) descriptor_table;
|
||||||
|
|
||||||
#endif /* ASSEMBLER */
|
#endif /* ASSEMBLER */
|
||||||
|
|
||||||
#endif /* VMX_H_ */
|
#endif /* VMX_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user