Changeset 87556 in vbox
- Timestamp:
- Feb 3, 2021 11:02:09 AM (4 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMR0.cpp
r87550 r87556 113 113 /** Set if VT-x (VMX) is supported by the CPU. */ 114 114 bool g_fHmVmxSupported = false; 115 /** Whether we're using the preemption timer or not. */115 /** VMX: Whether we're using the preemption timer or not. */ 116 116 bool g_fHmVmxUsePreemptTimer; 117 /** The shift mask employed by the VMX-Preemption timer. */117 /** VMX: The shift mask employed by the VMX-Preemption timer. */ 118 118 uint8_t g_cHmVmxPreemptTimerShift; 119 /** Whether we're using SUPR0EnableVTx or not. */ 119 /** VMX: Set if swapping EFER is supported. */ 120 bool g_fHmVmxSupportsVmcsEfer = false; 121 /** VMX: Whether we're using SUPR0EnableVTx or not. */ 120 122 static bool g_fHmVmxUsingSUPR0EnableVTx = false; 121 /** Set if we've called SUPR0EnableVTx(true) and should disable it during123 /** VMX: Set if we've called SUPR0EnableVTx(true) and should disable it during 122 124 * module termination. */ 123 125 static 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) */ 125 127 uint64_t g_uHmVmxHostCr4; 126 /** Host EFER value (set by ring-0 VMX init) */128 /** VMX: Host EFER value (set by ring-0 VMX init) */ 127 129 uint64_t g_uHmVmxHostMsrEfer; 128 /** Host SMM monitor control (used for logging/diagnostics) */130 /** VMX: Host SMM monitor control (used for logging/diagnostics) */ 129 131 uint64_t g_uHmVmxHostSmmMonitorCtl; 130 132 … … 487 489 g_cHmVmxPreemptTimerShift = 0; /* This is about right most of the time here. */ 488 490 } 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); 489 500 } 490 501 else … … 1182 1193 1183 1194 /* 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; 1189 1196 1190 1197 #if 0 -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r87555 r87556 4879 4879 * done as part of auto-load/store MSR area in the VMCS, see hmR0VmxExportGuestMsrs(). 4880 4880 */ 4881 PVMCC pVM = pVCpu->CTX_SUFF(pVM); 4882 if (pVM->hm.s.vmx.fSupportsVmcsEfer) 4881 if (g_fHmVmxSupportsVmcsEfer) 4883 4882 { 4884 4883 rc = VMXWriteVmcs64(VMX_VMCS64_HOST_EFER_FULL, g_uHmVmxHostMsrEfer); … … 5036 5035 * of the VM-entry MSR load area. 5037 5036 */ 5038 if ( pVM->hm.s.vmx.fSupportsVmcsEfer5037 if ( g_fHmVmxSupportsVmcsEfer 5039 5038 && hmR0VmxShouldSwapEferMsr(pVCpu, pVmxTransient)) 5040 5039 fVal |= VMX_ENTRY_CTLS_LOAD_EFER_MSR; … … 5103 5102 * used the "load IA32_EFER" control while exporting VM-entry controls. 5104 5103 */ 5105 if ( pVM->hm.s.vmx.fSupportsVmcsEfer5104 if ( g_fHmVmxSupportsVmcsEfer 5106 5105 && hmR0VmxShouldSwapEferMsr(pVCpu, pVmxTransient)) 5107 5106 { … … 6796 6795 * but to use the auto-load store MSR area in the VMCS for swapping EFER. See @bugref{7368}. 6797 6796 */ 6798 if ( pVM->hm.s.vmx.fSupportsVmcsEfer)6797 if (g_fHmVmxSupportsVmcsEfer) 6799 6798 { 6800 6799 int rc = VMXWriteVmcs64(VMX_VMCS64_GUEST_EFER_FULL, uGuestEferMsr); … … 6814 6813 Log4Func(("efer=%#RX64 shadow=%#RX64\n", uGuestEferMsr, pCtx->msrEFER)); 6815 6814 } 6816 else if (! pVM->hm.s.vmx.fSupportsVmcsEfer)6815 else if (!g_fHmVmxSupportsVmcsEfer) 6817 6816 hmR0VmxRemoveAutoLoadStoreMsr(pVCpu, pVmxTransient, MSR_K6_EFER); 6818 6817 … … 9849 9848 if (pVmcsInfo->u32EntryCtls & VMX_ENTRY_CTLS_LOAD_EFER_MSR) 9850 9849 { 9851 Assert( pVM->hm.s.vmx.fSupportsVmcsEfer);9850 Assert(g_fHmVmxSupportsVmcsEfer); 9852 9851 rc = VMXReadVmcs64(VMX_VMCS64_GUEST_EFER_FULL, &u64Val); 9853 9852 AssertRC(rc); -
trunk/src/VBox/VMM/VMMR3/HM.cpp
r87554 r87556 1662 1662 } 1663 1663 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)); 1665 1665 LogRel(("HM: Enabled VMX\n")); 1666 1666 pVM->hm.s.vmx.fEnabled = true; -
trunk/src/VBox/VMM/include/HMInternal.h
r87552 r87556 503 503 /** The shift mask employed by the VMX-Preemption timer (set by ring-0). */ 504 504 uint8_t cPreemptTimerShift; 505 /** Padding. */ 506 bool afPadding0[1]; 505 bool fAlignment1; 507 506 508 507 /** Pause-loop exiting (PLE) gap in ticks. */ … … 517 516 /** Host EFER value (set by ring-0 VMX init, for logging and guest NX). */ 518 517 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; 521 521 /** Whether to use VMCS shadowing. */ 522 522 bool fUseVmcsShadowing; 523 523 /** Set if Last Branch Record (LBR) is enabled. */ 524 524 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; 526 529 527 530 /** The first valid host LBR branch-from-IP stack range. */ … … 534 537 /** The last valid host LBR branch-to-IP stack range. */ 535 538 uint32_t idLbrToIpMsrLast; 536 537 /** The host LBR TOS (top-of-stack) MSR id. */538 uint32_t idLbrTosMsr;539 /** Padding. */540 uint32_t u32Alignment1;541 539 542 540 /** Host-physical address for a failing VMXON instruction (for diagnostics, ring-3). */ … … 1456 1454 extern bool g_fHmVmxUsePreemptTimer; 1457 1455 extern uint8_t g_cHmVmxPreemptTimerShift; 1456 extern bool g_fHmVmxSupportsVmcsEfer; 1458 1457 extern uint64_t g_uHmVmxHostCr4; 1459 1458 extern uint64_t g_uHmVmxHostMsrEfer;
Note:
See TracChangeset
for help on using the changeset viewer.