VirtualBox

Changeset 80655 in vbox


Ignore:
Timestamp:
Sep 9, 2019 4:13:04 AM (5 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Nested VMX: bugref:9180 Swap EFER when requested by the nested-guest.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r80622 r80655  
    45394539 *
    45404540 * @returns true if we need to load guest EFER, false otherwise.
    4541  * @param   pVCpu   The cross context virtual CPU structure.
     4541 * @param   pVCpu           The cross context virtual CPU structure.
     4542 * @param   pVmxTransient   The VMX-transient structure.
    45424543 *
    45434544 * @remarks Requires EFER, CR4.
    45444545 * @remarks No-long-jump zone!!!
    45454546 */
    4546 static bool hmR0VmxShouldSwapEferMsr(PCVMCPUCC pVCpu)
     4547static bool hmR0VmxShouldSwapEferMsr(PCVMCPUCC pVCpu, PCVMXTRANSIENT pVmxTransient)
    45474548{
    45484549#ifdef HMVMX_ALWAYS_SWAP_EFER
    4549     RT_NOREF(pVCpu);
     4550    RT_NOREF2(pVCpu, pVmxTransient);
    45504551    return true;
    45514552#else
     
    45544555    uint64_t const u64HostEfer  = pVM->hm.s.vmx.u64HostMsrEfer;
    45554556    uint64_t const u64GuestEfer = pCtx->msrEFER;
     4557
     4558# ifdef VBOX_WITH_NESTED_HWVIRT_VMX
     4559    /*
     4560     * For nested-guests, we shall honor swapping the EFER MSR when requested by
     4561     * the nested-guest.
     4562     */
     4563    if (   pVmxTransient->fIsNestedGuest
     4564        && (   CPUMIsGuestVmxEntryCtlsSet(pVCpu, pCtx, VMX_ENTRY_CTLS_LOAD_EFER_MSR)
     4565            || CPUMIsGuestVmxExitCtlsSet(pVCpu, pCtx, VMX_EXIT_CTLS_SAVE_EFER_MSR)
     4566            || CPUMIsGuestVmxExitCtlsSet(pVCpu, pCtx, VMX_EXIT_CTLS_LOAD_EFER_MSR)))
     4567        return true;
     4568# else
     4569    RT_NOREF(pVmxTransient);
     4570#endif
    45564571
    45574572    /*
     
    46634678             */
    46644679            if (   pVM->hm.s.vmx.fSupportsVmcsEfer
    4665                 && hmR0VmxShouldSwapEferMsr(pVCpu))
     4680                && hmR0VmxShouldSwapEferMsr(pVCpu, pVmxTransient))
    46664681                fVal |= VMX_ENTRY_CTLS_LOAD_EFER_MSR;
    46674682            else
     
    47304745             */
    47314746            if (   pVM->hm.s.vmx.fSupportsVmcsEfer
    4732                 && hmR0VmxShouldSwapEferMsr(pVCpu))
     4747                && hmR0VmxShouldSwapEferMsr(pVCpu, pVmxTransient))
    47334748            {
    47344749                fVal |= VMX_EXIT_CTLS_SAVE_EFER_MSR
     
    64426457        HMVMX_CPUMCTX_ASSERT(pVCpu, CPUMCTX_EXTRN_EFER);
    64436458
    6444         if (hmR0VmxShouldSwapEferMsr(pVCpu))
     6459        if (hmR0VmxShouldSwapEferMsr(pVCpu, pVmxTransient))
    64456460        {
    64466461            /*
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