VirtualBox

Changeset 75959 in vbox for trunk/src


Ignore:
Timestamp:
Dec 5, 2018 9:12:37 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9323: Nested HW Virt Ex checkbox initial implementation.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp

    r75958 r75959  
    468468        if (pSystemPage)
    469469        {
    470             /* Nested Paging: */
    471             if (pSystemPage->isNestedPagingEnabled())
     470            /* Nested Paging || Nested HW Virt Ex: */
     471            if (   pSystemPage->isNestedPagingEnabled()
     472                || pSystemPage->isNestedHWVirtExEnabled())
    472473            {
    473474                /* Enable HW Virt Ex if supported: */
     
    475476                    && !pSystemPage->isHWVirtExEnabled())
    476477                    m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_Enabled, true);
     478            }
     479
     480            /* Nested HW Virt Ex: */
     481            if (pSystemPage->isNestedHWVirtExEnabled())
     482            {
     483                /* Enable Nested Paging if supported: */
     484                if (   pSystemPage->isHWVirtExSupported()
     485                    && !pSystemPage->isNestedPagingEnabled())
     486                    m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging, true);
    477487            }
    478488        }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r75958 r75959  
    7272        /* Support flags: */
    7373        : m_fSupportedPAE(false)
     74        , m_fSupportedNestedHwVirtEx(false)
    7475        , m_fSupportedHwVirtEx(false)
    7576        , m_fSupportedNestedPaging(false)
     
    8687        , m_iCPUExecCap(-1)
    8788        , m_fEnabledPAE(false)
     89        , m_fEnabledNestedHwVirtEx(false)
    8890        /* Acceleration data: */
    8991        , m_paravirtProvider(KParavirtProvider_None)
     
    98100               /* Support flags: */
    99101               && (m_fSupportedPAE == other.m_fSupportedPAE)
     102               && (m_fSupportedNestedHwVirtEx == other.m_fSupportedNestedHwVirtEx)
    100103               && (m_fSupportedHwVirtEx == other.m_fSupportedHwVirtEx)
    101104               && (m_fSupportedNestedPaging == other.m_fSupportedNestedPaging)
     
    112115               && (m_iCPUExecCap == other.m_iCPUExecCap)
    113116               && (m_fEnabledPAE == other.m_fEnabledPAE)
     117               && (m_fEnabledNestedHwVirtEx == other.m_fEnabledNestedHwVirtEx)
    114118               /* Acceleration data: */
    115119               && (m_paravirtProvider == other.m_paravirtProvider)
     
    126130    /** Holds whether the PAE is supported. */
    127131    bool  m_fSupportedPAE;
     132    /** Holds whether the Nested HW Virt Ex is supported. */
     133    bool  m_fSupportedNestedHwVirtEx;
    128134    /** Holds whether the HW Virt Ex is supported. */
    129135    bool  m_fSupportedHwVirtEx;
     
    152158    /** Holds whether the PAE is enabled. */
    153159    bool  m_fEnabledPAE;
     160    /** Holds whether the Nested HW Virt Ex is enabled. */
     161    bool  m_fEnabledNestedHwVirtEx;
    154162
    155163    /** Holds the paravirtualization provider. */
     
    200208}
    201209
     210bool UIMachineSettingsSystem::isNestedHWVirtExSupported() const
     211{
     212    AssertPtrReturn(m_pCache, false);
     213    return m_pCache->base().m_fSupportedNestedHwVirtEx;
     214}
     215
     216bool UIMachineSettingsSystem::isNestedHWVirtExEnabled() const
     217{
     218    return m_pCheckBoxNestedVirtualization->isChecked();
     219}
     220
    202221bool UIMachineSettingsSystem::isHIDEnabled() const
    203222{
     
    241260    /* Gather support flags: */
    242261    oldSystemData.m_fSupportedPAE = vboxGlobal().host().GetProcessorFeature(KProcessorFeature_PAE);
     262    oldSystemData.m_fSupportedNestedHwVirtEx = vboxGlobal().host().GetProcessorFeature(KProcessorFeature_NestedHWVirt);
    243263    oldSystemData.m_fSupportedHwVirtEx = vboxGlobal().host().GetProcessorFeature(KProcessorFeature_HWVirtEx);
    244264    oldSystemData.m_fSupportedNestedPaging = vboxGlobal().host().GetProcessorFeature(KProcessorFeature_NestedPaging);
     
    282302    oldSystemData.m_iCPUExecCap = m_machine.GetCPUExecutionCap();
    283303    oldSystemData.m_fEnabledPAE = m_machine.GetCPUProperty(KCPUPropertyType_PAE);
     304    oldSystemData.m_fEnabledNestedHwVirtEx = m_machine.GetCPUProperty(KCPUPropertyType_HWVirt);
    284305
    285306    /* Gather old 'Acceleration' data: */
     
    330351    m_pSliderCPUExecCap->setValue(oldSystemData.m_iCPUExecCap);
    331352    m_pCheckBoxPAE->setChecked(oldSystemData.m_fEnabledPAE);
     353    m_pCheckBoxNestedVirtualization->setChecked(oldSystemData.m_fEnabledNestedHwVirtEx);
    332354
    333355    /* Load old 'Acceleration' data from the cache: */
     
    351373    /* Gather support flags: */
    352374    newSystemData.m_fSupportedPAE = m_pCache->base().m_fSupportedPAE;
     375    newSystemData.m_fSupportedNestedHwVirtEx = isNestedHWVirtExSupported();
    353376    newSystemData.m_fSupportedHwVirtEx = isHWVirtExSupported();
    354377    newSystemData.m_fSupportedNestedPaging = isNestedPagingSupported();
     
    377400    newSystemData.m_iCPUExecCap = m_pSliderCPUExecCap->value();
    378401    newSystemData.m_fEnabledPAE = m_pCheckBoxPAE->isChecked();
     402    newSystemData.m_fEnabledNestedHwVirtEx = isNestedHWVirtExEnabled();
    379403
    380404    /* Gather 'Acceleration' data: */
     
    516540            {
    517541                message.second << tr("Lowering the processor execution cap may result in a decline in performance.");
     542            }
     543        }
     544
     545        /* Nested HW Virt Ex: */
     546        if (isNestedHWVirtExEnabled())
     547        {
     548            /* HW Virt Ex test: */
     549            if (isHWVirtExSupported() && !isHWVirtExEnabled())
     550            {
     551                message.second << tr(
     552                    "The hardware virtualization is not currently enabled in the Acceleration section of the System page. "
     553                    "This is needed to support nested hardware virtualization. "
     554                    "It will be enabled automatically if you confirm your changes.");
     555            }
     556
     557            /* Nested Paging test: */
     558            if (isHWVirtExSupported() && isNestedPagingSupported() && !isNestedPagingEnabled())
     559            {
     560                message.second << tr(
     561                    "The nested paging is not currently enabled in the Acceleration section of the System page. "
     562                    "This is needed to support nested hardware virtualization. "
     563                    "It will be enabled automatically if you confirm your changes.");
    518564            }
    519565        }
     
    587633    /* Configure navigation for 'acceleration' tab: */
    588634    setTabOrder(m_pComboParavirtProvider, m_pCheckBoxPAE);
    589     setTabOrder(m_pCheckBoxPAE, m_pCheckBoxVirtualization);
     635    setTabOrder(m_pCheckBoxPAE, m_pCheckBoxNestedVirtualization);
     636    setTabOrder(m_pCheckBoxNestedVirtualization, m_pCheckBoxVirtualization);
    590637    setTabOrder(m_pCheckBoxVirtualization, m_pCheckBoxNestedPaging);
    591638}
     
    655702    m_pLabelCPUExtended->setEnabled(isMachineOffline());
    656703    m_pCheckBoxPAE->setEnabled(isMachineOffline() && systemData.m_fSupportedPAE);
     704    m_pCheckBoxNestedVirtualization->setEnabled(   (systemData.m_fSupportedNestedHwVirtEx && isMachineOffline())
     705                                                || (systemData.m_fEnabledNestedHwVirtEx && isMachineOffline()));
    657706
    658707    /* Polish 'Acceleration' availability: */
     
    10251074    connect(m_pSliderCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUExecCapSliderChange()));
    10261075    connect(m_pEditorCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUExecCapEditorChange()));
     1076    connect(m_pCheckBoxNestedVirtualization, &QCheckBox::stateChanged,
     1077            this, &UIMachineSettingsSystem::revalidate);
    10271078
    10281079    /* Configure 'Acceleration' connections: */
    10291080    connect(m_pCheckBoxVirtualization, &QCheckBox::stateChanged,
    10301081            this, &UIMachineSettingsSystem::sltHandleHwVirtExToggle);
     1082    connect(m_pCheckBoxNestedPaging, &QCheckBox::stateChanged,
     1083            this, &UIMachineSettingsSystem::revalidate);
    10311084}
    10321085
     
    12611314            fSuccess = m_machine.isOk();
    12621315        }
     1316        /* Save whether Nested HW Virt Ex is enabled: */
     1317        if (fSuccess && isMachineOffline() && newSystemData.m_fEnabledNestedHwVirtEx != oldSystemData.m_fEnabledNestedHwVirtEx)
     1318        {
     1319            m_machine.SetCPUProperty(KCPUPropertyType_HWVirt, newSystemData.m_fEnabledNestedHwVirtEx);
     1320            fSuccess = m_machine.isOk();
     1321        }
    12631322        /* Save CPU execution cap: */
    12641323        if (fSuccess && newSystemData.m_iCPUExecCap != oldSystemData.m_iCPUExecCap)
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h

    r75958 r75959  
    4949    /** Returns whether the Nested Paging is enabled. */
    5050    bool isNestedPagingEnabled() const;
     51
     52    /** Returns whether the Nested HW Virt Ex is supported. */
     53    bool isNestedHWVirtExSupported() const;
     54    /** Returns whether the Nested HW Virt Ex is enabled. */
     55    bool isNestedHWVirtExEnabled() const;
    5156
    5257    /** Returns whether the HID is enabled. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.ui

    r75958 r75959  
    511511        </widget>
    512512       </item>
    513        <item row="5" column="0" colspan="3">
     513       <item row="5" column="1" colspan="2">
     514        <widget class="QCheckBox" name="m_pCheckBoxNestedVirtualization">
     515         <property name="whatsThis">
     516          <string>When checked, the nested hardware virtualization CPU feature will be exposed to the virtual machine.</string>
     517         </property>
     518         <property name="text">
     519          <string>Enable nested &amp;VT-x/AMD-V</string>
     520         </property>
     521        </widget>
     522       </item>
     523       <item row="6" column="0" colspan="3">
    514524        <spacer name="m_pSpacerVertical3">
    515525         <property name="orientation">
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