VirtualBox

Changeset 106384 in vbox for trunk/src/VBox/Main/xml


Ignore:
Timestamp:
Oct 16, 2024 1:58:41 PM (3 months ago)
Author:
vboxsync
Message:

Main: Code for configuring and enabling nested virtualization support on ARM (M3 based hardware + macOS 15.0 aka Sequioa), bugref:10747

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r106061 r106384  
    39693969
    39703970#ifdef VBOX_WITH_VIRT_ARMV8
    3971 PlatformARM::PlatformARM()
     3971PlatformARM::PlatformARM() :
     3972    fNestedHWVirt(false)
    39723973{
    39733974}
     
    39753976bool PlatformARM::operator==(const PlatformARM& h) const
    39763977{
    3977     RT_NOREF(h);
    3978     return true;
     3978    return (this == &h)
     3979        || (fNestedHWVirt == h.fNestedHWVirt);
    39793980}
    39803981#endif /* VBOX_WITH_VIRT_ARMV8 */
     
    53065307}
    53075308
     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 */
     5318void 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
    53085336/**
    53095337 * Reads the platform settings.
     
    54435471        case PlatformArchitecture_ARM:
    54445472        {
    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);
    54465478            break;
    54475479        }
     
    73507382}
    73517383
     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 */
     7397void 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
    73527408/**
    73537409 * Stores platform-generic and platform-specific data and then writes out the XML.
     
    74657521    if (plat.architectureType == PlatformArchitecture_x86)
    74667522        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
    74687530}
    74697531
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