Lines Matching full:msr
267 int get_msr(int cpu, off_t offset, unsigned long long *msr);
319 unsigned long long msr = 3; in slm_bclk() local
323 if (get_msr(base_cpu, MSR_FSB_FREQ, &msr)) in slm_bclk()
326 i = msr & 0xf; in slm_bclk()
1033 * The accumulated sum of MSR is defined as a monotonic
1034 * increasing MSR, it will be accumulated periodically,
1047 int get_msr_sum(int cpu, off_t offset, unsigned long long *msr);
1052 /*The accumulated MSR value is updated by the timer */
1054 /*The MSR footprint recorded in last timer */
1059 /* The percpu MSR sum array.*/
1280 sprintf(pathname, "/dev/cpu/%d/msr", cpu); in get_msr_fd()
1283 err(-1, "%s open failed, try chown or chmod +r /dev/cpu/*/msr, or run as root", pathname); in get_msr_fd()
1325 int get_msr(int cpu, off_t offset, unsigned long long *msr) in get_msr() argument
1329 retval = pread(get_msr_fd(cpu), msr, sizeof(*msr), offset); in get_msr()
1331 if (retval != sizeof *msr) in get_msr()
1332 err(-1, "cpu%d: msr offset 0x%llx read failed", cpu, (unsigned long long)offset); in get_msr()
2217 * Some models have a dedicated C1 residency MSR, in delta_thread()
2611 unsigned long long msr; in get_epb() local
2630 get_msr(cpu, MSR_IA32_ENERGY_PERF_BIAS, &msr); in get_epb()
2632 return msr & 0xf; in get_epb()
2711 unsigned long long msr; in get_counters() local
2791 if (get_msr(cpu, MSR_SMI_COUNT, &msr)) in get_counters()
2793 t->smi_count = msr & 0xFFFFFFFF; in get_counters()
2841 if (get_msr(cpu, MSR_IA32_THERM_STATUS, &msr)) in get_counters()
2843 c->core_temp_c = tj_max - ((msr >> 16) & 0x7F); in get_counters()
2850 if (get_msr(cpu, MSR_CORE_ENERGY_STAT, &msr)) in get_counters()
2852 c->core_energy = msr & 0xFFFFFFFF; in get_counters()
2915 if (get_msr_sum(cpu, MSR_PKG_ENERGY_STATUS, &msr)) in get_counters()
2917 p->energy_pkg = msr; in get_counters()
2920 if (get_msr_sum(cpu, MSR_PP0_ENERGY_STATUS, &msr)) in get_counters()
2922 p->energy_cores = msr; in get_counters()
2925 if (get_msr_sum(cpu, MSR_DRAM_ENERGY_STATUS, &msr)) in get_counters()
2927 p->energy_dram = msr; in get_counters()
2930 if (get_msr_sum(cpu, MSR_PP1_ENERGY_STATUS, &msr)) in get_counters()
2932 p->energy_gfx = msr; in get_counters()
2935 if (get_msr_sum(cpu, MSR_PKG_PERF_STATUS, &msr)) in get_counters()
2937 p->rapl_pkg_perf_status = msr; in get_counters()
2940 if (get_msr_sum(cpu, MSR_DRAM_PERF_STATUS, &msr)) in get_counters()
2942 p->rapl_dram_perf_status = msr; in get_counters()
2945 if (get_msr_sum(cpu, MSR_PKG_ENERGY_STAT, &msr)) in get_counters()
2947 p->energy_pkg = msr; in get_counters()
2950 if (get_msr(cpu, MSR_IA32_PACKAGE_THERM_STATUS, &msr)) in get_counters()
2952 p->pkg_temp_c = tj_max - ((msr >> 16) & 0x7F); in get_counters()
3053 unsigned long long msr; in probe_cst_limit() local
3091 get_msr(base_cpu, MSR_PKG_CST_CONFIG_CONTROL, &msr); in probe_cst_limit()
3092 pkg_cstate_limit = pkg_cstate_limits[msr & 0xF]; in probe_cst_limit()
3097 unsigned long long msr; in dump_platform_info() local
3103 get_msr(base_cpu, MSR_PLATFORM_INFO, &msr); in dump_platform_info()
3105 fprintf(outf, "cpu%d: MSR_PLATFORM_INFO: 0x%08llx\n", base_cpu, msr); in dump_platform_info()
3107 ratio = (msr >> 40) & 0xFF; in dump_platform_info()
3110 ratio = (msr >> 8) & 0xFF; in dump_platform_info()
3116 unsigned long long msr; in dump_power_ctl() local
3121 get_msr(base_cpu, MSR_IA32_POWER_CTL, &msr); in dump_power_ctl()
3123 base_cpu, msr, msr & 0x2 ? "EN" : "DIS"); in dump_power_ctl()
3127 fprintf(outf, "C-state Pre-wake: %sabled\n", msr & 0x40000000 ? "DIS" : "EN"); in dump_power_ctl()
3134 unsigned long long msr; in dump_turbo_ratio_limit2() local
3137 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT2, &msr); in dump_turbo_ratio_limit2()
3139 fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT2: 0x%08llx\n", base_cpu, msr); in dump_turbo_ratio_limit2()
3141 ratio = (msr >> 8) & 0xFF; in dump_turbo_ratio_limit2()
3145 ratio = (msr >> 0) & 0xFF; in dump_turbo_ratio_limit2()
3153 unsigned long long msr; in dump_turbo_ratio_limit1() local
3156 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT1, &msr); in dump_turbo_ratio_limit1()
3158 fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT1: 0x%08llx\n", base_cpu, msr); in dump_turbo_ratio_limit1()
3160 ratio = (msr >> 56) & 0xFF; in dump_turbo_ratio_limit1()
3164 ratio = (msr >> 48) & 0xFF; in dump_turbo_ratio_limit1()
3168 ratio = (msr >> 40) & 0xFF; in dump_turbo_ratio_limit1()
3172 ratio = (msr >> 32) & 0xFF; in dump_turbo_ratio_limit1()
3176 ratio = (msr >> 24) & 0xFF; in dump_turbo_ratio_limit1()
3180 ratio = (msr >> 16) & 0xFF; in dump_turbo_ratio_limit1()
3184 ratio = (msr >> 8) & 0xFF; in dump_turbo_ratio_limit1()
3188 ratio = (msr >> 0) & 0xFF; in dump_turbo_ratio_limit1()
3196 unsigned long long msr, core_counts; in dump_turbo_ratio_limits() local
3199 get_msr(base_cpu, trl_msr_offset, &msr); in dump_turbo_ratio_limits()
3201 base_cpu, trl_msr_offset == MSR_SECONDARY_TURBO_RATIO_LIMIT ? "SECONDARY_" : "", msr); in dump_turbo_ratio_limits()
3213 ratio = (msr >> shift) & 0xFF; in dump_turbo_ratio_limits()
3225 unsigned long long msr; in dump_atom_turbo_ratio_limits() local
3228 get_msr(base_cpu, MSR_ATOM_CORE_RATIOS, &msr); in dump_atom_turbo_ratio_limits()
3229 fprintf(outf, "cpu%d: MSR_ATOM_CORE_RATIOS: 0x%08llx\n", base_cpu, msr & 0xFFFFFFFF); in dump_atom_turbo_ratio_limits()
3231 ratio = (msr >> 0) & 0x3F; in dump_atom_turbo_ratio_limits()
3235 ratio = (msr >> 8) & 0x3F; in dump_atom_turbo_ratio_limits()
3239 ratio = (msr >> 16) & 0x3F; in dump_atom_turbo_ratio_limits()
3243 get_msr(base_cpu, MSR_ATOM_CORE_TURBO_RATIOS, &msr); in dump_atom_turbo_ratio_limits()
3244 fprintf(outf, "cpu%d: MSR_ATOM_CORE_TURBO_RATIOS: 0x%08llx\n", base_cpu, msr & 0xFFFFFFFF); in dump_atom_turbo_ratio_limits()
3246 ratio = (msr >> 24) & 0x3F; in dump_atom_turbo_ratio_limits()
3250 ratio = (msr >> 16) & 0x3F; in dump_atom_turbo_ratio_limits()
3254 ratio = (msr >> 8) & 0x3F; in dump_atom_turbo_ratio_limits()
3258 ratio = (msr >> 0) & 0x3F; in dump_atom_turbo_ratio_limits()
3267 unsigned long long msr; in dump_knl_turbo_ratio_limits() local
3273 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT, &msr); in dump_knl_turbo_ratio_limits()
3275 fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT: 0x%08llx\n", base_cpu, msr); in dump_knl_turbo_ratio_limits()
3301 cores[b_nr] = (msr & 0xFF) >> 1; in dump_knl_turbo_ratio_limits()
3302 ratio[b_nr] = (msr >> 8) & 0xFF; in dump_knl_turbo_ratio_limits()
3305 delta_cores = (msr >> i) & 0x1F; in dump_knl_turbo_ratio_limits()
3306 delta_ratio = (msr >> (i + 5)) & 0x7; in dump_knl_turbo_ratio_limits()
3322 unsigned long long msr; in dump_cst_cfg() local
3327 get_msr(base_cpu, MSR_PKG_CST_CONFIG_CONTROL, &msr); in dump_cst_cfg()
3329 fprintf(outf, "cpu%d: MSR_PKG_CST_CONFIG_CONTROL: 0x%08llx", base_cpu, msr); in dump_cst_cfg()
3332 (msr & SNB_C3_AUTO_UNDEMOTE) ? "UNdemote-C3, " : "", in dump_cst_cfg()
3333 (msr & SNB_C1_AUTO_UNDEMOTE) ? "UNdemote-C1, " : "", in dump_cst_cfg()
3334 (msr & NHM_C3_AUTO_DEMOTE) ? "demote-C3, " : "", in dump_cst_cfg()
3335 (msr & NHM_C1_AUTO_DEMOTE) ? "demote-C1, " : "", in dump_cst_cfg()
3336 …(msr & (1 << 15)) ? "" : "UN", (unsigned int)msr & 0xF, pkg_cstate_limit_strings[pkg_cstate_limit]… in dump_cst_cfg()
3340 …fprintf(outf, ", automatic c-state conversion=%s", (msr & AUTOMATIC_CSTATE_CONVERSION) ? "on" : "o… in dump_cst_cfg()
3350 unsigned long long msr; in dump_config_tdp() local
3352 get_msr(base_cpu, MSR_CONFIG_TDP_NOMINAL, &msr); in dump_config_tdp()
3353 fprintf(outf, "cpu%d: MSR_CONFIG_TDP_NOMINAL: 0x%08llx", base_cpu, msr); in dump_config_tdp()
3354 fprintf(outf, " (base_ratio=%d)\n", (unsigned int)msr & 0xFF); in dump_config_tdp()
3356 get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_1, &msr); in dump_config_tdp()
3357 fprintf(outf, "cpu%d: MSR_CONFIG_TDP_LEVEL_1: 0x%08llx (", base_cpu, msr); in dump_config_tdp()
3358 if (msr) { in dump_config_tdp()
3359 fprintf(outf, "PKG_MIN_PWR_LVL1=%d ", (unsigned int)(msr >> 48) & 0x7FFF); in dump_config_tdp()
3360 fprintf(outf, "PKG_MAX_PWR_LVL1=%d ", (unsigned int)(msr >> 32) & 0x7FFF); in dump_config_tdp()
3361 fprintf(outf, "LVL1_RATIO=%d ", (unsigned int)(msr >> 16) & 0xFF); in dump_config_tdp()
3362 fprintf(outf, "PKG_TDP_LVL1=%d", (unsigned int)(msr) & 0x7FFF); in dump_config_tdp()
3366 get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_2, &msr); in dump_config_tdp()
3367 fprintf(outf, "cpu%d: MSR_CONFIG_TDP_LEVEL_2: 0x%08llx (", base_cpu, msr); in dump_config_tdp()
3368 if (msr) { in dump_config_tdp()
3369 fprintf(outf, "PKG_MIN_PWR_LVL2=%d ", (unsigned int)(msr >> 48) & 0x7FFF); in dump_config_tdp()
3370 fprintf(outf, "PKG_MAX_PWR_LVL2=%d ", (unsigned int)(msr >> 32) & 0x7FFF); in dump_config_tdp()
3371 fprintf(outf, "LVL2_RATIO=%d ", (unsigned int)(msr >> 16) & 0xFF); in dump_config_tdp()
3372 fprintf(outf, "PKG_TDP_LVL2=%d", (unsigned int)(msr) & 0x7FFF); in dump_config_tdp()
3376 get_msr(base_cpu, MSR_CONFIG_TDP_CONTROL, &msr); in dump_config_tdp()
3377 fprintf(outf, "cpu%d: MSR_CONFIG_TDP_CONTROL: 0x%08llx (", base_cpu, msr); in dump_config_tdp()
3378 if ((msr) & 0x3) in dump_config_tdp()
3379 fprintf(outf, "TDP_LEVEL=%d ", (unsigned int)(msr) & 0x3); in dump_config_tdp()
3380 fprintf(outf, " lock=%d", (unsigned int)(msr >> 31) & 1); in dump_config_tdp()
3383 get_msr(base_cpu, MSR_TURBO_ACTIVATION_RATIO, &msr); in dump_config_tdp()
3384 fprintf(outf, "cpu%d: MSR_TURBO_ACTIVATION_RATIO: 0x%08llx (", base_cpu, msr); in dump_config_tdp()
3385 fprintf(outf, "MAX_NON_TURBO_RATIO=%d", (unsigned int)(msr) & 0xFF); in dump_config_tdp()
3386 fprintf(outf, " lock=%d", (unsigned int)(msr >> 31) & 1); in dump_config_tdp()
3394 unsigned long long msr; in print_irtl() local
3400 get_msr(base_cpu, MSR_PKGC3_IRTL, &msr); in print_irtl()
3401 fprintf(outf, "cpu%d: MSR_PKGC3_IRTL: 0x%08llx (", base_cpu, msr); in print_irtl()
3402 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", in print_irtl()
3403 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); in print_irtl()
3407 get_msr(base_cpu, MSR_PKGC6_IRTL, &msr); in print_irtl()
3408 fprintf(outf, "cpu%d: MSR_PKGC6_IRTL: 0x%08llx (", base_cpu, msr); in print_irtl()
3409 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", in print_irtl()
3410 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); in print_irtl()
3414 get_msr(base_cpu, MSR_PKGC7_IRTL, &msr); in print_irtl()
3415 fprintf(outf, "cpu%d: MSR_PKGC7_IRTL: 0x%08llx (", base_cpu, msr); in print_irtl()
3416 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", in print_irtl()
3417 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); in print_irtl()
3421 get_msr(base_cpu, MSR_PKGC8_IRTL, &msr); in print_irtl()
3422 fprintf(outf, "cpu%d: MSR_PKGC8_IRTL: 0x%08llx (", base_cpu, msr); in print_irtl()
3423 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", in print_irtl()
3424 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); in print_irtl()
3428 get_msr(base_cpu, MSR_PKGC9_IRTL, &msr); in print_irtl()
3429 fprintf(outf, "cpu%d: MSR_PKGC9_IRTL: 0x%08llx (", base_cpu, msr); in print_irtl()
3430 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", in print_irtl()
3431 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); in print_irtl()
3435 get_msr(base_cpu, MSR_PKGC10_IRTL, &msr); in print_irtl()
3436 fprintf(outf, "cpu%d: MSR_PKGC10_IRTL: 0x%08llx (", base_cpu, msr); in print_irtl()
3437 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", in print_irtl()
3438 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); in print_irtl()
4171 int get_msr_sum(int cpu, off_t offset, unsigned long long *msr) in get_msr_sum() argument
4188 *msr = msr_last + per_cpu_msr_sum[cpu].entries[idx].sum; in get_msr_sum()
4215 fprintf(outf, "Can not update msr(0x%llx)\n", (unsigned long long)offset); in update_msr_sum()
4242 fprintf(outf, "Can not allocate memory for long time MSR.\n"); in msr_sum_record()
4402 sprintf(pathname, "/dev/cpu/%d/msr", base_cpu); in check_dev_msr()
4404 if (system("/sbin/modprobe msr > /dev/null 2>&1")) in check_dev_msr()
4405 err(-5, "no /dev/cpu/0/msr, Try \"# modprobe msr\" "); in check_dev_msr()
4445 sprintf(pathname, "/dev/cpu/%d/msr", base_cpu); in check_permissions()
4448 warn("/dev/cpu/0/msr open failed, try chown or chmod +r /dev/cpu/*/msr"); in check_permissions()
4462 unsigned long long msr; in probe_bclk() local
4477 get_msr(base_cpu, MSR_PLATFORM_INFO, &msr); in probe_bclk()
4478 base_ratio = (msr >> 8) & 0xFF; in probe_bclk()
4727 * Decode the ENERGY_PERF_BIAS MSR
4780 unsigned long long msr; in print_hwp() local
4800 if (get_msr(cpu, MSR_PM_ENABLE, &msr)) in print_hwp()
4803 fprintf(outf, "cpu%d: MSR_PM_ENABLE: 0x%08llx (%sHWP)\n", cpu, msr, (msr & (1 << 0)) ? "" : "No-"); in print_hwp()
4806 if ((msr & (1 << 0)) == 0) in print_hwp()
4809 if (get_msr(cpu, MSR_HWP_CAPABILITIES, &msr)) in print_hwp()
4814 cpu, msr, in print_hwp()
4815 (unsigned int)HWP_HIGHEST_PERF(msr), in print_hwp()
4816 (unsigned int)HWP_GUARANTEED_PERF(msr), in print_hwp()
4817 (unsigned int)HWP_MOSTEFFICIENT_PERF(msr), (unsigned int)HWP_LOWEST_PERF(msr)); in print_hwp()
4819 if (get_msr(cpu, MSR_HWP_REQUEST, &msr)) in print_hwp()
4824 cpu, msr, in print_hwp()
4825 (unsigned int)(((msr) >> 0) & 0xff), in print_hwp()
4826 (unsigned int)(((msr) >> 8) & 0xff), in print_hwp()
4827 (unsigned int)(((msr) >> 16) & 0xff), in print_hwp()
4828 (unsigned int)(((msr) >> 24) & 0xff), in print_hwp()
4829 (unsigned int)(((msr) >> 32) & 0xff3), (unsigned int)(((msr) >> 42) & 0x1)); in print_hwp()
4832 if (get_msr(cpu, MSR_HWP_REQUEST_PKG, &msr)) in print_hwp()
4837 cpu, msr, in print_hwp()
4838 (unsigned int)(((msr) >> 0) & 0xff), in print_hwp()
4839 (unsigned int)(((msr) >> 8) & 0xff), in print_hwp()
4840 (unsigned int)(((msr) >> 16) & 0xff), in print_hwp()
4841 (unsigned int)(((msr) >> 24) & 0xff), (unsigned int)(((msr) >> 32) & 0xff3)); in print_hwp()
4844 if (get_msr(cpu, MSR_HWP_INTERRUPT, &msr)) in print_hwp()
4849 cpu, msr, ((msr) & 0x1) ? "EN" : "Dis", ((msr) & 0x2) ? "EN" : "Dis"); in print_hwp()
4851 if (get_msr(cpu, MSR_HWP_STATUS, &msr)) in print_hwp()
4856 cpu, msr, ((msr) & 0x1) ? "" : "No-", ((msr) & 0x4) ? "" : "No-"); in print_hwp()
4866 unsigned long long msr; in print_perf_limit() local
4884 get_msr(cpu, MSR_CORE_PERF_LIMIT_REASONS, &msr); in print_perf_limit()
4885 fprintf(outf, "cpu%d: MSR_CORE_PERF_LIMIT_REASONS, 0x%08llx", cpu, msr); in print_perf_limit()
4887 (msr & 1 << 15) ? "bit15, " : "", in print_perf_limit()
4888 (msr & 1 << 14) ? "bit14, " : "", in print_perf_limit()
4889 (msr & 1 << 13) ? "Transitions, " : "", in print_perf_limit()
4890 (msr & 1 << 12) ? "MultiCoreTurbo, " : "", in print_perf_limit()
4891 (msr & 1 << 11) ? "PkgPwrL2, " : "", in print_perf_limit()
4892 (msr & 1 << 10) ? "PkgPwrL1, " : "", in print_perf_limit()
4893 (msr & 1 << 9) ? "CorePwr, " : "", in print_perf_limit()
4894 (msr & 1 << 8) ? "Amps, " : "", in print_perf_limit()
4895 (msr & 1 << 6) ? "VR-Therm, " : "", in print_perf_limit()
4896 (msr & 1 << 5) ? "Auto-HWP, " : "", in print_perf_limit()
4897 (msr & 1 << 4) ? "Graphics, " : "", in print_perf_limit()
4898 (msr & 1 << 2) ? "bit2, " : "", in print_perf_limit()
4899 (msr & 1 << 1) ? "ThermStatus, " : "", (msr & 1 << 0) ? "PROCHOT, " : ""); in print_perf_limit()
4901 (msr & 1 << 31) ? "bit31, " : "", in print_perf_limit()
4902 (msr & 1 << 30) ? "bit30, " : "", in print_perf_limit()
4903 (msr & 1 << 29) ? "Transitions, " : "", in print_perf_limit()
4904 (msr & 1 << 28) ? "MultiCoreTurbo, " : "", in print_perf_limit()
4905 (msr & 1 << 27) ? "PkgPwrL2, " : "", in print_perf_limit()
4906 (msr & 1 << 26) ? "PkgPwrL1, " : "", in print_perf_limit()
4907 (msr & 1 << 25) ? "CorePwr, " : "", in print_perf_limit()
4908 (msr & 1 << 24) ? "Amps, " : "", in print_perf_limit()
4909 (msr & 1 << 22) ? "VR-Therm, " : "", in print_perf_limit()
4910 (msr & 1 << 21) ? "Auto-HWP, " : "", in print_perf_limit()
4911 (msr & 1 << 20) ? "Graphics, " : "", in print_perf_limit()
4912 (msr & 1 << 18) ? "bit18, " : "", in print_perf_limit()
4913 (msr & 1 << 17) ? "ThermStatus, " : "", (msr & 1 << 16) ? "PROCHOT, " : ""); in print_perf_limit()
4917 get_msr(cpu, MSR_GFX_PERF_LIMIT_REASONS, &msr); in print_perf_limit()
4918 fprintf(outf, "cpu%d: MSR_GFX_PERF_LIMIT_REASONS, 0x%08llx", cpu, msr); in print_perf_limit()
4920 (msr & 1 << 0) ? "PROCHOT, " : "", in print_perf_limit()
4921 (msr & 1 << 1) ? "ThermStatus, " : "", in print_perf_limit()
4922 (msr & 1 << 4) ? "Graphics, " : "", in print_perf_limit()
4923 (msr & 1 << 6) ? "VR-Therm, " : "", in print_perf_limit()
4924 (msr & 1 << 8) ? "Amps, " : "", in print_perf_limit()
4925 (msr & 1 << 9) ? "GFXPwr, " : "", in print_perf_limit()
4926 (msr & 1 << 10) ? "PkgPwrL1, " : "", (msr & 1 << 11) ? "PkgPwrL2, " : ""); in print_perf_limit()
4928 (msr & 1 << 16) ? "PROCHOT, " : "", in print_perf_limit()
4929 (msr & 1 << 17) ? "ThermStatus, " : "", in print_perf_limit()
4930 (msr & 1 << 20) ? "Graphics, " : "", in print_perf_limit()
4931 (msr & 1 << 22) ? "VR-Therm, " : "", in print_perf_limit()
4932 (msr & 1 << 24) ? "Amps, " : "", in print_perf_limit()
4933 (msr & 1 << 25) ? "GFXPwr, " : "", in print_perf_limit()
4934 (msr & 1 << 26) ? "PkgPwrL1, " : "", (msr & 1 << 27) ? "PkgPwrL2, " : ""); in print_perf_limit()
4937 get_msr(cpu, MSR_RING_PERF_LIMIT_REASONS, &msr); in print_perf_limit()
4938 fprintf(outf, "cpu%d: MSR_RING_PERF_LIMIT_REASONS, 0x%08llx", cpu, msr); in print_perf_limit()
4940 (msr & 1 << 0) ? "PROCHOT, " : "", in print_perf_limit()
4941 (msr & 1 << 1) ? "ThermStatus, " : "", in print_perf_limit()
4942 (msr & 1 << 6) ? "VR-Therm, " : "", in print_perf_limit()
4943 (msr & 1 << 8) ? "Amps, " : "", in print_perf_limit()
4944 (msr & 1 << 10) ? "PkgPwrL1, " : "", (msr & 1 << 11) ? "PkgPwrL2, " : ""); in print_perf_limit()
4946 (msr & 1 << 16) ? "PROCHOT, " : "", in print_perf_limit()
4947 (msr & 1 << 17) ? "ThermStatus, " : "", in print_perf_limit()
4948 (msr & 1 << 22) ? "VR-Therm, " : "", in print_perf_limit()
4949 (msr & 1 << 24) ? "Amps, " : "", in print_perf_limit()
4950 (msr & 1 << 26) ? "PkgPwrL1, " : "", (msr & 1 << 27) ? "PkgPwrL2, " : ""); in print_perf_limit()
4968 unsigned long long msr; in get_tdp_intel() local
4971 if (!get_msr(base_cpu, MSR_PKG_POWER_INFO, &msr)) in get_tdp_intel()
4972 return ((msr >> 0) & RAPL_POWER_GRANULARITY) * rapl_power_units; in get_tdp_intel()
4983 unsigned long long msr; in rapl_probe_intel() local
5013 if (get_msr(base_cpu, MSR_RAPL_POWER_UNIT, &msr)) in rapl_probe_intel()
5016 rapl_power_units = 1.0 / (1 << (msr & 0xF)); in rapl_probe_intel()
5018 rapl_energy_units = 1.0 * (1 << (msr >> 8 & 0x1F)) / 1000000; in rapl_probe_intel()
5020 rapl_energy_units = 1.0 / (1 << (msr >> 8 & 0x1F)); in rapl_probe_intel()
5027 time_unit = msr >> 16 & 0xF; in rapl_probe_intel()
5042 unsigned long long msr; in rapl_probe_amd() local
5053 if (get_msr(base_cpu, MSR_RAPL_PWR_UNIT, &msr)) in rapl_probe_amd()
5056 rapl_time_units = ldexp(1.0, -(msr >> 16 & 0xf)); in rapl_probe_amd()
5057 rapl_energy_units = ldexp(1.0, -(msr >> 8 & 0x1f)); in rapl_probe_amd()
5058 rapl_power_units = ldexp(1.0, -(msr & 0xf)); in rapl_probe_amd()
5067 void print_power_limit_msr(int cpu, unsigned long long msr, char *label) in print_power_limit_msr() argument
5071 ((msr >> 15) & 1) ? "EN" : "DIS", in print_power_limit_msr()
5072 ((msr >> 0) & 0x7FFF) * rapl_power_units, in print_power_limit_msr()
5073 (1.0 + (((msr >> 22) & 0x3) / 4.0)) * (1 << ((msr >> 17) & 0x1F)) * rapl_time_units, in print_power_limit_msr()
5074 (((msr >> 16) & 1) ? "EN" : "DIS")); in print_power_limit_msr()
5081 unsigned long long msr; in print_rapl() local
5103 if (get_msr(cpu, MSR_RAPL_PWR_UNIT, &msr)) in print_rapl()
5107 if (get_msr(cpu, MSR_RAPL_POWER_UNIT, &msr)) in print_rapl()
5111 fprintf(outf, "cpu%d: %s: 0x%08llx (%f Watts, %f Joules, %f sec.)\n", cpu, msr_name, msr, in print_rapl()
5116 if (get_msr(cpu, MSR_PKG_POWER_INFO, &msr)) in print_rapl()
5120 cpu, msr, in print_rapl()
5121 ((msr >> 0) & RAPL_POWER_GRANULARITY) * rapl_power_units, in print_rapl()
5122 ((msr >> 16) & RAPL_POWER_GRANULARITY) * rapl_power_units, in print_rapl()
5123 ((msr >> 32) & RAPL_POWER_GRANULARITY) * rapl_power_units, in print_rapl()
5124 ((msr >> 48) & RAPL_TIME_GRANULARITY) * rapl_time_units); in print_rapl()
5129 if (get_msr(cpu, MSR_PKG_POWER_LIMIT, &msr)) in print_rapl()
5133 cpu, msr, (msr >> 63) & 1 ? "" : "UN"); in print_rapl()
5135 print_power_limit_msr(cpu, msr, "PKG Limit #1"); in print_rapl()
5138 ((msr >> 47) & 1) ? "EN" : "DIS", in print_rapl()
5139 ((msr >> 32) & 0x7FFF) * rapl_power_units, in print_rapl()
5140 (1.0 + (((msr >> 54) & 0x3) / 4.0)) * (1 << ((msr >> 49) & 0x1F)) * rapl_time_units, in print_rapl()
5141 ((msr >> 48) & 1) ? "EN" : "DIS"); in print_rapl()
5143 if (get_msr(cpu, MSR_VR_CURRENT_CONFIG, &msr)) in print_rapl()
5146 fprintf(outf, "cpu%d: MSR_VR_CURRENT_CONFIG: 0x%08llx\n", cpu, msr); in print_rapl()
5148 cpu, ((msr >> 0) & 0x1FFF) * rapl_power_units, (msr >> 31) & 1 ? "" : "UN"); in print_rapl()
5152 if (get_msr(cpu, MSR_DRAM_POWER_INFO, &msr)) in print_rapl()
5156 cpu, msr, in print_rapl()
5157 ((msr >> 0) & RAPL_POWER_GRANULARITY) * rapl_power_units, in print_rapl()
5158 ((msr >> 16) & RAPL_POWER_GRANULARITY) * rapl_power_units, in print_rapl()
5159 ((msr >> 32) & RAPL_POWER_GRANULARITY) * rapl_power_units, in print_rapl()
5160 ((msr >> 48) & RAPL_TIME_GRANULARITY) * rapl_time_units); in print_rapl()
5163 if (get_msr(cpu, MSR_DRAM_POWER_LIMIT, &msr)) in print_rapl()
5166 cpu, msr, (msr >> 31) & 1 ? "" : "UN"); in print_rapl()
5168 print_power_limit_msr(cpu, msr, "DRAM Limit"); in print_rapl()
5171 if (get_msr(cpu, MSR_PP0_POLICY, &msr)) in print_rapl()
5174 fprintf(outf, "cpu%d: MSR_PP0_POLICY: %lld\n", cpu, msr & 0xF); in print_rapl()
5177 if (get_msr(cpu, MSR_PP0_POWER_LIMIT, &msr)) in print_rapl()
5180 cpu, msr, (msr >> 31) & 1 ? "" : "UN"); in print_rapl()
5181 print_power_limit_msr(cpu, msr, "Cores Limit"); in print_rapl()
5184 if (get_msr(cpu, MSR_PP1_POLICY, &msr)) in print_rapl()
5187 fprintf(outf, "cpu%d: MSR_PP1_POLICY: %lld\n", cpu, msr & 0xF); in print_rapl()
5189 if (get_msr(cpu, MSR_PP1_POWER_LIMIT, &msr)) in print_rapl()
5192 cpu, msr, (msr >> 31) & 1 ? "" : "UN"); in print_rapl()
5193 print_power_limit_msr(cpu, msr, "GFX Limit"); in print_rapl()
5224 * Older processors do not have this MSR, so there we guess,
5227 * Several MSR temperature values are in units of degrees-C
5233 unsigned long long msr; in set_temperature_target() local
5260 /* Temperature Target MSR is Nehalem and newer only */ in set_temperature_target()
5264 if (get_msr(base_cpu, MSR_IA32_TEMPERATURE_TARGET, &msr)) in set_temperature_target()
5267 tcc_default = (msr >> 16) & 0xFF; in set_temperature_target()
5277 tcc_offset = (msr >> 24) & GENMASK(bits - 1, 0); in set_temperature_target()
5279 cpu, msr, tcc_default - tcc_offset, tcc_default, tcc_offset); in set_temperature_target()
5281 fprintf(outf, "cpu%d: MSR_IA32_TEMPERATURE_TARGET: 0x%08llx (%d C)\n", cpu, msr, tcc_default); in set_temperature_target()
5301 unsigned long long msr; in print_thermal() local
5323 if (get_msr(cpu, MSR_IA32_PACKAGE_THERM_STATUS, &msr)) in print_thermal()
5326 dts = (msr >> 16) & 0x7F; in print_thermal()
5327 fprintf(outf, "cpu%d: MSR_IA32_PACKAGE_THERM_STATUS: 0x%08llx (%d C)\n", cpu, msr, tj_max - dts); in print_thermal()
5329 if (get_msr(cpu, MSR_IA32_PACKAGE_THERM_INTERRUPT, &msr)) in print_thermal()
5332 dts = (msr >> 16) & 0x7F; in print_thermal()
5333 dts2 = (msr >> 8) & 0x7F; in print_thermal()
5335 cpu, msr, tj_max - dts, tj_max - dts2); in print_thermal()
5341 if (get_msr(cpu, MSR_IA32_THERM_STATUS, &msr)) in print_thermal()
5344 dts = (msr >> 16) & 0x7F; in print_thermal()
5345 resolution = (msr >> 27) & 0xF; in print_thermal()
5347 cpu, msr, tj_max - dts, resolution); in print_thermal()
5349 if (get_msr(cpu, MSR_IA32_THERM_INTERRUPT, &msr)) in print_thermal()
5352 dts = (msr >> 16) & 0x7F; in print_thermal()
5353 dts2 = (msr >> 8) & 0x7F; in print_thermal()
5355 cpu, msr, tj_max - dts, tj_max - dts2); in print_thermal()
5403 unsigned long long msr; in decode_feature_control_msr() local
5405 if (!get_msr(base_cpu, MSR_IA32_FEAT_CTL, &msr)) in decode_feature_control_msr()
5407 base_cpu, msr, msr & FEAT_CTL_LOCKED ? "" : "UN-", msr & (1 << 18) ? "SGX" : ""); in decode_feature_control_msr()
5412 unsigned long long msr; in decode_misc_enable_msr() local
5417 if (!get_msr(base_cpu, MSR_IA32_MISC_ENABLE, &msr)) in decode_misc_enable_msr()
5419 base_cpu, msr, in decode_misc_enable_msr()
5420 msr & MSR_IA32_MISC_ENABLE_TM1 ? "" : "No-", in decode_misc_enable_msr()
5421 msr & MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP ? "" : "No-", in decode_misc_enable_msr()
5422 msr & MSR_IA32_MISC_ENABLE_MWAIT ? "" : "No-", in decode_misc_enable_msr()
5423 msr & MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE ? "No-" : "", in decode_misc_enable_msr()
5424 msr & MSR_IA32_MISC_ENABLE_TURBO_DISABLE ? "No-" : ""); in decode_misc_enable_msr()
5429 unsigned long long msr; in decode_misc_feature_control() local
5434 if (!get_msr(base_cpu, MSR_MISC_FEATURE_CONTROL, &msr)) in decode_misc_feature_control()
5437 base_cpu, msr, msr & (0 << 0) ? "No-" : "", msr & (1 << 0) ? "No-" : "", in decode_misc_feature_control()
5438 msr & (2 << 0) ? "No-" : "", msr & (3 << 0) ? "No-" : ""); in decode_misc_feature_control()
5450 unsigned long long msr; in decode_misc_pwr_mgmt_msr() local
5455 if (!get_msr(base_cpu, MSR_MISC_PWR_MGMT, &msr)) in decode_misc_pwr_mgmt_msr()
5457 base_cpu, msr, in decode_misc_pwr_mgmt_msr()
5458 msr & (1 << 0) ? "DIS" : "EN", msr & (1 << 1) ? "EN" : "DIS", msr & (1 << 8) ? "EN" : "DIS"); in decode_misc_pwr_mgmt_msr()
5469 unsigned long long msr; in decode_c6_demotion_policy_msr() local
5474 if (!get_msr(base_cpu, MSR_CC6_DEMOTION_POLICY_CONFIG, &msr)) in decode_c6_demotion_policy_msr()
5476 base_cpu, msr, msr & (1 << 0) ? "EN" : "DIS"); in decode_c6_demotion_policy_msr()
5478 if (!get_msr(base_cpu, MSR_MC6_DEMOTION_POLICY_CONFIG, &msr)) in decode_c6_demotion_policy_msr()
5480 base_cpu, msr, msr & (1 << 0) ? "EN" : "DIS"); in decode_c6_demotion_policy_msr()
5676 edx_flags & (1 << 5) ? "MSR" : "-", in process_cpuid()
5684 errx(1, "CPUID: no MSR"); in process_cpuid()
6361 if (sscanf(add_command, "msr%d", &msr_num) == 1) in parse_add_command()