VirtualBox

Changeset 24484 in vbox for trunk/src


Ignore:
Timestamp:
Nov 9, 2009 10:21:11 AM (15 years ago)
Author:
vboxsync
Message:

Must reinit VT-x and AMD-V after a suspend as some BIOSes don't do their job properly.

File:
1 edited

Legend:

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

    r24482 r24484  
    732732    int            *paRc = (int *)pvUser2;
    733733
     734    if (!HWACCMR0Globals.fGlobalInit)
     735    {
     736        paRc[idCpu] = VINF_SUCCESS;
     737        AssertFailed();
     738        return;
     739    }
     740
    734741    paRc[idCpu] = hwaccmR0EnableCpu(pVM, idCpu);
    735742}
     
    785792{
    786793    int            *paRc = (int *)pvUser1;
     794
     795    if (!HWACCMR0Globals.fGlobalInit)
     796    {
     797        paRc[idCpu] = VINF_SUCCESS;
     798        AssertFailed();
     799        return;
     800    }
    787801
    788802    paRc[idCpu] = hwaccmR0DisableCpu(idCpu);
     
    810824        ASMAtomicWriteBool(&HWACCMR0Globals.fSuspended, true);
    811825
    812     if (    HWACCMR0Globals.enmHwAccmState == HWACCMSTATE_ENABLED
    813         &&  HWACCMR0Globals.fGlobalInit)
     826    if (HWACCMR0Globals.enmHwAccmState == HWACCMSTATE_ENABLED)
    814827    {
    815828        int     aRc[RTCPUSET_MAX_CPUS];
     
    820833        if (enmEvent == RTPOWEREVENT_SUSPEND)
    821834        {
    822             /* Turn off VT-x or AMD-V on all CPUs. */
    823             rc = RTMpOnAll(hwaccmR0DisableCpuCallback, aRc, NULL);
    824             Assert(RT_SUCCESS(rc) || rc == VERR_NOT_SUPPORTED);
     835            if (HWACCMR0Globals.fGlobalInit)
     836            {
     837                /* Turn off VT-x or AMD-V on all CPUs. */
     838                rc = RTMpOnAll(hwaccmR0DisableCpuCallback, aRc, NULL);
     839                Assert(RT_SUCCESS(rc) || rc == VERR_NOT_SUPPORTED);
     840            }
     841            /* else nothing to do here for the local init case */
    825842        }
    826843        else
    827844        {
    828             /* Reinit the CPUs from scratch as the suspend state has messed with the MSRs. */
     845            /* Reinit the CPUs from scratch as the suspend state might have messed with the MSRs. (lousy BIOSes as usual) */
    829846            rc = RTMpOnAll(HWACCMR0InitCPU, (void *)((HWACCMR0Globals.vmx.fSupported) ? X86_CPUID_VENDOR_INTEL_EBX : X86_CPUID_VENDOR_AMD_EBX), aRc);
    830847            Assert(RT_SUCCESS(rc) || rc == VERR_NOT_SUPPORTED);
     
    837854#endif
    838855
    839             /* Turn VT-x or AMD-V back on on all CPUs. */
    840             rc = RTMpOnAll(hwaccmR0EnableCpuCallback, NULL, aRc);
    841             Assert(RT_SUCCESS(rc) || rc == VERR_NOT_SUPPORTED);
     856            if (HWACCMR0Globals.fGlobalInit)
     857            {
     858                /* Turn VT-x or AMD-V back on on all CPUs. */
     859                rc = RTMpOnAll(hwaccmR0EnableCpuCallback, NULL, aRc);
     860                Assert(RT_SUCCESS(rc) || rc == VERR_NOT_SUPPORTED);
     861            }
     862            /* else nothing to do here for the local init case */
    842863        }
    843864    }
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