-/* $OpenBSD: vmm_machdep.c,v 1.29 2024/07/14 07:57:42 dv Exp $ */
+/* $OpenBSD: vmm_machdep.c,v 1.30 2024/07/24 21:04:12 dv Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
PATENTRY(6, PAT_UCMINUS) | PATENTRY(7, PAT_UC);
/* NPT */
- if (vmm_softc->mode == VMM_MODE_RVI) {
- vmcb->v_np_enable = 1;
- vmcb->v_n_cr3 = vcpu->vc_parent->vm_map->pmap->pm_pdirpa;
- }
+ vmcb->v_np_enable = 1;
+ vmcb->v_n_cr3 = vcpu->vc_parent->vm_map->pmap->pm_pdirpa;
/* Enable SVME in EFER (must always be set) */
vmcb->v_efer |= EFER_SVME;
IA32_VMX_USE_TPR_SHADOW;
want0 = 0;
- if (vmm_softc->mode == VMM_MODE_EPT) {
- want1 |= IA32_VMX_ACTIVATE_SECONDARY_CONTROLS;
- want0 |= IA32_VMX_CR3_LOAD_EXITING |
- IA32_VMX_CR3_STORE_EXITING;
- }
+ want1 |= IA32_VMX_ACTIVATE_SECONDARY_CONTROLS;
+ want0 |= IA32_VMX_CR3_LOAD_EXITING | IA32_VMX_CR3_STORE_EXITING;
if (vcpu->vc_vmx_basic & IA32_VMX_TRUE_CTLS_AVAIL) {
ctrl = IA32_VMX_TRUE_PROCBASED_CTLS;
* IA32_VMX_UNRESTRICTED_GUEST - enable unrestricted guest (if caller
* specified CR0_PG | CR0_PE in %cr0 in the 'vrs' parameter)
*/
- want1 = 0;
+ want1 = IA32_VMX_ENABLE_EPT;
/* XXX checking for 2ndary controls can be combined here */
if (vcpu_vmx_check_cap(vcpu, IA32_VMX_PROCBASED_CTLS,
}
}
- if (vmm_softc->mode == VMM_MODE_EPT)
- want1 |= IA32_VMX_ENABLE_EPT;
-
if (vcpu_vmx_check_cap(vcpu, IA32_VMX_PROCBASED_CTLS,
IA32_VMX_ACTIVATE_SECONDARY_CONTROLS, 1)) {
if (vcpu_vmx_check_cap(vcpu, IA32_VMX_PROCBASED2_CTLS,
/* If the guest hasn't enabled paging ... */
if (!(r & CR0_PG) && (oldcr0 & CR0_PG)) {
/* Paging was disabled (prev. enabled) - Flush TLB */
- if (vmm_softc->mode == VMM_MODE_EPT &&
- vcpu->vc_vmx_vpid_enabled) {
+ if (vcpu->vc_vmx_vpid_enabled) {
vid.vid_vpid = vcpu->vc_vpid;
vid.vid_addr = 0;
invvpid(IA32_VMX_INVVPID_SINGLE_CTX_GLB, &vid);