Lines Matching refs:msr

440 int get_msr_sum(int cpu, off_t offset, unsigned long long *msr);
693 int get_msr(int cpu, off_t offset, unsigned long long *msr) in get_msr() argument
697 retval = pread(get_msr_fd(cpu), msr, sizeof(*msr), offset); in get_msr()
699 if (retval != sizeof *msr) in get_msr()
1982 unsigned long long msr; in get_epb() local
2001 get_msr(cpu, MSR_IA32_ENERGY_PERF_BIAS, &msr); in get_epb()
2003 return msr & 0xf; in get_epb()
2082 unsigned long long msr; in get_counters() local
2161 if (get_msr(cpu, MSR_SMI_COUNT, &msr)) in get_counters()
2163 t->smi_count = msr & 0xFFFFFFFF; in get_counters()
2211 if (get_msr(cpu, MSR_IA32_THERM_STATUS, &msr)) in get_counters()
2213 c->core_temp_c = tj_max - ((msr >> 16) & 0x7F); in get_counters()
2220 if (get_msr(cpu, MSR_CORE_ENERGY_STAT, &msr)) in get_counters()
2222 c->core_energy = msr & 0xFFFFFFFF; in get_counters()
2285 if (get_msr_sum(cpu, MSR_PKG_ENERGY_STATUS, &msr)) in get_counters()
2287 p->energy_pkg = msr; in get_counters()
2290 if (get_msr_sum(cpu, MSR_PP0_ENERGY_STATUS, &msr)) in get_counters()
2292 p->energy_cores = msr; in get_counters()
2295 if (get_msr_sum(cpu, MSR_DRAM_ENERGY_STATUS, &msr)) in get_counters()
2297 p->energy_dram = msr; in get_counters()
2300 if (get_msr_sum(cpu, MSR_PP1_ENERGY_STATUS, &msr)) in get_counters()
2302 p->energy_gfx = msr; in get_counters()
2305 if (get_msr_sum(cpu, MSR_PKG_PERF_STATUS, &msr)) in get_counters()
2307 p->rapl_pkg_perf_status = msr; in get_counters()
2310 if (get_msr_sum(cpu, MSR_DRAM_PERF_STATUS, &msr)) in get_counters()
2312 p->rapl_dram_perf_status = msr; in get_counters()
2315 if (get_msr_sum(cpu, MSR_PKG_ENERGY_STAT, &msr)) in get_counters()
2317 p->energy_pkg = msr; in get_counters()
2320 if (get_msr(cpu, MSR_IA32_PACKAGE_THERM_STATUS, &msr)) in get_counters()
2322 p->pkg_temp_c = tj_max - ((msr >> 16) & 0x7F); in get_counters()
2430 unsigned long long msr; in dump_nhm_platform_info() local
2433 get_msr(base_cpu, MSR_PLATFORM_INFO, &msr); in dump_nhm_platform_info()
2435 fprintf(outf, "cpu%d: MSR_PLATFORM_INFO: 0x%08llx\n", base_cpu, msr); in dump_nhm_platform_info()
2437 ratio = (msr >> 40) & 0xFF; in dump_nhm_platform_info()
2440 ratio = (msr >> 8) & 0xFF; in dump_nhm_platform_info()
2443 get_msr(base_cpu, MSR_IA32_POWER_CTL, &msr); in dump_nhm_platform_info()
2445 base_cpu, msr, msr & 0x2 ? "EN" : "DIS"); in dump_nhm_platform_info()
2449 fprintf(outf, "C-state Pre-wake: %sabled\n", msr & 0x40000000 ? "DIS" : "EN"); in dump_nhm_platform_info()
2456 unsigned long long msr; in dump_hsw_turbo_ratio_limits() local
2459 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT2, &msr); in dump_hsw_turbo_ratio_limits()
2461 fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT2: 0x%08llx\n", base_cpu, msr); in dump_hsw_turbo_ratio_limits()
2463 ratio = (msr >> 8) & 0xFF; in dump_hsw_turbo_ratio_limits()
2467 ratio = (msr >> 0) & 0xFF; in dump_hsw_turbo_ratio_limits()
2475 unsigned long long msr; in dump_ivt_turbo_ratio_limits() local
2478 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT1, &msr); in dump_ivt_turbo_ratio_limits()
2480 fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT1: 0x%08llx\n", base_cpu, msr); in dump_ivt_turbo_ratio_limits()
2482 ratio = (msr >> 56) & 0xFF; in dump_ivt_turbo_ratio_limits()
2486 ratio = (msr >> 48) & 0xFF; in dump_ivt_turbo_ratio_limits()
2490 ratio = (msr >> 40) & 0xFF; in dump_ivt_turbo_ratio_limits()
2494 ratio = (msr >> 32) & 0xFF; in dump_ivt_turbo_ratio_limits()
2498 ratio = (msr >> 24) & 0xFF; in dump_ivt_turbo_ratio_limits()
2502 ratio = (msr >> 16) & 0xFF; in dump_ivt_turbo_ratio_limits()
2506 ratio = (msr >> 8) & 0xFF; in dump_ivt_turbo_ratio_limits()
2510 ratio = (msr >> 0) & 0xFF; in dump_ivt_turbo_ratio_limits()
2540 unsigned long long msr, core_counts; in dump_turbo_ratio_limits() local
2543 get_msr(base_cpu, trl_msr_offset, &msr); in dump_turbo_ratio_limits()
2545 base_cpu, trl_msr_offset == MSR_SECONDARY_TURBO_RATIO_LIMIT ? "SECONDARY_" : "", msr); in dump_turbo_ratio_limits()
2557 ratio = (msr >> shift) & 0xFF; in dump_turbo_ratio_limits()
2569 unsigned long long msr; in dump_atom_turbo_ratio_limits() local
2572 get_msr(base_cpu, MSR_ATOM_CORE_RATIOS, &msr); in dump_atom_turbo_ratio_limits()
2573 fprintf(outf, "cpu%d: MSR_ATOM_CORE_RATIOS: 0x%08llx\n", base_cpu, msr & 0xFFFFFFFF); in dump_atom_turbo_ratio_limits()
2575 ratio = (msr >> 0) & 0x3F; in dump_atom_turbo_ratio_limits()
2579 ratio = (msr >> 8) & 0x3F; in dump_atom_turbo_ratio_limits()
2583 ratio = (msr >> 16) & 0x3F; in dump_atom_turbo_ratio_limits()
2587 get_msr(base_cpu, MSR_ATOM_CORE_TURBO_RATIOS, &msr); in dump_atom_turbo_ratio_limits()
2588 fprintf(outf, "cpu%d: MSR_ATOM_CORE_TURBO_RATIOS: 0x%08llx\n", base_cpu, msr & 0xFFFFFFFF); in dump_atom_turbo_ratio_limits()
2590 ratio = (msr >> 24) & 0x3F; in dump_atom_turbo_ratio_limits()
2594 ratio = (msr >> 16) & 0x3F; in dump_atom_turbo_ratio_limits()
2598 ratio = (msr >> 8) & 0x3F; in dump_atom_turbo_ratio_limits()
2602 ratio = (msr >> 0) & 0x3F; in dump_atom_turbo_ratio_limits()
2611 unsigned long long msr; in dump_knl_turbo_ratio_limits() local
2617 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT, &msr); in dump_knl_turbo_ratio_limits()
2619 fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT: 0x%08llx\n", base_cpu, msr); in dump_knl_turbo_ratio_limits()
2645 cores[b_nr] = (msr & 0xFF) >> 1; in dump_knl_turbo_ratio_limits()
2646 ratio[b_nr] = (msr >> 8) & 0xFF; in dump_knl_turbo_ratio_limits()
2649 delta_cores = (msr >> i) & 0x1F; in dump_knl_turbo_ratio_limits()
2650 delta_ratio = (msr >> (i + 5)) & 0x7; in dump_knl_turbo_ratio_limits()
2666 unsigned long long msr; in dump_nhm_cst_cfg() local
2668 get_msr(base_cpu, MSR_PKG_CST_CONFIG_CONTROL, &msr); in dump_nhm_cst_cfg()
2670 fprintf(outf, "cpu%d: MSR_PKG_CST_CONFIG_CONTROL: 0x%08llx", base_cpu, msr); in dump_nhm_cst_cfg()
2673 (msr & SNB_C3_AUTO_UNDEMOTE) ? "UNdemote-C3, " : "", in dump_nhm_cst_cfg()
2674 (msr & SNB_C1_AUTO_UNDEMOTE) ? "UNdemote-C1, " : "", in dump_nhm_cst_cfg()
2675 (msr & NHM_C3_AUTO_DEMOTE) ? "demote-C3, " : "", in dump_nhm_cst_cfg()
2676 (msr & NHM_C1_AUTO_DEMOTE) ? "demote-C1, " : "", in dump_nhm_cst_cfg()
2677 …(msr & (1 << 15)) ? "" : "UN", (unsigned int)msr & 0xF, pkg_cstate_limit_strings[pkg_cstate_limit]… in dump_nhm_cst_cfg()
2681 …fprintf(outf, ", automatic c-state conversion=%s", (msr & AUTOMATIC_CSTATE_CONVERSION) ? "on" : "o… in dump_nhm_cst_cfg()
2691 unsigned long long msr; in dump_config_tdp() local
2693 get_msr(base_cpu, MSR_CONFIG_TDP_NOMINAL, &msr); in dump_config_tdp()
2694 fprintf(outf, "cpu%d: MSR_CONFIG_TDP_NOMINAL: 0x%08llx", base_cpu, msr); in dump_config_tdp()
2695 fprintf(outf, " (base_ratio=%d)\n", (unsigned int)msr & 0xFF); in dump_config_tdp()
2697 get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_1, &msr); in dump_config_tdp()
2698 fprintf(outf, "cpu%d: MSR_CONFIG_TDP_LEVEL_1: 0x%08llx (", base_cpu, msr); in dump_config_tdp()
2699 if (msr) { in dump_config_tdp()
2700 fprintf(outf, "PKG_MIN_PWR_LVL1=%d ", (unsigned int)(msr >> 48) & 0x7FFF); in dump_config_tdp()
2701 fprintf(outf, "PKG_MAX_PWR_LVL1=%d ", (unsigned int)(msr >> 32) & 0x7FFF); in dump_config_tdp()
2702 fprintf(outf, "LVL1_RATIO=%d ", (unsigned int)(msr >> 16) & 0xFF); in dump_config_tdp()
2703 fprintf(outf, "PKG_TDP_LVL1=%d", (unsigned int)(msr) & 0x7FFF); in dump_config_tdp()
2707 get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_2, &msr); in dump_config_tdp()
2708 fprintf(outf, "cpu%d: MSR_CONFIG_TDP_LEVEL_2: 0x%08llx (", base_cpu, msr); in dump_config_tdp()
2709 if (msr) { in dump_config_tdp()
2710 fprintf(outf, "PKG_MIN_PWR_LVL2=%d ", (unsigned int)(msr >> 48) & 0x7FFF); in dump_config_tdp()
2711 fprintf(outf, "PKG_MAX_PWR_LVL2=%d ", (unsigned int)(msr >> 32) & 0x7FFF); in dump_config_tdp()
2712 fprintf(outf, "LVL2_RATIO=%d ", (unsigned int)(msr >> 16) & 0xFF); in dump_config_tdp()
2713 fprintf(outf, "PKG_TDP_LVL2=%d", (unsigned int)(msr) & 0x7FFF); in dump_config_tdp()
2717 get_msr(base_cpu, MSR_CONFIG_TDP_CONTROL, &msr); in dump_config_tdp()
2718 fprintf(outf, "cpu%d: MSR_CONFIG_TDP_CONTROL: 0x%08llx (", base_cpu, msr); in dump_config_tdp()
2719 if ((msr) & 0x3) in dump_config_tdp()
2720 fprintf(outf, "TDP_LEVEL=%d ", (unsigned int)(msr) & 0x3); in dump_config_tdp()
2721 fprintf(outf, " lock=%d", (unsigned int)(msr >> 31) & 1); in dump_config_tdp()
2724 get_msr(base_cpu, MSR_TURBO_ACTIVATION_RATIO, &msr); in dump_config_tdp()
2725 fprintf(outf, "cpu%d: MSR_TURBO_ACTIVATION_RATIO: 0x%08llx (", base_cpu, msr); in dump_config_tdp()
2726 fprintf(outf, "MAX_NON_TURBO_RATIO=%d", (unsigned int)(msr) & 0xFF); in dump_config_tdp()
2727 fprintf(outf, " lock=%d", (unsigned int)(msr >> 31) & 1); in dump_config_tdp()
2735 unsigned long long msr; in print_irtl() local
2737 get_msr(base_cpu, MSR_PKGC3_IRTL, &msr); in print_irtl()
2738 fprintf(outf, "cpu%d: MSR_PKGC3_IRTL: 0x%08llx (", base_cpu, msr); in print_irtl()
2739 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", in print_irtl()
2740 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); in print_irtl()
2742 get_msr(base_cpu, MSR_PKGC6_IRTL, &msr); in print_irtl()
2743 fprintf(outf, "cpu%d: MSR_PKGC6_IRTL: 0x%08llx (", base_cpu, msr); in print_irtl()
2744 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", in print_irtl()
2745 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); in print_irtl()
2747 get_msr(base_cpu, MSR_PKGC7_IRTL, &msr); in print_irtl()
2748 fprintf(outf, "cpu%d: MSR_PKGC7_IRTL: 0x%08llx (", base_cpu, msr); in print_irtl()
2749 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", in print_irtl()
2750 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); in print_irtl()
2755 get_msr(base_cpu, MSR_PKGC8_IRTL, &msr); in print_irtl()
2756 fprintf(outf, "cpu%d: MSR_PKGC8_IRTL: 0x%08llx (", base_cpu, msr); in print_irtl()
2757 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", in print_irtl()
2758 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); in print_irtl()
2760 get_msr(base_cpu, MSR_PKGC9_IRTL, &msr); in print_irtl()
2761 fprintf(outf, "cpu%d: MSR_PKGC9_IRTL: 0x%08llx (", base_cpu, msr); in print_irtl()
2762 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", in print_irtl()
2763 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); in print_irtl()
2765 get_msr(base_cpu, MSR_PKGC10_IRTL, &msr); in print_irtl()
2766 fprintf(outf, "cpu%d: MSR_PKGC10_IRTL: 0x%08llx (", base_cpu, msr); in print_irtl()
2767 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT", in print_irtl()
2768 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]); in print_irtl()
3396 int get_msr_sum(int cpu, off_t offset, unsigned long long *msr) in get_msr_sum() argument
3413 *msr = msr_last + per_cpu_msr_sum[cpu].entries[idx].sum; in get_msr_sum()
3702 unsigned long long msr; in probe_nhm_msrs() local
3770 get_msr(base_cpu, MSR_PKG_CST_CONFIG_CONTROL, &msr); in probe_nhm_msrs()
3771 pkg_cstate_limit = pkg_cstate_limits[msr & 0xF]; in probe_nhm_msrs()
3773 get_msr(base_cpu, MSR_PLATFORM_INFO, &msr); in probe_nhm_msrs()
3774 base_ratio = (msr >> 8) & 0xFF; in probe_nhm_msrs()
4046 unsigned long long msr; in check_tcc_offset() local
4061 if (!get_msr(base_cpu, MSR_PLATFORM_INFO, &msr)) { in check_tcc_offset()
4062 msr = (msr >> 30) & 1; in check_tcc_offset()
4063 if (msr) in check_tcc_offset()
4354 unsigned long long msr; in print_hwp() local
4374 if (get_msr(cpu, MSR_PM_ENABLE, &msr)) in print_hwp()
4377 fprintf(outf, "cpu%d: MSR_PM_ENABLE: 0x%08llx (%sHWP)\n", cpu, msr, (msr & (1 << 0)) ? "" : "No-"); in print_hwp()
4380 if ((msr & (1 << 0)) == 0) in print_hwp()
4383 if (get_msr(cpu, MSR_HWP_CAPABILITIES, &msr)) in print_hwp()
4388 cpu, msr, in print_hwp()
4389 (unsigned int)HWP_HIGHEST_PERF(msr), in print_hwp()
4390 (unsigned int)HWP_GUARANTEED_PERF(msr), in print_hwp()
4391 (unsigned int)HWP_MOSTEFFICIENT_PERF(msr), (unsigned int)HWP_LOWEST_PERF(msr)); in print_hwp()
4393 if (get_msr(cpu, MSR_HWP_REQUEST, &msr)) in print_hwp()
4398 cpu, msr, in print_hwp()
4399 (unsigned int)(((msr) >> 0) & 0xff), in print_hwp()
4400 (unsigned int)(((msr) >> 8) & 0xff), in print_hwp()
4401 (unsigned int)(((msr) >> 16) & 0xff), in print_hwp()
4402 (unsigned int)(((msr) >> 24) & 0xff), in print_hwp()
4403 (unsigned int)(((msr) >> 32) & 0xff3), (unsigned int)(((msr) >> 42) & 0x1)); in print_hwp()
4406 if (get_msr(cpu, MSR_HWP_REQUEST_PKG, &msr)) in print_hwp()
4411 cpu, msr, in print_hwp()
4412 (unsigned int)(((msr) >> 0) & 0xff), in print_hwp()
4413 (unsigned int)(((msr) >> 8) & 0xff), in print_hwp()
4414 (unsigned int)(((msr) >> 16) & 0xff), in print_hwp()
4415 (unsigned int)(((msr) >> 24) & 0xff), (unsigned int)(((msr) >> 32) & 0xff3)); in print_hwp()
4418 if (get_msr(cpu, MSR_HWP_INTERRUPT, &msr)) in print_hwp()
4423 cpu, msr, ((msr) & 0x1) ? "EN" : "Dis", ((msr) & 0x2) ? "EN" : "Dis"); in print_hwp()
4425 if (get_msr(cpu, MSR_HWP_STATUS, &msr)) in print_hwp()
4430 cpu, msr, ((msr) & 0x1) ? "" : "No-", ((msr) & 0x4) ? "" : "No-"); in print_hwp()
4440 unsigned long long msr; in print_perf_limit() local
4458 get_msr(cpu, MSR_CORE_PERF_LIMIT_REASONS, &msr); in print_perf_limit()
4459 fprintf(outf, "cpu%d: MSR_CORE_PERF_LIMIT_REASONS, 0x%08llx", cpu, msr); in print_perf_limit()
4461 (msr & 1 << 15) ? "bit15, " : "", in print_perf_limit()
4462 (msr & 1 << 14) ? "bit14, " : "", in print_perf_limit()
4463 (msr & 1 << 13) ? "Transitions, " : "", in print_perf_limit()
4464 (msr & 1 << 12) ? "MultiCoreTurbo, " : "", in print_perf_limit()
4465 (msr & 1 << 11) ? "PkgPwrL2, " : "", in print_perf_limit()
4466 (msr & 1 << 10) ? "PkgPwrL1, " : "", in print_perf_limit()
4467 (msr & 1 << 9) ? "CorePwr, " : "", in print_perf_limit()
4468 (msr & 1 << 8) ? "Amps, " : "", in print_perf_limit()
4469 (msr & 1 << 6) ? "VR-Therm, " : "", in print_perf_limit()
4470 (msr & 1 << 5) ? "Auto-HWP, " : "", in print_perf_limit()
4471 (msr & 1 << 4) ? "Graphics, " : "", in print_perf_limit()
4472 (msr & 1 << 2) ? "bit2, " : "", in print_perf_limit()
4473 (msr & 1 << 1) ? "ThermStatus, " : "", (msr & 1 << 0) ? "PROCHOT, " : ""); in print_perf_limit()
4475 (msr & 1 << 31) ? "bit31, " : "", in print_perf_limit()
4476 (msr & 1 << 30) ? "bit30, " : "", in print_perf_limit()
4477 (msr & 1 << 29) ? "Transitions, " : "", in print_perf_limit()
4478 (msr & 1 << 28) ? "MultiCoreTurbo, " : "", in print_perf_limit()
4479 (msr & 1 << 27) ? "PkgPwrL2, " : "", in print_perf_limit()
4480 (msr & 1 << 26) ? "PkgPwrL1, " : "", in print_perf_limit()
4481 (msr & 1 << 25) ? "CorePwr, " : "", in print_perf_limit()
4482 (msr & 1 << 24) ? "Amps, " : "", in print_perf_limit()
4483 (msr & 1 << 22) ? "VR-Therm, " : "", in print_perf_limit()
4484 (msr & 1 << 21) ? "Auto-HWP, " : "", in print_perf_limit()
4485 (msr & 1 << 20) ? "Graphics, " : "", in print_perf_limit()
4486 (msr & 1 << 18) ? "bit18, " : "", in print_perf_limit()
4487 (msr & 1 << 17) ? "ThermStatus, " : "", (msr & 1 << 16) ? "PROCHOT, " : ""); in print_perf_limit()
4491 get_msr(cpu, MSR_GFX_PERF_LIMIT_REASONS, &msr); in print_perf_limit()
4492 fprintf(outf, "cpu%d: MSR_GFX_PERF_LIMIT_REASONS, 0x%08llx", cpu, msr); in print_perf_limit()
4494 (msr & 1 << 0) ? "PROCHOT, " : "", in print_perf_limit()
4495 (msr & 1 << 1) ? "ThermStatus, " : "", in print_perf_limit()
4496 (msr & 1 << 4) ? "Graphics, " : "", in print_perf_limit()
4497 (msr & 1 << 6) ? "VR-Therm, " : "", in print_perf_limit()
4498 (msr & 1 << 8) ? "Amps, " : "", in print_perf_limit()
4499 (msr & 1 << 9) ? "GFXPwr, " : "", in print_perf_limit()
4500 (msr & 1 << 10) ? "PkgPwrL1, " : "", (msr & 1 << 11) ? "PkgPwrL2, " : ""); in print_perf_limit()
4502 (msr & 1 << 16) ? "PROCHOT, " : "", in print_perf_limit()
4503 (msr & 1 << 17) ? "ThermStatus, " : "", in print_perf_limit()
4504 (msr & 1 << 20) ? "Graphics, " : "", in print_perf_limit()
4505 (msr & 1 << 22) ? "VR-Therm, " : "", in print_perf_limit()
4506 (msr & 1 << 24) ? "Amps, " : "", in print_perf_limit()
4507 (msr & 1 << 25) ? "GFXPwr, " : "", in print_perf_limit()
4508 (msr & 1 << 26) ? "PkgPwrL1, " : "", (msr & 1 << 27) ? "PkgPwrL2, " : ""); in print_perf_limit()
4511 get_msr(cpu, MSR_RING_PERF_LIMIT_REASONS, &msr); in print_perf_limit()
4512 fprintf(outf, "cpu%d: MSR_RING_PERF_LIMIT_REASONS, 0x%08llx", cpu, msr); in print_perf_limit()
4514 (msr & 1 << 0) ? "PROCHOT, " : "", in print_perf_limit()
4515 (msr & 1 << 1) ? "ThermStatus, " : "", in print_perf_limit()
4516 (msr & 1 << 6) ? "VR-Therm, " : "", in print_perf_limit()
4517 (msr & 1 << 8) ? "Amps, " : "", in print_perf_limit()
4518 (msr & 1 << 10) ? "PkgPwrL1, " : "", (msr & 1 << 11) ? "PkgPwrL2, " : ""); in print_perf_limit()
4520 (msr & 1 << 16) ? "PROCHOT, " : "", in print_perf_limit()
4521 (msr & 1 << 17) ? "ThermStatus, " : "", in print_perf_limit()
4522 (msr & 1 << 22) ? "VR-Therm, " : "", in print_perf_limit()
4523 (msr & 1 << 24) ? "Amps, " : "", in print_perf_limit()
4524 (msr & 1 << 26) ? "PkgPwrL1, " : "", (msr & 1 << 27) ? "PkgPwrL2, " : ""); in print_perf_limit()
4534 unsigned long long msr; in get_tdp_intel() local
4537 if (!get_msr(base_cpu, MSR_PKG_POWER_INFO, &msr)) in get_tdp_intel()
4538 return ((msr >> 0) & RAPL_POWER_GRANULARITY) * rapl_power_units; in get_tdp_intel()
4579 unsigned long long msr; in rapl_probe_intel() local
4724 if (get_msr(base_cpu, MSR_RAPL_POWER_UNIT, &msr)) in rapl_probe_intel()
4727 rapl_power_units = 1.0 / (1 << (msr & 0xF)); in rapl_probe_intel()
4729 rapl_energy_units = 1.0 * (1 << (msr >> 8 & 0x1F)) / 1000000; in rapl_probe_intel()
4731 rapl_energy_units = 1.0 / (1 << (msr >> 8 & 0x1F)); in rapl_probe_intel()
4735 time_unit = msr >> 16 & 0xF; in rapl_probe_intel()
4750 unsigned long long msr; in rapl_probe_amd() local
4775 if (get_msr(base_cpu, MSR_RAPL_PWR_UNIT, &msr)) in rapl_probe_amd()
4778 rapl_time_units = ldexp(1.0, -(msr >> 16 & 0xf)); in rapl_probe_amd()
4779 rapl_energy_units = ldexp(1.0, -(msr >> 8 & 0x1f)); in rapl_probe_amd()
4780 rapl_power_units = ldexp(1.0, -(msr & 0xf)); in rapl_probe_amd()
4844 unsigned long long msr; in print_thermal() local
4866 if (get_msr(cpu, MSR_IA32_PACKAGE_THERM_STATUS, &msr)) in print_thermal()
4869 dts = (msr >> 16) & 0x7F; in print_thermal()
4870 fprintf(outf, "cpu%d: MSR_IA32_PACKAGE_THERM_STATUS: 0x%08llx (%d C)\n", cpu, msr, tj_max - dts); in print_thermal()
4872 if (get_msr(cpu, MSR_IA32_PACKAGE_THERM_INTERRUPT, &msr)) in print_thermal()
4875 dts = (msr >> 16) & 0x7F; in print_thermal()
4876 dts2 = (msr >> 8) & 0x7F; in print_thermal()
4878 cpu, msr, tj_max - dts, tj_max - dts2); in print_thermal()
4884 if (get_msr(cpu, MSR_IA32_THERM_STATUS, &msr)) in print_thermal()
4887 dts = (msr >> 16) & 0x7F; in print_thermal()
4888 resolution = (msr >> 27) & 0xF; in print_thermal()
4890 cpu, msr, tj_max - dts, resolution); in print_thermal()
4892 if (get_msr(cpu, MSR_IA32_THERM_INTERRUPT, &msr)) in print_thermal()
4895 dts = (msr >> 16) & 0x7F; in print_thermal()
4896 dts2 = (msr >> 8) & 0x7F; in print_thermal()
4898 cpu, msr, tj_max - dts, tj_max - dts2); in print_thermal()
4904 void print_power_limit_msr(int cpu, unsigned long long msr, char *label) in print_power_limit_msr() argument
4908 ((msr >> 15) & 1) ? "EN" : "DIS", in print_power_limit_msr()
4909 ((msr >> 0) & 0x7FFF) * rapl_power_units, in print_power_limit_msr()
4910 (1.0 + (((msr >> 22) & 0x3) / 4.0)) * (1 << ((msr >> 17) & 0x1F)) * rapl_time_units, in print_power_limit_msr()
4911 (((msr >> 16) & 1) ? "EN" : "DIS")); in print_power_limit_msr()
4918 unsigned long long msr; in print_rapl() local
4940 if (get_msr(cpu, MSR_RAPL_PWR_UNIT, &msr)) in print_rapl()
4944 if (get_msr(cpu, MSR_RAPL_POWER_UNIT, &msr)) in print_rapl()
4948 fprintf(outf, "cpu%d: %s: 0x%08llx (%f Watts, %f Joules, %f sec.)\n", cpu, msr_name, msr, in print_rapl()
4953 if (get_msr(cpu, MSR_PKG_POWER_INFO, &msr)) in print_rapl()
4957 cpu, msr, in print_rapl()
4958 ((msr >> 0) & RAPL_POWER_GRANULARITY) * rapl_power_units, in print_rapl()
4959 ((msr >> 16) & RAPL_POWER_GRANULARITY) * rapl_power_units, in print_rapl()
4960 ((msr >> 32) & RAPL_POWER_GRANULARITY) * rapl_power_units, in print_rapl()
4961 ((msr >> 48) & RAPL_TIME_GRANULARITY) * rapl_time_units); in print_rapl()
4966 if (get_msr(cpu, MSR_PKG_POWER_LIMIT, &msr)) in print_rapl()
4970 cpu, msr, (msr >> 63) & 1 ? "" : "UN"); in print_rapl()
4972 print_power_limit_msr(cpu, msr, "PKG Limit #1"); in print_rapl()
4975 ((msr >> 47) & 1) ? "EN" : "DIS", in print_rapl()
4976 ((msr >> 32) & 0x7FFF) * rapl_power_units, in print_rapl()
4977 (1.0 + (((msr >> 54) & 0x3) / 4.0)) * (1 << ((msr >> 49) & 0x1F)) * rapl_time_units, in print_rapl()
4978 ((msr >> 48) & 1) ? "EN" : "DIS"); in print_rapl()
4980 if (get_msr(cpu, MSR_VR_CURRENT_CONFIG, &msr)) in print_rapl()
4983 fprintf(outf, "cpu%d: MSR_VR_CURRENT_CONFIG: 0x%08llx\n", cpu, msr); in print_rapl()
4985 cpu, ((msr >> 0) & 0x1FFF) * rapl_power_units, (msr >> 31) & 1 ? "" : "UN"); in print_rapl()
4989 if (get_msr(cpu, MSR_DRAM_POWER_INFO, &msr)) in print_rapl()
4993 cpu, msr, in print_rapl()
4994 ((msr >> 0) & RAPL_POWER_GRANULARITY) * rapl_power_units, in print_rapl()
4995 ((msr >> 16) & RAPL_POWER_GRANULARITY) * rapl_power_units, in print_rapl()
4996 ((msr >> 32) & RAPL_POWER_GRANULARITY) * rapl_power_units, in print_rapl()
4997 ((msr >> 48) & RAPL_TIME_GRANULARITY) * rapl_time_units); in print_rapl()
5000 if (get_msr(cpu, MSR_DRAM_POWER_LIMIT, &msr)) in print_rapl()
5003 cpu, msr, (msr >> 31) & 1 ? "" : "UN"); in print_rapl()
5005 print_power_limit_msr(cpu, msr, "DRAM Limit"); in print_rapl()
5008 if (get_msr(cpu, MSR_PP0_POLICY, &msr)) in print_rapl()
5011 fprintf(outf, "cpu%d: MSR_PP0_POLICY: %lld\n", cpu, msr & 0xF); in print_rapl()
5014 if (get_msr(cpu, MSR_PP0_POWER_LIMIT, &msr)) in print_rapl()
5017 cpu, msr, (msr >> 31) & 1 ? "" : "UN"); in print_rapl()
5018 print_power_limit_msr(cpu, msr, "Cores Limit"); in print_rapl()
5021 if (get_msr(cpu, MSR_PP1_POLICY, &msr)) in print_rapl()
5024 fprintf(outf, "cpu%d: MSR_PP1_POLICY: %lld\n", cpu, msr & 0xF); in print_rapl()
5026 if (get_msr(cpu, MSR_PP1_POWER_LIMIT, &msr)) in print_rapl()
5029 cpu, msr, (msr >> 31) & 1 ? "" : "UN"); in print_rapl()
5030 print_power_limit_msr(cpu, msr, "GFX Limit"); in print_rapl()
5194 unsigned long long msr = 3; in slm_bclk() local
5198 if (get_msr(base_cpu, MSR_FSB_FREQ, &msr)) in slm_bclk()
5201 i = msr & 0xf; in slm_bclk()
5263 unsigned long long msr; in set_temperature_target() local
5294 if (get_msr(base_cpu, MSR_IA32_TEMPERATURE_TARGET, &msr)) in set_temperature_target()
5297 tcc_default = (msr >> 16) & 0xFF; in set_temperature_target()
5302 tcc_offset = (msr >> 24) & 0xF; in set_temperature_target()
5304 cpu, msr, tcc_default - tcc_offset, tcc_default, tcc_offset); in set_temperature_target()
5307 tcc_offset = (msr >> 24) & 0x3F; in set_temperature_target()
5309 cpu, msr, tcc_default - tcc_offset, tcc_default, tcc_offset); in set_temperature_target()
5312 fprintf(outf, "cpu%d: MSR_IA32_TEMPERATURE_TARGET: 0x%08llx (%d C)\n", cpu, msr, tcc_default); in set_temperature_target()
5333 unsigned long long msr; in decode_feature_control_msr() local
5335 if (!get_msr(base_cpu, MSR_IA32_FEAT_CTL, &msr)) in decode_feature_control_msr()
5337 base_cpu, msr, msr & FEAT_CTL_LOCKED ? "" : "UN-", msr & (1 << 18) ? "SGX" : ""); in decode_feature_control_msr()
5342 unsigned long long msr; in decode_misc_enable_msr() local
5347 if (!get_msr(base_cpu, MSR_IA32_MISC_ENABLE, &msr)) in decode_misc_enable_msr()
5349 base_cpu, msr, in decode_misc_enable_msr()
5350 msr & MSR_IA32_MISC_ENABLE_TM1 ? "" : "No-", in decode_misc_enable_msr()
5351 msr & MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP ? "" : "No-", in decode_misc_enable_msr()
5352 msr & MSR_IA32_MISC_ENABLE_MWAIT ? "" : "No-", in decode_misc_enable_msr()
5353 msr & MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE ? "No-" : "", in decode_misc_enable_msr()
5354 msr & MSR_IA32_MISC_ENABLE_TURBO_DISABLE ? "No-" : ""); in decode_misc_enable_msr()
5359 unsigned long long msr; in decode_misc_feature_control() local
5364 if (!get_msr(base_cpu, MSR_MISC_FEATURE_CONTROL, &msr)) in decode_misc_feature_control()
5367 base_cpu, msr, msr & (0 << 0) ? "No-" : "", msr & (1 << 0) ? "No-" : "", in decode_misc_feature_control()
5368 msr & (2 << 0) ? "No-" : "", msr & (3 << 0) ? "No-" : ""); in decode_misc_feature_control()
5380 unsigned long long msr; in decode_misc_pwr_mgmt_msr() local
5388 if (!get_msr(base_cpu, MSR_MISC_PWR_MGMT, &msr)) in decode_misc_pwr_mgmt_msr()
5390 base_cpu, msr, in decode_misc_pwr_mgmt_msr()
5391 msr & (1 << 0) ? "DIS" : "EN", msr & (1 << 1) ? "EN" : "DIS", msr & (1 << 8) ? "EN" : "DIS"); in decode_misc_pwr_mgmt_msr()
5402 unsigned long long msr; in decode_c6_demotion_policy_msr() local
5404 if (!get_msr(base_cpu, MSR_CC6_DEMOTION_POLICY_CONFIG, &msr)) in decode_c6_demotion_policy_msr()
5406 base_cpu, msr, msr & (1 << 0) ? "EN" : "DIS"); in decode_c6_demotion_policy_msr()
5408 if (!get_msr(base_cpu, MSR_MC6_DEMOTION_POLICY_CONFIG, &msr)) in decode_c6_demotion_policy_msr()
5410 base_cpu, msr, msr & (1 << 0) ? "EN" : "DIS"); in decode_c6_demotion_policy_msr()