VirtualBox

Changeset 50996 in vbox


Ignore:
Timestamp:
Apr 8, 2014 1:15:27 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
93182
Message:

Main: Added paravirt. provider APIs.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/settings.h

    r50196 r50996  
    1818
    1919/*
    20  * Copyright (C) 2007-2013 Oracle Corporation
     20 * Copyright (C) 2007-2014 Oracle Corporation
    2121 *
    2222 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    866866    bool operator==(const Hardware&) const;
    867867
     868    bool areParavirtDefaultSettings() const
     869    {
     870        return paravirtProvider == ParavirtProvider_Legacy;
     871    }
     872
    868873    com::Utf8Str        strVersion;             // hardware version, optional
    869874    com::Guid           uuid;                   // hardware uuid, optional (null).
     
    912917
    913918    ChipsetType_T       chipsetType;            // requires settings version 1.11 (VirtualBox 4.0)
     919    ParavirtProvider_T  paravirtProvider;       // requires settings version 1.15 (VirtualBox 4.4)
    914920
    915921    bool                fEmulatedUSBCardReader; // 1.12 (VirtualBox 4.1)
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r50447 r50996  
    179179                     "                            [--hpet on|off]\n"
    180180                     "                            [--triplefaultreset on|off]\n"
     181                     "                            [--paravirtprovider none|default|legacy|minimal|\n"
     182                     "                                                hyperv]\n"
    181183                     "                            [--hwvirtex on|off]\n"
    182184                     "                            [--nestedpaging on|off]\n"
     
    328330                     "                            [--clipboard disabled|hosttoguest|guesttohost|\n"
    329331                     "                                         bidirectional]\n"
    330                      "                            [--draganddrop disabled|hosttoguest\n");
     332                     "                            [--draganddrop disabled|hosttoguest]\n");
    331333        RTStrmPrintf(pStrm,
    332334                     "                            [--vrde on|off]\n"
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r50721 r50996  
    55
    66/*
    7  * Copyright (C) 2006-2013 Oracle Corporation
     7 * Copyright (C) 2006-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    676676    SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_VPID, &f),        "vtxvpid",      "VT-x VPID");
    677677    SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_UnrestrictedExecution, &f), "vtxux", "VT-x unr. exec.");
     678
     679    ParavirtProvider_T paravirtProvider;
     680    CHECK_ERROR2_RET(machine, COMGETTER(ParavirtProvider)(&paravirtProvider), hrcCheck);
     681    const char *pszParavirtProvider;
     682    switch (paravirtProvider)
     683    {
     684        case ParavirtProvider_None:
     685            if (details == VMINFO_MACHINEREADABLE)
     686                pszParavirtProvider = "none";
     687            else
     688                pszParavirtProvider = "None";
     689            break;
     690
     691        case ParavirtProvider_Default:
     692            if (details == VMINFO_MACHINEREADABLE)
     693                pszParavirtProvider = "default";
     694            else
     695                pszParavirtProvider = "Default";
     696            break;
     697
     698        case ParavirtProvider_Legacy:
     699            if (details == VMINFO_MACHINEREADABLE)
     700                pszParavirtProvider = "legacy";
     701            else
     702                pszParavirtProvider = "Legacy";
     703            break;
     704
     705        case ParavirtProvider_Minimal:
     706            if (details == VMINFO_MACHINEREADABLE)
     707                pszParavirtProvider = "minimal";
     708            else
     709                pszParavirtProvider = "Minimal";
     710            break;
     711
     712        case ParavirtProvider_HyperV:
     713            if (details == VMINFO_MACHINEREADABLE)
     714                pszParavirtProvider = "hyperv";
     715            else
     716                pszParavirtProvider = "HyperV";
     717            break;
     718
     719        default:
     720            if (details == VMINFO_MACHINEREADABLE)
     721                pszParavirtProvider = "unknown";
     722            else
     723                pszParavirtProvider = "Unknown";
     724    }
     725    if (details == VMINFO_MACHINEREADABLE)
     726        RTPrintf("paravirtprovider=\"%s\"\n", pszParavirtProvider);
     727    else
     728        RTPrintf("Paravirt. Provider:  %s\n", pszParavirtProvider);
     729
    678730
    679731    MachineState_T machineState;
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r50721 r50996  
    55
    66/*
    7  * Copyright (C) 2006-2013 Oracle Corporation
     7 * Copyright (C) 2006-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    6262    MODIFYVM_SYNTHCPU,
    6363    MODIFYVM_TFRESET,
     64    MODIFYVM_PARAVIRTPROVIDER,
    6465    MODIFYVM_HWVIRTEX,
    6566    MODIFYVM_NESTEDPAGING,
     
    222223    { "--longmode",                 MODIFYVM_LONGMODE,                  RTGETOPT_REQ_BOOL_ONOFF },
    223224    { "--synthcpu",                 MODIFYVM_SYNTHCPU,                  RTGETOPT_REQ_BOOL_ONOFF },
    224     { "--triplefaultreset",         MODIFYVM_TFRESET,                  RTGETOPT_REQ_BOOL_ONOFF },
     225    { "--triplefaultreset",         MODIFYVM_TFRESET,                   RTGETOPT_REQ_BOOL_ONOFF },
     226    { "--paravirtprovider",         MODIFYVM_PARAVIRTPROVIDER,          RTGETOPT_REQ_STRING },
    225227    { "--hwvirtex",                 MODIFYVM_HWVIRTEX,                  RTGETOPT_REQ_BOOL_ONOFF },
    226228    { "--nestedpaging",             MODIFYVM_NESTEDPAGING,              RTGETOPT_REQ_BOOL_ONOFF },
     
    631633            }
    632634
     635            case MODIFYVM_PARAVIRTPROVIDER:
     636            {
     637                if (   !RTStrICmp(ValueUnion.psz, "none")
     638                    || !RTStrICmp(ValueUnion.psz, "disabled"))
     639                    CHECK_ERROR(machine, COMSETTER(ParavirtProvider)(ParavirtProvider_None));
     640                else if (!RTStrICmp(ValueUnion.psz, "default"))
     641                    CHECK_ERROR(machine, COMSETTER(ParavirtProvider)(ParavirtProvider_Default));
     642                else if (!RTStrICmp(ValueUnion.psz, "legacy"))
     643                    CHECK_ERROR(machine, COMSETTER(ParavirtProvider)(ParavirtProvider_Legacy));
     644                else if (!RTStrICmp(ValueUnion.psz, "minimal"))
     645                    CHECK_ERROR(machine, COMSETTER(ParavirtProvider)(ParavirtProvider_Minimal));
     646                else if (!RTStrICmp(ValueUnion.psz, "hyperv"))
     647                    CHECK_ERROR(machine, COMSETTER(ParavirtProvider)(ParavirtProvider_HyperV));
     648                else
     649                {
     650                    errorArgument("Invalid --paravirtprovider argument '%s'", ValueUnion.psz);
     651                    rc = E_FAIL;
     652                }
     653                break;
     654            }
     655
    633656            case MODIFYVM_HWVIRTEX:
    634657            {
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r50857 r50996  
    10081008      </desc>
    10091009    </const>
     1010  </enum>
     1011
     1012  <enum
     1013        name="ParavirtProvider"
     1014        uuid="f9448c17-7caa-4ca7-9349-edafe369fcb5"
     1015        >
     1016        <desc>
     1017          The paravirtualized guest interface provider. This enumeration represents possible
     1018          values for the <link to="IMachine::paravirtProvider"/> attribute.
     1019        </desc>
     1020        <const name="None"     value="0">
     1021          <desc>No provider is used.</desc>
     1022        </const>
     1023        <const name="Default"  value="1">
     1024          <desc>A default provider is automatically chosen according to the guest OS type.</desc>
     1025        </const>
     1026        <const name="Legacy"   value="2">
     1027      <desc>Used for VMs which didn't used to have any provider settings. Usually
     1028        interpreted as @c None for most VMs.</desc>
     1029        </const>
     1030        <const name="Minimal"  value="3">
     1031          <desc>A minimal set of features to expose to the paravirtualized guest.</desc>
     1032        </const>
     1033        <const name="HyperV"   value="4">
     1034          <desc>Microsoft Hyper-V.</desc>
     1035        </const>
    10101036  </enum>
    10111037
     
    48144840    </attribute>
    48154841
     4842        <attribute name="paravirtProvider" type="ParavirtProvider">
     4843          <desc>
     4844            The paravirtualized guest interface provider.
     4845          </desc>
     4846        </attribute>
     4847
    48164848    <attribute name="faultToleranceState" type="FaultToleranceState">
    48174849      <desc>
  • trunk/src/VBox/Main/include/MachineImpl.h

    r50651 r50996  
    55
    66/*
    7  * Copyright (C) 2006-2013 Oracle Corporation
     7 * Copyright (C) 2006-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    307307        PointingHIDType_T   mPointingHIDType;
    308308        ChipsetType_T       mChipsetType;
     309        ParavirtProvider_T  mParavirtProvider;
    309310        BOOL                mEmulatedUSBCardReaderEnabled;
    310311
     
    505506    STDMETHOD(COMGETTER(ChipsetType))(ChipsetType_T *aChipsetType);
    506507    STDMETHOD(COMSETTER(ChipsetType))(ChipsetType_T  aChipsetType);
     508    STDMETHOD(COMGETTER(ParavirtProvider))(ParavirtProvider_T *aParavirtProvider);
     509    STDMETHOD(COMSETTER(ParavirtProvider))(ParavirtProvider_T  aParavirtProvider);
    507510    STDMETHOD(COMGETTER(IOCacheEnabled))(BOOL *aEnabled);
    508511    STDMETHOD(COMSETTER(IOCacheEnabled))(BOOL  aEnabled);
     
    721724     */
    722725    ChipsetType_T getChipsetType() const { return mHWData->mChipsetType; }
     726    ParavirtProvider_T getParavirtProvider() const { return mHWData->mParavirtProvider; }
    723727
    724728    void setModified(uint32_t fl, bool fAllowStateModification = true);
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r50914 r50996  
    872872    uint32_t cbMcfgLength  = 0;
    873873
     874    ParavirtProvider_T paravirtProvider;
     875    hrc = pMachine->COMGETTER(ParavirtProvider)(&paravirtProvider);                         H();
     876
    874877    ChipsetType_T chipsetType;
    875878    hrc = pMachine->COMGETTER(ChipsetType)(&chipsetType);                                   H();
     
    11811184            InsertConfigInteger(pRoot, "PowerOffInsteadOfReset", 1);
    11821185
    1183 
     1186        /*
     1187         * Paravirt. provider.
     1188         */
     1189        PCFGMNODE pParavirtNode;
     1190        InsertConfigNode(pRoot, "GIM", &pParavirtNode);
     1191        const char *pcszParavirtProvider;
     1192        switch (paravirtProvider)
     1193        {
     1194            case ParavirtProvider_None:
     1195                pcszParavirtProvider = "None";
     1196                break;
     1197
     1198            case ParavirtProvider_Default:  /** @todo Choose a provider based on guest OS type. There is no "Default" provider. */
     1199                pcszParavirtProvider = "None";
     1200                break;
     1201
     1202            case ParavirtProvider_Legacy:
     1203            {
     1204                if (fOsXGuest)
     1205                    pcszParavirtProvider = "Minimal";
     1206                else
     1207                    pcszParavirtProvider = "None";
     1208                break;
     1209            }
     1210
     1211            case ParavirtProvider_Minimal:
     1212                pcszParavirtProvider = "Minimal";
     1213                break;
     1214
     1215            case ParavirtProvider_HyperV:
     1216                pcszParavirtProvider = "HyperV";
     1217                break;
     1218
     1219            default:
     1220                AssertMsgFailed(("Invalid paravirtProvider=%d\n", paravirtProvider));
     1221                return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, N_("Invalid paravirt. provider '%d'"),
     1222                                    paravirtProvider);
     1223        }
     1224        InsertConfigString(pParavirtNode, "Provider", pcszParavirtProvider);
    11841225
    11851226        /*
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r50922 r50996  
    55
    66/*
    7  * Copyright (C) 2004-2013 Oracle Corporation
     7 * Copyright (C) 2004-2014 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    206206    mPointingHIDType = PointingHIDType_PS2Mouse;
    207207    mChipsetType = ChipsetType_PIIX3;
     208    mParavirtProvider = ParavirtProvider_Default;
    208209    mEmulatedUSBCardReaderEnabled = FALSE;
    209210
     
    13041305            }
    13051306        }
     1307    }
     1308
     1309    return S_OK;
     1310}
     1311
     1312STDMETHODIMP Machine::COMGETTER(ParavirtProvider)(ParavirtProvider_T *aParavirtProvider)
     1313{
     1314    CheckComArgOutPointerValid(aParavirtProvider);
     1315
     1316    AutoCaller autoCaller(this);
     1317    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     1318
     1319    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     1320
     1321    *aParavirtProvider = mHWData->mParavirtProvider;
     1322
     1323    return S_OK;
     1324}
     1325
     1326STDMETHODIMP Machine::COMSETTER(ParavirtProvider)(ParavirtProvider_T aParavirtProvider)
     1327{
     1328    AutoCaller autoCaller(this);
     1329    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     1330    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     1331
     1332    HRESULT rc = checkStateDependency(MutableStateDep);
     1333    if (FAILED(rc)) return rc;
     1334
     1335    if (aParavirtProvider != mHWData->mParavirtProvider)
     1336    {
     1337        setModified(IsModified_MachineData);
     1338        mHWData.backup();
     1339        mHWData->mParavirtProvider = aParavirtProvider;
    13061340    }
    13071341
     
    93629396        mHWData->mKeyboardHIDType = data.keyboardHIDType;
    93639397        mHWData->mChipsetType = data.chipsetType;
     9398        mHWData->mParavirtProvider = data.paravirtProvider;
    93649399        mHWData->mEmulatedUSBCardReaderEnabled = data.fEmulatedUSBCardReader;
    93659400        mHWData->mHPETEnabled = data.fHPETEnabled;
     
    1063710672        data.chipsetType = mHWData->mChipsetType;
    1063810673
     10674        // paravirt
     10675        data.paravirtProvider = mHWData->mParavirtProvider;
     10676
    1063910677        data.fEmulatedUSBCardReader = !!mHWData->mEmulatedUSBCardReaderEnabled;
    1064010678
  • trunk/src/VBox/Main/xml/Settings.cpp

    r50721 r50996  
    5555
    5656/*
    57  * Copyright (C) 2007-2013 Oracle Corporation
     57 * Copyright (C) 2007-2014 Oracle Corporation
    5858 *
    5959 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    19131913          keyboardHIDType(KeyboardHIDType_PS2Keyboard),
    19141914          chipsetType(ChipsetType_PIIX3),
     1915          paravirtProvider(ParavirtProvider_Legacy),
    19151916          fEmulatedUSBCardReader(false),
    19161917          clipboardMode(ClipboardMode_Disabled),
     
    19871988                  && (keyboardHIDType           == h.keyboardHIDType)
    19881989                  && (chipsetType               == h.chipsetType)
     1990                  && (paravirtProvider          == h.paravirtProvider)
    19891991                  && (fEmulatedUSBCardReader    == h.fEmulatedUSBCardReader)
    19901992                  && (vrdeSettings              == h.vrdeSettings)
     
    28122814                                          N_("Invalid value '%s' in Chipset/@type"),
    28132815                                          strChipsetType.c_str());
     2816            }
     2817        }
     2818        else if (pelmHwChild->nameEquals("Paravirt"))
     2819        {
     2820            Utf8Str strProvider;
     2821            if (pelmHwChild->getAttributeValue("provider", strProvider))
     2822            {
     2823                if (strProvider == "None")
     2824                    hw.paravirtProvider = ParavirtProvider_None;
     2825                else if (strProvider == "Default")
     2826                    hw.paravirtProvider = ParavirtProvider_Default;
     2827                else if (strProvider == "Legacy")
     2828                    hw.paravirtProvider = ParavirtProvider_Legacy;
     2829                else if (strProvider == "Minimal")
     2830                    hw.paravirtProvider = ParavirtProvider_Minimal;
     2831                else if (strProvider == "HyperV")
     2832                    hw.paravirtProvider = ParavirtProvider_HyperV;
     2833                else
     2834                    throw ConfigFileError(this,
     2835                                          pelmHwChild,
     2836                                          N_("Invalid value '%s' in Paravirt/@provider attribute"),
     2837                                          strProvider.c_str());
    28142838            }
    28152839        }
     
    41164140    }
    41174141
     4142    if (    (m->sv >= SettingsVersion_v1_15)
     4143        && !hw.areParavirtDefaultSettings()
     4144       )
     4145    {
     4146        const char *pcszParavirtProvider;
     4147        switch (hw.paravirtProvider)
     4148        {
     4149            case ParavirtProvider_None:         pcszParavirtProvider = "None";     break;
     4150            case ParavirtProvider_Default:      pcszParavirtProvider = "Default";  break;
     4151            case ParavirtProvider_Legacy:       pcszParavirtProvider = "Legacy";   break;
     4152            case ParavirtProvider_Minimal:      pcszParavirtProvider = "Minimal";  break;
     4153            case ParavirtProvider_HyperV:       pcszParavirtProvider = "HyperV";   break;
     4154            default:            Assert(false);  pcszParavirtProvider = "None";     break;
     4155        }
     4156
     4157        xml::ElementNode *pelmParavirt = pelmHardware->createChild("Paravirt");
     4158        pelmParavirt->setAttribute("provider", pcszParavirtProvider);
     4159    }
     4160
    41184161    xml::ElementNode *pelmBoot = pelmHardware->createChild("Boot");
    41194162    for (BootOrderMap::const_iterator it = hw.mapBootOrder.begin();
     
    53685411    {
    53695412        /*
    5370          * Check whether the hotpluggable flag of all storage devices differs
    5371          * from the default for old settings.
    5372          * AHCI ports are hotpluggable by default every other device is not.
     5413         * Check whether a paravirtualization provider other than "Legacy" is used, if so bump the version.
    53735414         */
    5374         for (StorageControllersList::const_iterator it = storageMachine.llStorageControllers.begin();
    5375              it != storageMachine.llStorageControllers.end();
    5376              ++it)
    5377         {
    5378             bool fSettingsBumped = false;
    5379             const StorageController &sctl = *it;
    5380 
    5381             for (AttachedDevicesList::const_iterator it2 = sctl.llAttachedDevices.begin();
    5382                  it2 != sctl.llAttachedDevices.end();
    5383                  ++it2)
    5384             {
    5385                 const AttachedDevice &att = *it2;
    5386 
    5387                 if (   (   att.fHotPluggable
    5388                         && sctl.controllerType != StorageControllerType_IntelAhci)
    5389                     || (   !att.fHotPluggable
    5390                         && sctl.controllerType == StorageControllerType_IntelAhci))
     5415        if (hardwareMachine.paravirtProvider != ParavirtProvider_Legacy)
     5416            m->sv = SettingsVersion_v1_15;
     5417        else
     5418        {
     5419            /*
     5420             * Check whether the hotpluggable flag of all storage devices differs
     5421             * from the default for old settings.
     5422             * AHCI ports are hotpluggable by default every other device is not.
     5423             */
     5424            for (StorageControllersList::const_iterator it = storageMachine.llStorageControllers.begin();
     5425                 it != storageMachine.llStorageControllers.end();
     5426                 ++it)
     5427            {
     5428                bool fSettingsBumped = false;
     5429                const StorageController &sctl = *it;
     5430
     5431                for (AttachedDevicesList::const_iterator it2 = sctl.llAttachedDevices.begin();
     5432                     it2 != sctl.llAttachedDevices.end();
     5433                     ++it2)
    53915434                {
    5392                     m->sv = SettingsVersion_v1_15;
    5393                     fSettingsBumped = true;
     5435                    const AttachedDevice &att = *it2;
     5436
     5437                    if (   (   att.fHotPluggable
     5438                            && sctl.controllerType != StorageControllerType_IntelAhci)
     5439                        || (   !att.fHotPluggable
     5440                            && sctl.controllerType == StorageControllerType_IntelAhci))
     5441                    {
     5442                        m->sv = SettingsVersion_v1_15;
     5443                        fSettingsBumped = true;
     5444                        break;
     5445                    }
     5446                }
     5447
     5448                /* Abort early if possible. */
     5449                if (fSettingsBumped)
    53945450                    break;
    5395                 }
    5396             }
    5397 
    5398             /* Abort early if possible. */
    5399             if (fSettingsBumped)
    5400                 break;
     5451            }
    54015452        }
    54025453    }
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