Changeset 76678 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- Jan 7, 2019 1:48:16 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo
-
old new 8 8 /branches/VBox-5.0:104445,104938,104943,104950,104952-104953,104987-104988,104990,106453 9 9 /branches/VBox-5.1:112367,115992,116543,116550,116568,116573 10 /branches/VBox-5.2:119536,120083,120099,120213,120221,120239,123597-123598,123600-123601,123755,12 5768,125779-125780,12581210 /branches/VBox-5.2:119536,120083,120099,120213,120221,120239,123597-123598,123600-123601,123755,124260,124263,124271,124273,124277-124279,124284-124286,124288-124290,125768,125779-125780,125812 11 11 /branches/andy/draganddrop:90781-91268 12 12 /branches/andy/guestctrl20:78916,78930
-
- Property svn:mergeinfo
-
trunk/src/VBox
- Property svn:mergeinfo
-
old new 8 8 /branches/VBox-5.0/src/VBox:104938,104943,104950,104987-104988,104990,106453 9 9 /branches/VBox-5.1/src/VBox:112367,116543,116550,116568,116573 10 /branches/VBox-5.2/src/VBox:119536,120083,120099,120213,120221,120239,123597-123598,123600-123601,123755,12 5768,125779-125780,12581210 /branches/VBox-5.2/src/VBox:119536,120083,120099,120213,120221,120239,123597-123598,123600-123601,123755,124263,124273,124277-124279,124284-124286,124288-124290,125768,125779-125780,125812 11 11 /branches/andy/draganddrop/src/VBox:90781-91268 12 12 /branches/andy/guestctrl20/src/VBox:78916,78930
-
- Property svn:mergeinfo
-
trunk/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp
r76553 r76678 1870 1870 pFeatures->fIbrs = pFeatures->fIbpb; 1871 1871 pFeatures->fStibp = RT_BOOL(pSxfLeaf0->uEdx & X86_CPUID_STEXT_FEATURE_EDX_STIBP); 1872 #if 0 // Disabled until IA32_ARCH_CAPABILITIES support can be tested 1872 pFeatures->fFlushCmd = RT_BOOL(pSxfLeaf0->uEdx & X86_CPUID_STEXT_FEATURE_EDX_FLUSH_CMD); 1873 1873 pFeatures->fArchCap = RT_BOOL(pSxfLeaf0->uEdx & X86_CPUID_STEXT_FEATURE_EDX_ARCHCAP); 1874 #endif1875 1874 } 1876 1875 … … 1878 1877 PCCPUMCPUIDLEAF const pMWaitLeaf = cpumR3CpuIdFindLeaf(paLeaves, cLeaves, 5); 1879 1878 if (pMWaitLeaf) 1880 {1881 1879 pFeatures->fMWaitExtensions = (pMWaitLeaf->uEcx & (X86_CPUID_MWAIT_ECX_EXT | X86_CPUID_MWAIT_ECX_BREAKIRQIF0)) 1882 == (X86_CPUID_MWAIT_ECX_EXT | X86_CPUID_MWAIT_ECX_BREAKIRQIF0); 1883 } 1880 == (X86_CPUID_MWAIT_ECX_EXT | X86_CPUID_MWAIT_ECX_BREAKIRQIF0); 1884 1881 1885 1882 /* Extended features. */ … … 2473 2470 CPUMISAEXTCFG enmPcid; 2474 2471 CPUMISAEXTCFG enmInvpcid; 2472 CPUMISAEXTCFG enmFlushCmdMsr; 2475 2473 2476 2474 CPUMISAEXTCFG enmAbm; … … 3274 3272 //| X86_CPUID_STEXT_FEATURE_EDX_IBRS_IBPB RT_BIT(26) 3275 3273 //| X86_CPUID_STEXT_FEATURE_EDX_STIBP RT_BIT(27) 3274 | (pConfig->enmFlushCmdMsr ? X86_CPUID_STEXT_FEATURE_EDX_FLUSH_CMD : 0) 3276 3275 //| X86_CPUID_STEXT_FEATURE_EDX_ARCHCAP RT_BIT(29) 3277 3276 ; … … 3302 3301 PORTABLE_DISABLE_FEATURE_BIT( 1, pCurLeaf->uEbx, SHA, X86_CPUID_STEXT_FEATURE_EBX_SHA); 3303 3302 PORTABLE_DISABLE_FEATURE_BIT( 1, pCurLeaf->uEcx, PREFETCHWT1, X86_CPUID_STEXT_FEATURE_ECX_PREFETCHWT1); 3303 PORTABLE_DISABLE_FEATURE_BIT_CFG(3, pCurLeaf->uEdx, FLUSH_CMD, X86_CPUID_STEXT_FEATURE_EDX_FLUSH_CMD, pConfig->enmFlushCmdMsr); 3304 3304 } 3305 3305 … … 3315 3315 if (pConfig->enmInvpcid == CPUMISAEXTCFG_ENABLED_ALWAYS) 3316 3316 pCurLeaf->uEbx |= X86_CPUID_STEXT_FEATURE_EBX_INVPCID; 3317 if (pConfig->enmFlushCmdMsr == CPUMISAEXTCFG_ENABLED_ALWAYS) 3318 pCurLeaf->uEdx |= X86_CPUID_STEXT_FEATURE_EDX_FLUSH_CMD; 3317 3319 break; 3318 3320 } … … 4122 4124 "|PCID" 4123 4125 "|INVPCID" 4126 "|FlushCmdMsr" 4124 4127 "|ABM" 4125 4128 "|SSE4A" … … 4277 4280 AssertLogRelRCReturn(rc, rc); 4278 4281 4282 /** @cfgm{/CPUM/IsaExts/FlushCmdMsr, isaextcfg, true} 4283 * Whether to expose the IA32_FLUSH_CMD MSR to the guest. 4284 */ 4285 rc = cpumR3CpuIdReadIsaExtCfg(pVM, pIsaExts, "FlushCmdMsr", &pConfig->enmFlushCmdMsr, CPUMISAEXTCFG_ENABLED_SUPPORTED); 4286 AssertLogRelRCReturn(rc, rc); 4287 4279 4288 4280 4289 /* AMD: */ … … 4419 4428 } 4420 4429 4430 /* 4431 * Setup MSRs introduced in microcode updates or that are otherwise not in 4432 * the CPU profile, but are advertised in the CPUID info we just sanitized. 4433 */ 4434 if (RT_SUCCESS(rc)) 4435 rc = cpumR3MsrReconcileWithCpuId(pVM); 4421 4436 /* 4422 4437 * MSR fudging. … … 4831 4846 if (!pMsrRange) 4832 4847 { 4848 /** @todo incorrect fWrGpMask. */ 4833 4849 static CPUMMSRRANGE const s_SpecCtrl = 4834 4850 { … … 4844 4860 } 4845 4861 4846 if (pVM->cpum.s.HostFeatures.fArchCap) { 4862 if (pVM->cpum.s.HostFeatures.fArchCap) 4863 { 4847 4864 pLeaf->uEdx |= X86_CPUID_STEXT_FEATURE_EDX_ARCHCAP; 4848 4865 … … 5025 5042 pLeaf = cpumR3CpuIdGetExactLeaf(&pVM->cpum.s, UINT32_C(0x00000007), 0); 5026 5043 if (pLeaf) 5027 /*pVM->cpum.s.aGuestCpuIdPatmStd[7].uEdx =*/ pLeaf->uEdx &= ~(X86_CPUID_STEXT_FEATURE_EDX_IBRS_IBPB | X86_CPUID_STEXT_FEATURE_EDX_STIBP | X86_CPUID_STEXT_FEATURE_EDX_ARCHCAP); 5044 pLeaf->uEdx &= ~( X86_CPUID_STEXT_FEATURE_EDX_IBRS_IBPB | X86_CPUID_STEXT_FEATURE_EDX_STIBP 5045 | X86_CPUID_STEXT_FEATURE_EDX_ARCHCAP); 5028 5046 pVM->cpum.s.GuestFeatures.fSpeculationControl = 0; 5029 5047 Log(("CPUM: ClearGuestCpuIdFeature: Disabled speculation control!\n")); … … 6342 6360 DBGFREGSUBFIELD_RO("IBRS_IBPB\0" "IA32_SPEC_CTRL.IBRS and IA32_PRED_CMD.IBPB", 26, 1, 0), 6343 6361 DBGFREGSUBFIELD_RO("STIBP\0" "Supports IA32_SPEC_CTRL.STIBP", 27, 1, 0), 6362 DBGFREGSUBFIELD_RO("FLUSH_CMD\0" "Supports IA32_FLUSH_CMD", 28, 1, 0), 6344 6363 DBGFREGSUBFIELD_RO("ARCHCAP\0" "Supports IA32_ARCH_CAP", 29, 1, 0), 6345 6364 DBGFREGSUBFIELD_TERMINATOR() -
trunk/src/VBox/VMM/VMMR3/CPUMR3Db.cpp
r76561 r76678 595 595 596 596 /** 597 * Reconciles CPUID info with MSRs (selected ones). 598 * 599 * @returns VBox status code. 600 * @param pVM The cross context VM structure. 601 */ 602 int cpumR3MsrReconcileWithCpuId(PVM pVM) 603 { 604 PCCPUMMSRRANGE papToAdd[10]; 605 uint32_t cToAdd = 0; 606 607 /* 608 * The IA32_FLUSH_CMD MSR was introduced in MCUs for CVS-2018-3646 and associates. 609 */ 610 if (pVM->cpum.s.GuestFeatures.fFlushCmd && !cpumLookupMsrRange(pVM, MSR_IA32_FLUSH_CMD)) 611 { 612 static CPUMMSRRANGE const s_FlushCmd = 613 { 614 /*.uFirst =*/ MSR_IA32_FLUSH_CMD, 615 /*.uLast =*/ MSR_IA32_FLUSH_CMD, 616 /*.enmRdFn =*/ kCpumMsrRdFn_WriteOnly, 617 /*.enmWrFn =*/ kCpumMsrWrFn_Ia32FlushCmd, 618 /*.offCpumCpu =*/ UINT16_MAX, 619 /*.fReserved =*/ 0, 620 /*.uValue =*/ 0, 621 /*.fWrIgnMask =*/ 0, 622 /*.fWrGpMask =*/ ~MSR_IA32_FLUSH_CMD_F_L1D, 623 /*.szName = */ "IA32_FLUSH_CMD" 624 }; 625 papToAdd[cToAdd++] = &s_FlushCmd; 626 } 627 628 /* 629 * Do the adding. 630 */ 631 for (uint32_t i = 0; i < cToAdd; i++) 632 { 633 PCCPUMMSRRANGE pRange = papToAdd[i]; 634 LogRel(("CPUM: MSR/CPUID reconciliation insert: %#010x %s\n", pRange->uFirst, pRange->szName)); 635 int rc = cpumR3MsrRangesInsert(NULL /* pVM */, &pVM->cpum.s.GuestInfo.paMsrRangesR3, &pVM->cpum.s.GuestInfo.cMsrRanges, 636 pRange); 637 if (RT_FAILURE(rc)) 638 return rc; 639 } 640 return VINF_SUCCESS; 641 } 642 643 644 /** 597 645 * Worker for cpumR3MsrApplyFudge that applies one table. 598 646 * -
trunk/src/VBox/VMM/VMMR3/HM.cpp
r76553 r76678 485 485 "|IBPBOnVMEntry" 486 486 "|SpecCtrlByHost" 487 "|L1DFlushOnSched" 488 "|L1DFlushOnVMEntry" 487 489 "|TPRPatchingEnabled" 488 490 "|64bitEnabled" … … 675 677 rc = CFGMR3QueryBoolDef(pCfgHm, "IBPBOnVMEntry", &pVM->hm.s.fIbpbOnVmEntry, false); 676 678 AssertLogRelRCReturn(rc, rc); 679 680 /** @cfgm{/HM/L1DFlushOnSched, bool, true} 681 * CVS-2018-3646 workaround, ignored on CPUs that aren't affected. */ 682 rc = CFGMR3QueryBoolDef(pCfgHm, "L1DFlushOnSched", &pVM->hm.s.fL1dFlushOnSched, true); 683 AssertLogRelRCReturn(rc, rc); 684 685 /** @cfgm{/HM/L1DFlushOnVMEntry, bool} 686 * CVS-2018-3646 workaround, ignored on CPUs that aren't affected. */ 687 rc = CFGMR3QueryBoolDef(pCfgHm, "L1DFlushOnVMEntry", &pVM->hm.s.fL1dFlushOnVmEntry, false); 688 AssertLogRelRCReturn(rc, rc); 689 690 /* Disable L1DFlushOnSched if L1DFlushOnVMEntry is enabled. */ 691 if (pVM->hm.s.fL1dFlushOnVmEntry) 692 pVM->hm.s.fL1dFlushOnSched = false; 677 693 678 694 /** @cfgm{/HM/SpecCtrlByHost, bool} … … 1293 1309 1294 1310 /* 1311 * Check if L1D flush is needed/possible. 1312 */ 1313 if ( !pVM->cpum.ro.HostFeatures.fFlushCmd 1314 || pVM->cpum.ro.HostFeatures.enmMicroarch < kCpumMicroarch_Intel_Core7_Nehalem 1315 || pVM->cpum.ro.HostFeatures.enmMicroarch >= kCpumMicroarch_Intel_Core7_End 1316 || pVM->cpum.ro.HostFeatures.fArchVmmNeedNotFlushL1d 1317 || pVM->cpum.ro.HostFeatures.fArchRdclNo) 1318 pVM->hm.s.fL1dFlushOnSched = pVM->hm.s.fL1dFlushOnVmEntry = false; 1319 1320 /* 1295 1321 * Sync options. 1296 1322 */ … … 1309 1335 pCpuCtx->fWorldSwitcher |= CPUMCTX_WSF_IBPB_ENTRY; 1310 1336 } 1337 if (pVM->cpum.ro.HostFeatures.fFlushCmd && pVM->hm.s.fL1dFlushOnVmEntry) 1338 pCpuCtx->fWorldSwitcher |= CPUMCTX_WSF_L1D_ENTRY; 1311 1339 if (iCpu == 0) 1312 LogRel(("HM: fWorldSwitcher=%#x (fIbpbOnVmExit=%RTbool fIbpbOnVmEntry=%RTbool)\n", 1313 pCpuCtx->fWorldSwitcher, pVM->hm.s.fIbpbOnVmExit, pVM->hm.s.fIbpbOnVmEntry)); 1340 LogRel(("HM: fWorldSwitcher=%#x (fIbpbOnVmExit=%RTbool fIbpbOnVmEntry=%RTbool fL1dFlushOnVmEntry=%RTbool); fL1dFlushOnSched=%RTbool\n", 1341 pCpuCtx->fWorldSwitcher, pVM->hm.s.fIbpbOnVmExit, pVM->hm.s.fIbpbOnVmEntry, pVM->hm.s.fL1dFlushOnVmEntry, 1342 pVM->hm.s.fL1dFlushOnSched)); 1314 1343 } 1315 1344
Note:
See TracChangeset
for help on using the changeset viewer.