- Timestamp:
- Dec 20, 2018 9:57:15 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 127598
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/CPUM.cpp
r76207 r76310 802 802 static void cpumR3FreeSvmHwVirtState(PVM pVM) 803 803 { 804 Assert(pVM->cpum. ro.GuestFeatures.fSvm);804 Assert(pVM->cpum.s.GuestFeatures.fSvm); 805 805 for (VMCPUID i = 0; i < pVM->cCpus; i++) 806 806 { … … 836 836 static int cpumR3AllocSvmHwVirtState(PVM pVM) 837 837 { 838 Assert(pVM->cpum. ro.GuestFeatures.fSvm);838 Assert(pVM->cpum.s.GuestFeatures.fSvm); 839 839 840 840 int rc = VINF_SUCCESS; … … 925 925 static void cpumR3FreeVmxHwVirtState(PVM pVM) 926 926 { 927 Assert(pVM->cpum. ro.GuestFeatures.fVmx);927 Assert(pVM->cpum.s.GuestFeatures.fVmx); 928 928 for (VMCPUID i = 0; i < pVM->cCpus; i++) 929 929 { … … 1674 1674 PCPUMFEATURES pHostFeat = &pVM->cpum.s.HostFeatures; 1675 1675 VMXMSRS VmxMsrs; 1676 int rc = HMVmxGetHostMsrs(pVM, &VmxMsrs); 1677 if (RT_SUCCESS(rc)) 1678 cpumR3ExplodeVmxFeatures(&VmxMsrs, pHostFeat); 1676 if (cpumR3IsHwAssistVmxNstGstExecAllowed(pVM)) 1677 { 1678 /** @todo NSTVMX: When NEM support for nested-VMX is there, we'll need to fetch 1679 * the MSRs from NEM or do the support driver IOCTL route, see patch in 1680 * @bugref{9180}. */ 1681 if (HMIsEnabled(pVM)) 1682 { 1683 int rc = HMVmxGetHostMsrs(pVM, &VmxMsrs); 1684 if (RT_SUCCESS(rc)) 1685 cpumR3ExplodeVmxFeatures(&VmxMsrs, pHostFeat); 1686 } 1687 else 1688 AssertMsgFailed(("NEM support for nested-VMX is not implemented yet\n")); 1689 } 1679 1690 1680 1691 /* … … 2038 2049 * Allocate memory required by the guest hardware virtualization state. 2039 2050 */ 2040 if (pVM->cpum. ro.GuestFeatures.fVmx)2051 if (pVM->cpum.s.GuestFeatures.fVmx) 2041 2052 rc = cpumR3AllocVmxHwVirtState(pVM); 2042 else if (pVM->cpum. ro.GuestFeatures.fSvm)2053 else if (pVM->cpum.s.GuestFeatures.fSvm) 2043 2054 rc = cpumR3AllocSvmHwVirtState(pVM); 2044 2055 else … … 2055 2066 for (VMCPUID i = 0; i < pVM->cCpus; i++) 2056 2067 cpumR3InitVmxHwVirtState(&pVM->aCpus[i]); 2068 2069 /* Initialize VMX features. */ 2070 cpumR3InitVmxCpuFeatures(pVM); 2071 DBGFR3Info(pVM->pUVM, "cpumvmxfeat", "default", DBGFR3InfoLogRelHlp()); 2057 2072 } 2058 2073 else if (enmHwvirt == CPUMHWVIRT_SVM) … … 2137 2152 #endif 2138 2153 2139 if (pVM->cpum. ro.GuestFeatures.fVmx)2154 if (pVM->cpum.s.GuestFeatures.fVmx) 2140 2155 cpumR3FreeVmxHwVirtState(pVM); 2141 else if (pVM->cpum. ro.GuestFeatures.fSvm)2156 else if (pVM->cpum.s.GuestFeatures.fSvm) 2142 2157 cpumR3FreeSvmHwVirtState(pVM); 2143 2158 return VINF_SUCCESS; … … 2297 2312 */ 2298 2313 CPUMSetGuestGif(pCtx, true); 2299 Assert(!pVM->cpum. ro.GuestFeatures.fVmx || !pVM->cpum.ro.GuestFeatures.fSvm); /* Paranoia. */2300 if (pVM->cpum. ro.GuestFeatures.fVmx)2314 Assert(!pVM->cpum.s.GuestFeatures.fVmx || !pVM->cpum.s.GuestFeatures.fSvm); /* Paranoia. */ 2315 if (pVM->cpum.s.GuestFeatures.fVmx) 2301 2316 cpumR3InitVmxHwVirtState(pVCpu); 2302 else if (pVM->cpum. ro.GuestFeatures.fSvm)2317 else if (pVM->cpum.s.GuestFeatures.fSvm) 2303 2318 cpumR3InitSvmHwVirtState(pVCpu); 2304 2319 } … … 2397 2412 SSMR3PutStructEx(pSSM, pZmm16Hi, sizeof(*pZmm16Hi), SSMSTRUCT_FLAGS_FULL_STRUCT, g_aCpumZmm16HiFields, NULL); 2398 2413 } 2399 if (pVM->cpum. ro.GuestFeatures.fSvm)2414 if (pVM->cpum.s.GuestFeatures.fSvm) 2400 2415 { 2401 2416 Assert(pGstCtx->hwvirt.svm.CTX_SUFF(pVmcb)); … … 2637 2652 if (uVersion >= CPUM_SAVED_STATE_VERSION_HWVIRT_SVM) 2638 2653 { 2639 if (pVM->cpum. ro.GuestFeatures.fSvm)2654 if (pVM->cpum.s.GuestFeatures.fSvm) 2640 2655 { 2641 2656 Assert(pGstCtx->hwvirt.svm.CTX_SUFF(pVmcb)); … … 3455 3470 PCPUMCTX pCtx = &pVCpu->cpum.s.Guest; 3456 3471 static const char *const s_aHwvirtModes[] = { "No/inactive", "SVM", "VMX", "Common" }; 3457 bool const fSvm = pVM->cpum. ro.GuestFeatures.fSvm;3458 bool const fVmx = pVM->cpum. ro.GuestFeatures.fVmx;3472 bool const fSvm = pVM->cpum.s.GuestFeatures.fSvm; 3473 bool const fVmx = pVM->cpum.s.GuestFeatures.fVmx; 3459 3474 uint8_t const idxHwvirtState = fSvm ? CPUMHWVIRTDUMP_SVM : (fVmx ? CPUMHWVIRTDUMP_VMX : CPUMHWVIRTDUMP_NONE); 3460 3475 AssertCompile(CPUMHWVIRTDUMP_LAST <= RT_ELEMENTS(s_aHwvirtModes)); … … 3986 4001 } 3987 4002 3988 case VMINITCOMPLETED_HM:3989 {3990 /*3991 * Currently, nested VMX/SVM both derives their guest VMX/SVM CPUID bit from the host3992 * CPUID bit. This could be later changed if we need to support nested-VMX on CPUs3993 * that are not capable of VMX.3994 */3995 if (pVM->cpum.s.GuestFeatures.fVmx)3996 {3997 Assert( pVM->cpum.s.GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_INTEL3998 || pVM->cpum.s.GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_VIA);3999 cpumR3InitVmxCpuFeatures(pVM);4000 DBGFR3Info(pVM->pUVM, "cpumvmxfeat", "default", DBGFR3InfoLogRelHlp());4001 }4002 4003 if (pVM->cpum.s.GuestFeatures.fVmx)4004 LogRel(("CPUM: Enabled guest VMX support\n"));4005 else if (pVM->cpum.s.GuestFeatures.fSvm)4006 LogRel(("CPUM: Enabled guest SVM support\n"));4007 break;4008 }4009 4010 4003 default: 4011 4004 break;
Note:
See TracChangeset
for help on using the changeset viewer.