VirtualBox

Changeset 91360 in vbox


Ignore:
Timestamp:
Sep 24, 2021 11:30:02 AM (3 years ago)
Author:
vboxsync
Message:

VMM: Nested VMX: bugref:10092 Introduced VBOX_WITH_NESTED_HWVIRT_VMX_EPT (to be removed eventually) for hopefully segregating breaking nested EPT related changes.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Config.kmk

    r91316 r91360  
    452452  endif
    453453 endif
     454 # Enables guest EPT support for VMX nested hardware virtualization.
     455 VBOX_WITH_NESTED_HWVIRT_VMX_EPT = 1
    454456endif
    455457# Enable native NEM on windows.
  • trunk/include/VBox/vmm/hm_vmx.h

    r91358 r91360  
    17791779#define VMX_BF_EPTP_RSVD_8_11_SHIFT                             8
    17801780#define VMX_BF_EPTP_RSVD_8_11_MASK                              UINT64_C(0x0000000000000f00)
    1781 #define VMX_BF_EPTP_PML4_ADDR_SHIFT                             12
    1782 #define VMX_BF_EPTP_PML4_ADDR_MASK                              UINT64_C(0xfffffffffffff000)
     1781#define VMX_BF_EPTP_PML4_TABLE_ADDR_SHIFT                       12
     1782#define VMX_BF_EPTP_PML4_TABLE_ADDR_MASK                        UINT64_C(0xfffffffffffff000)
    17831783RT_BF_ASSERT_COMPILE_CHECKS(VMX_BF_EPTP_, UINT64_C(0), UINT64_MAX,
    1784                             (MEMTYPE, PAGE_WALK_LENGTH, ACCESS_DIRTY, SUPER_SHW_STACK, RSVD_8_11, PML4_ADDR));
     1784                            (MEMTYPE, PAGE_WALK_LENGTH, ACCESS_DIRTY, SUPER_SHW_STACK, RSVD_8_11, PML4_TABLE_ADDR));
     1785
     1786/* Mask of valid EPTP bits sans physically non-addressable bits. */
     1787#define VMX_EPTP_VALID_MASK                                     (  VMX_BF_EPTP_MEMTYPE_MASK          \
     1788                                                                 | VMX_BF_EPTP_PAGE_WALK_LENGTH_MASK \
     1789                                                                 | VMX_BF_EPTP_ACCESS_DIRTY_MASK     \
     1790                                                                 | VMX_BF_EPTP_SUPER_SHW_STACK_MASK  \
     1791                                                                 | VMX_BF_EPTP_PML4_TABLE_ADDR_MASK)
    17851792/** @} */
    17861793
     
    41484155    kVmxVDiag_Vmentry_EntryIntInfoTypeVecRsvd,
    41494156    kVmxVDiag_Vmentry_EntryXcptErrCodeRsvd,
     4157    kVmxVDiag_Vmentry_EptpAccessDirty,
     4158    kVmxVDiag_Vmentry_EptpPageWalkLength,
     4159    kVmxVDiag_Vmentry_EptpMemType,
     4160    kVmxVDiag_Vmentry_EptpRsvd,
    41504161    kVmxVDiag_Vmentry_ExitCtlsAllowed1,
    41514162    kVmxVDiag_Vmentry_ExitCtlsDisallowed0,
  • trunk/src/VBox/VMM/Config.kmk

    r91014 r91360  
    3535ifdef VBOX_WITH_NESTED_HWVIRT_VMX
    3636 VMM_COMMON_DEFS += VBOX_WITH_NESTED_HWVIRT_VMX
     37endif
     38ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT
     39 VMM_COMMON_DEFS += VBOX_WITH_NESTED_HWVIRT_VMX_EPT
    3740endif
    3841ifdef VBOX_WITH_NESTED_HWVIRT_ONLY_IN_IEM
  • trunk/src/VBox/VMM/VMMAll/HMVMXAll.cpp

    r91297 r91360  
    169169    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_EntryIntInfoTypeVecRsvd  , "EntryIntInfoTypeVecRsvd"   ),
    170170    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_EntryXcptErrCodeRsvd     , "EntryXcptErrCodeRsvd"      ),
     171    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_EptpAccessDirty          , "EptpAccessDirty"           ),
     172    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_EptpPageWalkLength       , "EptpPageWalkLength"        ),
     173    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_EptpMemType              , "EptpMemType"               ),
     174    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_EptpRsvd                 , "EptpRsvd"                  ),
    171175    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_ExitCtlsAllowed1         , "ExitCtlsAllowed1"          ),
    172176    VMXV_DIAG_DESC(kVmxVDiag_Vmentry_ExitCtlsDisallowed0      , "ExitCtlsDisallowed0"       ),
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h

    r91323 r91360  
    60786078            IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_Vpid);
    60796079
     6080#ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT
     6081        /* Extended Page Tables Pointer (EPTP). */
     6082        if (pVmcs->u32ProcCtls2 & VMX_PROC_CTLS2_EPT)
     6083        {
     6084            /* Reserved bits. */
     6085            uint8_t const cMaxPhysAddrWidth = IEM_GET_GUEST_CPU_FEATURES(pVCpu)->cMaxPhysAddrWidth;
     6086            uint64_t const fValidMask       = VMX_EPTP_VALID_MASK & ~(UINT64_MAX << cMaxPhysAddrWidth);
     6087            if (pVmcs->u64EptpPtr.u & fValidMask)
     6088            { /* likely */ }
     6089            else
     6090                IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_EptpRsvd);
     6091
     6092            /* Memory Type. */
     6093            uint64_t const fCaps    = pVCpu->cpum.GstCtx.hwvirt.vmx.Msrs.u64EptVpidCaps;
     6094            uint8_t const  fMemType = RT_BF_GET(pVmcs->u64EptpPtr.u, VMX_BF_EPTP_MEMTYPE);
     6095            if (   (   fMemType == VMX_EPTP_MEMTYPE_WB
     6096                    && RT_BF_GET(fCaps, VMX_BF_EPT_VPID_CAP_MEMTYPE_WB))
     6097                || (   fMemType == VMX_EPTP_MEMTYPE_UC
     6098                    && RT_BF_GET(fCaps, VMX_BF_EPT_VPID_CAP_MEMTYPE_UC)))
     6099            { /* likely */ }
     6100            else
     6101                IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_EptpMemType);
     6102
     6103            /*
     6104             * Page walk length (PML4).
     6105             * Intel used to specify bit 7 of IA32_VMX_EPT_VPID_CAP as page walk length
     6106             * of 5 but that seems to be removed from the latest specs. leaving only PML4
     6107             * as the maximum supported page-walk level hence we hardcode it as 3 (1 less than 4)
     6108             */
     6109            Assert(RT_BF_GET(fCaps, VMX_BF_EPT_VPID_CAP_PAGE_WALK_LENGTH_4));
     6110            if (RT_BF_GET(pVmcs->u64EptpPtr.u, VMX_BF_EPTP_PAGE_WALK_LENGTH) == 3)
     6111            { /* likely */ }
     6112            else
     6113                IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_EptpPageWalkLength);
     6114
     6115            /* Access and dirty bits support in EPT structures. */
     6116            if (   !RT_BF_GET(pVmcs->u64EptpPtr.u, VMX_BF_EPTP_ACCESS_DIRTY)
     6117                ||  RT_BF_GET(fCaps, VMX_BF_EPT_VPID_CAP_ACCESS_DIRTY))
     6118            { /* likely */ }
     6119            else
     6120                IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_EptpAccessDirty);
     6121        }
     6122#else
     6123        Assert(!(pVmcs->u32ProcCtls2 & VMX_PROC_CTLS2_EPT));                /* We don't support EPT yet. */
     6124#endif
     6125
    60806126        Assert(!(pVmcs->u32PinCtls & VMX_PIN_CTLS_POSTED_INT));             /* We don't support posted interrupts yet. */
    6081         Assert(!(pVmcs->u32ProcCtls2 & VMX_PROC_CTLS2_EPT));                /* We don't support EPT yet. */
    60826127        Assert(!(pVmcs->u32ProcCtls2 & VMX_PROC_CTLS2_PML));                /* We don't support PML yet. */
    60836128        Assert(!(pVmcs->u32ProcCtls2 & VMX_PROC_CTLS2_UNRESTRICTED_GUEST)); /* We don't support Unrestricted-guests yet. */
Note: See TracChangeset for help on using the changeset viewer.

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