VirtualBox

Changeset 87518 in vbox for trunk/src


Ignore:
Timestamp:
Feb 1, 2021 9:01:16 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
142543
Message:

VMM/HM: Make a R0 copy of HM::fAllow64BitGuests on setup (for VT-x). bugref:9217

Location:
trunk/src/VBox/VMM
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/HMAll.cpp

    r87515 r87518  
    662662 * @sa      VMR3IsLongModeAllowed, NEMHCIsLongModeAllowed
    663663 */
    664 VMM_INT_DECL(bool) HMIsLongModeAllowed(PVM pVM)
    665 {
    666     return HMIsEnabled(pVM) && pVM->hm.s.fAllow64BitGuests;
     664VMM_INT_DECL(bool) HMIsLongModeAllowed(PVMCC pVM)
     665{
     666    return HMIsEnabled(pVM) && CTX_EXPR(pVM->hm.s.fAllow64BitGuestsCfg, pVM->hmr0.s.fAllow64BitGuests, RT_NOTHING);
    667667}
    668668
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r87515 r87518  
    990990
    991991    /*
    992      * Validate some parameters.
     992     * Validate and copy over some parameters.
    993993     */
    994994    AssertReturn(pVM->hm.s.svm.fSupported, VERR_INCOMPATIBLE_CONFIG);
     
    998998                 VERR_INCOMPATIBLE_CONFIG);
    999999    pVM->hmr0.s.fNestedPaging = fNestedPaging;
     1000    pVM->hmr0.s.fAllow64BitGuests = pVM->hm.s.fAllow64BitGuestsCfg;
    10001001
    10011002    /*
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r87515 r87518  
    25042504    {
    25052505        Assert(!(pVCpu->hmr0.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_LOADED_GUEST));  /* Guest MSRs better not be loaded now. */
    2506         if (pVCpu->CTX_SUFF(pVM)->hm.s.fAllow64BitGuests)
     2506        if (pVCpu->CTX_SUFF(pVM)->hmr0.s.fAllow64BitGuests)
    25072507        {
    25082508            pVCpu->hmr0.s.vmx.u64HostMsrLStar        = ASMRdMsr(MSR_K8_LSTAR);
     
    25262526static bool hmR0VmxIsLazyGuestMsr(PCVMCPUCC pVCpu, uint32_t idMsr)
    25272527{
    2528     if (pVCpu->CTX_SUFF(pVM)->hm.s.fAllow64BitGuests)
     2528    if (pVCpu->CTX_SUFF(pVM)->hmr0.s.fAllow64BitGuests)
    25292529    {
    25302530        switch (idMsr)
     
    25592559
    25602560    Assert(pVCpu->hmr0.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_SAVED_HOST);
    2561     if (pVCpu->CTX_SUFF(pVM)->hm.s.fAllow64BitGuests)
     2561    if (pVCpu->CTX_SUFF(pVM)->hmr0.s.fAllow64BitGuests)
    25622562    {
    25632563        /*
     
    26152615    {
    26162616        Assert(pVCpu->hmr0.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_SAVED_HOST);
    2617         if (pVCpu->CTX_SUFF(pVM)->hm.s.fAllow64BitGuests)
     2617        if (pVCpu->CTX_SUFF(pVM)->hmr0.s.fAllow64BitGuests)
    26182618        {
    26192619            ASMWrMsr(MSR_K8_LSTAR,          pVCpu->hmr0.s.vmx.u64HostMsrLStar);
     
    37743774     * required for 64-bit guests.
    37753775     */
    3776     if (pVM->hm.s.fAllow64BitGuests)
     3776    if (pVM->hmr0.s.fAllow64BitGuests)
    37773777    {
    37783778        hmR0VmxSetMsrPermission(pVCpu, pVmcsInfo, false, MSR_K8_LSTAR,          VMXMSRPM_ALLOW_RD_WR);
     
    39903990        /* Some 32-bit CPUs do not support CR8 load/store exiting as MOV CR8 is
    39913991           invalid on 32-bit Intel CPUs. Set this control only for 64-bit guests. */
    3992         if (pVM->hm.s.fAllow64BitGuests)
    3993         {
     3992        if (pVM->hmr0.s.fAllow64BitGuests)
    39943993            fVal |= VMX_PROC_CTLS_CR8_STORE_EXIT             /* CR8 reads cause a VM-exit. */
    39953994                 |  VMX_PROC_CTLS_CR8_LOAD_EXIT;             /* CR8 writes cause a VM-exit. */
    3996         }
    39973995    }
    39983996
     
    45384536                 VERR_INCOMPATIBLE_CONFIG);
    45394537    pVM->hmr0.s.fNestedPaging = fNestedPaging;
     4538    pVM->hmr0.s.fAllow64BitGuests = pVM->hm.s.fAllow64BitGuestsCfg;
    45404539
    45414540    /* Initialize these always, see hmR3InitFinalizeR0().*/
     
    77547753            if (fWhat & CPUMCTX_EXTRN_KERNEL_GS_BASE)
    77557754            {
    7756                 if (   pVM->hm.s.fAllow64BitGuests
     7755                if (   pVM->hmr0.s.fAllow64BitGuests
    77577756                    && (pVCpu->hmr0.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_LOADED_GUEST))
    77587757                    pCtx->msrKERNELGSBASE = ASMRdMsr(MSR_K8_KERNEL_GS_BASE);
     
    77617760            if (fWhat & CPUMCTX_EXTRN_SYSCALL_MSRS)
    77627761            {
    7763                 if (   pVM->hm.s.fAllow64BitGuests
     7762                if (   pVM->hmr0.s.fAllow64BitGuests
    77647763                    && (pVCpu->hmr0.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_LOADED_GUEST))
    77657764                {
     
    1059610595         * be taken care of by EPT/shadow paging.
    1059710596         */
    10598         if (pVM->hm.s.fAllow64BitGuests)
    10599         {
     10597        if (pVM->hmr0.s.fAllow64BitGuests)
    1060010598            u32ProcCtls |= VMX_PROC_CTLS_CR8_STORE_EXIT
    1060110599                        |  VMX_PROC_CTLS_CR8_LOAD_EXIT;
    10602         }
    1060310600    }
    1060410601
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r87515 r87518  
    346346     * already have the support. */
    347347#ifdef VBOX_WITH_64_BITS_GUESTS
    348     rc = CFGMR3QueryBoolDef(pCfgHm, "64bitEnabled", &pVM->hm.s.fAllow64BitGuests, HC_ARCH_BITS == 64);
     348    rc = CFGMR3QueryBoolDef(pCfgHm, "64bitEnabled", &pVM->hm.s.fAllow64BitGuestsCfg, HC_ARCH_BITS == 64);
    349349    AssertLogRelRCReturn(rc, rc);
    350350#else
    351     pVM->hm.s.fAllow64BitGuests = false;
     351    pVM->hm.s.fAllow64BitGuestsCfg = false;
    352352#endif
    353353
     
    16651665    }
    16661666
    1667     LogRel((pVM->hm.s.fAllow64BitGuests ? "HM: Guest support: 32-bit and 64-bit\n"
    1668                                         : "HM: Guest support: 32-bit only\n"));
     1667    LogRel((pVM->hm.s.fAllow64BitGuestsCfg ? "HM: Guest support: 32-bit and 64-bit\n"
     1668                                          : "HM: Guest support: 32-bit only\n"));
    16691669
    16701670    /*
     
    16951695     */
    16961696    CPUMR3SetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_SEP);
    1697     if (pVM->hm.s.fAllow64BitGuests)
     1697    if (pVM->hm.s.fAllow64BitGuestsCfg)
    16981698    {
    16991699        CPUMR3SetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_PAE);
     
    18691869                    case CPUMCPUVENDOR_AMD:
    18701870                    case CPUMCPUVENDOR_HYGON:
    1871                         if (pVM->hm.s.fAllow64BitGuests)
     1871                        if (pVM->hm.s.fAllow64BitGuestsCfg)
    18721872                        {
    18731873                            LogRel(("HM: Intercepting #UD for emulating SYSENTER/SYSEXIT in long mode.\n"));
     
    19221922    CPUMR3SetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_SEP);
    19231923    CPUMR3SetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_SYSCALL);
    1924     if (pVM->hm.s.fAllow64BitGuests)
     1924    if (pVM->hm.s.fAllow64BitGuestsCfg)
    19251925    {
    19261926        CPUMR3SetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_PAE);
     
    19361936                                          : "HM: Disabled TPR patching\n"));
    19371937
    1938     LogRel((pVM->hm.s.fAllow64BitGuests ? "HM: Guest support: 32-bit and 64-bit\n"
    1939                                         : "HM: Guest support: 32-bit only\n"));
     1938    LogRel((pVM->hm.s.fAllow64BitGuestsCfg ? "HM: Guest support: 32-bit and 64-bit\n"
     1939                                           : "HM: Guest support: 32-bit only\n"));
    19401940    return VINF_SUCCESS;
    19411941}
  • trunk/src/VBox/VMM/include/HMInternal.h

    r87515 r87518  
    433433     * Config value that is copied to HMR0PERVM::fNestedPaging on setup. */
    434434    bool                        fNestedPagingCfg;
    435     /** Set when we've initialized VMX or SVM. */
     435    /** Set when we've finalized the VMX / SVM initialization in ring-3
     436     *  (hmR3InitFinalizeR0Intel / hmR3InitFinalizeR0Amd). */
    436437    bool                        fInitialized;
    437     /** Set if large pages are enabled (requires nested paging). */
     438    /** Set if large pages are enabled (requires nested paging).
     439     * Config only, passed on the PGM where it really belongs.
     440     * @todo move to PGM */
    438441    bool                        fLargePages;
    439     /** Set if we can support 64-bit guests or not. */
    440     bool                        fAllow64BitGuests;
     442    /** Set if we can support 64-bit guests or not.
     443     *  Config value that is copied to HMR0PERVM::fAllow64BitGuests on setup. */
     444    bool                        fAllow64BitGuestsCfg;
    441445    /** Set when TPR patching is allowed. */
    442446    bool                        fTprPatchingAllowed;
     
    657661    /** Set if nested paging is enabled. */
    658662    bool                        fNestedPaging;
    659 
    660     bool                        afAlignment0[7];
     663    /** Set if we can support 64-bit guests or not. */
     664    bool                        fAllow64BitGuests;
     665
     666    bool                        afAlignment0[6];
    661667
    662668    /** SVM specific data. */
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