VirtualBox

Changeset 103085 in vbox


Ignore:
Timestamp:
Jan 26, 2024 4:17:43 PM (10 months ago)
Author:
vboxsync
Message:

Main,FE/VBoxManage,FE/VirtualBox,ValidationKit: Allow setting the primary VM execution engine to make it easier to force particular engine for testing, bugref:10583

Location:
trunk
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/en_US/man_VBoxManage-modifyvm.xml

    r101125 r103085  
    275275          <arg choice="plain">high</arg>
    276276        </group></arg>
     277      <arg>--vm-execution-engine=<group choice="plain">
     278          <arg choice="plain">default</arg>
     279          <arg choice="plain">hm</arg>
     280          <arg choice="plain">hwvirt</arg>
     281          <arg choice="plain">nem</arg>
     282          <arg choice="plain">native-api</arg>
     283          <arg choice="plain">interpreter</arg>
     284          <arg choice="plain">recompiler</arg>
     285        </group></arg>
    277286    </cmdsynopsis>
    278287
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r101418 r103085  
    242242    MODIFYVM_DEFAULTFRONTEND,
    243243    MODIFYVM_VMPROC_PRIORITY,
     244    MODIFYVM_VMEXEC_ENGINE,
    244245    MODIFYVM_TESTING_ENABLED,
    245246    MODIFYVM_TESTING_MMIO,
     
    477478    OPT2("--default-frontend",              "--defaultfrontend",        MODIFYVM_DEFAULTFRONTEND,           RTGETOPT_REQ_STRING),
    478479    OPT1("--vm-process-priority",                                       MODIFYVM_VMPROC_PRIORITY,           RTGETOPT_REQ_STRING),
     480    OPT1("--vm-execution-engine",                                       MODIFYVM_VMEXEC_ENGINE,             RTGETOPT_REQ_STRING),
    479481    OPT1("--testing-enabled",                                           MODIFYVM_TESTING_ENABLED,           RTGETOPT_REQ_BOOL_ONOFF),
    480482    OPT1("--testing-mmio",                                              MODIFYVM_TESTING_MMIO,              RTGETOPT_REQ_BOOL_ONOFF),
     
    674676}
    675677
     678static VMExecutionEngine_T nameToVMExecEngine(const char *pszName)
     679{
     680    if (!RTStrICmp(pszName, "default"))
     681        return VMExecutionEngine_Default;
     682    if (   !RTStrICmp(pszName, "hwvirt")
     683        || !RTStrICmp(pszName, "hm"))
     684        return VMExecutionEngine_HwVirt;
     685    if (   !RTStrICmp(pszName, "nem")
     686        || !RTStrICmp(pszName, "native-api"))
     687        return VMExecutionEngine_NativeApi;
     688    if (!RTStrICmp(pszName, "interpreter"))
     689        return VMExecutionEngine_Interpreter;
     690    if (   !RTStrICmp(pszName, "recompiler"))
     691        return VMExecutionEngine_Recompiler;
     692
     693    return VMExecutionEngine_NotSet;
     694}
     695
    676696/**
    677697 * Handles the x86-specific modifyvm options.
     
    36133633            }
    36143634
     3635            case MODIFYVM_VMEXEC_ENGINE:
     3636            {
     3637                VMExecutionEngine_T enmExecEngine = nameToVMExecEngine(ValueUnion.psz);
     3638                if (enmExecEngine == VMExecutionEngine_NotSet)
     3639                {
     3640                    errorArgument(ModifyVM::tr("Invalid --vm-execution-engine '%s'"), ValueUnion.psz);
     3641                    hrc = E_FAIL;
     3642                }
     3643                else
     3644                {
     3645                    CHECK_ERROR(sessionMachine, COMSETTER(VMExecutionEngine)(enmExecEngine));
     3646                }
     3647                break;
     3648            }
     3649
    36153650            case MODIFYVM_TESTING_ENABLED:
    36163651                hrc = setExtraData(sessionMachine, "VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled", ValueUnion.f ? "1" : "");
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp

    r102595 r103085  
    15101510    switch (enmEngine)
    15111511    {
    1512         case KVMExecutionEngine_Emulated:
    1513             strExecutionEngine = "IEM";         /* no translation */
     1512        case KVMExecutionEngine_Interpreter:
     1513            strExecutionEngine = "IEM (Interpreter)"; /* no translation */
     1514            break;
     1515        case KVMExecutionEngine_Recompiler:
     1516            strExecutionEngine = "IEM (Recompiler)"; /* no translation */
    15141517            break;
    15151518        case KVMExecutionEngine_HwVirt:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp

    r101563 r103085  
    743743         * vm_execution_engine_native_api_16px.png one... @bugref{9898} */
    744744        setStateIcon(KVMExecutionEngine_NotSet, UIIconPool::iconSet(":/vtx_amdv_disabled_16px.png"));
    745         setStateIcon(KVMExecutionEngine_Emulated, UIIconPool::iconSet(":/vtx_amdv_disabled_16px.png"));
     745        setStateIcon(KVMExecutionEngine_Interpreter, UIIconPool::iconSet(":/vtx_amdv_disabled_16px.png"));
     746        setStateIcon(KVMExecutionEngine_Recompiler, UIIconPool::iconSet(":/vtx_amdv_disabled_16px.png"));
    746747        setStateIcon(KVMExecutionEngine_HwVirt, UIIconPool::iconSet(":/vtx_amdv_16px.png"));
    747748        setStateIcon(KVMExecutionEngine_NativeApi, UIIconPool::iconSet(":/vm_execution_engine_native_api_16px.png"));
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.cpp

    r101316 r103085  
    366366    {
    367367        case KVMExecutionEngine_HwVirt:
    368             strExecutionEngine = "VT-x/AMD-V";  /* no translation */
     368            strExecutionEngine = "VT-x/AMD-V";        /* no translation */
    369369            break;
    370         case KVMExecutionEngine_Emulated:
    371             strExecutionEngine = "IEM";         /* no translation */
     370        case KVMExecutionEngine_Interpreter:
     371            strExecutionEngine = "IEM (Interpreter)"; /* no translation */
     372            break;
     373        case KVMExecutionEngine_Recompiler:
     374            strExecutionEngine = "IEM (Recompiler)";  /* no translation */
    372375            break;
    373376        case KVMExecutionEngine_NativeApi:
    374             strExecutionEngine = "native API";  /* no translation */
     377            strExecutionEngine = "native API";        /* no translation */
    375378            break;
    376379        default:
  • trunk/src/VBox/Main/Makefile.kmk

    r103028 r103085  
    543543        $(if $(VBOX_WITH_FULL_VM_ENCRYPTION),VBOX_WITH_FULL_VM_ENCRYPTION,) \
    544544        $(if-expr defined(VBOX_WITH_SDS),VBOX_WITH_SDS,) \
    545         $(if $(VBOX_WITH_VIRT_ARMV8),VBOX_WITH_VIRT_ARMV8,)
     545        $(if $(VBOX_WITH_VIRT_ARMV8),VBOX_WITH_VIRT_ARMV8,) \
     546        $(if $(VBOX_WITH_NATIVE_NEM),VBOX_WITH_NATIVE_NEM,) \
     547        $(if $(VBOX_WITH_IEM_NATIVE_RECOMPILER),VBOX_WITH_IEM_NATIVE_RECOMPILER,)
    546548 ifdef VBOX_WITH_USB
    547549  VBoxSVC_DEFS += \
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r102673 r103085  
    73357335  </interface>
    73367336
     7337  <enum
     7338    name="VMExecutionEngine"
     7339    uuid="69485f52-5cd3-40c9-946f-ae7d5c50798b"
     7340    >
     7341    <desc>
     7342      The main execution engine of a VM.
     7343    </desc>
     7344    <const name="NotSet"            value="0">
     7345      <desc>
     7346        Has not yet been set (try again later), for reading the actual used execution
     7347        engine from <link to="IMachineDebugger::executionEngine"/>.
     7348        This can not be set through <link to="IMachine::executionEngine"/>.
     7349      </desc>
     7350    </const>
     7351    <const name="Default"           value="1">
     7352      <desc>
     7353        Use the default/best available option for the host.
     7354        This will never be returned by <link to="IMachineDebugger::executionEngine"/>.
     7355      </desc>
     7356    </const>
     7357    <const name="HwVirt"            value="2">
     7358      <desc>Hardware assisted virtualization through HM. Only for x86-based hosts.</desc>
     7359    </const>
     7360    <const name="NativeApi"         value="3">
     7361      <desc>Hardware assisted virtualization thru native API (NEM).</desc>
     7362    </const>
     7363    <const name="Interpreter"    value="4">
     7364      <desc>CPU emulation using the interpreter.</desc>
     7365    </const>
     7366    <const name="Recompiler"     value="5">
     7367      <desc>CPU emulation using the recompiler.</desc>
     7368    </const>
     7369  </enum>
     7370
    73377371  <interface
    73387372    name="IMachine" extends="$unknown"
    7339     uuid="8161d51b-17b4-4598-add2-eb1fe1de6230"
     7373    uuid="e36a5081-a82a-40bd-9e4e-42a44d6ce50f"
    73407374    wsmap="managed"
    73417375    rest="managed"
     
    80468080    </attribute>
    80478081
     8082    <attribute name="VMExecutionEngine" type="VMExecutionEngine">
     8083      <desc>
     8084        The configured VM execution engine. It is a VM setting which can
     8085        be changed both before starting the VM and when a VM is saved.
     8086
     8087        The default value is 'Default', which selects the default
     8088        aka best available execution engine available on the host.
     8089      </desc>
     8090    </attribute>
     8091
    80488092    <attribute name="paravirtDebug" type="wstring">
    80498093      <desc>
     
    1313613180    name="ISystemProperties"
    1313713181    extends="$unknown"
    13138     uuid="bed5b0ec-e866-401b-ac32-fd63aa67954b"
     13182    uuid="c61e666e-34ab-403a-8160-78bd4512ca86"
    1313913183    wsmap="managed"
    1314013184    rest="managed"
     
    1362013664      <param name="profiles" type="ICPUProfile" safearray="yes" dir="return">
    1362113665        <desc>The matching CPU profiles.</desc>
     13666      </param>
     13667    </method>
     13668
     13669    <method name="getExecutionEnginesForVmCpuArchitecture">
     13670      <desc>Returns the possible <link to="VMExecutionEngine"/> enum values
     13671        for a given VM CPU architecture.</desc>
     13672
     13673      <param name="cpuArchitecture" type="CPUArchitecture" dir="in">
     13674        <desc>The CPU architecture type to get the values for.</desc>
     13675      </param>
     13676
     13677      <param name="executionEngine" type="VMExecutionEngine" safearray="yes" dir="return">
     13678        <desc>The enum values (sorted by what should be a sensible decreasing
     13679        importance of the type) which are valid.</desc>
    1362213680      </param>
    1362313681    </method>
     
    2259122649  /////////////////////////////////////////////////////////////////////////
    2259222650  -->
    22593 
    22594   <enum
    22595     name="VMExecutionEngine"
    22596     uuid="6e3f78f9-2dfe-4ed7-863d-67cad351e9d8"
    22597     >
    22598     <desc>
    22599       The main execution engine of a VM.
    22600     </desc>
    22601     <const name="NotSet"            value="0">
    22602       <desc>Has not yet been set (try again later).</desc>
    22603     </const>
    22604     <const name="Emulated"          value="1">
    22605       <desc>Emulated thru IEM.</desc>
    22606     </const>
    22607     <const name="HwVirt"            value="2">
    22608       <desc>Hardware assisted virtualization thru HM. Only for x86-based hosts.</desc>
    22609     </const>
    22610     <const name="NativeApi"         value="3">
    22611       <desc>Hardware assisted virtualization thru native API (NEM).</desc>
    22612     </const>
    22613   </enum>
    2261422651
    2261522652  <interface
  • trunk/src/VBox/Main/include/MachineImpl.h

    r101035 r103085  
    311311        uint32_t            mCpuIdPortabilityLevel;
    312312        Utf8Str             mCpuProfile;
     313        VMExecutionEngine_T mExecEngine;
    313314
    314315        BOOL                mCPUAttached[SchemaDefs::MaxCPUCount];
     
    10271028    HRESULT getVMProcessPriority(VMProcPriority_T *aVMProcessPriority);
    10281029    HRESULT setVMProcessPriority(VMProcPriority_T aVMProcessPriority);
     1030    HRESULT getVMExecutionEngine(VMExecutionEngine_T *aVMExecutionEngine);
     1031    HRESULT setVMExecutionEngine(VMExecutionEngine_T aVMExecutionEngine);
    10291032    HRESULT getStateKeyId(com::Utf8Str &aKeyId);
    10301033    HRESULT getStateKeyStore(com::Utf8Str &aKeyStore);
  • trunk/src/VBox/Main/include/SystemPropertiesImpl.h

    r101117 r103085  
    151151    HRESULT getCPUProfiles(CPUArchitecture_T aArchitecture, const com::Utf8Str &aNamePattern,
    152152                           std::vector<ComPtr<ICPUProfile> > &aProfiles) RT_OVERRIDE;
     153    HRESULT getExecutionEnginesForVmCpuArchitecture(CPUArchitecture_T aCpuArchitecture,
     154                                                    std::vector<VMExecutionEngine_T> &aExecutionEngines) RT_OVERRIDE;
    153155
    154156    HRESULT i_getUserHomeDirectory(Utf8Str &strPath);
  • trunk/src/VBox/Main/src-client/ConsoleImplConfigArmV8.cpp

    r102517 r103085  
    169169    hrc = pMachine->COMGETTER(CPUExecutionCap)(&ulCpuExecutionCap);                         H();
    170170
     171    VMExecutionEngine_T enmExecEngine = VMExecutionEngine_NotSet;
     172    hrc = pMachine->COMGETTER(VMExecutionEngine)(&enmExecEngine);                           H();
     173
     174    if (   enmExecEngine != VMExecutionEngine_Default
     175        && enmExecEngine != VMExecutionEngine_NativeApi)
     176    {
     177        return pVMM->pfnVMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS,
     178                                     N_("The ARM backend doesn't support any other execution engine than 'default' or 'native-api' right now."));
     179    }
     180
    171181    LogRel(("Guest architecture: ARM\n"));
    172182
  • trunk/src/VBox/Main/src-client/ConsoleImplConfigX86.cpp

    r101482 r103085  
    551551    hrc = pMachine->COMGETTER(CPUExecutionCap)(&ulCpuExecutionCap);                         H();
    552552
     553    VMExecutionEngine_T enmExecEngine = VMExecutionEngine_NotSet;
     554    hrc = pMachine->COMGETTER(VMExecutionEngine)(&enmExecEngine);                           H();
     555
    553556    LogRel(("Guest architecture: x86\n"));
    554557
     
    839842        }
    840843
     844        /*
     845         * Set VM execution engine.
     846         */
     847        /** @todo: r=aeichner Maybe provide a better VMM API for this instead of the different CFGM knobs. */
     848        LogRel(("Using execution engine %u\n", enmExecEngine));
     849        switch (enmExecEngine)
     850        {
     851            case VMExecutionEngine_HwVirt:
     852                InsertConfigInteger(pEM, "IemExecutesAll", 0);
     853                InsertConfigInteger(pEM, "IemRecompiled",  0);
     854                InsertConfigInteger(pHM, "UseNEMInstead",  0);
     855                InsertConfigInteger(pHM, "FallbackToNEM",  0);
     856                InsertConfigInteger(pHM, "FallbackToIEM",  0);
     857                break;
     858            case VMExecutionEngine_NativeApi:
     859                InsertConfigInteger(pEM, "IemExecutesAll", 0);
     860                InsertConfigInteger(pEM, "IemRecompiled",  0);
     861                InsertConfigInteger(pHM, "UseNEMInstead",  1);
     862                InsertConfigInteger(pHM, "FallbackToNEM",  1);
     863                InsertConfigInteger(pHM, "FallbackToIEM",  0);
     864                break;
     865            case VMExecutionEngine_Interpreter:
     866            case VMExecutionEngine_Recompiler:
     867                InsertConfigInteger(pEM, "IemExecutesAll", 1);
     868                InsertConfigInteger(pEM, "IemRecompiled",  enmExecEngine == VMExecutionEngine_Recompiler);
     869                InsertConfigInteger(pHM, "UseNEMInstead",  0);
     870                InsertConfigInteger(pHM, "FallbackToNEM",  0);
     871                InsertConfigInteger(pHM, "FallbackToIEM",  1);
     872                break;
     873            case VMExecutionEngine_Default:
     874                break; /* Nothing to do, let VMM decide. */
     875            default:
     876                AssertLogRelFailed();
     877        }
     878
    841879        /* HWVirtEx exclusive mode */
    842880        BOOL fHMExclusive = true;
     
    904942            InsertConfigInteger(pRoot, "PowerOffInsteadOfReset", 1);
    905943
    906         /* Use NEM rather than HM. */
    907         BOOL fUseNativeApi = false;
    908         hrc = platformX86->GetHWVirtExProperty(HWVirtExPropertyType_UseNativeApi, &fUseNativeApi); H();
    909         InsertConfigInteger(pHM, "UseNEMInstead", fUseNativeApi);
     944        /** @todo This is a bit redundant but in order to avoid forcing setting version bumps later on
     945         * and don't magically change behavior of old VMs we have to keep this for now. As soon as the user sets
     946         * the execution to anything else than Default the execution engine setting takes precedence.
     947         */
     948        if (enmExecEngine == VMExecutionEngine_Default)
     949        {
     950            /* Use NEM rather than HM. */
     951            BOOL fUseNativeApi = false;
     952            hrc = platformX86->GetHWVirtExProperty(HWVirtExPropertyType_UseNativeApi, &fUseNativeApi); H();
     953            InsertConfigInteger(pHM, "UseNEMInstead", fUseNativeApi);
     954        }
    910955
    911956        /* Enable workaround for missing TLB flush for OS/2 guests, see ticketref:20625. */
  • trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp

    r102092 r103085  
    435435            {
    436436                case VM_EXEC_ENGINE_NOT_SET:    *apenmEngine = VMExecutionEngine_NotSet; break;
    437                 case VM_EXEC_ENGINE_IEM:        *apenmEngine = VMExecutionEngine_Emulated; break;
    438437                case VM_EXEC_ENGINE_HW_VIRT:    *apenmEngine = VMExecutionEngine_HwVirt; break;
    439438                case VM_EXEC_ENGINE_NATIVE_API: *apenmEngine = VMExecutionEngine_NativeApi; break;
     439                case VM_EXEC_ENGINE_IEM:
     440                {
     441                    bool fForced = false;
     442                    vrc = ptrVM.vtable()->pfnEMR3QueryExecutionPolicy(ptrVM.rawUVM(), EMEXECPOLICY_IEM_RECOMPILED, &fForced);
     443                    if (RT_SUCCESS(vrc) && fForced)
     444                        *apenmEngine = VMExecutionEngine_Recompiler;
     445                    else
     446                        *apenmEngine = VMExecutionEngine_Interpreter;
     447                    break;
     448                }
    440449                default: AssertMsgFailed(("bEngine=%d\n", bEngine));
    441450            }
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r102455 r103085  
    67146714    if (SUCCEEDED(hrc))
    67156715        hrc = i_onVMProcessPriorityChange(aVMProcessPriority);
     6716    return hrc;
     6717}
     6718
     6719HRESULT Machine::getVMExecutionEngine(VMExecutionEngine_T *aVMExecutionEngine)
     6720{
     6721    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     6722
     6723    *aVMExecutionEngine = mUserData->s.enmExecEngine;
     6724
     6725    return S_OK;
     6726}
     6727
     6728HRESULT Machine::setVMExecutionEngine(VMExecutionEngine_T aVMExecutionEngine)
     6729{
     6730    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     6731    HRESULT hrc = i_checkStateDependency(MutableOrSavedStateDep);
     6732    if (SUCCEEDED(hrc))
     6733    {
     6734        hrc = mUserData.backupEx();
     6735        if (SUCCEEDED(hrc))
     6736        {
     6737            i_setModified(IsModified_MachineData);
     6738            mUserData->s.enmExecEngine = aVMExecutionEngine;
     6739        }
     6740    }
    67166741    return hrc;
    67176742}
  • trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp

    r102280 r103085  
    13701370}
    13711371
     1372HRESULT SystemProperties::getExecutionEnginesForVmCpuArchitecture(CPUArchitecture_T aCpuArchitecture,
     1373                                                                  std::vector<VMExecutionEngine_T> &aExecutionEngines)
     1374{
     1375    switch (aCpuArchitecture)
     1376    {
     1377        case CPUArchitecture_x86:
     1378        case CPUArchitecture_AMD64:
     1379        {
     1380            static const VMExecutionEngine_T aExecEngines[] =
     1381            {
     1382                VMExecutionEngine_Default,
     1383#ifdef RT_ARCH_AMD64
     1384                VMExecutionEngine_HwVirt,
     1385# ifdef VBOX_WITH_NATIVE_NEM
     1386                VMExecutionEngine_NativeApi,
     1387# endif
     1388#endif
     1389                VMExecutionEngine_Interpreter,
     1390#ifdef VBOX_WITH_IEM_NATIVE_RECOMPILER
     1391                VMExecutionEngine_Recompiler,
     1392#endif
     1393            };
     1394            aExecutionEngines.assign(aExecEngines,
     1395                                     aExecEngines + RT_ELEMENTS(aExecEngines));
     1396            break;
     1397        }
     1398
     1399        case CPUArchitecture_ARMv8_32:
     1400            aExecutionEngines.clear(); /* Currently not supported at all. */
     1401            break;
     1402
     1403        case CPUArchitecture_ARMv8_64:
     1404        {
     1405#ifdef VBOX_WITH_VIRT_ARMV8
     1406            static const VMExecutionEngine_T aExecEngines[] =
     1407            {
     1408                VMExecutionEngine_Default,
     1409# ifdef VBOX_WITH_NATIVE_NEM
     1410                VMExecutionEngine_NativeApi,
     1411# endif
     1412            };
     1413            aExecutionEngines.assign(aExecEngines,
     1414                                     aExecEngines + RT_ELEMENTS(aExecEngines));
     1415#else
     1416            aExecutionEngines.clear();
     1417#endif
     1418            break;
     1419        }
     1420
     1421        default:
     1422            AssertFailedStmt(aExecutionEngines.clear());
     1423            break;
     1424    }
     1425
     1426    return S_OK;
     1427}
     1428
    13721429
    13731430// public methods only for internal purposes
  • trunk/src/VBox/Main/xml/Settings.cpp

    r102455 r103085  
    44094409    fTeleporterEnabled(false),
    44104410    uTeleporterPort(0),
    4411     enmVMPriority(VMProcPriority_Default)
     4411    enmVMPriority(VMProcPriority_Default),
     4412    enmExecEngine(VMExecutionEngine_Default)
    44124413{
    44134414    llGroups.push_back("/");
     
    44344435            && strTeleporterPassword      == c.strTeleporterPassword
    44354436            && ovIcon                     == c.ovIcon
    4436             && enmVMPriority              == c.enmVMPriority);
     4437            && enmVMPriority              == c.enmVMPriority
     4438            && enmExecEngine              == c.enmExecEngine);
    44374439}
    44384440
     
    70197021        }
    70207022
     7023        {
     7024            Utf8Str strExecEngine;
     7025            if (elmMachine.getAttributeValue("executionEngine", strExecEngine))
     7026            {
     7027                if (strExecEngine == "HwVirt")
     7028                    machineUserData.enmExecEngine = VMExecutionEngine_HwVirt;
     7029                else if (strExecEngine == "NativeApi")
     7030                    machineUserData.enmExecEngine = VMExecutionEngine_NativeApi;
     7031                else if (strExecEngine == "Interpreter")
     7032                    machineUserData.enmExecEngine = VMExecutionEngine_Interpreter;
     7033                else if (strExecEngine == "Recompiler")
     7034                    machineUserData.enmExecEngine = VMExecutionEngine_Recompiler;
     7035                else
     7036                    machineUserData.enmExecEngine = VMExecutionEngine_Default;
     7037            }
     7038        }
     7039
    70217040        str.setNull();
    70227041        elmMachine.getAttributeValue("icon", str);
     
    92069225            break;
    92079226    }
     9227
     9228    switch (machineUserData.enmExecEngine)
     9229    {
     9230        case VMExecutionEngine_HwVirt:
     9231            elmMachine.setAttribute("executionEngine", "HwVirt");
     9232            break;
     9233        case VMExecutionEngine_NativeApi:
     9234            elmMachine.setAttribute("executionEngine", "NativeApi");
     9235            break;
     9236        case VMExecutionEngine_Interpreter:
     9237            elmMachine.setAttribute("executionEngine", "Interpreter");
     9238            break;
     9239        case VMExecutionEngine_Recompiler:
     9240            elmMachine.setAttribute("executionEngine", "Recompiler");
     9241            break;
     9242        case VMExecutionEngine_Default:
     9243        default:
     9244            break;
     9245    }
     9246
    92089247    // Please keep the icon last so that one doesn't have to check if there
    92099248    // is anything in the line after this very long attribute in the XML.
     
    94859524        if (   (   hardwareMachine.platformSettings.architectureType != PlatformArchitecture_None
    94869525                && hardwareMachine.platformSettings.architectureType != PlatformArchitecture_x86)
    9487             || hardwareMachine.graphicsAdapter.graphicsControllerType == GraphicsControllerType_QemuRamFB)
     9526            || hardwareMachine.graphicsAdapter.graphicsControllerType == GraphicsControllerType_QemuRamFB
     9527            || machineUserData.enmExecEngine != VMExecutionEngine_Default)
    94889528        {
    94899529            /* Note: The new chipset type ARMv8Virtual implies setting the platform architecture type to ARM. */
  • trunk/src/VBox/Main/xml/VirtualBox-settings.xsd

    r101200 r103085  
    156156    <xsd:enumeration value="Normal"/>
    157157    <xsd:enumeration value="High"/>
     158  </xsd:restriction>
     159</xsd:simpleType>
     160
     161<xsd:simpleType name="TVMExecEngine">
     162  <xsd:restriction base="xsd:string">
     163    <xsd:enumeration value="Default"/>
     164    <xsd:enumeration value="HwVirt"/>
     165    <xsd:enumeration value="NativeApi"/>
     166    <xsd:enumeration value="Interpreter"/>
     167    <xsd:enumeration value="Recompiler"/>
    158168  </xsd:restriction>
    159169</xsd:simpleType>
     
    15891599  <xsd:attribute name="version" type="xsd:string" default="1.15"/> <!-- Used for OVF files only, must not be present in normal settings files. The default corresponds to settings created by 5.0, which covers many older versions but not newer ones. -->
    15901600  <xsd:attribute name="VMProcessPriority" type="TVMProcPriority"/>
     1601  <xsd:attribute name="executionEngine" type="TVMExecEngine"/> <!-- new since v1.20. -->
    15911602</xsd:complexType>
    15921603
  • trunk/src/VBox/ValidationKit/testdriver/vboxtestvms.py

    r103078 r103085  
    5757
    5858# All virtualization modes.
    59 g_asVirtModes      = ['hwvirt', 'hwvirt-np', 'raw',];
    60 # All virtualization modes except for raw-mode.
    61 g_asVirtModesNoRaw = ['hwvirt', 'hwvirt-np',];
     59g_asVirtModes      = ['hwvirt', 'hwvirt-np', 'raw', 'native-api', 'interpreter', 'recompiler'];
    6260# Dictionary mapping the virtualization mode mnemonics to a little less cryptic
    6361# strings used in test descriptions.
    6462g_dsVirtModeDescs  = {
    65     'raw'       : 'Raw-mode',
    66     'hwvirt'    : 'HwVirt',
    67     'hwvirt-np' : 'NestedPaging'
     63    'raw'         : 'Raw-mode',
     64    'hwvirt'      : 'HwVirt',
     65    'hwvirt-np'   : 'NestedPaging',
     66    'native-api'  : 'NativeApi',
     67    'interpreter' : 'Interpreter',
     68    'recompiler'  : 'Recompiler'
    6869};
    6970
     
    552553                    oSession = oTestDrv.openSession(oVM);
    553554                    if oSession is not None:
    554                         fRc =         oSession.enableVirtExX86(sVirtMode != 'raw');
     555                        if oSession.fpApiVer >= 7.1:
     556                            adVmExecEngines = {
     557                                'hwvirt'                   : vboxcon.VMExecutionEngine_HwVirt,
     558                                'hwvirt-np'                : vboxcon.VMExecutionEngine_HwVirt,
     559                                'native-api'               : vboxcon.VMExecutionEngine_NativeApi,
     560                                'interpreter'              : vboxcon.VMExecutionEngine_Interpreter,
     561                                'recompiler'               : vboxcon.VMExecutionEngine_Recompiler,
     562                            };
     563                            fRc = oSession.setExecutionEngine(adVmExecEngines[sVirtMode]);
     564                        else:
     565                            fRc = oSession.enableVirtExX86(sVirtMode != 'raw');
     566
    555567                        fRc = fRc and oSession.enableNestedPagingX86(sVirtMode == 'hwvirt-np');
    556568                        fRc = fRc and oSession.setCpuCount(cCpus);
     
    12721284                    oSession = oTestDrv.openSession(oVM);
    12731285                    if oSession is not None:
    1274                         fRc =         oSession.enableVirtExX86(sVirtMode != 'raw');
     1286                        if oSession.fpApiVer >= 7.1:
     1287                            adVmExecEngines = {
     1288                                'hwvirt'                   : vboxcon.VMExecutionEngine_HwVirt,
     1289                                'hwvirt-np'                : vboxcon.VMExecutionEngine_HwVirt,
     1290                                'native-api'               : vboxcon.VMExecutionEngine_NativeApi,
     1291                                'interpreter'              : vboxcon.VMExecutionEngine_Interpreter,
     1292                                'recompiler'               : vboxcon.VMExecutionEngine_Recompiler,
     1293                            };
     1294                            fRc = oSession.setExecutionEngine(adVmExecEngines[sVirtMode]);
     1295                        else:
     1296                            fRc = oSession.enableVirtExX86(sVirtMode != 'raw');
     1297
    12751298                        fRc = fRc and oSession.enableNestedPagingX86(sVirtMode == 'hwvirt-np');
    12761299                        fRc = fRc and oSession.setCpuCount(cCpus);
     
    18541877        return True;
    18551878
    1856     def _removeUnsupportedVirtModes(self, oTestDrv):
    1857         """
    1858         Removes unsupported virtualization modes.
    1859         """
    1860         if 'hwvirt' in self.asVirtModes and not oTestDrv.hasHostHwVirt():
    1861             reporter.log('Hardware assisted virtualization is not available on the host, skipping it.');
    1862             self.asVirtModes.remove('hwvirt');
    1863 
    1864         if 'hwvirt-np' in self.asVirtModes and not oTestDrv.hasHostNestedPaging():
    1865             reporter.log('Nested paging not supported by the host, skipping it.');
    1866             self.asVirtModes.remove('hwvirt-np');
    1867 
    1868         if 'raw' in self.asVirtModes and not oTestDrv.hasRawModeSupport():
    1869             reporter.log('Raw-mode virtualization is not available in this build (or perhaps for this host), skipping it.');
    1870             self.asVirtModes.remove('raw');
    1871 
    1872         return True;
     1879    def _removeUnsupportedVirtModes(self, oTestDrv, oVm, asVirtModesWanted):
     1880        """
     1881        Removes unsupported virtualization modes for the given VM.
     1882        """
     1883        if oTestDrv.fpApiVer >= 7.1:
     1884            enmCpuArch = None;
     1885            if oVm.sPlatformArchitecture == 'x86':
     1886                if oVm.is64bitRequired():
     1887                    enmCpuArch = vboxcon.CPUArchitecture_AMD64;
     1888                else:
     1889                    enmCpuArch = vboxcon.CPUArchitecture_x86;
     1890            elif oVm.sPlatformArchitecture == 'ARM':
     1891                if oVm.is64bitRequired():
     1892                    enmCpuArch = vboxcon.CPUArchitecture_ARMv8_64;
     1893                else:
     1894                    enmCpuArch = vboxcon.CPUArchitecture_ARMv8_32;
     1895
     1896            try:
     1897                aenmExecEngines = oTestDrv.oVBox.systemProperties.getExecutionEnginesForVmCpuArchitecture(enmCpuArch);
     1898
     1899                if 'raw' in asVirtModesWanted and not oTestDrv.hasRawModeSupport():
     1900                    reporter.log('Raw-mode virtualization is not available in this build (or perhaps for this host), skipping it.');
     1901                    asVirtModesWanted.remove('raw');
     1902
     1903                if 'hwvirt' in asVirtModesWanted and not vboxcon.VMExecutionEngine_HwVirt in aenmExecEngines:
     1904                    reporter.log('Hardware assisted virtualization is not available on the host, skipping it.');
     1905                    asVirtModesWanted.remove('hwvirt');
     1906
     1907                if 'hwvirt-np' in asVirtModesWanted and (   not vboxcon.VMExecutionEngine_HwVirt in aenmExecEngines \
     1908                                                         or not oTestDrv.hasHostNestedPaging()):
     1909                    reporter.log('Nested paging not supported by the host, skipping it.');
     1910                    asVirtModesWanted.remove('hwvirt-np');
     1911
     1912                if 'native-api' in asVirtModesWanted and not vboxcon.VMExecutionEngine_NativeApi in aenmExecEngines:
     1913                    reporter.log('Native API (aka NEM) virtualization is not available in this build (or perhaps for this host) and VM CPU architecture, skipping it.');
     1914                    asVirtModesWanted.remove('native-api');
     1915
     1916                if 'interpreter' in asVirtModesWanted and not vboxcon.VMExecutionEngine_Interpreter in aenmExecEngines:
     1917                    reporter.log('IEM interpreter is not available in this build (or perhaps for this host) and VM CPU architecture, skipping it.');
     1918                    asVirtModesWanted.remove('iem-interpreted');
     1919
     1920                if 'recompiler' in asVirtModesWanted and not vboxcon.VMExecutionEngine_Recompiler in aenmExecEngines:
     1921                    reporter.log('IEM recompiler is not available in this build (or perhaps for this host) and VM CPU architecture, skipping it.');
     1922                    asVirtModesWanted.remove('iem-recompiled');
     1923            except:
     1924                reporter.errorXcpt('failed to query supported execution engines for "%s"' % (oVm.sVmName, ));
     1925                asVirtModesWanted = [];
     1926        else:
     1927            asVirtModesWanted.remove('native-api');
     1928            asVirtModesWanted.remove('interpreter');
     1929            asVirtModesWanted.remove('recompiler');
     1930
     1931            if 'hwvirt' in asVirtModesWanted and not oTestDrv.hasHostHwVirt():
     1932                reporter.log('Hardware assisted virtualization is not available on the host, skipping it.');
     1933                asVirtModesWanted.remove('hwvirt');
     1934
     1935            if 'hwvirt-np' in asVirtModesWanted and not oTestDrv.hasHostNestedPaging():
     1936                reporter.log('Nested paging not supported by the host, skipping it.');
     1937                asVirtModesWanted.remove('hwvirt-np');
     1938
     1939            if 'raw' in asVirtModesWanted and not oTestDrv.hasRawModeSupport():
     1940                reporter.log('Raw-mode virtualization is not available in this build (or perhaps for this host), skipping it.');
     1941                asVirtModesWanted.remove('raw');
     1942
     1943        return asVirtModesWanted;
    18731944
    18741945    def actionExecute(self, oTestDrv, fnCallback): # pylint: disable=too-many-locals
     
    18841955        """
    18851956
    1886         self._removeUnsupportedVirtModes(oTestDrv);
    18871957        cMaxCpus = oTestDrv.getHostCpuCount();
    18881958
     
    19021972            # Intersect the supported modes and the ones being testing.
    19031973            asVirtModesSup = [sMode for sMode in oTestVm.asVirtModesSup if sMode in self.asVirtModes];
     1974
     1975            # Filter out what the host doesn't support.
     1976            asVirtModesSup = self._removeUnsupportedVirtModes(oTestDrv, oTestVm, asVirtModesSup);
    19041977
    19051978            # Ditto for CPUs.
  • trunk/src/VBox/ValidationKit/testdriver/vboxwrappers.py

    r101067 r103085  
    27862786        return fRc;
    27872787
     2788    def setExecutionEngine(self, iVmExecEngine):
     2789        """
     2790        Sets a VM execution engine.
     2791        Returns the True on success, False on failure (logged).
     2792        """
     2793        try:
     2794            self.o.machine.VMExecutionEngine = iVmExecEngine;
     2795        except:
     2796            reporter.errorXcpt('Unable to set VM execution engine "%s"' % (iVmExecEngine,))
     2797            return False;
     2798        return True;
     2799
    27882800    #
    27892801    # IConsole wrappers.
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