Lines Matching defs:msr

301 int get_msr(int cpu, off_t offset, unsigned long long *msr);
353 unsigned long long msr = 3;
357 if (get_msr(base_cpu, MSR_FSB_FREQ, &msr))
360 i = msr & 0xf;
1014 unsigned long long msr[NUM_RAPL_COUNTERS];
1032 unsigned long long msr;
1047 .msr = MSR_PKG_ENERGY_STATUS,
1060 .msr = MSR_PKG_ENERGY_STAT,
1073 .msr = MSR_PP0_ENERGY_STATUS,
1086 .msr = MSR_DRAM_ENERGY_STATUS,
1099 .msr = MSR_PP1_ENERGY_STATUS,
1112 .msr = MSR_PKG_PERF_STATUS,
1125 .msr = MSR_DRAM_PERF_STATUS,
1138 .msr = MSR_CORE_ENERGY_STAT,
1254 int get_msr_sum(int cpu, off_t offset, unsigned long long *msr);
1519 sprintf(pathname, "/dev/cpu/%d/msr", cpu);
1522 err(-1, "%s open failed, try chown or chmod +r /dev/cpu/*/msr, "
1523 "or run with --no-msr, or run as root", pathname);
1590 int get_msr(int cpu, off_t offset, unsigned long long *msr)
1596 retval = pread(get_msr_fd(cpu), msr, sizeof(*msr), offset);
1598 if (retval != sizeof *msr)
1599 err(-1, "cpu%d: msr offset 0x%llx read failed", cpu, (unsigned long long)offset);
1654 " -M, --no-msr Disable all uses of the MSR driver\n"
3007 unsigned long long msr;
3029 get_msr(cpu, MSR_IA32_ENERGY_PERF_BIAS, &msr);
3031 return msr & 0xf;
3160 const char *const path = "/sys/bus/event_source/devices/msr/type";
3168 const char *const path = "/sys/bus/event_source/devices/msr/events/aperf";
3176 const char *const path = "/sys/bus/event_source/devices/msr/events/mperf";
3414 fprintf(stderr, "Reading rapl counter via msr at %u\n", i);
3418 if (get_msr_sum(cpu, rci->msr[i], &rci->data[i]))
3421 if (get_msr(cpu, rci->msr[i], &rci->data[i]))
3455 unsigned long long msr;
3498 if (get_msr(cpu, MSR_SMI_COUNT, &msr))
3500 t->smi_count = msr & 0xFFFFFFFF;
3554 if (get_msr(cpu, MSR_IA32_THERM_STATUS, &msr))
3556 c->core_temp_c = tj_max - ((msr >> 16) & 0x7F);
3628 if (get_msr(cpu, MSR_IA32_PACKAGE_THERM_STATUS, &msr))
3630 p->pkg_temp_c = tj_max - ((msr >> 16) & 0x7F);
3740 unsigned long long msr;
3778 get_msr(base_cpu, MSR_PKG_CST_CONFIG_CONTROL, &msr);
3779 pkg_cstate_limit = pkg_cstate_limits[msr & 0xF];
3784 unsigned long long msr;
3790 get_msr(base_cpu, MSR_PLATFORM_INFO, &msr);
3792 fprintf(outf, "cpu%d: MSR_PLATFORM_INFO: 0x%08llx\n", base_cpu, msr);
3794 ratio = (msr >> 40) & 0xFF;
3797 ratio = (msr >> 8) & 0xFF;
3803 unsigned long long msr;
3808 get_msr(base_cpu, MSR_IA32_POWER_CTL, &msr);
3810 base_cpu, msr, msr & 0x2 ? "EN" : "DIS");
3814 fprintf(outf, "C-state Pre-wake: %sabled\n", msr & 0x40000000 ? "DIS" : "EN");
3821 unsigned long long msr;
3824 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT2, &msr);
3826 fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT2: 0x%08llx\n", base_cpu, msr);
3828 ratio = (msr >> 8) & 0xFF;
3832 ratio = (msr >> 0) & 0xFF;
3840 unsigned long long msr;
3843 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT1, &msr);
3845 fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT1: 0x%08llx\n", base_cpu, msr);
3847 ratio = (msr >> 56) & 0xFF;
3851 ratio = (msr >> 48) & 0xFF;
3855 ratio = (msr >> 40) & 0xFF;
3859 ratio = (msr >> 32) & 0xFF;
3863 ratio = (msr >> 24) & 0xFF;
3867 ratio = (msr >> 16) & 0xFF;
3871 ratio = (msr >> 8) & 0xFF;
3875 ratio = (msr >> 0) & 0xFF;
3883 unsigned long long msr, core_counts;
3886 get_msr(base_cpu, trl_msr_offset, &msr);
3888 base_cpu, trl_msr_offset == MSR_SECONDARY_TURBO_RATIO_LIMIT ? "SECONDARY_" : "", msr);
3900 ratio = (msr >> shift) & 0xFF;
3912 unsigned long long msr;
3915 get_msr(base_cpu, MSR_ATOM_CORE_RATIOS, &msr);
3916 fprintf(outf, "cpu%d: MSR_ATOM_CORE_RATIOS: 0x%08llx\n", base_cpu, msr & 0xFFFFFFFF);
3918 ratio = (msr >> 0) & 0x3F;
3922 ratio = (msr >> 8) & 0x3F;
3926 ratio = (msr >> 16) & 0x3F;
3930 get_msr(base_cpu, MSR_ATOM_CORE_TURBO_RATIOS, &msr);
3931 fprintf(outf, "cpu%d: MSR_ATOM_CORE_TURBO_RATIOS: 0x%08llx\n", base_cpu, msr & 0xFFFFFFFF);
3933 ratio = (msr >> 24) & 0x3F;
3937 ratio = (msr >> 16) & 0x3F;
3941 ratio = (msr >> 8) & 0x3F;
3945 ratio = (msr >> 0) & 0x3F;
3954 unsigned long long msr;
3960 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT, &msr);
3962 fprintf(outf, "cpu%d: MSR_TURBO_RATIO_LIMIT: 0x%08llx\n", base_cpu, msr);
3988 cores[b_nr] = (msr & 0xFF) >> 1;
3989 ratio[b_nr] = (msr >> 8) & 0xFF;
3992 delta_cores = (msr >> i) & 0x1F;
3993 delta_ratio = (msr >> (i + 5)) & 0x7;
4009 unsigned long long msr;
4014 get_msr(base_cpu, MSR_PKG_CST_CONFIG_CONTROL, &msr);
4016 fprintf(outf, "cpu%d: MSR_PKG_CST_CONFIG_CONTROL: 0x%08llx", base_cpu, msr);
4019 (msr & SNB_C3_AUTO_UNDEMOTE) ? "UNdemote-C3, " : "",
4020 (msr & SNB_C1_AUTO_UNDEMOTE) ? "UNdemote-C1, " : "",
4021 (msr & NHM_C3_AUTO_DEMOTE) ? "demote-C3, " : "",
4022 (msr & NHM_C1_AUTO_DEMOTE) ? "demote-C1, " : "",
4023 (msr & (1 << 15)) ? "" : "UN", (unsigned int)msr & 0xF, pkg_cstate_limit_strings[pkg_cstate_limit]);
4027 fprintf(outf, ", automatic c-state conversion=%s", (msr & AUTOMATIC_CSTATE_CONVERSION) ? "on" : "off");
4037 unsigned long long msr;
4039 get_msr(base_cpu, MSR_CONFIG_TDP_NOMINAL, &msr);
4040 fprintf(outf, "cpu%d: MSR_CONFIG_TDP_NOMINAL: 0x%08llx", base_cpu, msr);
4041 fprintf(outf, " (base_ratio=%d)\n", (unsigned int)msr & 0xFF);
4043 get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_1, &msr);
4044 fprintf(outf, "cpu%d: MSR_CONFIG_TDP_LEVEL_1: 0x%08llx (", base_cpu, msr);
4045 if (msr) {
4046 fprintf(outf, "PKG_MIN_PWR_LVL1=%d ", (unsigned int)(msr >> 48) & 0x7FFF);
4047 fprintf(outf, "PKG_MAX_PWR_LVL1=%d ", (unsigned int)(msr >> 32) & 0x7FFF);
4048 fprintf(outf, "LVL1_RATIO=%d ", (unsigned int)(msr >> 16) & 0xFF);
4049 fprintf(outf, "PKG_TDP_LVL1=%d", (unsigned int)(msr) & 0x7FFF);
4053 get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_2, &msr);
4054 fprintf(outf, "cpu%d: MSR_CONFIG_TDP_LEVEL_2: 0x%08llx (", base_cpu, msr);
4055 if (msr) {
4056 fprintf(outf, "PKG_MIN_PWR_LVL2=%d ", (unsigned int)(msr >> 48) & 0x7FFF);
4057 fprintf(outf, "PKG_MAX_PWR_LVL2=%d ", (unsigned int)(msr >> 32) & 0x7FFF);
4058 fprintf(outf, "LVL2_RATIO=%d ", (unsigned int)(msr >> 16) & 0xFF);
4059 fprintf(outf, "PKG_TDP_LVL2=%d", (unsigned int)(msr) & 0x7FFF);
4063 get_msr(base_cpu, MSR_CONFIG_TDP_CONTROL, &msr);
4064 fprintf(outf, "cpu%d: MSR_CONFIG_TDP_CONTROL: 0x%08llx (", base_cpu, msr);
4065 if ((msr) & 0x3)
4066 fprintf(outf, "TDP_LEVEL=%d ", (unsigned int)(msr) & 0x3);
4067 fprintf(outf, " lock=%d", (unsigned int)(msr >> 31) & 1);
4070 get_msr(base_cpu, MSR_TURBO_ACTIVATION_RATIO, &msr);
4071 fprintf(outf, "cpu%d: MSR_TURBO_ACTIVATION_RATIO: 0x%08llx (", base_cpu, msr);
4072 fprintf(outf, "MAX_NON_TURBO_RATIO=%d", (unsigned int)(msr) & 0xFF);
4073 fprintf(outf, " lock=%d", (unsigned int)(msr >> 31) & 1);
4081 unsigned long long msr;
4087 get_msr(base_cpu, MSR_PKGC3_IRTL, &msr);
4088 fprintf(outf, "cpu%d: MSR_PKGC3_IRTL: 0x%08llx (", base_cpu, msr);
4089 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT",
4090 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]);
4094 get_msr(base_cpu, MSR_PKGC6_IRTL, &msr);
4095 fprintf(outf, "cpu%d: MSR_PKGC6_IRTL: 0x%08llx (", base_cpu, msr);
4096 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT",
4097 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]);
4101 get_msr(base_cpu, MSR_PKGC7_IRTL, &msr);
4102 fprintf(outf, "cpu%d: MSR_PKGC7_IRTL: 0x%08llx (", base_cpu, msr);
4103 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT",
4104 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]);
4108 get_msr(base_cpu, MSR_PKGC8_IRTL, &msr);
4109 fprintf(outf, "cpu%d: MSR_PKGC8_IRTL: 0x%08llx (", base_cpu, msr);
4110 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT",
4111 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]);
4115 get_msr(base_cpu, MSR_PKGC9_IRTL, &msr);
4116 fprintf(outf, "cpu%d: MSR_PKGC9_IRTL: 0x%08llx (", base_cpu, msr);
4117 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT",
4118 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]);
4122 get_msr(base_cpu, MSR_PKGC10_IRTL, &msr);
4123 fprintf(outf, "cpu%d: MSR_PKGC10_IRTL: 0x%08llx (", base_cpu, msr);
4124 fprintf(outf, "%svalid, %lld ns)\n", msr & (1 << 15) ? "" : "NOT",
4125 (msr & 0x3FF) * irtl_time_units[(msr >> 10) & 0x3]);
4886 int get_msr_sum(int cpu, off_t offset, unsigned long long *msr)
4905 *msr = msr_last + per_cpu_msr_sum[cpu].entries[idx].sum;
4934 fprintf(outf, "Can not update msr(0x%llx)\n", (unsigned long long)offset);
5128 sprintf(pathname, "/dev/cpu/%d/msr", base_cpu);
5130 if (system("/sbin/modprobe msr > /dev/null 2>&1"))
5178 sprintf(pathname, "/dev/cpu/%d/msr", base_cpu);
5185 "\tRun as root to enable them or use %s to disable the access explicitly", pathname, "--no-msr");
5192 unsigned long long msr;
5207 get_msr(base_cpu, MSR_PLATFORM_INFO, &msr);
5208 base_ratio = (msr >> 8) & 0xFF;
5643 unsigned long long msr;
5666 if (get_msr(cpu, MSR_PM_ENABLE, &msr))
5669 fprintf(outf, "cpu%d: MSR_PM_ENABLE: 0x%08llx (%sHWP)\n", cpu, msr, (msr & (1 << 0)) ? "" : "No-");
5672 if ((msr & (1 << 0)) == 0)
5675 if (get_msr(cpu, MSR_HWP_CAPABILITIES, &msr))
5680 cpu, msr,
5681 (unsigned int)HWP_HIGHEST_PERF(msr),
5682 (unsigned int)HWP_GUARANTEED_PERF(msr),
5683 (unsigned int)HWP_MOSTEFFICIENT_PERF(msr), (unsigned int)HWP_LOWEST_PERF(msr));
5685 if (get_msr(cpu, MSR_HWP_REQUEST, &msr))
5690 cpu, msr,
5691 (unsigned int)(((msr) >> 0) & 0xff),
5692 (unsigned int)(((msr) >> 8) & 0xff),
5693 (unsigned int)(((msr) >> 16) & 0xff),
5694 (unsigned int)(((msr) >> 24) & 0xff),
5695 (unsigned int)(((msr) >> 32) & 0xff3), (unsigned int)(((msr) >> 42) & 0x1));
5698 if (get_msr(cpu, MSR_HWP_REQUEST_PKG, &msr))
5703 cpu, msr,
5704 (unsigned int)(((msr) >> 0) & 0xff),
5705 (unsigned int)(((msr) >> 8) & 0xff),
5706 (unsigned int)(((msr) >> 16) & 0xff),
5707 (unsigned int)(((msr) >> 24) & 0xff), (unsigned int)(((msr) >> 32) & 0xff3));
5710 if (get_msr(cpu, MSR_HWP_INTERRUPT, &msr))
5715 cpu, msr, ((msr) & 0x1) ? "EN" : "Dis", ((msr) & 0x2) ? "EN" : "Dis");
5717 if (get_msr(cpu, MSR_HWP_STATUS, &msr))
5722 cpu, msr, ((msr) & 0x1) ? "" : "No-", ((msr) & 0x4) ? "" : "No-");
5732 unsigned long long msr;
5753 get_msr(cpu, MSR_CORE_PERF_LIMIT_REASONS, &msr);
5754 fprintf(outf, "cpu%d: MSR_CORE_PERF_LIMIT_REASONS, 0x%08llx", cpu, msr);
5756 (msr & 1 << 15) ? "bit15, " : "",
5757 (msr & 1 << 14) ? "bit14, " : "",
5758 (msr & 1 << 13) ? "Transitions, " : "",
5759 (msr & 1 << 12) ? "MultiCoreTurbo, " : "",
5760 (msr & 1 << 11) ? "PkgPwrL2, " : "",
5761 (msr & 1 << 10) ? "PkgPwrL1, " : "",
5762 (msr & 1 << 9) ? "CorePwr, " : "",
5763 (msr & 1 << 8) ? "Amps, " : "",
5764 (msr & 1 << 6) ? "VR-Therm, " : "",
5765 (msr & 1 << 5) ? "Auto-HWP, " : "",
5766 (msr & 1 << 4) ? "Graphics, " : "",
5767 (msr & 1 << 2) ? "bit2, " : "",
5768 (msr & 1 << 1) ? "ThermStatus, " : "", (msr & 1 << 0) ? "PROCHOT, " : "");
5770 (msr & 1 << 31) ? "bit31, " : "",
5771 (msr & 1 << 30) ? "bit30, " : "",
5772 (msr & 1 << 29) ? "Transitions, " : "",
5773 (msr & 1 << 28) ? "MultiCoreTurbo, " : "",
5774 (msr & 1 << 27) ? "PkgPwrL2, " : "",
5775 (msr & 1 << 26) ? "PkgPwrL1, " : "",
5776 (msr & 1 << 25) ? "CorePwr, " : "",
5777 (msr & 1 << 24) ? "Amps, " : "",
5778 (msr & 1 << 22) ? "VR-Therm, " : "",
5779 (msr & 1 << 21) ? "Auto-HWP, " : "",
5780 (msr & 1 << 20) ? "Graphics, " : "",
5781 (msr & 1 << 18) ? "bit18, " : "",
5782 (msr & 1 << 17) ? "ThermStatus, " : "", (msr & 1 << 16) ? "PROCHOT, " : "");
5786 get_msr(cpu, MSR_GFX_PERF_LIMIT_REASONS, &msr);
5787 fprintf(outf, "cpu%d: MSR_GFX_PERF_LIMIT_REASONS, 0x%08llx", cpu, msr);
5789 (msr & 1 << 0) ? "PROCHOT, " : "",
5790 (msr & 1 << 1) ? "ThermStatus, " : "",
5791 (msr & 1 << 4) ? "Graphics, " : "",
5792 (msr & 1 << 6) ? "VR-Therm, " : "",
5793 (msr & 1 << 8) ? "Amps, " : "",
5794 (msr & 1 << 9) ? "GFXPwr, " : "",
5795 (msr & 1 << 10) ? "PkgPwrL1, " : "", (msr & 1 << 11) ? "PkgPwrL2, " : "");
5797 (msr & 1 << 16) ? "PROCHOT, " : "",
5798 (msr & 1 << 17) ? "ThermStatus, " : "",
5799 (msr & 1 << 20) ? "Graphics, " : "",
5800 (msr & 1 << 22) ? "VR-Therm, " : "",
5801 (msr & 1 << 24) ? "Amps, " : "",
5802 (msr & 1 << 25) ? "GFXPwr, " : "",
5803 (msr & 1 << 26) ? "PkgPwrL1, " : "", (msr & 1 << 27) ? "PkgPwrL2, " : "");
5806 get_msr(cpu, MSR_RING_PERF_LIMIT_REASONS, &msr);
5807 fprintf(outf, "cpu%d: MSR_RING_PERF_LIMIT_REASONS, 0x%08llx", cpu, msr);
5809 (msr & 1 << 0) ? "PROCHOT, " : "",
5810 (msr & 1 << 1) ? "ThermStatus, " : "",
5811 (msr & 1 << 6) ? "VR-Therm, " : "",
5812 (msr & 1 << 8) ? "Amps, " : "",
5813 (msr & 1 << 10) ? "PkgPwrL1, " : "", (msr & 1 << 11) ? "PkgPwrL2, " : "");
5815 (msr & 1 << 16) ? "PROCHOT, " : "",
5816 (msr & 1 << 17) ? "ThermStatus, " : "",
5817 (msr & 1 << 22) ? "VR-Therm, " : "",
5818 (msr & 1 << 24) ? "Amps, " : "",
5819 (msr & 1 << 26) ? "PkgPwrL1, " : "", (msr & 1 << 27) ? "PkgPwrL2, " : "");
5837 unsigned long long msr;
5840 if (!get_msr(base_cpu, MSR_PKG_POWER_INFO, &msr))
5841 return ((msr >> 0) & RAPL_POWER_GRANULARITY) * rapl_power_units;
5852 unsigned long long msr;
5869 if (get_msr(base_cpu, MSR_RAPL_POWER_UNIT, &msr))
5872 rapl_power_units = 1.0 / (1 << (msr & 0xF));
5874 rapl_energy_units = 1.0 * (1 << (msr >> 8 & 0x1F)) / 1000000;
5876 rapl_energy_units = 1.0 / (1 << (msr >> 8 & 0x1F));
5883 time_unit = msr >> 16 & 0xF;
5898 unsigned long long msr;
5908 if (get_msr(base_cpu, MSR_RAPL_PWR_UNIT, &msr))
5911 rapl_time_units = ldexp(1.0, -(msr >> 16 & 0xf));
5912 rapl_energy_units = ldexp(1.0, -(msr >> 8 & 0x1f));
5913 rapl_power_units = ldexp(1.0, -(msr & 0xf));
5922 void print_power_limit_msr(int cpu, unsigned long long msr, char *label)
5926 ((msr >> 15) & 1) ? "EN" : "DIS",
5927 ((msr >> 0) & 0x7FFF) * rapl_power_units,
5928 (1.0 + (((msr >> 22) & 0x3) / 4.0)) * (1 << ((msr >> 17) & 0x1F)) * rapl_time_units,
5929 (((msr >> 16) & 1) ? "EN" : "DIS"));
5936 unsigned long long msr;
5958 if (get_msr(cpu, MSR_RAPL_PWR_UNIT, &msr))
5962 if (get_msr(cpu, MSR_RAPL_POWER_UNIT, &msr))
5966 fprintf(outf, "cpu%d: %s: 0x%08llx (%f Watts, %f Joules, %f sec.)\n", cpu, msr_name, msr,
5971 if (get_msr(cpu, MSR_PKG_POWER_INFO, &msr))
5975 cpu, msr,
5976 ((msr >> 0) & RAPL_POWER_GRANULARITY) * rapl_power_units,
5977 ((msr >> 16) & RAPL_POWER_GRANULARITY) * rapl_power_units,
5978 ((msr >> 32) & RAPL_POWER_GRANULARITY) * rapl_power_units,
5979 ((msr >> 48) & RAPL_TIME_GRANULARITY) * rapl_time_units);
5984 if (get_msr(cpu, MSR_PKG_POWER_LIMIT, &msr))
5988 cpu, msr, (msr >> 63) & 1 ? "" : "UN");
5990 print_power_limit_msr(cpu, msr, "PKG Limit #1");
5993 ((msr >> 47) & 1) ? "EN" : "DIS",
5994 ((msr >> 32) & 0x7FFF) * rapl_power_units,
5995 (1.0 + (((msr >> 54) & 0x3) / 4.0)) * (1 << ((msr >> 49) & 0x1F)) * rapl_time_units,
5996 ((msr >> 48) & 1) ? "EN" : "DIS");
5998 if (get_msr(cpu, MSR_VR_CURRENT_CONFIG, &msr))
6001 fprintf(outf, "cpu%d: MSR_VR_CURRENT_CONFIG: 0x%08llx\n", cpu, msr);
6003 cpu, ((msr >> 0) & 0x1FFF) * rapl_power_units, (msr >> 31) & 1 ? "" : "UN");
6007 if (get_msr(cpu, MSR_DRAM_POWER_INFO, &msr))
6011 cpu, msr,
6012 ((msr >> 0) & RAPL_POWER_GRANULARITY) * rapl_power_units,
6013 ((msr >> 16) & RAPL_POWER_GRANULARITY) * rapl_power_units,
6014 ((msr >> 32) & RAPL_POWER_GRANULARITY) * rapl_power_units,
6015 ((msr >> 48) & RAPL_TIME_GRANULARITY) * rapl_time_units);
6018 if (get_msr(cpu, MSR_DRAM_POWER_LIMIT, &msr))
6021 cpu, msr, (msr >> 31) & 1 ? "" : "UN");
6023 print_power_limit_msr(cpu, msr, "DRAM Limit");
6026 if (get_msr(cpu, MSR_PP0_POLICY, &msr))
6029 fprintf(outf, "cpu%d: MSR_PP0_POLICY: %lld\n", cpu, msr & 0xF);
6032 if (get_msr(cpu, MSR_PP0_POWER_LIMIT, &msr))
6035 cpu, msr, (msr >> 31) & 1 ? "" : "UN");
6036 print_power_limit_msr(cpu, msr, "Cores Limit");
6039 if (get_msr(cpu, MSR_PP1_POLICY, &msr))
6042 fprintf(outf, "cpu%d: MSR_PP1_POLICY: %lld\n", cpu, msr & 0xF);
6044 if (get_msr(cpu, MSR_PP1_POWER_LIMIT, &msr))
6047 cpu, msr, (msr >> 31) & 1 ? "" : "UN");
6048 print_power_limit_msr(cpu, msr, "GFX Limit");
6088 unsigned long long msr;
6119 if (get_msr(base_cpu, MSR_IA32_TEMPERATURE_TARGET, &msr))
6122 tcc_default = (msr >> 16) & 0xFF;
6132 tcc_offset = (msr >> 24) & GENMASK(bits - 1, 0);
6134 cpu, msr, tcc_default - tcc_offset, tcc_default, tcc_offset);
6136 fprintf(outf, "cpu%d: MSR_IA32_TEMPERATURE_TARGET: 0x%08llx (%d C)\n", cpu, msr, tcc_default);
6156 unsigned long long msr;
6181 if (get_msr(cpu, MSR_IA32_PACKAGE_THERM_STATUS, &msr))
6184 dts = (msr >> 16) & 0x7F;
6185 fprintf(outf, "cpu%d: MSR_IA32_PACKAGE_THERM_STATUS: 0x%08llx (%d C)\n", cpu, msr, tj_max - dts);
6187 if (get_msr(cpu, MSR_IA32_PACKAGE_THERM_INTERRUPT, &msr))
6190 dts = (msr >> 16) & 0x7F;
6191 dts2 = (msr >> 8) & 0x7F;
6193 cpu, msr, tj_max - dts, tj_max - dts2);
6199 if (get_msr(cpu, MSR_IA32_THERM_STATUS, &msr))
6202 dts = (msr >> 16) & 0x7F;
6203 resolution = (msr >> 27) & 0xF;
6205 cpu, msr, tj_max - dts, resolution);
6207 if (get_msr(cpu, MSR_IA32_THERM_INTERRUPT, &msr))
6210 dts = (msr >> 16) & 0x7F;
6211 dts2 = (msr >> 8) & 0x7F;
6213 cpu, msr, tj_max - dts, tj_max - dts2);
6261 unsigned long long msr;
6266 if (!get_msr(base_cpu, MSR_IA32_FEAT_CTL, &msr))
6268 base_cpu, msr, msr & FEAT_CTL_LOCKED ? "" : "UN-", msr & (1 << 18) ? "SGX" : "");
6273 unsigned long long msr;
6281 if (!get_msr(base_cpu, MSR_IA32_MISC_ENABLE, &msr))
6283 base_cpu, msr,
6284 msr & MSR_IA32_MISC_ENABLE_TM1 ? "" : "No-",
6285 msr & MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP ? "" : "No-",
6286 msr & MSR_IA32_MISC_ENABLE_MWAIT ? "" : "No-",
6287 msr & MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE ? "No-" : "",
6288 msr & MSR_IA32_MISC_ENABLE_TURBO_DISABLE ? "No-" : "");
6293 unsigned long long msr;
6301 if (!get_msr(base_cpu, MSR_MISC_FEATURE_CONTROL, &msr))
6304 base_cpu, msr, msr & (0 << 0) ? "No-" : "", msr & (1 << 0) ? "No-" : "",
6305 msr & (2 << 0) ? "No-" : "", msr & (3 << 0) ? "No-" : "");
6317 unsigned long long msr;
6325 if (!get_msr(base_cpu, MSR_MISC_PWR_MGMT, &msr))
6327 base_cpu, msr,
6328 msr & (1 << 0) ? "DIS" : "EN", msr & (1 << 1) ? "EN" : "DIS", msr & (1 << 8) ? "EN" : "DIS");
6339 unsigned long long msr;
6347 if (!get_msr(base_cpu, MSR_CC6_DEMOTION_POLICY_CONFIG, &msr))
6349 base_cpu, msr, msr & (1 << 0) ? "EN" : "DIS");
6351 if (!get_msr(base_cpu, MSR_MC6_DEMOTION_POLICY_CONFIG, &msr))
6353 base_cpu, msr, msr & (1 << 0) ? "EN" : "DIS");
6543 } else if (!no_msr && cai->msr && probe_msr(cpu, cai->msr) == 0) {
6545 rci->msr[cai->rci_index] = cai->msr;
7314 fprintf(outf, "aperf/mperf source preference: %s\n", amperf_source == AMPERF_SOURCE_MSR ? "msr" : "perf");
7533 errx(1, "Requested MSR counter 0x%x, but in --no-msr mode", msr_num);
7602 if (sscanf(add_command, "msr%d", &msr_num) == 1)
7839 { "no-msr", no_argument, 0, 'M' },
7852 * like adding the MSR counter with --add and at the same time using --no-msr.