VirtualBox

Changeset 45971 in vbox for trunk/src


Ignore:
Timestamp:
May 9, 2013 7:46:52 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
85623
Message:

Main, VMM: Added an API seting to disable VT-x unrestricted execution.

Location:
trunk/src/VBox
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r45926 r45971  
    675675    SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_LargePages, &f),  "largepages",   "Large Pages");
    676676    SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_VPID, &f),        "vtxvpid",      "VT-x VPID");
     677    SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_UnrestrictedExecution, &f), "vtxux", "VT-x unr. exec.");
    677678
    678679    MachineState_T machineState;
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r45926 r45971  
    6565    MODIFYVM_LARGEPAGES,
    6666    MODIFYVM_VTXVPID,
     67    MODIFYVM_VTXUX,
    6768    MODIFYVM_CPUS,
    6869    MODIFYVM_CPUHOTPLUG,
     
    222223    { "--largepages",               MODIFYVM_LARGEPAGES,                RTGETOPT_REQ_BOOL_ONOFF },
    223224    { "--vtxvpid",                  MODIFYVM_VTXVPID,                   RTGETOPT_REQ_BOOL_ONOFF },
     225    { "--vtxux",                    MODIFYVM_VTXUX,                     RTGETOPT_REQ_BOOL_ONOFF },
    224226    { "--cpuidset",                 MODIFYVM_SETCPUID,                  RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
    225227    { "--cpuidremove",              MODIFYVM_DELCPUID,                  RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX},
     
    606608            }
    607609
     610            case MODIFYVM_VTXUX:
     611            {
     612                CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_UnrestrictedExecution, ValueUnion.f));
     613                break;
     614            }
     615   
    608616            case MODIFYVM_CPUS:
    609617            {
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r45940 r45971  
    950950  <enum
    951951    name="HWVirtExPropertyType"
    952     uuid="ce81dfdd-d2b8-4a90-bbea-40ee8b7ffcee"
     952    uuid="39463ecd-b4b8-401f-b168-76cfa87e11f0"
    953953    >
    954954    <desc>
     
    983983      </desc>
    984984    </const>
    985     <const name="LargePages"            value="5">
    986       <desc>
    987         Whether large page allocation is enabled; requires nested paging and a 64 bits host.
    988       </desc>
    989     </const>
    990     <const name="Force"                 value="6">
     985    <const name="UnrestrictedExecution" value="5">
     986      <desc>
     987        Whether VT-x unrestricted execution is enabled. If this feature is not available, it will not be used.
     988      </desc>
     989    </const>
     990    <const name="LargePages"            value="6">
     991      <desc>
     992        Whether large page allocation is enabled; requires nested paging and a 64-bit host.
     993      </desc>
     994    </const>
     995    <const name="Force"                 value="7">
    991996      <desc>
    992997        Whether the VM should fail to start if hardware virtualization (VT-x/AMD-V) cannot be used. If
     
    41974202      <desc>
    41984203        This setting determines whether VirtualBox allows page
    4199         fusion for this machine (64 bits host only).
     4204        fusion for this machine (64-bit hosts only).
    42004205      </desc>
    42014206    </attribute>
     
    1480314808      <desc>
    1480414809        Takes a guest screen shot of the requested size and returns it as
    14805         an array of bytes in uncompressed 32-bit RGBA format.
     14810        an array of bytes in uncompressed 32-bpp RGBA format.
    1480614811        A pixel consists of 4 bytes in order: R, G, B, 0xFF.
    1480714812
     
    1545315458  <interface
    1545415459    name="IMachineDebugger" extends="$unknown"
    15455     uuid="a80bb82c-37c5-4155-a524-9c1d0a1689ba"
     15460    uuid="1eeeb3c2-0089-4448-878e-414aee00e03b"
    1545615461    wsmap="managed"
    1545715462    >
     
    1585115856        Flag indicating whether the VM is currently making use of the VPID
    1585215857        VT-x extension.
     15858      </desc>
     15859    </attribute>
     15860
     15861    <attribute name="HWVirtExUXEnabled" type="boolean" readonly="yes">
     15862      <desc>
     15863        Flag indicating whether the VM is currently making use of the
     15864        unrestricted execution feature of VT-x.
    1585315865      </desc>
    1585415866    </attribute>
     
    1964319655        followed by a 32-bpp XOR (color) mask.
    1964419656
    19645         For pointers without alpha channel the XOR mask pixels are 32
    19646         bit values: (lsb)BGR0(msb). For pointers with alpha channel
    19647         the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
     19657        For pointers without alpha channel the XOR mask pixels are
     19658        32-bit values: (lsb)BGR0(msb). For pointers with alpha channel
     19659        the XOR mask consists of (lsb)BGRA(msb) 32-bit values.
    1964819660
    1964919661        An AND mask is used for pointers with alpha channel, so if the
  • trunk/src/VBox/Main/include/MachineDebuggerImpl.h

    r44528 r45971  
    7373    STDMETHOD(COMGETTER(HWVirtExNestedPagingEnabled))(BOOL *a_pfEnabled);
    7474    STDMETHOD(COMGETTER(HWVirtExVPIDEnabled))(BOOL *a_pfEnabled);
     75    STDMETHOD(COMGETTER(HWVirtExUXEnabled))(BOOL *a_pfEnabled);
    7576    STDMETHOD(COMGETTER(PAEEnabled))(BOOL *a_pfEnabled);
    7677    STDMETHOD(COMGETTER(OSName))(BSTR *a_pbstrName);
  • trunk/src/VBox/Main/include/MachineImpl.h

    r45926 r45971  
    269269        BOOL                mHWVirtExLargePagesEnabled;
    270270        BOOL                mHWVirtExVPIDEnabled;
     271        BOOL                mHWVirtExUXEnabled;
    271272        BOOL                mHWVirtExForceEnabled;
    272273        BOOL                mAccelerate2DVideoEnabled;
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r45927 r45971  
    997997        hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_VPID, &fEnableVPID);       H();
    998998        InsertConfigInteger(pHM, "EnableVPID", fEnableVPID);
     999
     1000        /* Unrestricted execution aka UX (VT-x) */
     1001        BOOL fEnableUX = false;
     1002        hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_UnrestrictedExecution, &fEnableUX); H();
     1003        InsertConfigInteger(pHM, "EnableUX", fEnableUX);
    9991004
    10001005        /*
  • trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp

    r45528 r45971  
    667667    if (ptrVM.isOk())
    668668        *aEnabled = HMR3IsVpidActive(ptrVM.rawUVM());
     669    else
     670        *aEnabled = false;
     671
     672    return S_OK;
     673}
     674
     675/**
     676 * Returns the current unrestricted execution setting.
     677 *
     678 * @returns COM status code
     679 * @param   aEnabled address of result variable
     680 */
     681STDMETHODIMP MachineDebugger::COMGETTER(HWVirtExUXEnabled) (BOOL *aEnabled)
     682{
     683    CheckComArgOutPointerValid(aEnabled);
     684
     685    AutoCaller autoCaller(this);
     686    if (FAILED(autoCaller.rc()))
     687        return autoCaller.rc();
     688
     689    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     690
     691    Console::SafeVMPtrQuiet ptrVM(mParent);
     692
     693    if (ptrVM.isOk())
     694        *aEnabled = HMR3IsUXActive(ptrVM.rawUVM());
    669695    else
    670696        *aEnabled = false;
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r45926 r45971  
    183183#endif
    184184    mHWVirtExVPIDEnabled = true;
     185    mHWVirtExUXEnabled = true;
    185186    mHWVirtExForceEnabled = false;
    186187#if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS)
     
    24292430            break;
    24302431
     2432        case HWVirtExPropertyType_UnrestrictedExecution:
     2433            *aVal = mHWData->mHWVirtExUXEnabled;
     2434            break;
     2435
    24312436        case HWVirtExPropertyType_LargePages:
    24322437            *aVal = mHWData->mHWVirtExLargePagesEnabled;
     
    24822487            break;
    24832488
     2489        case HWVirtExPropertyType_UnrestrictedExecution:
     2490            setModified(IsModified_MachineData);
     2491            mHWData.backup();
     2492            mHWData->mHWVirtExUXEnabled = !!aVal;
     2493            break;
     2494   
    24842495        case HWVirtExPropertyType_LargePages:
    24852496            setModified(IsModified_MachineData);
     
    87238734        mHWData->mHWVirtExLargePagesEnabled   = data.fLargePages;
    87248735        mHWData->mHWVirtExVPIDEnabled         = data.fVPID;
     8736        mHWData->mHWVirtExUXEnabled           = data.fUnrestrictedExecution;
    87258737        mHWData->mHWVirtExForceEnabled        = data.fHardwareVirtForce;
    87268738        mHWData->mPAEEnabled                  = data.fPAE;
     
    99579969        data.fLargePages            = !!mHWData->mHWVirtExLargePagesEnabled;
    99589970        data.fVPID                  = !!mHWData->mHWVirtExVPIDEnabled;
     9971        data.fUnrestrictedExecution = !!mHWData->mHWVirtExUXEnabled;
    99599972        data.fHardwareVirtForce     = !!mHWData->mHWVirtExForceEnabled;
    99609973        data.fPAE                   = !!mHWData->mPAEEnabled;
  • trunk/src/VBox/Main/xml/Settings.cpp

    r45926 r45971  
    17331733          fNestedPaging(true),
    17341734          fVPID(true),
     1735          fUnrestrictedExecution(true),
    17351736          fHardwareVirtForce(false),
    17361737          fSyntheticCpu(false),
     
    18031804                  && (fLargePages               == h.fLargePages)
    18041805                  && (fVPID                     == h.fVPID)
     1806                  && (fUnrestrictedExecution    == h.fUnrestrictedExecution)
    18051807                  && (fHardwareVirtForce        == h.fHardwareVirtForce)
    18061808                  && (fSyntheticCpu             == h.fSyntheticCpu)
     
    25352537            if ((pelmCPUChild = pelmHwChild->findChildElement("HardwareVirtExVPID")))
    25362538                pelmCPUChild->getAttributeValue("enabled", hw.fVPID);
     2539            if ((pelmCPUChild = pelmHwChild->findChildElement("HardwareVirtExUX")))
     2540                pelmCPUChild->getAttributeValue("enabled", hw.fUnrestrictedExecution);
    25372541            if ((pelmCPUChild = pelmHwChild->findChildElement("HardwareVirtForce")))
    25382542                pelmCPUChild->getAttributeValue("enabled", hw.fHardwareVirtForce);
     
    37333737    pelmCPU->createChild("HardwareVirtExNestedPaging")->setAttribute("enabled", hw.fNestedPaging);
    37343738    pelmCPU->createChild("HardwareVirtExVPID")->setAttribute("enabled", hw.fVPID);
     3739    pelmCPU->createChild("HardwareVirtExUX")->setAttribute("enabled", hw.fUnrestrictedExecution);
    37353740    pelmCPU->createChild("PAE")->setAttribute("enabled", hw.fPAE);
    37363741    if (m->sv >= SettingsVersion_v1_14 && hw.enmLongMode != Hardware::LongMode_Legacy)
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r45963 r45971  
    400400    AssertRCReturn(rc, rc);
    401401
    402     /** @cfgm{/HM/EnableUnrestrictedExec, bool, true}
     402    /** @cfgm{/HM/EnableUX, bool, true}
    403403     * Enables the VT-x unrestricted execution feature. */
    404     rc = CFGMR3QueryBoolDef(pCfgHM, "EnableUnrestrictedExec", &pVM->hm.s.vmx.fAllowUnrestricted, true);
     404    rc = CFGMR3QueryBoolDef(pCfgHM, "EnableUX", &pVM->hm.s.vmx.fAllowUnrestricted, true);
    405405    AssertRCReturn(rc, rc);
    406406
     
    28212821
    28222822/**
     2823 * Checks if we are currently using VT-x unrestricted execution,
     2824 * aka UX.
     2825 *
     2826 * @returns true if UX is being used, otherwise false.
     2827 * @param   pUVM        The user mode VM handle.
     2828 */
     2829VMMR3DECL(bool) HMR3IsUXActive(PUVM pUVM)
     2830{
     2831    UVM_ASSERT_VALID_EXT_RETURN(pUVM, false);
     2832    PVM pVM = pUVM->pVM;
     2833    VM_ASSERT_VALID_EXT_RETURN(pVM, false);
     2834    return pVM->hm.s.vmx.fUnrestrictedGuest;
     2835}
     2836
     2837
     2838/**
    28232839 * Checks if internal events are pending. In that case we are not allowed to dispatch interrupts.
    28242840 *
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