VirtualBox

Changeset 87556 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Feb 3, 2021 11:02:09 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
142583
Message:

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

Location:
trunk/src/VBox/VMM/VMMR0
Files:
2 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);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette