VirtualBox

Changeset 57514 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 24, 2015 3:52:22 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
102309
Message:

VMM/HMVMXR0: Fix EPT capabilities checks and propagate errors to ring-3.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r57477 r57514  
    21722172                /* Shouldn't happen. EPT is supported but no suitable flush-types supported. */
    21732173                pVM->hm.s.vmx.enmFlushEpt = VMXFLUSHEPT_NOT_SUPPORTED;
     2174                pVM->aCpus[0].hm.s.u32HMError = VMX_UFC_EPT_FLUSH_TYPE_UNSUPPORTED;
    21742175                return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
    21752176            }
    21762177
    21772178            /* Make sure the write-back cacheable memory type for EPT is supported. */
    2178             if (!(pVM->hm.s.vmx.Msrs.u64EptVpidCaps & MSR_IA32_VMX_EPT_VPID_CAP_EMT_WB))
     2179            if (RT_UNLIKELY(!(pVM->hm.s.vmx.Msrs.u64EptVpidCaps & MSR_IA32_VMX_EPT_VPID_CAP_EMT_WB)))
    21792180            {
    2180                 LogRel(("hmR0VmxSetupTaggedTlb: Unsupported EPTP memory type %#x.\n", pVM->hm.s.vmx.Msrs.u64EptVpidCaps));
    21812181                pVM->hm.s.vmx.enmFlushEpt = VMXFLUSHEPT_NOT_SUPPORTED;
     2182                pVM->aCpus[0].hm.s.u32HMError = VMX_UFC_EPT_MEM_TYPE_NOT_WB;
    21822183                return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
    21832184            }
     2185
     2186            /* EPT requires a page-walk length of 4. */
     2187            if (RT_UNLIKELY(!(pVM->hm.s.vmx.Msrs.u64EptVpidCaps & MSR_IA32_VMX_EPT_VPID_CAP_PAGE_WALK_LENGTH_4)))
     2188            {
     2189                pVM->hm.s.vmx.enmFlushEpt = VMXFLUSHEPT_NOT_SUPPORTED;
     2190                pVM->aCpus[0].hm.s.u32HMError = VMX_UFC_EPT_PAGE_WALK_LENGTH_UNSUPPORTED;
     2191                return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
     2192            }
    21842193        }
    21852194        else
     
    21872196            /* Shouldn't happen. EPT is supported but INVEPT instruction is not supported. */
    21882197            pVM->hm.s.vmx.enmFlushEpt = VMXFLUSHEPT_NOT_SUPPORTED;
     2198            pVM->aCpus[0].hm.s.u32HMError = VMX_UFC_EPT_INVEPT_UNAVAILABLE;
    21892199            return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
    21902200        }
     
    37963806            /* Validate. See Intel spec. 26.2.1 "Checks on VMX Controls" */
    37973807            AssertMsg(   ((pVCpu->hm.s.vmx.HCPhysEPTP >> 3) & 0x07) == 3      /* Bits 3:5 (EPT page walk length - 1) must be 3. */
    3798                       && ((pVCpu->hm.s.vmx.HCPhysEPTP >> 6) & 0x3f) == 0,     /* Bits 6:11 MBZ. */
     3808                      && ((pVCpu->hm.s.vmx.HCPhysEPTP >> 7) & 0x1f) == 0,     /* Bits 7:11 MBZ. */
    37993809                         ("EPTP %#RX64\n", pVCpu->hm.s.vmx.HCPhysEPTP));
     3810            AssertMsg(  !((pVCpu->hm.s.vmx.HCPhysEPTP >> 6) & 0x01)           /* Bit 6 (EPT accessed & dirty bit). */
     3811                      || (pVM->hm.s.vmx.Msrs.u64EptVpidCaps & MSR_IA32_VMX_EPT_VPID_CAP_EPT_ACCESS_DIRTY),
     3812                         ("EPTP accessed/dirty bit not supported by CPU but set %#RX64\n", pVCpu->hm.s.vmx.HCPhysEPTP));
    38003813
    38013814            rc = VMXWriteVmcs64(VMX_VMCS64_CTRL_EPTP_FULL, pVCpu->hm.s.vmx.HCPhysEPTP);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette