From 495b57cd9b9ed106f33efe638f6cd5a267b40658 Mon Sep 17 00:00:00 2001 From: cem Date: Sat, 1 Feb 2020 19:46:02 +0000 Subject: [PATCH] x86: Add/amend some power-management comments/macros No functional change. --- sys/x86/cpufreq/hwpstate_intel.c | 12 ++++++++++++ sys/x86/include/specialreg.h | 1 + sys/x86/x86/identcpu.c | 6 +++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/sys/x86/cpufreq/hwpstate_intel.c b/sys/x86/cpufreq/hwpstate_intel.c index 2caef66c6ad..69de190e0fa 100644 --- a/sys/x86/cpufreq/hwpstate_intel.c +++ b/sys/x86/cpufreq/hwpstate_intel.c @@ -329,6 +329,14 @@ set_autonomous_hwp(struct hwp_softc *sc) /* XXX: Many MSRs aren't readable until feature is enabled */ ret = wrmsr_safe(MSR_IA32_PM_ENABLE, 1); if (ret) { + /* + * This is actually a package-level MSR, and only the first + * write is not ignored. So it is harmless to enable it across + * all devices, and this allows us not to care especially in + * which order cores (and packages) are probed. This error + * condition should not happen given we gate on the HWP CPUID + * feature flag, if the Intel SDM is correct. + */ device_printf(dev, "Failed to enable HWP for cpu%d (%d)\n", pc->pc_cpuid, ret); goto out; @@ -350,6 +358,10 @@ set_autonomous_hwp(struct hwp_softc *sc) goto out; } + /* + * High and low are static; "guaranteed" is dynamic; and efficient is + * also dynamic. + */ sc->high = IA32_HWP_CAPABILITIES_HIGHEST_PERFORMANCE(caps); sc->guaranteed = IA32_HWP_CAPABILITIES_GUARANTEED_PERFORMANCE(caps); sc->efficient = IA32_HWP_CAPABILITIES_EFFICIENT_PERFORMANCE(caps); diff --git a/sys/x86/include/specialreg.h b/sys/x86/include/specialreg.h index 7dbdeb4b14d..c17c159660d 100644 --- a/sys/x86/include/specialreg.h +++ b/sys/x86/include/specialreg.h @@ -566,6 +566,7 @@ #define MSR_IA32_TEMPERATURE_TARGET 0x1a2 #define MSR_TURBO_RATIO_LIMIT 0x1ad #define MSR_TURBO_RATIO_LIMIT1 0x1ae +#define MSR_IA32_ENERGY_PERF_BIAS 0x1b0 #define MSR_DEBUGCTLMSR 0x1d9 #define MSR_LASTBRANCHFROMIP 0x1db #define MSR_LASTBRANCHTOIP 0x1dc diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c index 4eddc7dabb6..8c554c6f65d 100644 --- a/sys/x86/x86/identcpu.c +++ b/sys/x86/x86/identcpu.c @@ -119,9 +119,9 @@ u_int cpu_mon_min_size; /* MONITOR minimum range size, bytes */ u_int cpu_mon_max_size; /* MONITOR minimum range size, bytes */ u_int cpu_maxphyaddr; /* Max phys addr width in bits */ u_int cpu_power_eax; /* 06H: Power management leaf, %eax */ -u_int cpu_power_ebx; /* 06H: Power management leaf, %eax */ -u_int cpu_power_ecx; /* 06H: Power management leaf, %eax */ -u_int cpu_power_edx; /* 06H: Power management leaf, %eax */ +u_int cpu_power_ebx; /* 06H: Power management leaf, %ebx */ +u_int cpu_power_ecx; /* 06H: Power management leaf, %ecx */ +u_int cpu_power_edx; /* 06H: Power management leaf, %edx */ char machine[] = MACHINE; SYSCTL_UINT(_hw, OID_AUTO, via_feature_rng, CTLFLAG_RD, -- 2.45.2