VirtualBox

Changeset 51728 in vbox for trunk/src


Ignore:
Timestamp:
Jun 26, 2014 5:52:17 AM (11 years ago)
Author:
vboxsync
Message:

VMM: Add MWait Extensions as a CPUM feature to allow configuring it from other VMM components.

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

Legend:

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

    r51720 r51728  
    22852285            break;
    22862286
     2287        /*
     2288         * Set the MWAIT Extensions Present bit in the MWAIT/MONITOR leaf.
     2289         * This currently includes the Present bit and MWAITBREAK bit as well.
     2290         */
     2291        case CPUMCPUIDFEATURE_MWAIT_EXTS:
     2292            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000005), 0);
     2293            if (   !pLeaf
     2294                || !pVM->cpum.s.HostFeatures.fMWaitExtensions)
     2295            {
     2296                LogRel(("CPUM: WARNING! Can't turn on MWAIT Extensions when the host doesn't support it!\n"));
     2297                return;
     2298            }
     2299
     2300            /* Valid for both Intel and AMD. */
     2301            pVM->cpum.s.aGuestCpuIdStd[5].ecx = pLeaf->uEcx |= X86_CPUID_MWAIT_ECX_EXT | X86_CPUID_MWAIT_ECX_BREAKIRQIF0;
     2302            pVM->cpum.s.GuestFeatures.fMWaitExtensions = 1;
     2303            LogRel(("CPUM: SetGuestCpuIdFeature: Enabled MWAIT Extensions.\n"));
     2304            break;
     2305
    22872306        default:
    22882307            AssertMsgFailed(("enmFeature=%d\n", enmFeature));
     
    23202339        case CPUMCPUIDFEATURE_RDTSCP:       return pVM->cpum.s.GuestFeatures.fRdTscP;
    23212340        case CPUMCPUIDFEATURE_HVP:          return pVM->cpum.s.GuestFeatures.fHypervisorPresent;
     2341        case CPUMCPUIDFEATURE_MWAIT_EXTS:   return pVM->cpum.s.GuestFeatures.fMWaitExtensions;
    23222342
    23232343        case CPUMCPUIDFEATURE_INVALID:
     
    24182438                pVM->cpum.s.aGuestCpuIdStd[1].ecx = pLeaf->uEcx &= ~X86_CPUID_FEATURE_ECX_HVP;
    24192439            pVM->cpum.s.GuestFeatures.fHypervisorPresent = 0;
     2440            break;
     2441
     2442        case CPUMCPUIDFEATURE_MWAIT_EXTS:
     2443            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000005), 0);
     2444            if (pLeaf)
     2445                pVM->cpum.s.aGuestCpuIdStd[5].ecx = pLeaf->uEcx &= ~(X86_CPUID_MWAIT_ECX_EXT | X86_CPUID_MWAIT_ECX_BREAKIRQIF0);
     2446            pVM->cpum.s.GuestFeatures.fMWaitExtensions = 0;
     2447            Log(("CPUM: ClearGuestCpuIdFeature: Disabled MWAIT Extensions!\n"));
    24202448            break;
    24212449
  • trunk/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp

    r51344 r51728  
    14201420        pFeatures->fMonitorMWait        = RT_BOOL(paLeaves[1].uEcx & X86_CPUID_FEATURE_ECX_MONITOR);
    14211421
     1422        /* MWAIT/MONITOR leaf. */
     1423        PCCPUMCPUIDLEAF const pMWaitLeaf = cpumR3CpuIdFindLeaf(paLeaves, cLeaves, 5);
     1424        if (pMWaitLeaf)
     1425        {
     1426            pFeatures->fMWaitExtensions = (pMWaitLeaf->uEcx & (X86_CPUID_MWAIT_ECX_EXT | X86_CPUID_MWAIT_ECX_BREAKIRQIF0))
     1427                                                           == (X86_CPUID_MWAIT_ECX_EXT | X86_CPUID_MWAIT_ECX_BREAKIRQIF0);
     1428        }
     1429
    14221430        /* Extended features. */
    14231431        PCCPUMCPUIDLEAF const pExtLeaf  = cpumR3CpuIdFindLeaf(paLeaves, cLeaves, 0x80000001);
  • trunk/src/VBox/VMM/include/CPUMInternal.h

    r51517 r51728  
    155155    /** MWAIT & MONITOR instructions supported. */
    156156    uint32_t        fMonitorMWait : 1;
     157    /** MWAIT Extensions present. */
     158    uint32_t        fMWaitExtensions : 1;
    157159
    158160    /** AMD64: Supports long mode. */
     
    173175
    174176    /** Alignment padding. */
    175     uint32_t        fPadding : 9;
     177    uint32_t        fPadding : 8;
    176178
    177179    uint64_t        auPadding[2];
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