diff --git a/sys/x86/cpufreq/hwpstate_amd.c b/sys/x86/cpufreq/hwpstate_amd.c --- a/sys/x86/cpufreq/hwpstate_amd.c +++ b/sys/x86/cpufreq/hwpstate_amd.c @@ -137,6 +137,11 @@ "If enabled (1), limit administrative control of P-states to the value in " "CurPstateLimit"); +static bool hwpstate_prefer_msr; +SYSCTL_BOOL(_debug, OID_AUTO, hwpstate_prefer_msr, CTLFLAG_RDTUN, + &hwpstate_prefer_msr, 0, + "If enabled (1), use MSR instead of acpi_perf for P-state information"); + static device_method_t hwpstate_methods[] = { /* Device interface */ DEVMETHOD(device_identify, hwpstate_identify), @@ -385,15 +390,17 @@ * we can get _PSS info from acpi_perf * without going into ACPI. */ - HWPSTATE_DEBUG(dev, "going to fetch info from acpi_perf\n"); - error = hwpstate_get_info_from_acpi_perf(dev, perf_dev); + if (!hwpstate_prefer_msr) { + HWPSTATE_DEBUG(dev, "going to fetch info from acpi_perf\n"); + error = hwpstate_get_info_from_acpi_perf(dev, perf_dev); + } } } } - if (error == 0) { + if (error == 0 && !hwpstate_prefer_msr) { /* - * Now we get _PSS info from acpi_perf without error. + * We got _PSS info from acpi_perf without error. * Let's check it. */ msr = rdmsr(MSR_AMD_10H_11H_LIMIT); @@ -408,7 +415,7 @@ * If we cannot get info from acpi_perf, * Let's get info from MSRs. */ - if (error) + if (error || hwpstate_prefer_msr) error = hwpstate_get_info_from_msr(dev); if (error) return (error);