VirtualBox

Changeset 25931 in vbox


Ignore:
Timestamp:
Jan 20, 2010 2:05:01 PM (15 years ago)
Author:
vboxsync
Message:

Added VBOX_HWVIRTEX_IGNORE_SVM_IN_USE environment variable check to enable hack for disregarding VERR_SVM_IN_USE errors (quite a few BIOSes around that incorrectly set EFER.SVME).

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/HWACCM.cpp

    r25929 r25931  
    4646#include <iprt/asm.h>
    4747#include <iprt/string.h>
     48#include <iprt/env.h>
    4849#include <iprt/thread.h>
    4950
     
    653654    int rc;
    654655
     656    /* Hack to allow users to work around broken BIOSes that incorrectly set EFER.SVME, which makes us believe somebody else
     657     * is already using AMD-V.
     658     */
     659    if (    !pVM->hwaccm.s.vmx.fSupported
     660        &&  !pVM->hwaccm.s.svm.fSupported
     661        &&  pVM->hwaccm.s.lLastError == VERR_SVM_IN_USE /* implies functional AMD-V */
     662        &&  RTEnvGet("VBOX_HWVIRTEX_IGNORE_SVM_IN_USE"))
     663    {
     664        LogRel(("HWACCM: VBOX_HWVIRTEX_IGNORE_SVM_IN_USE active!\n"));
     665        pVM->hwaccm.s.svm.fSupported        = true;
     666        pVM->hwaccm.s.svm.fIgnoreInUseError = true;
     667    }
     668    else
    655669    if (    !pVM->hwaccm.s.vmx.fSupported
    656670        &&  !pVM->hwaccm.s.svm.fSupported)
     
    658672        LogRel(("HWACCM: No VT-x or AMD-V CPU extension found. Reason %Rrc\n", pVM->hwaccm.s.lLastError));
    659673        LogRel(("HWACCM: VMX MSR_IA32_FEATURE_CONTROL=%RX64\n", pVM->hwaccm.s.vmx.msr.feature_ctrl));
     674
    660675        if (VMMIsHwVirtExtForced(pVM))
    661676        {
  • trunk/src/VBox/VMM/HWACCMInternal.h

    r25387 r25931  
    173173    /** Configured for VT-x or AMD-V. */
    174174    bool                fConfigured;
     175
     176    /** Set if the VBOX_HWVIRTEX_IGNORE_SVM_IN_USE hack is active. */
     177    bool                fIgnoreAMDVInUseError;
    175178
    176179    /** In use by our code. (for power suspend) */
     
    413416        /** Set if erratum 170 affects the AMD cpu. */
    414417        bool                        fAlwaysFlushTLB;
    415         bool                        u8Alignment;
     418        /** Set when the hack to ignore VERR_SVM_IN_USE is active. */
     419        bool                        fIgnoreInUseError;
    416420
    417421        /** R0 memory object for the IO bitmap (12kb). */
  • trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp

    r25226 r25931  
    149149VMMR0DECL(int) HWACCMR0Init(void)
    150150{
    151     int        rc;
     151    int     rc;
     152    bool    fAMDVPresent = false;
    152153
    153154    memset(&HWACCMR0Globals, 0, sizeof(HWACCMR0Globals));
     
    354355                RTCPUID idCpu = 0;
    355356
     357                fAMDVPresent = true;
     358
     359                /* Query AMD features. */
     360                ASMCpuId(0x8000000A, &HWACCMR0Globals.svm.u32Rev, &HWACCMR0Globals.uMaxASID, &u32Dummy, &HWACCMR0Globals.svm.u32Features);
     361
    356362                /* We need to check if AMD-V has been properly initialized on all CPUs. Some BIOSes might do a poor job. */
    357363                memset(aRc, 0, sizeof(aRc));
     
    368374                if (RT_SUCCESS(rc))
    369375                {
    370                     /* Query AMD features. */
    371                     ASMCpuId(0x8000000A, &HWACCMR0Globals.svm.u32Rev, &HWACCMR0Globals.uMaxASID, &u32Dummy, &HWACCMR0Globals.svm.u32Features);
    372376                    /* Read the HWCR msr for diagnostics. */
    373377                    HWACCMR0Globals.svm.msrHWCR    = ASMRdMsr(MSR_K8_HWCR);
     
    400404    }
    401405    else
    402     if (HWACCMR0Globals.svm.fSupported)
     406    if (fAMDVPresent)
    403407    {
    404408        HWACCMR0Globals.pfnEnterSession     = SVMR0Enter;
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r25914 r25931  
    7878    uint64_t val = ASMRdMsr(MSR_K6_EFER);
    7979    if (val & MSR_K6_EFER_SVME)
    80         return VERR_SVM_IN_USE;
     80    {
     81        /* If the VBOX_HWVIRTEX_IGNORE_SVM_IN_USE hack is active, then we blindly use AMD-V. */
     82        if (    pVM
     83            &&  pVM->hwaccm.s.svm.fIgnoreInUseError)
     84        {
     85            pCpu->fIgnoreAMDVInUseError = true;
     86        }
     87
     88        if (!pCpu->fIgnoreAMDVInUseError)
     89            return VERR_SVM_IN_USE;
     90    }
    8191
    8292    /* Turn on AMD-V in the EFER MSR. */
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