acpi: Issue _OSC call for native thermal interrupt handling
PATCH v4 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. To inform SMM that OS will handle thermal interrupts, we need to use _OSC under processor scope very early in ACPI initialization flow. This needs to be done before SMM code path looks for _OSC capabilities. The bit 12 of _OSC in processor scope defines whether OS will handle thermal interrupts. When bit 12 is set to 1, OS will handle thermal interrupts. Refer to this document for details on _OSC
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 to take over thermal LVT.
Also this change writes HWP status bits to 0 to clear any HWP status bits in intel_thermal_interrupt().
---
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 | 47 ++++++++++++++++++++++++++++++++ drivers/acpi/bus.c | 3 ++ drivers/acpi/internal.h | 2 ++ 4 files changed, 55 insertions(+)
arch/x86/kernel/cpu/mcheck/therm_throt.c +3 -0
@@ -385,6 +385,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 +47 -0
53 lines not on this page · raw message
drivers/acpi/bus.c +3 -0
@@ -1005,6 +1005,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 +2 -0
@@ -138,6 +138,8 @@ void acpi_early_processor_set_pdc(void);static inline void acpi_early_processor_set_pdc (void ) {}#endif +void acpi_early_processor_set_osc (void ); +/* -------------------------------------------------------------------------- Embedded Controller -------------------------------------------------------------------------- */
Signature · 1 line
1.9.1
Quoted 15 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 performance
Quoted 1 line
So we need native handling of thermal interrupts.
Is this working around a firmware bug?
Quoted 3 lines
To inform SMM that
OS will handle thermal interrupts, we need to use_OSCunder processor scope very early in ACPI initialization flow.
Does _OSC say that OS "will" handle thermal interrupts or that it "can" handle thermal interrupts? Couldn't a platform decide it wants to handle them, regardless of what the OS may be capable of?
Quoted 7 lines
This needs to be done
before SMM code path looks for_OSCcapabilities. The bit 12 of_OSCin processor scope defines whether OS will handle thermal interrupts. When bit 12 is set to 1, OS will handle thermal interrupts. Refer to this document for details on_OSC
http://www.intel.com/content/www/us/en/standards/processor-vendor-
specific-acpi-specification.html
Where is bit 12 documented?
Quoted 3 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 to take over thermal LVT.
Does this change just affect Skylake platforms or all platforms?
-- ljk
Quoted 124 lines
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]>---
v4:
Suggestion by Boris for removing use of intermediate variable for clearing HWP status and usingboot_cpu_hasinstead ofstatic_cpu_hasv3:
- AddedCONFIG_X86aroundstatic_cpu_has()to fix compile error on ARCH=ia64, reported by kbuild test robot
- returnAE_CTRL_TERMINATEto terminate acpi name walk space, when_OSCis set already once.
v2:
Unnecessary newline was introduced, removed that inacpi_processor.carch/x86/kernel/cpu/mcheck/therm_throt.c | 3 ++ drivers/acpi/acpi_processor.c | 47 ++++++++++++++++++++++++++++++++ drivers/acpi/bus.c | 3 ++ drivers/acpi/internal.h | 2 ++ 4 files changed, 55 insertions(+)arch/x86/kernel/cpu/mcheck/therm_throt.c +3
-0@@ -385,6 +385,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 +47
-0@@ -491,6 +491,53 @@ static void acpi_processor_remove(struct acpi_device *device) }#endif /* CONFIG_ACPI_HOTPLUG_CPU */ +#ifdef CONFIG_X86 +static bool acpi_hwp_native_thermal_lvt_set; +static acpi_status acpi_set_hwp_native_thermal_lvt_osc (acpi_handle handle, +u32 lvl,void *context, +void **rv) +{ +u8 sb_uuid_str[] ="4077A616-290C-47BE-9EBD-D87058713953" ; +u32 capbuf[2 ]; +struct acpi_osc_context osc_context = { + .uuid_str = sb_uuid_str, + .rev =1 , + .cap.length =8 , + .cap.pointer = capbuf, + }; + +if (acpi_hwp_native_thermal_lvt_set) +return AE_CTRL_TERMINATE ; + + capbuf[0 ] =0x0000 ; + capbuf[1 ] =0x1000 ;/* set bit 12 */ + +if (ACPI_SUCCESS (acpi_run_osc (handle, &osc_context))) { + acpi_hwp_native_thermal_lvt_set = true; +kfree (osc_context.ret.pointer); + } + +return AE_OK ; +} + +void acpi_early_processor_set_osc (void ) +{ +if (boot_cpu_has (X86_FEATURE_HWP )) { +acpi_walk_namespace (ACPI_TYPE_PROCESSOR ,ACPI_ROOT_OBJECT , +ACPI_UINT32_MAX , + acpi_set_hwp_native_thermal_lvt_osc, +NULL ,NULL ,NULL ); +acpi_get_devices (ACPI_PROCESSOR_DEVICE_HID , + acpi_set_hwp_native_thermal_lvt_osc, +NULL ,NULL ); + } +} +#else + +void acpi_early_processor_set_osc (void ) {} + +#endif +/* * The following ACPI IDs are known to be suitable for representing as * processor devices. drivers/acpi/bus.c +3
-0@@ -1005,6 +1005,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 +2
-0@@ -138,6 +138,8 @@ void acpi_early_processor_set_pdc(void);static inline void acpi_early_processor_set_pdc (void ) {}#endif +void acpi_early_processor_set_osc (void ); +/* -------------------------------------------------------------------------- Embedded Controller -------------------------------------------------------------------------- */
Quoted 24 lines · Linda Knippers
Quoted 23 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 performance
Quoted 2 lines
Quoted 1 line
So we need native handling of thermal interrupts.
Is this working around a firmware bug?
Yes. But Linux always had capability to handle thermal interrupts natively, so we should continue to have this in OS control, when possible.
Quoted 9 lines
Quoted 6 lines
To inform SMM that
OS will handle thermal interrupts, we need to use_OSCunder processor
scope very early in ACPI initialization flow.Does
_OSCsay that OS "will" handle thermal interrupts or that it "can"
handle thermal interrupts?
Can handle.
Quoted 3 lines
Couldn't a platform decide it wants to handle them, regardless of what the OS may be capable of?
Yes. In that case platform can change the delivery mode bits to SMM in LVT.
Quoted 11 lines
Quoted 9 lines
This needs to be done
before SMM code path looks for_OSCcapabilities. The bit 12 of_OSCin processor scope defines whether OS will handle thermal interrupts.
When bit 12 is set to 1, OS will handle thermal interrupts. Refer to this document for details on_OSC
http://www.intel.com/content/www/us/en/standards/processor-vendor-
specific-acpi-specification.htmlWhere is bit 12 documented?
In the above document.
Quoted 6 lines
Quoted 5 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 to take over thermal LVT.Does this change just affect Skylake platforms or all platforms?
Any platform which has Intel ® Speed Shift Technology (aka HWP) feature present and enabled.
Thanks,
Srinivas
Quoted 144 lines
-- ljk
Quoted 142 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>
---
v4:
Suggestion by Boris for removing use of intermediate variable for clearing HWP status and usingboot_cpu_hasinstead ofstatic_cpu_hasv3:
- AddedCONFIG_X86aroundstatic_cpu_has()to fix compile error on ARCH=ia64, reported by kbuild test robot
- returnAE_CTRL_TERMINATEto terminate acpi name walk space, when_OSC
is set already once.
v2:
Unnecessary newline was introduced, removed that inacpi_processor.carch/x86/kernel/cpu/mcheck/therm_throt.c | 3 ++
drivers/acpi/acpi_processor.c | 47
++++++++++++++++++++++++++++++++
drivers/acpi/bus.c | 3 ++
drivers/acpi/internal.h | 2 ++4 files changed, 55 insertions(+)arch/x86/kernel/cpu/mcheck/therm_throt.c +0
-0@@ -385,6 +385,9 @@ static void intel_thermal_interrupt(void) { __u64 msr_val;arch/x86/kernel/cpu/mcheck/therm_throt.c +3
-0+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 +0
-0@@ -491,6 +491,53 @@ static void acpi_processor_remove(struct acpi_device *device) } #endif /* CONFIG_ACPI_HOTPLUG_CPU */drivers/acpi/acpi_processor.c +3
-0+#ifdef CONFIG_X86 +static bool acpi_hwp_native_thermal_lvt_set; +static acpi_status acpi_set_hwp_native_thermal_lvt_osc(acpi_handlehandle,
drivers/acpi/acpi_processor.c +1
-0+ u32 lvl,void *context,
drivers/acpi/acpi_processor.c +29
-0+ void **rv) +{ +u8 sb_uuid_str[] ="4077A616-290C-47BE-9EBD-D87058713953" ; +u32 capbuf[2 ]; +struct acpi_osc_context osc_context = { + .uuid_str = sb_uuid_str, + .rev =1 , + .cap.length =8 , + .cap.pointer = capbuf, + }; + +if (acpi_hwp_native_thermal_lvt_set) +return AE_CTRL_TERMINATE ; + + capbuf[0 ] =0x0000 ; + capbuf[1 ] =0x1000 ;/* set bit 12 */ + +if (ACPI_SUCCESS (acpi_run_osc (handle, &osc_context))) { + acpi_hwp_native_thermal_lvt_set = true; +kfree (osc_context.ret.pointer); + } + +return AE_OK ; +} + +void acpi_early_processor_set_osc (void ) +{ +if (boot_cpu_has (X86_FEATURE_HWP )) { + acpi_walk_namespace(ACPI_TYPE_PROCESSOR,
ACPI_ROOT_OBJECT,drivers/acpi/acpi_processor.c +2
-0+ ACPI_UINT32_MAX, + acpi_set_hwp_native_thermal_lv
t_osc,drivers/acpi/acpi_processor.c +3
-0+ NULL, NULL, NULL); +acpi_get_devices (ACPI_PROCESSOR_DEVICE_HID , + acpi_set_hwp_native_thermal_lvt_osc,
drivers/acpi/acpi_processor.c +9
-0+ NULL, NULL); + } +} +#else + +void acpi_early_processor_set_osc (void ) {} + +#endif +/*
* The following ACPI IDs are known to be suitable for representing as
* processor devices.drivers/acpi/bus.c +0
-0@@ -1005,6 +1005,9 @@ static int __init acpi_bus_init(void) goto error1; }drivers/acpi/bus.c +3
-0+/* Set capability bits for _OSC under processor scope */ +acpi_early_processor_set_osc (); +/*
*_OSCmethod may exist in module level code,
* so it must be run afterACPI_FULL_INITIALIZATIONdrivers/acpi/internal.h +0
-0@@ -138,6 +138,8 @@ void acpi_early_processor_set_pdc(void); static inline void acpi_early_processor_set_pdc(void) {} #endifdrivers/acpi/internal.h +2
-0+void acpi_early_processor_set_osc (void ); +/* -------------------------------------------------------------
-------------
Embedded Controller
---------------------------------------------------------------
----------- */
Quoted 41 lines · Srinivas Pandruvada
Quoted 24 lines · Linda Knippers
Quoted 23 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 performanceQuoted 2 lines
Quoted 1 line
So we need native handling of thermal interrupts.
Is this working around a firmware bug?
Yes. But Linux always had capability to handle thermal interrupts natively, so we should continue to have this in OS control, when possible.
Quoted 9 lines
Quoted 6 lines
To inform SMM that
OS will handle thermal interrupts, we need to use_OSCunder processor
scope very early in ACPI initialization flow.Does
_OSCsay that OS "will" handle thermal interrupts or that it "can"
handle thermal interrupts?
Quoted 7 lines
Can handle.
Quoted 3 lines
Couldn't a platform decide it wants to handle
them, regardless of what the OS may be capable of?Yes. In that case platform can change the delivery mode bits to SMM in LVT.
And would still exhibit the BIOS bug?
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
This needs to be done
before SMM code path looks for_OSCcapabilities. The bit 12 of_OSCin processor scope defines whether OS will handle thermal interrupts.
When bit 12 is set to 1, OS will handle thermal interrupts. Refer to this document for details on_OSC
http://www.intel.com/content/www/us/en/standards/processor-vendor-
specific-acpi-specification.html
Quoted 3 lines
Quoted 2 lines
Where is bit 12 documented?
In the above document.
When I look at that document, I see bit 12 described as
"If set, OSPM supports native interrupt handling for Collaborative Processor Performance Control notifications." Is that the same thing or am I looking at the wrong table?
-- ljk
Quoted 157 lines
Quoted 7 lines
Quoted 6 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 to take over thermal LVT.Does this change just affect Skylake platforms or all platforms?
Any platform which has Intel ® Speed Shift Technology (aka HWP) feature present and enabled.
Thanks,
SrinivasQuoted 144 lines
-- ljk
Quoted 142 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>
---
v4:
Suggestion by Boris for removing use of intermediate variable for clearing HWP status and usingboot_cpu_hasinstead ofstatic_cpu_hasv3:
- AddedCONFIG_X86aroundstatic_cpu_has()to fix compile error on ARCH=ia64, reported by kbuild test robot
- returnAE_CTRL_TERMINATEto terminate acpi name walk space, when_OSC
is set already once.
v2:
Unnecessary newline was introduced, removed that inacpi_processor.carch/x86/kernel/cpu/mcheck/therm_throt.c | 3 ++ drivers/acpi/acpi_processor.c | 47 ++++++++++++++++++++++++++++++++ drivers/acpi/bus.c | 3 ++ drivers/acpi/internal.h | 2 ++ 4 files changed, 55 insertions(+)arch/x86/kernel/cpu/mcheck/therm_throt.c +3
-0@@ -385,6 +385,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 +33
-0@@ -491,6 +491,53 @@ static void acpi_processor_remove(struct acpi_device *device) }#endif /* CONFIG_ACPI_HOTPLUG_CPU */ +#ifdef CONFIG_X86 +static bool acpi_hwp_native_thermal_lvt_set; +static acpi_status acpi_set_hwp_native_thermal_lvt_osc (acpi_handle handle, +u32 lvl,void *context, +void **rv) +{ +u8 sb_uuid_str[] ="4077A616-290C-47BE-9EBD-D87058713953" ; +u32 capbuf[2 ]; +struct acpi_osc_context osc_context = { + .uuid_str = sb_uuid_str, + .rev =1 , + .cap.length =8 , + .cap.pointer = capbuf, + }; + +if (acpi_hwp_native_thermal_lvt_set) +return AE_CTRL_TERMINATE ; + + capbuf[0 ] =0x0000 ; + capbuf[1 ] =0x1000 ;/* set bit 12 */ + +if (ACPI_SUCCESS (acpi_run_osc (handle, &osc_context))) { + acpi_hwp_native_thermal_lvt_set = true; +kfree (osc_context.ret.pointer); + } + +return AE_OK ; +} + +void acpi_early_processor_set_osc (void ) +{ +if (boot_cpu_has (X86_FEATURE_HWP )) { + acpi_walk_namespace(ACPI_TYPE_PROCESSOR,
ACPI_ROOT_OBJECT,drivers/acpi/acpi_processor.c +2
-0+ACPI_UINT32_MAX , + acpi_set_hwp_native_thermal_lv
t_osc,drivers/acpi/acpi_processor.c +3
-0+ NULL, NULL, NULL); +acpi_get_devices (ACPI_PROCESSOR_DEVICE_HID , + acpi_set_hwp_native_thermal_lvt_osc,
drivers/acpi/acpi_processor.c +9
-0+ NULL, NULL); + } +} +#else + +void acpi_early_processor_set_osc (void ) {} + +#endif +/* * The following ACPI IDs are known to be suitable for representing as
* processor devices.drivers/acpi/bus.c +3
-0@@ -1005,6 +1005,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 +2
-2@@ -138,6 +138,8 @@ void acpi_early_processor_set_pdc(void);static inline void acpi_early_processor_set_pdc (void ) {}#endif +void acpi_early_processor_set_osc (void ); +/* ------------------------------------------------------------- ------------- Embedded Controller --------------------------------------------------------------- ----------- */
Quoted 55 lines · Linda Knippers
Quoted 53 lines · Srinivas Pandruvada
Quoted 31 lines · Linda Knippers
Quoted 29 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 performanceQuoted 2 lines
Quoted 1 line
So we need native handling of thermal interrupts.
Is this working around a firmware bug?
Yes. But Linux always had capability to handle thermal interrupts natively, so we should continue to have this in OS control, when possible.
Quoted 11 lines
Quoted 8 lines
To inform SMM that
OS will handle thermal interrupts, we need to use_OSCunder processor
scope very early in ACPI initialization flow.Does
_OSCsay that OS "will" handle thermal interrupts or that it "can"
handle thermal interrupts?Can handle.
Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Couldn't a platform decide it wants to handle them, regardless of what the OS may be capable of?
Yes. In that case platform can change the delivery mode bits to SMM in
LVT.And would still exhibit the BIOS bug?
Yes. But eventually BIOS bug will be fixed.
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
This needs to be done
before SMM code path looks for_OSCcapabilities. The bit 12 of_OSCin processor scope defines whether OS will handle thermal interrupts.
When bit 12 is set to 1, OS will handle thermal interrupts. Refer to this document for details on_OSC
http://www.intel.com/content/www/us/en/standards/processor-vend
or-
specific-acpi-specification.html
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
Where is bit 12 documented?
In the above document.
When I look at that document, I see bit 12 described as "If set, OSPM supports native interrupt handling for Collaborative Processor
Performance Control notifications." Is that the same thing or am I looking at the wrong table?
Yes. If you look at section 14.4 in Intel SDM, you will see that "HWP is an implementation of the ACPI-defined Collaborative Processor Performance Control (CPPC)". Section 14.4.5 also specifies that HWP uses IA32_THERM_STATUS to communicate if there are notifications, which is notified via thermal interrupt.
You asked above if platform can handle these notification in SMM only. If you do then the notification will arrive as ACPI notifications. We don't have support for such notifications in Linux yet.
Thanks,
Srinivas
Quoted 180 lines
-- ljk
Quoted 177 lines
Quoted 10 lines
Quoted 9 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 to take over thermal LVT.Does this change just affect Skylake platforms or all platforms?
Any platform which has Intel ® Speed Shift Technology (aka HWP) feature
present and enabled.Thanks,
SrinivasQuoted 160 lines
-- ljk
Quoted 157 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]ntel
.com>
---
v4:
Suggestion by Boris for removing use of intermediate variable for
clearing HWP status and usingboot_cpu_hasinstead ofstatic_cpu_hasv3:
- AddedCONFIG_X86aroundstatic_cpu_has()to fix compile error on
ARCH=ia64, reported by kbuild test robot
- returnAE_CTRL_TERMINATEto terminate acpi name walk space, when_OSC
is set already once.
v2:
Unnecessary newline was introduced, removed that inacpi_processor.carch/x86/kernel/cpu/mcheck/therm_throt.c | 3 ++
drivers/acpi/acpi_processor.c | 47
++++++++++++++++++++++++++++++++
drivers/acpi/bus.c | 3 ++
drivers/acpi/internal.h | 2 ++4 files changed, 55 insertions(+)arch/x86/kernel/cpu/mcheck/therm_throt.c +0
-0@@ -385,6 +385,9 @@ static void intel_thermal_interrupt(void) { __u64 msr_val;arch/x86/kernel/cpu/mcheck/therm_throt.c +3
-0+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 +0
-0@@ -491,6 +491,53 @@ static void acpi_processor_remove(struct acpi_device *device) } #endif /* CONFIG_ACPI_HOTPLUG_CPU */drivers/acpi/acpi_processor.c +3
-0+#ifdef CONFIG_X86 +static bool acpi_hwp_native_thermal_lvt_set; +static acpi_statusacpi_set_hwp_native_thermal_lvt_osc(acpi_handle
handle,drivers/acpi/acpi_processor.c +1
-0+ u32lvl,
void *context,drivers/acpi/acpi_processor.c +1
-0+ void**rv)
drivers/acpi/acpi_processor.c +2
-0+{ + u8 sb_uuid_str[] = "4077A616-290C-47BE-9EBD-D87058713953";
drivers/acpi/acpi_processor.c +15
-0+u32 capbuf[2 ]; +struct acpi_osc_context osc_context = { + .uuid_str = sb_uuid_str, + .rev =1 , + .cap.length =8 , + .cap.pointer = capbuf, + }; + +if (acpi_hwp_native_thermal_lvt_set) +return AE_CTRL_TERMINATE ; + + capbuf[0 ] =0x0000 ; + capbuf[1 ] =0x1000 ;/* set bit 12 */ + +if (ACPI_SUCCESS (acpi_run_osc (handle, &osc_context))){
drivers/acpi/acpi_processor.c +11
-0+ acpi_hwp_native_thermal_lvt_set = true; +kfree (osc_context.ret.pointer); + } + +return AE_OK ; +} + +void acpi_early_processor_set_osc (void ) +{ +if (boot_cpu_has (X86_FEATURE_HWP )) { + acpi_walk_namespace(ACPI_TYPE_PROCESSOR,
ACPI_ROOT_OBJECT,drivers/acpi/acpi_processor.c +2
-0+ ACPI_UINT32_MAX, + acpi_set_hwp_native_therma
l_lvt_osc,drivers/acpi/acpi_processor.c +3
-0+ NULL, NULL, NULL); +acpi_get_devices (ACPI_PROCESSOR_DEVICE_HID , + acpi_set_hwp_native_thermal_l
vt_o
sc,drivers/acpi/acpi_processor.c +9
-0+ NULL, NULL); + } +} +#else + +void acpi_early_processor_set_osc (void ) {} + +#endif +/*
* The following ACPI IDs are known to be suitable for representing as
* processor devices.drivers/acpi/bus.c +0
-0@@ -1005,6 +1005,9 @@ static int __init acpi_bus_init(void) goto error1; }drivers/acpi/bus.c +1
-0+/* Set capability bits for _OSC under processor scope */
drivers/acpi/bus.c +2
-0+acpi_early_processor_set_osc (); +/*
*_OSCmethod may exist in module level code,
* so it must be run afterACPI_FULL_INITIALIZATIONdrivers/acpi/internal.h +0
-0@@ -138,6 +138,8 @@ void acpi_early_processor_set_pdc(void); static inline void acpi_early_processor_set_pdc(void) {} #endifdrivers/acpi/internal.h +2
-0+void acpi_early_processor_set_osc (void ); +/* ---------------------------------------------------------
----
-------------
Embedded Controller
-----------------------------------------------------------
----
----------- */
On 3/17/2016 5:12 PM, Srinivas Pandruvada wrote:
<snip>
Quoted 17 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
This needs to be done
before SMM code path looks for_OSCcapabilities. The bit 12 of_OSCin processor scope defines whether OS will handle thermal interrupts.
When bit 12 is set to 1, OS will handle thermal interrupts. Refer to this document for details on_OSC
http://www.intel.com/content/www/us/en/standards/processor-vend
or-
specific-acpi-specification.htmlQuoted 8 lines
Quoted 3 lines
Quoted 2 lines
Where is bit 12 documented?
In the above document.
When I look at that document, I see bit 12 described as "If set, OSPM supports native interrupt handling for Collaborative Processor
Performance Control notifications." Is that the same thing or am I looking at the wrong table?
Quoted 5 lines
Yes. If you look at section 14.4 in Intel SDM, you will see that "HWP is an implementation of the ACPI-defined Collaborative Processor Performance Control (CPPC)". Section 14.4.5 also specifies that HWP uses
IA32_THERM_STATUSto communicate if there are notifications, which is notified via thermal interrupt.
Ok, thanks. That wasn't clear from the commit message. It sounded like bit 12 directly indicated that the OS will handle thermal interrupts but it's a bit more indirect than that.
Quoted 3 lines
You asked above if platform can handle these notification in SMM only. If you do then the notification will arrive as ACPI notifications. We don't have support for such notifications in Linux yet.
What I meant to ask was if the platform can disregard the _OSC information and handle thermal events on it's own, without OS involvement. For example, servers typically don't want to rely on the OS to manage thermal issues.
<snip>
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 4 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 to take over thermal LVT.Does this change just affect Skylake platforms or all platforms?
Any platform which has Intel ® Speed Shift Technology (aka HWP) feature present and enabled.
Could this be an unexpected change in behavior for platforms with HWP that don't have this bug, assuming they would look at the _OSC CPPP bit? That's actually my main concern here.
-- ljk
Quoted 164 lines
Quoted 164 lines
Quoted 164 lines
Thanks,
SrinivasQuoted 160 lines
-- ljk
Quoted 157 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]ntel
.com>
---
v4:
Suggestion by Boris for removing use of intermediate variable for
clearing HWP status and usingboot_cpu_hasinstead ofstatic_cpu_hasv3:
- AddedCONFIG_X86aroundstatic_cpu_has()to fix compile error on
ARCH=ia64, reported by kbuild test robot
- returnAE_CTRL_TERMINATEto terminate acpi name walk space, when_OSC
is set already once.
v2:
Unnecessary newline was introduced, removed that inacpi_processor.carch/x86/kernel/cpu/mcheck/therm_throt.c | 3 ++ drivers/acpi/acpi_processor.c | 47 ++++++++++++++++++++++++++++++++ drivers/acpi/bus.c | 3 ++ drivers/acpi/internal.h | 2 ++ 4 files changed, 55 insertions(+)arch/x86/kernel/cpu/mcheck/therm_throt.c +3
-0@@ -385,6 +385,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 +3
-0@@ -491,6 +491,53 @@ static void acpi_processor_remove(struct acpi_device *device) }#endif /* CONFIG_ACPI_HOTPLUG_CPU */ +#ifdef CONFIG_X86 +static bool acpi_hwp_native_thermal_lvt_set; +static acpi_statusacpi_set_hwp_native_thermal_lvt_osc(acpi_handle
handle,drivers/acpi/acpi_processor.c +1
-0+ u32lvl,
void *context,drivers/acpi/acpi_processor.c +1
-0+void **rv)
drivers/acpi/acpi_processor.c +2
-0+{ + u8 sb_uuid_str[] = "4077A616-290C-47BE-9EBD-D87058713953";
drivers/acpi/acpi_processor.c +15
-0+u32 capbuf[2 ]; +struct acpi_osc_context osc_context = { + .uuid_str = sb_uuid_str, + .rev =1 , + .cap.length =8 , + .cap.pointer = capbuf, + }; + +if (acpi_hwp_native_thermal_lvt_set) +return AE_CTRL_TERMINATE ; + + capbuf[0 ] =0x0000 ; + capbuf[1 ] =0x1000 ;/* set bit 12 */ + +if (ACPI_SUCCESS (acpi_run_osc (handle, &osc_context))){
drivers/acpi/acpi_processor.c +11
-0+ acpi_hwp_native_thermal_lvt_set = true; +kfree (osc_context.ret.pointer); + } + +return AE_OK ; +} + +void acpi_early_processor_set_osc (void ) +{ +if (boot_cpu_has (X86_FEATURE_HWP )) { + acpi_walk_namespace(ACPI_TYPE_PROCESSOR,
ACPI_ROOT_OBJECT,drivers/acpi/acpi_processor.c +2
-0+ACPI_UINT32_MAX , + acpi_set_hwp_native_therma
l_lvt_osc,drivers/acpi/acpi_processor.c +3
-0+ NULL, NULL, NULL); +acpi_get_devices (ACPI_PROCESSOR_DEVICE_HID , + acpi_set_hwp_native_thermal_l
vt_o
sc,drivers/acpi/acpi_processor.c +9
-0+ NULL, NULL); + } +} +#else + +void acpi_early_processor_set_osc (void ) {} + +#endif +/* * The following ACPI IDs are known to be suitable for representing as
* processor devices.drivers/acpi/bus.c +3
-0@@ -1005,6 +1005,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, drivers/acpi/bus.c +0
-0* so it must be run after ACPI_FULL_INITIALIZATION drivers/acpi/internal.h +2
-4@@ -138,6 +138,8 @@ void acpi_early_processor_set_pdc(void);static inline void acpi_early_processor_set_pdc (void ) {}#endif +void acpi_early_processor_set_osc (void ); +/* --------------------------------------------------------- ---- ------------- Embedded Controller ----------------------------------------------------------- ---- ----------- */
Quoted 45 lines · Linda Knippers
On 3/17/2016 5:12 PM, Srinivas Pandruvada wrote:
<snip>Quoted 17 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
This needs to be done
before SMM code path looks for_OSCcapabilities. The bit 12 of_OSCin processor scope defines whether OS will handle thermal interrupts.
When bit 12 is set to 1, OS will handle thermal interrupts. Refer to this document for details on_OSC
http://www.intel.com/content/www/us/en/standards/processor-vend
or-
specific-acpi-specification.htmlQuoted 8 lines
Quoted 3 lines
Quoted 2 lines
Where is bit 12 documented?
In the above document.
When I look at that document, I see bit 12 described as "If set, OSPM supports native interrupt handling for Collaborative Processor
Performance Control notifications." Is that the same thing or am I looking at the wrong table?Quoted 5 lines
Yes. If you look at section 14.4 in Intel SDM, you will see that "HWP is an implementation of the ACPI-defined Collaborative Processor Performance Control (CPPC)". Section 14.4.5 also specifies that HWP uses
IA32_THERM_STATUSto communicate if there are notifications, which is notified via thermal interrupt.Ok, thanks. That wasn't clear from the commit message. It sounded like bit 12 directly indicated that the OS will handle thermal interrupts but it's a bit more indirect than that.
Quoted 3 lines
You asked above if platform can handle these notification in SMM only. If you do then the notification will arrive as ACPI notifications. We don't have support for such notifications in Linux yet.
What I meant to ask was if the platform can disregard the
_OSCinformation and handle thermal events on it's own, without OS involvement. For example, servers typically don't want to rely on the OS to manage thermal issues.<snip>
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 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 to take over thermal LVT.
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Does this change just affect Skylake platforms or all platforms?
Any platform which has Intel ® Speed Shift Technology (aka HWP) feature present and enabled.
Could this be an unexpected change in behavior for platforms with HWP that don't have this bug, assuming they would look at the
_OSCCPPP bit? That's actually my main concern here.
Do you have any specific platforms in mind or just in general?
Thanks,
Rafael
On 3/17/2016 8:17 PM, Rafael J. Wysocki wrote:
<snip>
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 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 to take over thermal LVT.Does this change just affect Skylake platforms or all platforms?
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Any platform which has Intel ® Speed Shift Technology (aka HWP) feature present and enabled.
Could this be an unexpected change in behavior for platforms with HWP that don't have this bug, assuming they would look at the
_OSCCPPP bit? That's actually my main concern here.Do you have any specific platforms in mind or just in general?
It's just general right now but as more HWP server platforms come out, it may become specific.
-- ljk
Quoted 4 lines
Thanks,
Rafael