VirtualBox

Changeset 106384 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Oct 16, 2024 1:58:41 PM (4 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
165197
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/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r106061 r106384  
    250250    MODIFYVM_GUEST_DEBUG_ADDRESS,
    251251    MODIFYVM_GUEST_DEBUG_PORT,
     252
     253    /*
     254     * Stuff common between x86 and ARM.
     255     */
     256    MODIFYVM_NESTED_HW_VIRT,
     257
    252258    /*
    253259     * x86-specific stuff.
     
    267273    MODIFYVM_X86_MDS_CLEAR_ON_SCHED,
    268274    MODIFYVM_X86_MDS_CLEAR_ON_VM_ENTRY,
    269     MODIFYVM_X86_NESTED_HW_VIRT,
    270275    MODIFYVM_X86_NESTEDPAGING,
    271276    MODIFYVM_X86_PAE,
     
    516521    OPT1("--x86-mds-clear-on-vm-entry",                                 MODIFYVM_X86_MDS_CLEAR_ON_VM_ENTRY, RTGETOPT_REQ_BOOL_ONOFF),
    517522    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),
    520525    OPT1("--x86-nested-paging",                                         MODIFYVM_X86_NESTEDPAGING,          RTGETOPT_REQ_BOOL_ONOFF),
    521526    OPT2("--nested-paging",                 "--nestedpaging",           MODIFYVM_X86_NESTEDPAGING,          RTGETOPT_REQ_BOOL_ONOFF),
     
    792797            break;
    793798
    794         case MODIFYVM_X86_NESTED_HW_VIRT:
     799        case MODIFYVM_NESTED_HW_VIRT:
    795800            CHECK_ERROR(platformX86, SetCPUProperty(CPUPropertyTypeX86_HWVirt, pValueUnion->f));
    796801            break;
     
    825830}
    826831
     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 */
     843static 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
    827864RTEXITCODE handleModifyVM(HandlerArg *a)
    828865{
     
    857894    ComPtr<IPlatform> platform;
    858895    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());
    863896
    864897    ComPtr<IGraphicsAdapter> pGraphicsAdapter;
     
    37393772            default:
    37403773            {
    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
    37423799                if (FAILED(hrc))
    37433800                    errorGetOpt(c, &ValueUnion);
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