VirtualBox

Changeset 13221

Show
Ignore:
Timestamp:
10/13/08 16:43:54 (3 months ago)
Author:
vboxsync
Message:

Enabled VPID (VT-x tagged TLB); default off
- Added machine & machine debugger property
- Added -vtxvpid option to VBoxManage

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/VBox/hwaccm.h

    r12989 r13221  
    111111VMMR3DECL(bool) HWACCMR3IsAllowed(PVM pVM); 
    112112VMMR3DECL(void) HWACCMR3PagingModeChanged(PVM pVM, PGMMODE enmShadowMode); 
     113VMMR3DECL(bool) HWACCMR3IsVPIDActive(PVM pVM); 
     114 
    113115/** @} */ 
    114116#endif /* IN_RING3 */ 
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp

    r13082 r13221  
    334334                 "                            [-hwvirtex on|off|default]\n" 
    335335                 "                            [-nestedpaging on|off]\n" 
     336                 "                            [-vtxvpid on|off]\n" 
    336337                 "                            [-monitorcount <number>]\n" 
    337338                 "                            [-bioslogofadein on|off]\n" 
     
    998999    else 
    9991000        RTPrintf("Nested Paging:   %s\n", HWVirtExNestedPagingEnabled ? "on" : "off"); 
     1001 
     1002    BOOL HWVirtExVPIDEnabled; 
     1003    machine->COMGETTER(HWVirtExVPIDEnabled)(&HWVirtExVPIDEnabled); 
     1004    if (details == VMINFO_MACHINEREADABLE) 
     1005        RTPrintf("vtxvpid=\"%s\"\n", HWVirtExVPIDEnabled ? "on" : "off"); 
     1006    else 
     1007        RTPrintf("VT-x VPID:   %s\n", HWVirtExVPIDEnabled ? "on" : "off"); 
    10001008 
    10011009    MachineState_T machineState; 
     
    37983806    char *hwvirtex = NULL; 
    37993807    char *nestedpaging = NULL; 
     3808    char *vtxvpid = NULL; 
    38003809    char *pae = NULL; 
    38013810    char *ioapic = NULL; 
     
    39313940            nestedpaging = argv[i]; 
    39323941        } 
     3942        else if (strcmp(argv[i], "-vtxvpid") == 0) 
     3943        { 
     3944            if (argc <= i + 1) 
     3945                return errorArgument("Missing argument to '%s'", argv[i]); 
     3946            i++; 
     3947            vtxvpid = argv[i]; 
     3948        } 
    39333949        else if (strcmp(argv[i], "-pae") == 0) 
    39343950        { 
     
    45774593            { 
    45784594                errorArgument("Invalid -nestedpaging argument '%s'", ioapic); 
     4595                rc = E_FAIL; 
     4596                break; 
     4597            } 
     4598        } 
     4599        if (vtxvpid) 
     4600        { 
     4601            if (strcmp(vtxvpid, "on") == 0) 
     4602            { 
     4603                CHECK_ERROR(machine, COMSETTER(HWVirtExVPIDEnabled)(true)); 
     4604            } 
     4605            else if (strcmp(vtxvpid, "off") == 0) 
     4606            { 
     4607                CHECK_ERROR(machine, COMSETTER(HWVirtExVPIDEnabled)(false)); 
     4608            } 
     4609            else 
     4610            { 
     4611                errorArgument("Invalid -vtxvpid argument '%s'", ioapic); 
    45794612                rc = E_FAIL; 
    45804613                break; 
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r13165 r13221  
    189189    hrc = pMachine->COMGETTER(HWVirtExNestedPagingEnabled)(&fEnableNestedPaging);   H(); 
    190190    rc = CFGMR3InsertInteger(pRoot, "EnableNestedPaging", fEnableNestedPaging);     RC_CHECK(); 
     191 
     192    /* VPID (VT-x) */ 
     193    BOOL fEnableVPID = false; 
     194    hrc = pMachine->COMGETTER(HWVirtExVPIDEnabled)(&fEnableVPID);   H(); 
     195    rc = CFGMR3InsertInteger(pRoot, "EnableVPID", fEnableVPID);     RC_CHECK(); 
    191196 
    192197    /* Physical Address Extension (PAE) */ 
  • trunk/src/VBox/Main/MachineDebuggerImpl.cpp

    r10695 r13221  
    552552 
    553553/** 
     554 * Returns the current VPID flag. 
     555 * 
     556 * @returns COM status code 
     557 * @param   enabled address of result variable 
     558 */ 
     559STDMETHODIMP MachineDebugger::COMGETTER(HWVirtExVPIDEnabled)(BOOL *enabled) 
     560{ 
     561    if (!enabled) 
     562        return E_POINTER; 
     563 
     564    AutoWriteLock alock (this); 
     565    CHECK_READY(); 
     566 
     567    Console::SafeVMPtrQuiet pVM (mParent); 
     568    if (pVM.isOk()) 
     569        *enabled = HWACCMR3IsVPIDActive(pVM.raw()); 
     570    else 
     571        *enabled = false; 
     572    return S_OK; 
     573} 
     574 
     575/** 
    554576 * Returns the current PAE flag. 
    555577 * 
  • trunk/src/VBox/Main/MachineImpl.cpp

    r13165 r13221  
    191191    mHWVirtExEnabled = TSBool_False; 
    192192    mHWVirtExNestedPagingEnabled = false; 
     193    mHWVirtExVPIDEnabled = false; 
    193194    mPAEEnabled = false; 
    194195 
     
    219220        mHWVirtExEnabled != that.mHWVirtExEnabled || 
    220221        mHWVirtExNestedPagingEnabled != that.mHWVirtExNestedPagingEnabled || 
     222        mHWVirtExVPIDEnabled != that.mHWVirtExVPIDEnabled || 
    221223        mPAEEnabled != that.mPAEEnabled || 
    222224        mClipboardMode != that.mClipboardMode) 
     
    11531155} 
    11541156 
     1157STDMETHODIMP Machine::COMGETTER(HWVirtExVPIDEnabled)(BOOL *enabled) 
     1158{ 
     1159    if (!enabled) 
     1160        return E_POINTER; 
     1161 
     1162    AutoCaller autoCaller (this); 
     1163    CheckComRCReturnRC (autoCaller.rc()); 
     1164 
     1165    AutoReadLock alock (this); 
     1166 
     1167    *enabled = mHWData->mHWVirtExVPIDEnabled; 
     1168 
     1169    return S_OK; 
     1170} 
     1171 
     1172STDMETHODIMP Machine::COMSETTER(HWVirtExVPIDEnabled)(BOOL enable) 
     1173{ 
     1174    AutoCaller autoCaller (this); 
     1175    CheckComRCReturnRC (autoCaller.rc()); 
     1176 
     1177    AutoWriteLock alock (this); 
     1178 
     1179    HRESULT rc = checkStateDependency (MutableStateDep); 
     1180    CheckComRCReturnRC (rc); 
     1181 
     1182    /** @todo check validity! */ 
     1183 
     1184    mHWData.backup(); 
     1185    mHWData->mHWVirtExVPIDEnabled = enable; 
     1186 
     1187    return S_OK; 
     1188} 
    11551189 
    11561190STDMETHODIMP Machine::COMGETTER(PAEEnabled)(BOOL *enabled) 
     
    47584792        mHWData->mHWVirtExEnabled             = TSBool_Default; 
    47594793        mHWData->mHWVirtExNestedPagingEnabled = false; 
     4794        mHWData->mHWVirtExVPIDEnabled         = false; 
    47604795        mHWData->mPAEEnabled                  = false; 
    47614796 
     
    47794814            { 
    47804815                mHWData->mHWVirtExNestedPagingEnabled = HWVirtExNestedPagingNode.value <bool> ("enabled"); 
     4816            } 
     4817 
     4818            /* HardwareVirtExVPID (optional, default is false) */ 
     4819            Key HWVirtExVPIDNode = cpuNode.findKey ("HardwareVirtExVPID"); 
     4820            if (!HWVirtExVPIDNode.isNull()) 
     4821            { 
     4822                mHWData->mHWVirtExVPIDEnabled = HWVirtExVPIDNode.value <bool> ("enabled"); 
    47814823            } 
    47824824 
     
    61726214        hwVirtExNode.setStringValue ("enabled", value); 
    61736215 
    6174         /* Nested paging (optional, default is true) */ 
     6216        /* Nested paging (optional, default is false) */ 
    61756217        Key HWVirtExNestedPagingNode = cpuNode.createKey ("HardwareVirtExNestedPaging"); 
    61766218        HWVirtExNestedPagingNode.setValue <bool> ("enabled", !!mHWData->mHWVirtExNestedPagingEnabled); 
    6177          
     6219 
     6220        /* VPID (optional, default is false) */ 
     6221        Key HWVirtExVPIDNode = cpuNode.createKey ("HardwareVirtExVPID"); 
     6222        HWVirtExVPIDNode.setValue <bool> ("enabled", !!mHWData->mHWVirtExVPIDEnabled); 
     6223 
    61786224        /* PAE (optional, default is false) */ 
    61796225        Key PAENode = cpuNode.createKey ("PAE"); 
  • trunk/src/VBox/Main/Makefile.kmk

    r12944 r13221  
    2727# Include sub-makefile(s). 
    2828# 
    29 ifdef VBOX_WITH_WEBSERVICES 
    30  include $(PATH_SUB_CURRENT)/webservice/Makefile.kmk 
    31 endif 
     29#ifdef VBOX_WITH_WEBSERVICES 
     30# include $(PATH_SUB_CURRENT)/webservice/Makefile.kmk 
     31#endif 
    3232include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk 
    3333 
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r13165 r13221  
    26452645  <interface 
    26462646     name="IMachine" extends="$unknown" 
    2647      uuid="1e509de4-d96c-4f44-8b94-860194f710ac
     2647     uuid="9797b8f2-0631-4db8-813d-4c63356b223b
    26482648     wsmap="managed" 
    26492649     > 
     
    28762876    </attribute> 
    28772877 
     2878    <attribute name="HWVirtExVPIDEnabled" type="boolean" default="false"> 
     2879      <desc> 
     2880        This setting determines whether VirtualBox will try to make use of 
     2881        the VPID extension of Intel VT-x. Note that in case such extensions are 
     2882        not available, they will not be used. 
     2883      </desc> 
     2884    </attribute> 
     2885 
    28782886    <attribute name="PAEEnabled" type="boolean" default="false"> 
    28792887      <desc> 
     
    88718879  <interface 
    88728880     name="IMachineDebugger" extends="$unknown" 
    8873      uuid="54ebce96-fa7d-4a4d-bc81-a7db41c29637
     8881     uuid="0de52346-938b-4020-a33b-471be542f3ff
    88748882     wsmap="suppress" 
    88758883     > 
     
    89428950        Flag indicating whether the VM is currently making use of the nested paging 
    89438951        CPU hardware virtualization extension. 
     8952      </desc> 
     8953    </attribute> 
     8954 
     8955    <attribute name="HWVirtExVPIDEnabled" type="boolean" readonly="yes"> 
     8956      <desc> 
     8957        Flag indicating whether the VM is currently making use of the VPID 
     8958        VT-x extension. 
    89448959      </desc> 
    89458960    </attribute> 
  • trunk/src/VBox/Main/include/MachineDebuggerImpl.h

    r10695 r13221  
    6868    STDMETHOD(COMGETTER(HWVirtExEnabled))(BOOL *enabled); 
    6969    STDMETHOD(COMGETTER(HWVirtExNestedPagingEnabled))(BOOL *enabled); 
     70    STDMETHOD(COMGETTER(HWVirtExVPIDEnabled))(BOOL *enabled); 
    7071    STDMETHOD(COMGETTER(PAEEnabled))(BOOL *enabled); 
    7172    STDMETHOD(COMGETTER(VirtualTimeRate))(ULONG *pct); 
  • trunk/src/VBox/Main/include/MachineImpl.h

    r13165 r13221  
    255255        TSBool_T       mHWVirtExEnabled; 
    256256        BOOL           mHWVirtExNestedPagingEnabled; 
     257        BOOL           mHWVirtExVPIDEnabled; 
    257258        BOOL           mPAEEnabled; 
    258259 
     
    489490    STDMETHOD(COMGETTER(HWVirtExNestedPagingEnabled))(BOOL *enabled); 
    490491    STDMETHOD(COMSETTER(HWVirtExNestedPagingEnabled))(BOOL enabled); 
     492    STDMETHOD(COMGETTER(HWVirtExVPIDEnabled))(BOOL *enabled); 
     493    STDMETHOD(COMSETTER(HWVirtExVPIDEnabled))(BOOL enabled); 
    491494    STDMETHOD(COMGETTER(PAEEnabled))(BOOL *enabled); 
    492495    STDMETHOD(COMSETTER(PAEEnabled))(BOOL enabled); 
  • trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd

    r12126 r13221  
    417417</xsd:complexType> 
    418418 
     419<xsd:complexType name="THWVirtExVPIDType"> 
     420  <xsd:attribute name="enabled" type="xsd:boolean" default="false"/> 
     421</xsd:complexType> 
     422 
    419423<xsd:complexType name="TPAEType"> 
    420424  <xsd:attribute name="enabled" type="xsd:boolean" default="false"/> 
     
    425429    <xsd:element name="HardwareVirtEx" type="THWVirtExType" minOccurs="0"/> 
    426430    <xsd:element name="HardwareVirtExNestedPaging" type="THWVirtExNestedPagingType" minOccurs="0"/> 
     431    <xsd:element name="HardwareVirtExVPID" type="THWVirtExVPIDType" minOccurs="0"/> 
    427432    <xsd:element name="PAE" type="TPAEType" minOccurs="0"/> 
    428433  </xsd:sequence> 
  • trunk/src/VBox/VMM/HWACCM.cpp

    r13178 r13221  
    195195    /* Nested paging: disabled by default. */ 
    196196    rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "EnableNestedPaging", &pVM->hwaccm.s.fAllowNestedPaging, false); 
     197    AssertRC(rc); 
     198 
     199    /* VT-x VPID: disabled by default. */ 
     200    rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "EnableVPID", &pVM->hwaccm.s.fAllowVPID, false); 
    197201    AssertRC(rc); 
    198202 
     
    576580#endif /* HWACCM_VTX_WITH_EPT */ 
    577581#ifdef HWACCM_VTX_WITH_VPID 
    578             else 
    579             if (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls2.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_VPID) 
    580                 pVM->hwaccm.s.vmx.fVPID = true
     582            if (    (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls2.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_VPID) 
     583                &&  !pVM->hwaccm.s.fNestedPaging)    /* VPID and EPT are mutually exclusive. */ 
     584                pVM->hwaccm.s.vmx.fVPID = pVM->hwaccm.s.fAllowVPID
    581585#endif /* HWACCM_VTX_WITH_VPID */ 
    582586 
     
    954958 
    955959/** 
     960 * Checks if we are currently using VPID in VT-x mode. 
     961 * 
     962 * @returns boolean 
     963 * @param   pVM         The VM to operate on. 
     964 */ 
     965VMMR3DECL(bool) HWACCMR3IsVPIDActive(PVM pVM) 
     966{ 
     967    return pVM->hwaccm.s.vmx.fVPID; 
     968} 
     969 
     970 
     971/** 
    956972 * Checks if internal events are pending. In that case we are not allowed to dispatch interrupts. 
    957973 * 
  • trunk/src/VBox/VMM/HWACCMInternal.h

    r13204 r13221  
    4242#define HWACCM_VMX_EMULATE_REALMODE 
    4343#define HWACCM_VTX_WITH_EPT 
     44#define HWACCM_VTX_WITH_VPID 
    4445 
    4546__BEGIN_DECLS 
     
    189190    /** Set if nested paging is allowed. */ 
    190191    bool                        fAllowNestedPaging; 
     192    /** Set if VT-x VPID is allowed. */ 
     193    bool                        fAllowVPID; 
    191194 
    192195    /** Set if we need to flush the TLB during the world switch. */ 
     
    196199    bool                        fFPUOldStyleOverride; 
    197200 
     201#if 0 
    198202    /** Explicit alignment padding to make 32-bit gcc align u64RegisterMask 
    199203     *  naturally. */ 
    200204    bool                        padding[1]; 
     205#endif 
    201206 
    202207    /** HWACCM_CHANGED_* flags. */ 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy