VirtualBox

Changeset 76290 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Dec 19, 2018 9:11:47 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
127568
Message:

VMM/HM: Nested VMX: bugref:9180 Added a new pre-init VMM call, invoked from HMR3Init() to copy VMX features to the VM structures earlier than HMR0InitVM does. This way
the VMX features are available at the time of CPUMR3Init.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r76198 r76290  
    4646#include <VBox/vmm/pgm.h>
    4747#include <VBox/vmm/ssm.h>
     48#include <VBox/vmm/gim.h>
    4849#include <VBox/vmm/trpm.h>
    4950#include <VBox/vmm/dbgf.h>
     
    400401static DECLCALLBACK(void) hmR3Info(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
    401402static DECLCALLBACK(void) hmR3InfoEventPending(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
    402 static int                hmR3InitCPU(PVM pVM);
     403static int                hmR3InitFinalizeR3(PVM pVM);
    403404static int                hmR3InitFinalizeR0(PVM pVM);
    404405static int                hmR3InitFinalizeR0Intel(PVM pVM);
     
    702703            if (fCaps & SUPVTCAPS_AMD_V)
    703704            {
     705                rc = SUPR3CallVMMR0Ex(pVM->pVMR0, 0 /*idCpu*/, VMMR0_DO_HM_PRE_INIT, 0, NULL);
     706                AssertRCReturn(rc, rc);
     707                Assert(pVM->hm.s.svm.fSupported);
     708
    704709                LogRel(("HM: HMR3Init: AMD-V%s\n", fCaps & SUPVTCAPS_NESTED_PAGING ? " w/ nested paging" : ""));
    705                 pVM->hm.s.svm.fSupported = true;
    706710                VM_SET_MAIN_EXECUTION_ENGINE(pVM, VM_EXEC_ENGINE_HW_VIRT);
    707711            }
     
    712716                if (RT_SUCCESS(rc))
    713717                {
     718                    rc = SUPR3CallVMMR0Ex(pVM->pVMR0, 0 /*idCpu*/, VMMR0_DO_HM_PRE_INIT, 0, NULL);
     719                    AssertRCReturn(rc, rc);
     720                    Assert(pVM->hm.s.vmx.fSupported);
     721
    714722                    LogRel(("HM: HMR3Init: VT-x%s%s%s\n",
    715723                            fCaps & SUPVTCAPS_NESTED_PAGING ? " w/ nested paging" : "",
    716724                            fCaps & SUPVTCAPS_VTX_UNRESTRICTED_GUEST ? " and unrestricted guest execution" : "",
    717725                            (fCaps & (SUPVTCAPS_NESTED_PAGING | SUPVTCAPS_VTX_UNRESTRICTED_GUEST)) ? " hw support" : ""));
    718                     pVM->hm.s.vmx.fSupported = true;
    719726                    VM_SET_MAIN_EXECUTION_ENGINE(pVM, VM_EXEC_ENGINE_HW_VIRT);
    720727                }
     
    844851
    845852/**
    846  * Initializes the per-VCPU HM.
     853 * Initializes HM components after ring-3 phase has been fully initialized.
    847854 *
    848855 * @returns VBox status code.
    849856 * @param   pVM         The cross context VM structure.
    850857 */
    851 static int hmR3InitCPU(PVM pVM)
     858static int hmR3InitFinalizeR3(PVM pVM)
    852859{
    853860    LogFlow(("HMR3InitCPU\n"));
     
    860867        PVMCPU pVCpu = &pVM->aCpus[i];
    861868        pVCpu->hm.s.fActive = false;
     869        pVCpu->hm.s.fGIMTrapXcptUD = GIMShouldTrapXcptUD(pVCpu);    /* Is safe to call now since GIMR3Init() has completed. */
    862870    }
    863871
     
    11801188    {
    11811189        case VMINITCOMPLETED_RING3:
    1182             return hmR3InitCPU(pVM);
     1190            return hmR3InitFinalizeR3(pVM);
    11831191        case VMINITCOMPLETED_RING0:
    11841192            return hmR3InitFinalizeR0(pVM);
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