Changeset 49988 in vbox
- Timestamp:
- Dec 19, 2013 2:55:16 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/tools/VBoxCpuReport.cpp
r49972 r49988 498 498 } 499 499 #if 0 500 else if (uMsr >= 0x c0011000 && uMsr <= 0xc0011100)500 else if (uMsr >= 0x00003170 && uMsr <= 0xc0000090) 501 501 { 502 502 vbCpuRepDebug("testing %#x...\n", uMsr); … … 523 523 if (!fGp) 524 524 fFlags = 0; 525 /* VIA HACK - writing to 0x0000317e on a quad core make the core unresponsive. */ 526 else if (uMsr == 0x0000317e && g_enmVendor == CPUMCPUVENDOR_VIA) 527 { 528 uValue = 0; 529 fFlags = VBCPUREPMSR_F_WRITE_ONLY; 530 fGp = *pcMsrs == 0 531 || (*ppaMsrs)[*pcMsrs - 1].uMsr != 0x0000317d 532 || (*ppaMsrs)[*pcMsrs - 1].fFlags != VBCPUREPMSR_F_WRITE_ONLY; 533 } 525 534 else 526 535 { 527 536 /* Is it a write only register? */ 528 537 #if 0 529 if (uMsr >= 0x c0011000 && uMsr <= 0xc0011100)538 if (uMsr >= 0x00003170 && uMsr <= 0xc0000090) 530 539 { 531 540 vbCpuRepDebug("test writing %#x...\n", uMsr); … … 567 576 if (RT_FAILURE(rc)) 568 577 return RTMsgErrorRc(rc, "Out of memory (uMsr=%#x).\n", uMsr); 569 vbCpuRepDebug("%#010x: uValue=%#llx fFlags=%#x\n", uMsr, uValue, fFlags); 578 if ( g_enmVendor != CPUMCPUVENDOR_VIA 579 || uValue 580 || fFlags) 581 vbCpuRepDebug("%#010x: uValue=%#llx fFlags=%#x\n", uMsr, uValue, fFlags); 570 582 } 571 583 } … … 1118 1130 case 0x0000103f: return "P6_UNK_0000_103f"; /* P6_M_Dothan. */ 1119 1131 case 0x000010cd: return "P6_UNK_0000_10cd"; /* P6_M_Dothan. */ 1132 1133 case 0x00001107: return "VIA_UNK_0000_1107"; 1134 case 0x0000110f: return "VIA_UNK_0000_110f"; 1135 case 0x00001153: return "VIA_UNK_0000_1153"; 1136 case 0x00001200: return "VIA_UNK_0000_1200"; 1137 case 0x00001201: return "VIA_UNK_0000_1201"; 1138 case 0x00001202: return "VIA_UNK_0000_1202"; 1139 case 0x00001203: return "VIA_UNK_0000_1203"; 1140 case 0x00001204: return "VIA_UNK_0000_1204"; 1141 case 0x00001205: return "VIA_UNK_0000_1205"; 1142 case 0x00001206: return "VIA_ALT_VENDOR_EBX"; 1143 case 0x00001207: return "VIA_ALT_VENDOR_ECDX"; 1144 case 0x00001208: return "VIA_UNK_0000_1208"; 1145 case 0x00001209: return "VIA_UNK_0000_1209"; 1146 case 0x0000120a: return "VIA_UNK_0000_120a"; 1147 case 0x0000120b: return "VIA_UNK_0000_120b"; 1148 case 0x0000120c: return "VIA_UNK_0000_120c"; 1149 case 0x0000120d: return "VIA_UNK_0000_120d"; 1150 case 0x0000120e: return "VIA_UNK_0000_120e"; 1151 case 0x0000120f: return "VIA_UNK_0000_120f"; 1152 case 0x00001210: return "VIA_UNK_0000_1210"; 1153 case 0x00001211: return "VIA_UNK_0000_1211"; 1154 case 0x00001212: return "VIA_UNK_0000_1212"; 1155 case 0x00001213: return "VIA_UNK_0000_1213"; 1156 case 0x00001214: return "VIA_UNK_0000_1214"; 1157 case 0x00001220: return "VIA_UNK_0000_1220"; 1158 case 0x00001221: return "VIA_UNK_0000_1221"; 1159 case 0x00001230: return "VIA_UNK_0000_1230"; 1160 case 0x00001231: return "VIA_UNK_0000_1231"; 1161 case 0x00001232: return "VIA_UNK_0000_1232"; 1162 case 0x00001233: return "VIA_UNK_0000_1233"; 1163 case 0x00001234: return "VIA_UNK_0000_1234"; 1164 case 0x00001235: return "VIA_UNK_0000_1235"; 1165 case 0x00001236: return "VIA_UNK_0000_1236"; 1166 case 0x00001237: return "VIA_UNK_0000_1237"; 1167 case 0x00001238: return "VIA_UNK_0000_1238"; 1168 case 0x00001239: return "VIA_UNK_0000_1239"; 1169 case 0x00001240: return "VIA_UNK_0000_1240"; 1170 case 0x00001241: return "VIA_UNK_0000_1241"; 1171 case 0x00001243: return "VIA_UNK_0000_1243"; 1172 case 0x00001245: return "VIA_UNK_0000_1245"; 1173 case 0x00001246: return "VIA_UNK_0000_1246"; 1174 case 0x00001247: return "VIA_UNK_0000_1247"; 1175 case 0x00001248: return "VIA_UNK_0000_1248"; 1176 case 0x00001249: return "VIA_UNK_0000_1249"; 1177 case 0x0000124a: return "VIA_UNK_0000_124a"; 1178 1120 1179 case 0x00002000: return "P6_CR0"; 1121 1180 case 0x00002002: return "P6_CR2"; … … 2194 2253 case 0x00000053: 2195 2254 case 0x00000054: 2255 2196 2256 case 0x00001006: 2197 2257 case 0x00001007: 2258 return VBCPUREPBADNESS_BOND_VILLAIN; 2259 2260 case 0x0000120e: 2261 case 0x00001233: 2262 case 0x00001239: 2263 case 0x00001249: 2264 case 0x0000124a: 2265 if (g_enmVendor == CPUMCPUVENDOR_VIA) 2266 return VBCPUREPBADNESS_BOND_VILLAIN; 2267 break; 2268 2198 2269 case 0xc0010010: 2199 2270 case 0xc0010016: … … 2203 2274 case 0xc001001a: 2204 2275 case 0xc001001d: 2205 case 0xc001101e:2206 2276 case 0xc0010064: /* P-state fequency, voltage, ++. */ 2207 2277 case 0xc0010065: /* P-state fequency, voltage, ++. */ … … 2213 2283 case 0xc001006b: /* P-state fequency, voltage, ++. */ 2214 2284 case 0xc0010070: /* COFVID Control. */ 2285 case 0xc001101e: 2215 2286 case 0xc0011021: /* IC_CFG (instruction cache configuration) */ 2216 2287 case 0xc0011023: /* CU_CFG (combined unit configuration) */ … … 2233 2304 return VBCPUREPBADNESS_MOSTLY_HARMLESS; 2234 2305 } 2306 2307 2308 /** 2309 * Checks if this might be a VIA dummy register. 2310 * 2311 * @returns true if it's a dummy, false if it isn't. 2312 * @param uMsr The MSR. 2313 * @param uValue The value. 2314 * @param fFlags The flags. 2315 */ 2316 static bool isMsrViaDummy(uint32_t uMsr, uint64_t uValue, uint32_t fFlags) 2317 { 2318 if (g_enmVendor != CPUMCPUVENDOR_VIA) 2319 return false; 2320 2321 if (uValue) 2322 return false; 2323 2324 if (fFlags) 2325 return false; 2326 2327 switch (uMsr) 2328 { 2329 case 0x00000010: 2330 case 0x0000001b: 2331 case 0x000000c1: 2332 case 0x000000c2: 2333 case 0x0000011e: 2334 case 0x00000186: 2335 case 0x00000187: 2336 //case 0x00000200 ... (mtrrs will be detected) 2337 return false; 2338 2339 case 0xc0000080: 2340 case 0xc0000081: 2341 case 0xc0000082: 2342 case 0xc0000083: 2343 if (vbCpuRepSupportsLongMode()) 2344 return false; 2345 break; 2346 } 2347 2348 if (uMsr >= 0x00001200 && uMsr <= 0x00003fff && queryMsrWriteBadness(uMsr) != VBCPUREPBADNESS_MOSTLY_HARMLESS) 2349 return false; 2350 2351 if ( !msrProberModifyNoChange(uMsr) 2352 && !msrProberModifyZero(uMsr)) 2353 return false; 2354 2355 uint64_t fIgnMask = 0; 2356 uint64_t fGpMask = 0; 2357 int rc = msrProberModifyBitChanges(uMsr, &fIgnMask, &fGpMask, 0); 2358 if (RT_FAILURE(rc)) 2359 return false; 2360 2361 if (fIgnMask != UINT64_MAX) 2362 return false; 2363 if (fGpMask != 0) 2364 return false; 2365 2366 return true; 2367 } 2368 2235 2369 2236 2370 … … 2302 2436 2303 2437 2304 static int printMsrValueIgnoreWrites(uint32_t uMsr, uint64_t uValue, const char *pszAnnotation) 2305 { 2306 vbCpuRepPrintf(" MVI(%#010x, \"%s\"", uMsr, getMsrName(uMsr)); 2438 2439 static int printMsrValueIgnoreWritesNamed(uint32_t uMsr, uint64_t uValue, const char *pszName, const char *pszAnnotation) 2440 { 2441 vbCpuRepPrintf(" MVI(%#010x, \"%s\"", uMsr, pszName); 2307 2442 printMsrValueU64(uValue); 2308 2443 vbCpuRepPrintf("),"); … … 2311 2446 printMsrNewLine(); 2312 2447 return VINF_SUCCESS; 2448 } 2449 2450 2451 static int printMsrValueIgnoreWrites(uint32_t uMsr, uint64_t uValue, const char *pszAnnotation) 2452 { 2453 return printMsrValueIgnoreWritesNamed(uMsr, uValue, getMsrName(uMsr), pszAnnotation); 2313 2454 } 2314 2455 … … 2341 2482 2342 2483 2343 static int printMsrRangeValueIgnoreWrites (uint32_t uMsr, uint32_t uLast, uint64_t uValue, const char *pszAnnotation)2344 { 2345 vbCpuRepPrintf(" RVI(%#010x, %#010x, \"%s\"", uMsr, uLast, getMsrRangeName(uMsr));2484 static int printMsrRangeValueIgnoreWritesNamed(uint32_t uMsr, uint32_t uLast, uint64_t uValue, const char *pszName, const char *pszAnnotation) 2485 { 2486 vbCpuRepPrintf(" RVI(%#010x, %#010x, \"%s\"", uMsr, uLast, pszName); 2346 2487 printMsrValueU64(uValue); 2347 2488 vbCpuRepPrintf("),"); … … 2350 2491 printMsrNewLine(); 2351 2492 return VINF_SUCCESS; 2493 } 2494 2495 2496 static int printMsrRangeValueIgnoreWrites(uint32_t uMsr, uint32_t uLast, uint64_t uValue, const char *pszAnnotation) 2497 { 2498 return printMsrRangeValueIgnoreWritesNamed(uMsr, uLast, uValue, getMsrRangeName(uMsr), pszAnnotation); 2352 2499 } 2353 2500 … … 2581 2728 return s_szBuf; 2582 2729 } 2583 2584 2730 2585 2731 … … 2732 2878 || fGpMaskN != fGpMask0) 2733 2879 { 2734 if (!fEarlyEndOk )2880 if (!fEarlyEndOk && !isMsrViaDummy(uMsr, paMsrs[i].uValue, paMsrs[i].fFlags)) 2735 2881 { 2736 2882 vbCpuRepDebug("MSR %s (%#x) range ended unexpectedly early on %#x: ro=%d ign=%#llx/%#llx gp=%#llx/%#llx [N/0]\n", … … 2822 2968 2823 2969 /** 2970 * Reports a VIA dummy range. 2971 * 2972 * @returns VBox status code. 2973 * @param paMsrs Pointer to the first MSR. 2974 * @param cMsrs The number of MSRs in the array @a paMsr. 2975 * @param pidxLoop Index variable that should be advanced to the 2976 * last MSR entry in the range. 2977 */ 2978 static int reportMsr_ViaDummyRange(VBCPUREPMSR const *paMsrs, uint32_t cMsrs, uint32_t *pidxLoop) 2979 { 2980 /* Figure how many. */ 2981 uint32_t uMsr = paMsrs[0].uMsr; 2982 uint32_t cRegs = 1; 2983 while ( cRegs < cMsrs 2984 && paMsrs[cRegs].uMsr == uMsr + cRegs 2985 && isMsrViaDummy(paMsrs[cRegs].uMsr, paMsrs[cRegs].uValue, paMsrs[cRegs].fFlags)) 2986 { 2987 cRegs++; 2988 if (!(cRegs % 0x80)) 2989 vbCpuRepPrintf("VIA dummy detection cRegs=%#x...\n", cRegs); 2990 } 2991 2992 /* Advance. */ 2993 *pidxLoop += cRegs - 1; 2994 2995 /* Report it/them. */ 2996 char szName[80]; 2997 if (cRegs == 1) 2998 { 2999 RTStrPrintf(szName, sizeof(szName), "ZERO_%04x_%04x", RT_HI_U16(uMsr), RT_LO_U16(uMsr)); 3000 return printMsrValueIgnoreWritesNamed(uMsr, 0, szName, NULL); 3001 } 3002 3003 uint32_t uMsrLast = uMsr + cRegs - 1; 3004 RTStrPrintf(szName, sizeof(szName), "ZERO_%04x_%04x_THRU_%04x_%04x", 3005 RT_HI_U16(uMsr), RT_LO_U16(uMsr), RT_HI_U16(uMsrLast), RT_LO_U16(uMsrLast)); 3006 return printMsrRangeValueIgnoreWritesNamed(uMsr, uMsrLast, 0, szName, NULL); 3007 } 3008 3009 3010 /** 2824 3011 * Special function for reporting the IA32_APIC_BASE register, as it seems to be 2825 3012 * causing trouble on newer systems. … … 2923 3110 uint32_t cRegs = 1; 2924 3111 while ( cRegs < cMsrs 2925 && paMsrs[cRegs].uMsr == uMsr + cRegs) 3112 && paMsrs[cRegs].uMsr == uMsr + cRegs 3113 && !isMsrViaDummy(paMsrs[cRegs].uMsr, paMsrs[cRegs].uValue, paMsrs[cRegs].fFlags) ) 2926 3114 cRegs++; 2927 3115 if (cRegs & 1) … … 3624 3812 int rc; 3625 3813 #if 1 3626 if (uMsr >= 0xc0000000 && g_fIntelNetBurst) 3814 if (uMsr < 0x00001200) 3815 continue; 3816 if (uMsr >= 0x00001238) 3627 3817 { 3628 3818 vbCpuRepDebug("produceMsrReport: uMsr=%#x (%s)...\n", uMsr, getMsrNameHandled(uMsr)); … … 3640 3830 rc = reportMsr_Generic(uMsr, fFlags, uValue); 3641 3831 } 3832 /* 3833 * VIA implement MSRs in a interesting way, so we have to select what we 3834 * want to handle there to avoid making the code below unreadable. 3835 */ 3836 else if (isMsrViaDummy(uMsr, uValue, fFlags)) 3837 rc = reportMsr_ViaDummyRange(&paMsrs[i], cMsrs - i, &i); 3642 3838 /* 3643 3839 * This shall be sorted by uMsr as much as possible. … … 3718 3914 else if (uMsr >= 0xc0000408 && uMsr <= 0xc000040f) 3719 3915 rc = reportMsr_AmdFam10hMc4MiscN(&paMsrs[i], cMsrs - i, &i); 3720 else if (uMsr == 0xc0010000 )3916 else if (uMsr == 0xc0010000 && g_enmVendor == CPUMCPUVENDOR_AMD) 3721 3917 rc = reportMsr_AmdK8PerfCtlN(&paMsrs[i], cMsrs - i, &i); 3722 else if (uMsr == 0xc0010004 )3918 else if (uMsr == 0xc0010004 && g_enmVendor == CPUMCPUVENDOR_AMD) 3723 3919 rc = reportMsr_AmdK8PerfCtrN(&paMsrs[i], cMsrs - i, &i); 3724 else if (uMsr == 0xc0010010 )3920 else if (uMsr == 0xc0010010 && g_enmVendor == CPUMCPUVENDOR_AMD) 3725 3921 rc = reportMsr_AmdK8SysCfg(uMsr, uValue); 3726 else if (uMsr == 0xc0010015 )3922 else if (uMsr == 0xc0010015 && g_enmVendor == CPUMCPUVENDOR_AMD) 3727 3923 rc = reportMsr_AmdK8HwCr(uMsr, uValue); 3728 else if ( uMsr == 0xc0010016 || uMsr == 0xc0010018)3924 else if ((uMsr == 0xc0010016 || uMsr == 0xc0010018) && g_enmVendor == CPUMCPUVENDOR_AMD) 3729 3925 rc = reportMsr_AmdK8IorrBaseN(uMsr, uValue); 3730 else if ( uMsr == 0xc0010017 || uMsr == 0xc0010019)3926 else if ((uMsr == 0xc0010017 || uMsr == 0xc0010019) && g_enmVendor == CPUMCPUVENDOR_AMD) 3731 3927 rc = reportMsr_AmdK8IorrMaskN(uMsr, uValue); 3732 else if ( uMsr == 0xc001001a || uMsr == 0xc001001d)3928 else if ((uMsr == 0xc001001a || uMsr == 0xc001001d) && g_enmVendor == CPUMCPUVENDOR_AMD) 3733 3929 rc = reportMsr_AmdK8TopMemN(uMsr, uValue); 3734 else if (uMsr == 0xc0010030 )3930 else if (uMsr == 0xc0010030 && g_enmVendor == CPUMCPUVENDOR_AMD) 3735 3931 rc = reportMsr_GenRangeFunction(&paMsrs[i], cMsrs - i, 6, "AmdK8CpuNameN", &i); 3736 else if (uMsr >= 0xc0010044 && uMsr <= 0xc001004a )3932 else if (uMsr >= 0xc0010044 && uMsr <= 0xc001004a && g_enmVendor == CPUMCPUVENDOR_AMD) 3737 3933 rc = reportMsr_GenRangeFunctionEx(&paMsrs[i], cMsrs - i, 7, "AmdK8McCtlMaskN", 0xc0010044, true /*fEarlyEndOk*/, false, 0, &i); 3738 else if (uMsr == 0xc0010050 )3934 else if (uMsr == 0xc0010050 && g_enmVendor == CPUMCPUVENDOR_AMD) 3739 3935 rc = reportMsr_GenRangeFunction(&paMsrs[i], cMsrs - i, 4, "AmdK8SmiOnIoTrapN", &i); 3740 else if (uMsr == 0xc0010064 )3936 else if (uMsr == 0xc0010064 && g_enmVendor == CPUMCPUVENDOR_AMD) 3741 3937 rc = reportMsr_AmdFam10hPStateN(&paMsrs[i], cMsrs - i, &i); 3742 else if (uMsr == 0xc0010070 )3938 else if (uMsr == 0xc0010070 && g_enmVendor == CPUMCPUVENDOR_AMD) 3743 3939 rc = reportMsr_AmdFam10hCofVidControl(uMsr, uValue); 3744 else if ((uMsr == 0xc0010118 || uMsr == 0xc0010119) && getMsrFnName(uMsr, NULL) )3940 else if ((uMsr == 0xc0010118 || uMsr == 0xc0010119) && getMsrFnName(uMsr, NULL) && g_enmVendor == CPUMCPUVENDOR_AMD) 3745 3941 rc = printMsrFunction(uMsr, NULL, NULL, annotateValue(uValue)); /* RAZ, write key. */ 3746 else if (uMsr == 0xc0010200 )3942 else if (uMsr == 0xc0010200 && g_enmVendor == CPUMCPUVENDOR_AMD) 3747 3943 rc = reportMsr_AmdGenPerfMixedRange(&paMsrs[i], cMsrs - i, 12, &i); 3748 else if (uMsr == 0xc0010230 )3944 else if (uMsr == 0xc0010230 && g_enmVendor == CPUMCPUVENDOR_AMD) 3749 3945 rc = reportMsr_AmdGenPerfMixedRange(&paMsrs[i], cMsrs - i, 8, &i); 3750 else if (uMsr == 0xc0010240 )3946 else if (uMsr == 0xc0010240 && g_enmVendor == CPUMCPUVENDOR_AMD) 3751 3947 rc = reportMsr_AmdGenPerfMixedRange(&paMsrs[i], cMsrs - i, 8, &i); 3752 else if (uMsr == 0xc0011019 && g_enmMicroarch >= kCpumMicroarch_AMD_15h_Piledriver )3948 else if (uMsr == 0xc0011019 && g_enmMicroarch >= kCpumMicroarch_AMD_15h_Piledriver && g_enmVendor == CPUMCPUVENDOR_AMD) 3753 3949 rc = reportMsr_GenRangeFunctionEx(&paMsrs[i], cMsrs - i, 3, "AmdK7DrXAddrMaskN", 0xc0011019 - 1, 3754 3950 false /*fEarlyEndOk*/, false /*fNoIgnMask*/, 0, &i); 3755 else if (uMsr == 0xc0011021 )3951 else if (uMsr == 0xc0011021 && g_enmVendor == CPUMCPUVENDOR_AMD) 3756 3952 rc = reportMsr_AmdK7InstrCacheCfg(uMsr, uValue); 3757 3953 else if (uMsr == 0xc0011023 && CPUMMICROARCH_IS_AMD_FAM_15H(g_enmMicroarch)) 3758 3954 rc = reportMsr_AmdFam15hCombUnitCfg(uMsr, uValue); 3759 else if (uMsr == 0xc0011027 )3955 else if (uMsr == 0xc0011027 && g_enmVendor == CPUMCPUVENDOR_AMD) 3760 3956 rc = reportMsr_GenRangeFunctionEx(&paMsrs[i], cMsrs - i, 1, "AmdK7DrXAddrMaskN", 0xc0011027, 3761 3957 false /*fEarlyEndOk*/, false /*fNoIgnMask*/, 0, &i); … … 4073 4269 /* Make it C/C++ acceptable. */ 4074 4270 strcpy(szNameC, pszName); 4075 for (char *psz = szNameC; *psz; psz++) 4076 if (!RT_C_IS_ALNUM(*psz) && *psz != '_') 4077 *psz = '_'; 4078 for (size_t off = strlen(szNameC); off > 1 && szNameC[off - 1] == '_'; off--) 4079 szNameC[off - 1] = '\0'; 4271 unsigned offDst = 0; 4272 for (unsigned offSrc = 0; ; offSrc++) 4273 { 4274 char ch = szNameC[offSrc]; 4275 if (!RT_C_IS_ALNUM(ch) && ch != '_' && ch != '\0') 4276 ch = '_'; 4277 if (ch == '_' && offDst > 0 && szNameC[offDst - 1] == '_') 4278 offDst--; 4279 szNameC[offDst++] = ch; 4280 if (!ch) 4281 break; 4282 } 4283 while (offDst > 1 && szNameC[offDst - 1] == '_') 4284 szNameC[--offDst] = '\0'; 4285 4080 4286 vbCpuRepDebug("NameC: %s\n", szNameC); 4081 4287 } … … 4232 4438 } enmOp = kCpuReportOp_Normal; 4233 4439 g_pReportOut = NULL; 4234 g_pDebugOut = g_pStdErr;4440 g_pDebugOut = NULL; 4235 4441 const char *pszOutput = NULL; 4236 4442 const char *pszDebugOut = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.