Changeset 106384 in vbox
- Timestamp:
- Oct 16, 2024 1:58:41 PM (7 months ago)
- svn:sync-xref-src-repo-rev:
- 165197
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/settings.h
r106061 r106384 1229 1229 1230 1230 bool operator==(const PlatformARM&) const; 1231 1232 /** Nested hardware virtualization. */ 1233 bool fNestedHWVirt; //< requires settings version 1.20 (VirtualBox 7.1) 1231 1234 }; 1232 1235 #endif /* VBOX_WITH_VIRT_ARMV8 */ … … 1578 1581 void readPlatformCPUIDTreeX86(const xml::ElementNode &elmChild, PlatformX86 &platX86); 1579 1582 void readPlatformX86(const xml::ElementNode &elmPlatformX86OrHardware, PlatformX86 &platX86); 1583 #ifdef VBOX_WITH_VIRT_ARMV8 1584 void readPlatformARM(const xml::ElementNode &elmPlatformARM, PlatformARM &platARM); 1585 #endif 1580 1586 void readPlatform(const xml::ElementNode &elmPlatformOrHardware, Hardware &hw, Platform &plat); 1581 1587 void readHardware(const xml::ElementNode &elmHardware, Hardware &hw); … … 1601 1607 1602 1608 void buildPlatformX86XML(xml::ElementNode &elmParent, xml::ElementNode &elmCPU, const PlatformX86 &plat); 1609 #ifdef VBOX_WITH_VIRT_ARMV8 1610 void buildPlatformARMXML(xml::ElementNode &elmParent, const PlatformARM &plat); 1611 #endif 1603 1612 void buildPlatformXML(xml::ElementNode &elmParent, const Hardware &h, const Platform &plat); 1604 1613 void buildHardwareXML(xml::ElementNode &elmParent, const Hardware &hw, uint32_t fl, std::list<xml::ElementNode*> *pllElementsWithUuidAttributes); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r106061 r106384 250 250 MODIFYVM_GUEST_DEBUG_ADDRESS, 251 251 MODIFYVM_GUEST_DEBUG_PORT, 252 253 /* 254 * Stuff common between x86 and ARM. 255 */ 256 MODIFYVM_NESTED_HW_VIRT, 257 252 258 /* 253 259 * x86-specific stuff. … … 267 273 MODIFYVM_X86_MDS_CLEAR_ON_SCHED, 268 274 MODIFYVM_X86_MDS_CLEAR_ON_VM_ENTRY, 269 MODIFYVM_X86_NESTED_HW_VIRT,270 275 MODIFYVM_X86_NESTEDPAGING, 271 276 MODIFYVM_X86_PAE, … … 516 521 OPT1("--x86-mds-clear-on-vm-entry", MODIFYVM_X86_MDS_CLEAR_ON_VM_ENTRY, RTGETOPT_REQ_BOOL_ONOFF), 517 522 OPT1("--mds-clear-on-vm-entry", MODIFYVM_X86_MDS_CLEAR_ON_VM_ENTRY, RTGETOPT_REQ_BOOL_ONOFF), 518 OPT1("--x86-nested-hw-virt", MODIFYVM_ X86_NESTED_HW_VIRT,RTGETOPT_REQ_BOOL_ONOFF),519 OPT1("--nested-hw-virt", MODIFYVM_ X86_NESTED_HW_VIRT,RTGETOPT_REQ_BOOL_ONOFF),523 OPT1("--x86-nested-hw-virt", MODIFYVM_NESTED_HW_VIRT, RTGETOPT_REQ_BOOL_ONOFF), 524 OPT1("--nested-hw-virt", MODIFYVM_NESTED_HW_VIRT, RTGETOPT_REQ_BOOL_ONOFF), 520 525 OPT1("--x86-nested-paging", MODIFYVM_X86_NESTEDPAGING, RTGETOPT_REQ_BOOL_ONOFF), 521 526 OPT2("--nested-paging", "--nestedpaging", MODIFYVM_X86_NESTEDPAGING, RTGETOPT_REQ_BOOL_ONOFF), … … 792 797 break; 793 798 794 case MODIFYVM_ X86_NESTED_HW_VIRT:799 case MODIFYVM_NESTED_HW_VIRT: 795 800 CHECK_ERROR(platformX86, SetCPUProperty(CPUPropertyTypeX86_HWVirt, pValueUnion->f)); 796 801 break; … … 825 830 } 826 831 832 /** 833 * Handles the x86-specific modifyvm options. 834 * 835 * @returns HRESULT 836 * @retval E_INVALIDARG if handed-in option was not being handled. 837 * @param pGetOptState Pointer to GetOpt state to use. 838 * @param c Current GetOpt value (short form). 839 * @param pValueUnion Pointer to current value union. 840 * @param sessionMachine Session machine to use. 841 * @param platformARM ARM-specific platform object to use. 842 */ 843 static HRESULT handleModifyVM_ARM(PRTGETOPTSTATE pGetOptState, int c, PRTGETOPTUNION pValueUnion, 844 ComPtr<IMachine> &sessionMachine, ComPtr<IPlatformARM> &platformARM) 845 { 846 RT_NOREF(pGetOptState, sessionMachine); 847 848 HRESULT hrc = S_OK; 849 850 switch (c) 851 { 852 case MODIFYVM_NESTED_HW_VIRT: 853 CHECK_ERROR(platformARM, SetCPUProperty(CPUPropertyTypeARM_HWVirt, pValueUnion->f)); 854 break; 855 856 default: 857 hrc = E_INVALIDARG; 858 break; 859 } 860 861 return hrc; 862 } 863 827 864 RTEXITCODE handleModifyVM(HandlerArg *a) 828 865 { … … 857 894 ComPtr<IPlatform> platform; 858 895 CHECK_ERROR_RET(sessionMachine, COMGETTER(Platform)(platform.asOutParam()), RTEXITCODE_FAILURE); 859 860 /* For the x86-based options we need the x86-specific platform object. */861 ComPtr<IPlatformX86> platformX86;862 platform->COMGETTER(X86)(platformX86.asOutParam());863 896 864 897 ComPtr<IGraphicsAdapter> pGraphicsAdapter; … … 3739 3772 default: 3740 3773 { 3741 hrc = handleModifyVM_x86(&GetOptState, c, &ValueUnion, sessionMachine, platformX86); 3774 PlatformArchitecture_T enmArch; 3775 CHECK_ERROR_RET(platform, COMGETTER(Architecture)(&enmArch), RTEXITCODE_FAILURE); 3776 3777 if (enmArch == PlatformArchitecture_x86) 3778 { 3779 /* For the x86-based options we need the x86-specific platform object. */ 3780 ComPtr<IPlatformX86> platformX86; 3781 CHECK_ERROR_RET(platform, COMGETTER(X86)(platformX86.asOutParam()), RTEXITCODE_FAILURE); 3782 3783 hrc = handleModifyVM_x86(&GetOptState, c, &ValueUnion, sessionMachine, platformX86); 3784 } 3785 else if (enmArch == PlatformArchitecture_ARM) 3786 { 3787 /* For the ARM-based options we need the x86-specific platform object. */ 3788 ComPtr<IPlatformARM> platformARM; 3789 CHECK_ERROR_RET(platform, COMGETTER(ARM)(platformARM.asOutParam()), RTEXITCODE_FAILURE); 3790 3791 hrc = handleModifyVM_ARM(&GetOptState, c, &ValueUnion, sessionMachine, platformARM); 3792 } 3793 else 3794 { 3795 errorArgument(ModifyVM::tr("Invalid platform architecture returned for VM")); 3796 hrc = E_FAIL; 3797 } 3798 3742 3799 if (FAILED(hrc)) 3743 3800 errorGetOpt(c, &ValueUnion); -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r106218 r106384 1221 1221 setting may slow down workloads causing many VM exits, so it is only 1222 1222 recommended for situation where there is a real need to be paranoid. 1223 </desc> 1224 </const> 1225 </enum> 1226 1227 <enum 1228 name="CPUPropertyTypeARM" 1229 uuid="c84685f6-6bd3-4071-97c6-86f34595648f" 1230 > 1231 <desc> 1232 Virtual CPU property type for ARM-based CPUs. This enumeration represents possible values of the 1233 IPlatformARM get- and setCPUProperty methods. 1234 </desc> 1235 <const name="Null" value="0"> 1236 <desc>Null value (never used by the API).</desc> 1237 </const> 1238 <const name="HWVirt" value="1"> 1239 <desc> 1240 Enables the hardware virtualization feature on the guest CPU. 1241 This requires the nested virtualization feature on the host CPU. 1223 1242 </desc> 1224 1243 </const> … … 7392 7411 <interface 7393 7412 name="IPlatformARM" extends="$unknown" 7394 uuid=" 75dff9be-6cb3-4857-bde6-2faf82ed9a8d"7413 uuid="002c75fe-3316-4920-aece-7d21ce6f624b" 7395 7414 wsmap="managed" 7396 7415 rest="managed" … … 7403 7422 </desc> 7404 7423 7405 <!-- Currently empty, but that should change before long... --> 7406 <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/> 7424 <method name="getCPUProperty" const="yes"> 7425 <rest request="get" path="/vms/{vmid}/configuration/"/> 7426 <desc> 7427 Returns the virtual CPU boolean value of the specified property. 7428 7429 <result name="E_INVALIDARG"> 7430 Invalid property. 7431 </result> 7432 7433 </desc> 7434 <param name="property" type="CPUPropertyTypeARM" dir="in"> 7435 <desc> 7436 Property type to query. 7437 </desc> 7438 </param> 7439 <param name="value" type="boolean" dir="return"> 7440 <desc> 7441 Property value. 7442 </desc> 7443 </param> 7444 </method> 7445 7446 <method name="setCPUProperty"> 7447 <rest request="post" path="/vms/{vmid}/configuration/"/> 7448 <desc> 7449 Sets the virtual CPU boolean value of the specified property. 7450 7451 <result name="E_INVALIDARG"> 7452 Invalid property. 7453 </result> 7454 7455 </desc> 7456 <param name="property" type="CPUPropertyTypeARM" dir="in"> 7457 <desc> 7458 Property type to query. 7459 </desc> 7460 </param> 7461 <param name="value" type="boolean" dir="in"> 7462 <desc> 7463 Property value. 7464 </desc> 7465 </param> 7466 </method> 7407 7467 7408 7468 </interface> -
trunk/src/VBox/Main/include/PlatformARMImpl.h
r106061 r106384 68 68 HRESULT i_saveSettings(settings::PlatformARM &data); 69 69 HRESULT i_applyDefaults(GuestOSType *aOsType); 70 71 private: 72 73 // wrapped IPlatformARM methods 74 HRESULT getCPUProperty(CPUPropertyTypeARM_T aProperty, BOOL *aValue); 75 HRESULT setCPUProperty(CPUPropertyTypeARM_T aProperty, BOOL aValue); 70 76 }; 71 77 #endif /* !MAIN_INCLUDED_PlatformARMImpl_h */ -
trunk/src/VBox/Main/src-all/PlatformPropertiesImpl.cpp
r106139 r106384 1277 1277 static const TpmType_T aTpmTypes[] = 1278 1278 { 1279 TpmType_None 1279 TpmType_None, 1280 TpmType_v2_0 1280 1281 }; 1281 1282 aSupportedTpmTypes.assign(aTpmTypes, -
trunk/src/VBox/Main/src-client/ConsoleImplConfigArmV8.cpp
r106361 r106384 153 153 #endif 154 154 155 /* Get the ARM platform object. */ 156 ComPtr<IPlatformARM> platformARM; 157 hrc = platform->COMGETTER(ARM)(platformARM.asOutParam()); H(); 158 155 159 ComPtr<IPlatformProperties> pPlatformProperties; 156 160 hrc = platform->COMGETTER(Properties)(pPlatformProperties.asOutParam()); H(); … … 364 368 PCFGMNODE pCpum; 365 369 InsertConfigNode(pRoot, "CPUM", &pCpum); 370 371 /* Nested Virtualization. */ 372 BOOL fNestedHWVirt = FALSE; 373 hrc = platformARM->GetCPUProperty(CPUPropertyTypeARM_HWVirt, &fNestedHWVirt); H(); 374 InsertConfigInteger(pCpum, "NestedHWVirt", fNestedHWVirt ? true : false); 366 375 367 376 -
trunk/src/VBox/Main/src-server/PlatformARMImpl.cpp
r106061 r106384 31 31 #include "PlatformImpl.h" 32 32 #include "LoggingNew.h" 33 34 #include "AutoStateDep.h" 33 35 34 36 #include <VBox/settings.h> … … 239 241 HRESULT PlatformARM::i_loadSettings(const settings::PlatformARM &data) 240 242 { 241 RT_NOREF(data); 242 243 /* Nothing here yet. */ 243 AutoCaller autoCaller(this); 244 AssertComRCReturnRC(autoCaller.hrc()); 245 246 AutoReadLock mlock(mMachine COMMA_LOCKVAL_SRC_POS); 247 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 248 249 // simply copy 250 m->bd.assignCopy(&data); 244 251 return S_OK; 245 252 } … … 255 262 HRESULT PlatformARM::i_saveSettings(settings::PlatformARM &data) 256 263 { 257 RT_NOREF(data); 264 AutoCaller autoCaller(this); 265 AssertComRCReturnRC(autoCaller.hrc()); 266 267 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 268 269 data = *m->bd.data(); 270 271 return S_OK; 272 } 273 274 HRESULT PlatformARM::i_applyDefaults(GuestOSType *aOsType) 275 { 276 RT_NOREF(aOsType); 258 277 259 278 /* Nothing here yet. */ … … 261 280 } 262 281 263 HRESULT PlatformARM::i_applyDefaults(GuestOSType *aOsType) 264 { 265 RT_NOREF(aOsType); 266 267 /* Nothing here yet. */ 268 return S_OK; 269 } 282 HRESULT PlatformARM::getCPUProperty(CPUPropertyTypeARM_T aProperty, BOOL *aValue) 283 { 284 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 285 286 switch (aProperty) 287 { 288 case CPUPropertyTypeARM_HWVirt: 289 *aValue = m->bd->fNestedHWVirt; 290 break; 291 292 default: 293 return E_INVALIDARG; 294 } 295 return S_OK; 296 } 297 298 HRESULT PlatformARM::setCPUProperty(CPUPropertyTypeARM_T aProperty, BOOL aValue) 299 { 300 /* sanity */ 301 AutoCaller autoCaller(this); 302 AssertComRCReturnRC(autoCaller.hrc()); 303 304 /* the machine needs to be mutable */ 305 AutoMutableStateDependency adep(mMachine); 306 if (FAILED(adep.hrc())) return adep.hrc(); 307 308 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 309 310 switch (aProperty) 311 { 312 case CPUPropertyTypeARM_HWVirt: 313 { 314 m->bd.backup(); 315 m->bd->fNestedHWVirt = !!aValue; 316 break; 317 } 318 319 default: 320 return E_INVALIDARG; 321 } 322 323 alock.release(); 324 325 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); 326 mMachine->i_setModified(Machine::IsModified_Platform); 327 328 return S_OK; 329 } -
trunk/src/VBox/Main/xml/Settings.cpp
r106061 r106384 3969 3969 3970 3970 #ifdef VBOX_WITH_VIRT_ARMV8 3971 PlatformARM::PlatformARM() 3971 PlatformARM::PlatformARM() : 3972 fNestedHWVirt(false) 3972 3973 { 3973 3974 } … … 3975 3976 bool PlatformARM::operator==(const PlatformARM& h) const 3976 3977 { 3977 RT_NOREF(h);3978 return true;3978 return (this == &h) 3979 || (fNestedHWVirt == h.fNestedHWVirt); 3979 3980 } 3980 3981 #endif /* VBOX_WITH_VIRT_ARMV8 */ … … 5306 5307 } 5307 5308 5309 #ifdef VBOX_WITH_VIRT_ARMV8 5310 /** 5311 * Reads the ARM platform settings. 5312 * 5313 * For settings >= v1.20 these were stored under the "Platform/arm" node. 5314 * 5315 * @param elmPlatformARM Platform/arm node to read from. 5316 * @param platARM Where to store the ARM platform settings. 5317 */ 5318 void MachineConfigFile::readPlatformARM(const xml::ElementNode &elmPlatformARM, 5319 PlatformARM &platARM) 5320 { 5321 xml::NodesLoop nl1(elmPlatformARM); 5322 5323 const xml::ElementNode *pelChild; 5324 while ((pelChild = nl1.forAllNodes())) 5325 { 5326 if (pelChild->nameEquals("CPU")) 5327 { 5328 const xml::ElementNode *pelmCPUChild; 5329 if ((pelmCPUChild = pelChild->findChildElement("NestedHWVirt"))) 5330 pelmCPUChild->getAttributeValue("enabled", platARM.fNestedHWVirt); 5331 } 5332 } 5333 } 5334 #endif 5335 5308 5336 /** 5309 5337 * Reads the platform settings. … … 5443 5471 case PlatformArchitecture_ARM: 5444 5472 { 5445 /* Nothing here yet -- add ARM-specific stuff as soon as we have it. */ 5473 const xml::ElementNode *pelmPlatformARM; 5474 5475 pelmPlatformARM = elmPlatformOrHardware.findChildElement("arm"); 5476 if (pelmPlatformARM) 5477 readPlatformARM(*pelmPlatformARM, plat.arm); 5446 5478 break; 5447 5479 } … … 7350 7382 } 7351 7383 7384 #ifdef VBOX_WITH_VIRT_ARMV8 7385 /** 7386 * Writes ARM-specific platform settings out to the XML. 7387 * 7388 * For settings >= v1.20 this creates a \<arm\> node under elmParent. 7389 * keys under that. Called for both the \<Machine\> node and for snapshots. 7390 * 7391 * @param elmParent Parent element. 7392 * For settings >= v1.20 this is the \<Platform\> element. 7393 * @param elmCPU CPU element platform-generic settings. 7394 * For settings >= v1.20 this is the \<Platform/CPU\> element. 7395 * @param platARM ARM-specific platform settings to use for building the XML. 7396 */ 7397 void MachineConfigFile::buildPlatformARMXML(xml::ElementNode &elmParent, const PlatformARM &platARM) 7398 { 7399 xml::ElementNode *pelmARMRoot = elmParent.createChild("arm"); 7400 xml::ElementNode *pelmARMCPU = pelmARMRoot->createChild("CPU"); 7401 7402 if (platARM.fNestedHWVirt) 7403 pelmARMCPU->createChild("NestedHWVirt")->setAttribute("enabled", platARM.fNestedHWVirt); 7404 } 7405 #endif /* VBOX_WITH_VIRT_ARMV8 */ 7406 7407 7352 7408 /** 7353 7409 * Stores platform-generic and platform-specific data and then writes out the XML. … … 7465 7521 if (plat.architectureType == PlatformArchitecture_x86) 7466 7522 buildPlatformX86XML(*pelmPlatformOrHardware, *pelmCPU, plat.x86); 7467 /** @todo Put ARM stuff here as soon as we have it. */ 7523 #ifdef VBOX_WITH_VIRT_ARMV8 7524 else if (plat.architectureType == PlatformArchitecture_ARM) 7525 { 7526 Assert(m->sv >= SettingsVersion_v1_20); 7527 buildPlatformARMXML(*pelmPlatformOrHardware, plat.arm); 7528 } 7529 #endif 7468 7530 } 7469 7531
Note:
See TracChangeset
for help on using the changeset viewer.