VirtualBox

Changeset 87556 in vbox


Ignore:
Timestamp:
Feb 3, 2021 11:02:09 AM (4 years ago)
Author:
vboxsync
Message:

VMM/HMVMX: Copied fSupportsVmcsEfer from HM::vmxUse to g_fHmVmxSupportsVmcsEfer in ring-0. bugref:9217

Location:
trunk/src/VBox/VMM
Files:
4 edited

Legend:

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

    r87550 r87556  
    113113/** Set if VT-x (VMX) is supported by the CPU. */
    114114bool                    g_fHmVmxSupported = false;
    115 /** Whether we're using the preemption timer or not. */
     115/** VMX: Whether we're using the preemption timer or not. */
    116116bool                    g_fHmVmxUsePreemptTimer;
    117 /** The shift mask employed by the VMX-Preemption timer. */
     117/** VMX: The shift mask employed by the VMX-Preemption timer. */
    118118uint8_t                 g_cHmVmxPreemptTimerShift;
    119 /** Whether we're using SUPR0EnableVTx or not. */
     119/** VMX: Set if swapping EFER is supported.  */
     120bool                    g_fHmVmxSupportsVmcsEfer = false;
     121/** VMX: Whether we're using SUPR0EnableVTx or not. */
    120122static bool             g_fHmVmxUsingSUPR0EnableVTx = false;
    121 /** Set if we've called SUPR0EnableVTx(true) and should disable it during
     123/** VMX: Set if we've called SUPR0EnableVTx(true) and should disable it during
    122124 * module termination. */
    123125static bool             g_fHmVmxCalledSUPR0EnableVTx = false;
    124 /** Host CR4 value (set by ring-0 VMX init) */
     126/** VMX: Host CR4 value (set by ring-0 VMX init) */
    125127uint64_t                g_uHmVmxHostCr4;
    126 /** Host EFER value (set by ring-0 VMX init) */
     128/** VMX: Host EFER value (set by ring-0 VMX init) */
    127129uint64_t                g_uHmVmxHostMsrEfer;
    128 /** Host SMM monitor control (used for logging/diagnostics) */
     130/** VMX: Host SMM monitor control (used for logging/diagnostics) */
    129131uint64_t                g_uHmVmxHostSmmMonitorCtl;
    130132
     
    487489                        g_cHmVmxPreemptTimerShift = 0; /* This is about right most of the time here. */
    488490                }
     491                else
     492                    g_fHmVmxUsePreemptTimer   = false;
     493
     494                /*
     495                 * Check for EFER swapping support.
     496                 */
     497                g_fHmVmxSupportsVmcsEfer = (g_HmMsrs.u.vmx.EntryCtls.n.allowed1 & VMX_ENTRY_CTLS_LOAD_EFER_MSR)
     498                                        && (g_HmMsrs.u.vmx.ExitCtls.n.allowed1  & VMX_EXIT_CTLS_LOAD_EFER_MSR)
     499                                        && (g_HmMsrs.u.vmx.ExitCtls.n.allowed1  & VMX_EXIT_CTLS_SAVE_EFER_MSR);
    489500            }
    490501            else
     
    11821193
    11831194        /* Use the VMCS controls for swapping the EFER MSR if supported. */
    1184         Assert(!pVM->hm.s.vmx.fSupportsVmcsEfer);
    1185         if (   (g_HmMsrs.u.vmx.EntryCtls.n.allowed1 & VMX_ENTRY_CTLS_LOAD_EFER_MSR)
    1186             && (g_HmMsrs.u.vmx.ExitCtls.n.allowed1  & VMX_EXIT_CTLS_LOAD_EFER_MSR)
    1187             && (g_HmMsrs.u.vmx.ExitCtls.n.allowed1  & VMX_EXIT_CTLS_SAVE_EFER_MSR))
    1188             pVM->hm.s.vmx.fSupportsVmcsEfer = true;
     1195        pVM->hm.s.vmx.fSupportsVmcsEferForRing3 = g_fHmVmxSupportsVmcsEfer;
    11891196
    11901197#if 0
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r87555 r87556  
    48794879     * done as part of auto-load/store MSR area in the VMCS, see hmR0VmxExportGuestMsrs().
    48804880     */
    4881     PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    4882     if (pVM->hm.s.vmx.fSupportsVmcsEfer)
     4881    if (g_fHmVmxSupportsVmcsEfer)
    48834882    {
    48844883        rc = VMXWriteVmcs64(VMX_VMCS64_HOST_EFER_FULL, g_uHmVmxHostMsrEfer);
     
    50365035             * of the VM-entry MSR load area.
    50375036             */
    5038             if (   pVM->hm.s.vmx.fSupportsVmcsEfer
     5037            if (   g_fHmVmxSupportsVmcsEfer
    50395038                && hmR0VmxShouldSwapEferMsr(pVCpu, pVmxTransient))
    50405039                fVal |= VMX_ENTRY_CTLS_LOAD_EFER_MSR;
     
    51035102             * used the "load IA32_EFER" control while exporting VM-entry controls.
    51045103             */
    5105             if (   pVM->hm.s.vmx.fSupportsVmcsEfer
     5104            if (   g_fHmVmxSupportsVmcsEfer
    51065105                && hmR0VmxShouldSwapEferMsr(pVCpu, pVmxTransient))
    51075106            {
     
    67966795             * but to use the auto-load store MSR area in the VMCS for swapping EFER. See @bugref{7368}.
    67976796             */
    6798             if (pVM->hm.s.vmx.fSupportsVmcsEfer)
     6797            if (g_fHmVmxSupportsVmcsEfer)
    67996798            {
    68006799                int rc = VMXWriteVmcs64(VMX_VMCS64_GUEST_EFER_FULL, uGuestEferMsr);
     
    68146813            Log4Func(("efer=%#RX64 shadow=%#RX64\n", uGuestEferMsr, pCtx->msrEFER));
    68156814        }
    6816         else if (!pVM->hm.s.vmx.fSupportsVmcsEfer)
     6815        else if (!g_fHmVmxSupportsVmcsEfer)
    68176816            hmR0VmxRemoveAutoLoadStoreMsr(pVCpu, pVmxTransient, MSR_K6_EFER);
    68186817
     
    98499848        if (pVmcsInfo->u32EntryCtls & VMX_ENTRY_CTLS_LOAD_EFER_MSR)
    98509849        {
    9851             Assert(pVM->hm.s.vmx.fSupportsVmcsEfer);
     9850            Assert(g_fHmVmxSupportsVmcsEfer);
    98529851            rc = VMXReadVmcs64(VMX_VMCS64_GUEST_EFER_FULL, &u64Val);
    98539852            AssertRC(rc);
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r87554 r87556  
    16621662    }
    16631663
    1664     LogRel(("HM: Supports VMCS EFER fields         = %RTbool\n", pVM->hm.s.vmx.fSupportsVmcsEfer));
     1664    LogRel(("HM: Supports VMCS EFER fields         = %RTbool\n", pVM->hm.s.vmx.fSupportsVmcsEferForRing3));
    16651665    LogRel(("HM: Enabled VMX\n"));
    16661666    pVM->hm.s.vmx.fEnabled = true;
  • trunk/src/VBox/VMM/include/HMInternal.h

    r87552 r87556  
    503503        /** The shift mask employed by the VMX-Preemption timer (set by ring-0). */
    504504        uint8_t                     cPreemptTimerShift;
    505         /** Padding. */
    506         bool                        afPadding0[1];
     505        bool                        fAlignment1;
    507506
    508507        /** Pause-loop exiting (PLE) gap in ticks. */
     
    517516        /** Host EFER value (set by ring-0 VMX init, for logging and guest NX). */
    518517        uint64_t                    u64HostMsrEfer;
    519         /** Whether the CPU supports VMCS fields for swapping EFER. */
    520         bool                        fSupportsVmcsEfer;
     518        /** Whether the CPU supports VMCS fields for swapping EFER (set by ring-0 VMX
     519         *  init, for logging). */
     520        bool                        fSupportsVmcsEferForRing3;
    521521        /** Whether to use VMCS shadowing. */
    522522        bool                        fUseVmcsShadowing;
    523523        /** Set if Last Branch Record (LBR) is enabled. */
    524524        bool                        fLbr;
    525         uint8_t                     u8Alignment2[5];
     525        bool                        fAlignment2;
     526
     527        /** The host LBR TOS (top-of-stack) MSR id. */
     528        uint32_t                    idLbrTosMsr;
    526529
    527530        /** The first valid host LBR branch-from-IP stack range. */
     
    534537        /** The last valid host LBR branch-to-IP stack range. */
    535538        uint32_t                    idLbrToIpMsrLast;
    536 
    537         /** The host LBR TOS (top-of-stack) MSR id. */
    538         uint32_t                    idLbrTosMsr;
    539         /** Padding. */
    540         uint32_t                    u32Alignment1;
    541539
    542540        /** Host-physical address for a failing VMXON instruction (for diagnostics, ring-3). */
     
    14561454extern bool             g_fHmVmxUsePreemptTimer;
    14571455extern uint8_t          g_cHmVmxPreemptTimerShift;
     1456extern bool             g_fHmVmxSupportsVmcsEfer;
    14581457extern uint64_t         g_uHmVmxHostCr4;
    14591458extern uint64_t         g_uHmVmxHostMsrEfer;
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