acpi: Issue _OSC call for native thermal interrupt handling
PATCH v7 1/1 acpi: Issue _OSC call for native thermal interrupt handling
There are several reports of freeze on enabling HWP (Hardware PStates) feature on Skylake based systems by Intel P states driver. The root cause is identified as the HWP interrupts causing BIOS code to freeze. HWP interrupts uses thermal LVT.
Linux natively handles thermal interrupts, but in Skylake based systems SMM will take control of thermal interrupts. This is a problem for several reasons:
- It is freezing in BIOS when tries to handle thermal interrupt, which will require BIOS upgrade
- With SMM handling thermal we loose all the reporting features of Linux arch/x86/kernel/cpu/mcheck/therm_throt driver
- Some thermal drivers like x86-package-temp driver depends on the thermal threshold interrupts
- The HWP interrupts are useful for debugging and tuning performance
So we need native handling of thermal interrupts. This requires some way to inform SMM that OS can handle thermal interrupts. This can be done by using _OSC/_PDC under processor scope very early in ACPI initialization flow.
The bit 12 of _OSC/_PDC in processor scope defines whether OS supports handling of native interrupts for Collaborative Processor Performance Control (CPPC) notifications. Since HWP is a implementation of CPPC, setting this bit is equivalent to inform SMM that OS is capable of handling thermal interrupts.
Refer to this document for details on _OSC/_PDC
http://www.intel.com/content/www/us/en/standards/processor-vendor-
specific-acpi-specification.html
This change introduces a new function acpi_early_processor_set_osc(), which walks acpi name space and finds acpi processor object and set capability via _OSC method.
Also this change writes HWP status bits to 0 to clear any HWP status bits in intel_thermal_interrupt().
---
v7:
Checking platform ack and setting status for successful ack and printing information message.
v6:
Added __init for two functions and moved dummy function to internal.h Shortened the name of the function.
v5:
No code change. Changed commit message to explain HWP is a implementation of CPPC.
v4:
Suggestion by Boris for removing use of intermediate variable for clearing HWP status and using boot_cpu_has instead of static_cpu_has
v3:
- Added CONFIG_X86 around static_cpu_has() to fix compile error on ARCH=ia64, reported by kbuild test robot
- return AE_CTRL_TERMINATE to terminate acpi name walk space, when _OSC is set already once.
v2:
Unnecessary newline was introduced, removed that in acpi_processor.c
arch/x86/kernel/cpu/mcheck/therm_throt.c | 3 ++ drivers/acpi/acpi_processor.c | 52 ++++++++++++++++++++++++++++++++ drivers/acpi/bus.c | 3 ++ drivers/acpi/internal.h | 6 ++++ 4 files changed, 64 insertions(+)
arch/x86/kernel/cpu/mcheck/therm_throt.c +3 -0
@@ -384,6 +384,9 @@ static void intel_thermal_interrupt(void) {__u64 msr_val; +if (static_cpu_has (X86_FEATURE_HWP )) +wrmsrl_safe (MSR_HWP_STATUS ,0 ); +rdmsrl (MSR_IA32_THERM_STATUS , msr_val);/* Check for violation of core thermal thresholds*/
drivers/acpi/acpi_processor.c +52 -0
58 lines not on this page · raw message
drivers/acpi/bus.c +3 -0
@@ -1019,6 +1019,9 @@ static int __init acpi_bus_init(void) goto error1; } +/* Set capability bits for _OSC under processor scope */ +acpi_early_processor_set_osc (); +/* * _OSC method may exist in module level code, * so it must be run after ACPI_FULL_INITIALIZATION
drivers/acpi/internal.h +6 -0
@@ -145,6 +145,12 @@ void acpi_early_processor_set_pdc(void);static inline void acpi_early_processor_set_pdc (void ) {}#endif +#ifdef CONFIG_X86 +void acpi_early_processor_set_osc (void ); +#else +static inline void acpi_early_processor_set_osc (void ) {} +#endif +/* -------------------------------------------------------------------------- Embedded Controller -------------------------------------------------------------------------- */
Signature · 1 line
1.9.1
Rafael J. Wysocki
maintainerQuoted 28 lines · Srinivas Pandruvada
There are several reports of freeze on enabling HWP (Hardware PStates) feature on Skylake based systems by Intel P states driver. The root cause is identified as the HWP interrupts causing BIOS code to freeze. HWP interrupts uses thermal LVT.
Linux natively handles thermal interrupts, but in Skylake based systems SMM will take control of thermal interrupts. This is a problem for several reasons:
- It is freezing in BIOS when tries to handle thermal interrupt, which will require BIOS upgrade
- With SMM handling thermal we loose all the reporting features of Linuxarch/x86/kernel/cpu/mcheck/therm_throtdriver
- Some thermal drivers like x86-package-temp driver depends on the thermal threshold interrupts
- The HWP interrupts are useful for debugging and tuning performanceSo we need native handling of thermal interrupts. This requires some way to inform SMM that OS can handle thermal interrupts. This can be done by using _OSC/_PDC under processor scope very early in ACPI initialization flow.
The bit 12 of _OSC/_PDC in processor scope defines whether OS supports handling of native interrupts for Collaborative Processor Performance Control (CPPC) notifications. Since HWP is a implementation of CPPC, setting this bit is equivalent to inform SMM that OS is capable of handling thermal interrupts.
Refer to this document for details on _OSC/_PDC
http://www.intel.com/content/www/us/en/standards/processor-vendor-
specific-acpi-specification.html
Quoted 8 lines
This change introduces a new function
acpi_early_processor_set_osc(), which walks acpi name space and finds acpi processor object and set capability via_OSCmethod.Also this change writes HWP status bits to 0 to clear any HWP status bits in
intel_thermal_interrupt().Signed-off-by Srinivas Pandruvada <[email protected]>
I've queued it up, but I have modified the subject and the changelog and renamed the new function.
Please have a look at
http://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/commit/?h=bleeding-edge&id=42341f87ba1bee4c5be95038c24abb69cbcf361a
and let me know if it makes sense to you.
Thanks,
Rafael
Quoted 54 lines · Rafael J. Wysocki
Quoted 45 lines · Srinivas Pandruvada
There are several reports of freeze on enabling HWP (Hardware PStates)
feature on Skylake based systems by Intel P states driver. The root cause is identified as the HWP interrupts causing BIOS code to freeze.
HWP interrupts uses thermal LVT.
Linux natively handles thermal interrupts, but in Skylake based systems
SMM will take control of thermal interrupts. This is a problem for several
reasons:
- It is freezing in BIOS when tries to handle thermal interrupt, which
will require BIOS upgrade
- With SMM handling thermal we loose all the reporting features of Linuxarch/x86/kernel/cpu/mcheck/therm_throtdriver
- Some thermal drivers like x86-package-temp driver depends on the thermal
threshold interrupts
- The HWP interrupts are useful for debugging and tuning performanceSo we need native handling of thermal interrupts. This requires some
way to inform SMM that OS can handle thermal interrupts. This can be
done by using _OSC/_PDC under processor scope very early in ACPI initialization flow.
The bit 12 of _OSC/_PDC in processor scope defines whether OS supports
handling of native interrupts for Collaborative Processor Performance
Control (CPPC) notifications. Since HWP is a implementation of CPPC,
setting this bit is equivalent to inform SMM that OS is capable of handling thermal interrupts.
Refer to this document for details on _OSC/_PDC
http://www.intel.com/content/www/us/en/standards/processor-vendor-
specific-acpi-specification.htmlThis change introduces a new function
acpi_early_processor_set_osc(),
which walks acpi name space and finds acpi processor object and set capability via_OSCmethod.Quoted 6 lines
Also this change writes HWP status bits to 0 to clear any HWP status
bits inintel_thermal_interrupt().Signed-off-by Srinivas Pandruvada <[email protected].com>
Quoted 7 lines
I've queued it up, but I have modified the subject and the changelog and renamed the new function.
Please have a look at
http://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/commi
t/?h=bleeding-edge&id=42341f87ba1bee4c5be95038c24abb69cbcf361a and let me know if it makes sense to you.
Looks fine to me.
Thanks,
Srinivas
Quoted 3 lines
Thanks,
Rafael