* Redo a subset of set_autonomous_hwp on resume; untested. Without this, * testers observed that on resume MSR_IA32_HWP_REQUEST was bogus. */
| 576 | * testers observed that on resume MSR_IA32_HWP_REQUEST was bogus. |
| 577 | */ |
| 578 | static int |
| 579 | intel_hwpstate_resume(device_t dev) |
| 580 | { |
| 581 | struct hwp_softc *sc; |
| 582 | struct pcpu *pc; |
| 583 | int ret; |
| 584 | |
| 585 | sc = device_get_softc(dev); |
| 586 | |
| 587 | pc = cpu_get_pcpu(dev); |
| 588 | if (pc == NULL) |
| 589 | return (ENXIO); |
| 590 | |
| 591 | thread_lock(curthread); |
| 592 | sched_bind(curthread, pc->pc_cpuid); |
| 593 | thread_unlock(curthread); |
| 594 | |
| 595 | ret = wrmsr_safe(MSR_IA32_PM_ENABLE, 1); |
| 596 | if (ret) { |
| 597 | device_printf(dev, |
| 598 | "Failed to enable HWP for cpu%d after suspend (%d)\n", |
| 599 | pc->pc_cpuid, ret); |
| 600 | goto out; |
| 601 | } |
| 602 | |
| 603 | if (sc->hwp_pkg_ctrl_en) |
| 604 | ret = wrmsr_safe(MSR_IA32_HWP_REQUEST, sc->req | |
| 605 | IA32_HWP_REQUEST_PACKAGE_CONTROL); |
| 606 | else |
| 607 | ret = wrmsr_safe(MSR_IA32_HWP_REQUEST, sc->req); |
| 608 | if (ret) { |
| 609 | device_printf(dev, |
| 610 | "Failed to set%s autonomous HWP for cpu%d after suspend\n", |
| 611 | sc->hwp_pkg_ctrl_en ? " PKG" : "", pc->pc_cpuid); |
| 612 | goto out; |
| 613 | } |
| 614 | if (sc->hwp_pkg_ctrl_en) { |
| 615 | ret = wrmsr_safe(MSR_IA32_HWP_REQUEST_PKG, sc->req); |
| 616 | if (ret) { |
| 617 | device_printf(dev, |
| 618 | "Failed to set autonomous HWP for package after " |
| 619 | "suspend\n"); |
| 620 | goto out; |
| 621 | } |
| 622 | } |
| 623 | if (!sc->hwp_pref_ctrl && sc->hwp_perf_bias_cached) { |
| 624 | ret = wrmsr_safe(MSR_IA32_ENERGY_PERF_BIAS, |
| 625 | sc->hwp_energy_perf_bias); |
| 626 | if (ret) { |
| 627 | device_printf(dev, |
| 628 | "Failed to set energy perf bias for cpu%d after " |
| 629 | "suspend\n", pc->pc_cpuid); |
| 630 | } |
| 631 | } |
| 632 | |
| 633 | out: |
| 634 | thread_lock(curthread); |
| 635 | sched_unbind(curthread); |
nothing calls this directly
no test coverage detected