Lines Matching +full:ecx +full:- +full:1000

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
114 "Set 1 (default) to enable package-level control, 0 to disable");
127 dev = sc->dev; in intel_hwp_dump_sysctl_handler()
136 sched_bind(curthread, pc->pc_cpuid); in intel_hwp_dump_sysctl_handler()
140 sbuf_printf(sb, "CPU%d: HWP %sabled\n", pc->pc_cpuid, in intel_hwp_dump_sysctl_handler()
156 if (sc->hwp_pkg_ctrl && (data & IA32_HWP_REQUEST_PACKAGE_CONTROL)) in intel_hwp_dump_sysctl_handler()
162 if (!sc->hwp_pkg_ctrl || (data & x) != 0) \ in intel_hwp_dump_sysctl_handler()
204 * Given x * 10 in [0, 1000], round to the integer nearest x.
206 * This allows round-tripping nice human readable numbers through this
207 * interface. Otherwise, user-provided percentages such as 25, 50, 75 get
220 return (round10(x * 1000 / 0xff)); in raw_to_percent()
223 /* Range of MSR_IA32_ENERGY_PERF_BIAS is more limited: 0-0xf. */
229 * also round-trip to the same raw value. in percent_to_raw_perf_bias()
253 dev = oidp->oid_arg1; in sysctl_epp_select()
255 if (!sc->hwp_pref_ctrl && !sc->hwp_perf_bias) in sysctl_epp_select()
263 sched_bind(curthread, pc->pc_cpuid); in sysctl_epp_select()
266 if (sc->hwp_pref_ctrl) { in sysctl_epp_select()
267 val = (sc->req & IA32_HWP_REQUEST_ENERGY_PERFORMANCE_PREFERENCE) >> 24; in sysctl_epp_select()
273 * This register is per-core (but not HT). in sysctl_epp_select()
275 if (!sc->hwp_perf_bias_cached) { in sysctl_epp_select()
279 sc->hwp_energy_perf_bias = epb; in sysctl_epp_select()
280 sc->hwp_perf_bias_cached = true; in sysctl_epp_select()
282 val = sc->hwp_energy_perf_bias & in sysctl_epp_select()
290 if (ret || req->newptr == NULL) in sysctl_epp_select()
298 if (sc->hwp_pref_ctrl) { in sysctl_epp_select()
301 sc->req = in sysctl_epp_select()
302 ((sc->req & ~IA32_HWP_REQUEST_ENERGY_PERFORMANCE_PREFERENCE) in sysctl_epp_select()
305 if (sc->hwp_pkg_ctrl_en) in sysctl_epp_select()
306 ret = wrmsr_safe(MSR_IA32_HWP_REQUEST_PKG, sc->req); in sysctl_epp_select()
308 ret = wrmsr_safe(MSR_IA32_HWP_REQUEST, sc->req); in sysctl_epp_select()
313 sc->hwp_energy_perf_bias = in sysctl_epp_select()
314 ((sc->hwp_energy_perf_bias & in sysctl_epp_select()
317 sc->hwp_energy_perf_bias); in sysctl_epp_select()
331 if (device_find_child(parent, "hwpstate_intel", -1) != NULL) in intel_hwpstate_identify()
371 dev = sc->dev; in set_autonomous_hwp()
378 sched_bind(curthread, pc->pc_cpuid); in set_autonomous_hwp()
385 * This is actually a package-level MSR, and only the first in set_autonomous_hwp()
393 pc->pc_cpuid, ret); in set_autonomous_hwp()
397 ret = rdmsr_safe(MSR_IA32_HWP_REQUEST, &sc->req); in set_autonomous_hwp()
401 pc->pc_cpuid, ret); in set_autonomous_hwp()
409 pc->pc_cpuid, ret); in set_autonomous_hwp()
417 sc->high = IA32_HWP_CAPABILITIES_HIGHEST_PERFORMANCE(caps); in set_autonomous_hwp()
418 sc->guaranteed = IA32_HWP_CAPABILITIES_GUARANTEED_PERFORMANCE(caps); in set_autonomous_hwp()
419 sc->efficient = IA32_HWP_CAPABILITIES_EFFICIENT_PERFORMANCE(caps); in set_autonomous_hwp()
420 sc->low = IA32_HWP_CAPABILITIES_LOWEST_PERFORMANCE(caps); in set_autonomous_hwp()
423 sc->req &= ~IA32_HWP_DESIRED_PERFORMANCE; in set_autonomous_hwp()
426 sc->req &= ~IA32_HWP_ACTIVITY_WINDOW; in set_autonomous_hwp()
429 sc->req &= ~IA32_HWP_MINIMUM_PERFORMANCE; in set_autonomous_hwp()
430 sc->req |= sc->low; in set_autonomous_hwp()
433 sc->req &= ~IA32_HWP_REQUEST_MAXIMUM_PERFORMANCE; in set_autonomous_hwp()
434 sc->req |= sc->high << 8; in set_autonomous_hwp()
436 /* If supported, request package-level control for this CPU. */ in set_autonomous_hwp()
437 if (sc->hwp_pkg_ctrl_en) in set_autonomous_hwp()
438 ret = wrmsr_safe(MSR_IA32_HWP_REQUEST, sc->req | in set_autonomous_hwp()
441 ret = wrmsr_safe(MSR_IA32_HWP_REQUEST, sc->req); in set_autonomous_hwp()
445 sc->hwp_pkg_ctrl_en ? " PKG" : "", pc->pc_cpuid); in set_autonomous_hwp()
449 /* If supported, write the PKG-wide control MSR. */ in set_autonomous_hwp()
450 if (sc->hwp_pkg_ctrl_en) { in set_autonomous_hwp()
453 * (package-level) is identical to the IA32_HWP_REQUEST MSR in set_autonomous_hwp()
457 ret = wrmsr_safe(MSR_IA32_HWP_REQUEST_PKG, sc->req); in set_autonomous_hwp()
479 sc->dev = dev; in intel_hwpstate_attach()
483 sc->hwp_notifications = true; in intel_hwpstate_attach()
485 sc->hwp_activity_window = true; in intel_hwpstate_attach()
487 sc->hwp_pref_ctrl = true; in intel_hwpstate_attach()
489 sc->hwp_pkg_ctrl = true; in intel_hwpstate_attach()
491 /* Allow administrators to disable pkg-level control. */ in intel_hwpstate_attach()
492 sc->hwp_pkg_ctrl_en = (sc->hwp_pkg_ctrl && hwpstate_pkg_ctrl_enable); in intel_hwpstate_attach()
494 /* ecx */ in intel_hwpstate_attach()
496 sc->hwp_perf_bias = true; in intel_hwpstate_attach()
539 set->dev = dev; in intel_hwpstate_get()
541 ret = cpu_est_clockrate(pc->pc_cpuid, &rate); in intel_hwpstate_get()
543 set->freq = rate / 1000000; in intel_hwpstate_get()
545 set->volts = CPUFREQ_VAL_UNKNOWN; in intel_hwpstate_get()
546 set->power = CPUFREQ_VAL_UNKNOWN; in intel_hwpstate_get()
547 set->lat = CPUFREQ_VAL_UNKNOWN; in intel_hwpstate_get()
586 sched_bind(curthread, pc->pc_cpuid); in intel_hwpstate_resume()
593 pc->pc_cpuid, ret); in intel_hwpstate_resume()
597 if (sc->hwp_pkg_ctrl_en) in intel_hwpstate_resume()
598 ret = wrmsr_safe(MSR_IA32_HWP_REQUEST, sc->req | in intel_hwpstate_resume()
601 ret = wrmsr_safe(MSR_IA32_HWP_REQUEST, sc->req); in intel_hwpstate_resume()
605 sc->hwp_pkg_ctrl_en ? " PKG" : "", pc->pc_cpuid); in intel_hwpstate_resume()
608 if (sc->hwp_pkg_ctrl_en) { in intel_hwpstate_resume()
609 ret = wrmsr_safe(MSR_IA32_HWP_REQUEST_PKG, sc->req); in intel_hwpstate_resume()
617 if (!sc->hwp_pref_ctrl && sc->hwp_perf_bias_cached) { in intel_hwpstate_resume()
619 sc->hwp_energy_perf_bias); in intel_hwpstate_resume()
623 "suspend\n", pc->pc_cpuid); in intel_hwpstate_resume()