aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-04-01 19:17:36 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-04-01 19:17:36 -0400
commit8fbd4ade93dc67f035914cd4030f1c58797d9e59 (patch)
tree13f5333b55aebc7a1913ca7568b69b02e11a5a6b
parentf55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff)
parenta21211672c9a1d730a39aa65d4a5b3414700adfb (diff)
Merge branch 'acpi-processor'
* acpi-processor: ACPI / processor: Request native thermal interrupt handling via _OSC
-rw-r--r--arch/x86/kernel/cpu/mcheck/therm_throt.c3
-rw-r--r--drivers/acpi/acpi_processor.c52
-rw-r--r--drivers/acpi/bus.c3
-rw-r--r--drivers/acpi/internal.h6
4 files changed, 64 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index 0b445c2ff735..ac780cad3b86 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -384,6 +384,9 @@ static void intel_thermal_interrupt(void)
384{ 384{
385 __u64 msr_val; 385 __u64 msr_val;
386 386
387 if (static_cpu_has(X86_FEATURE_HWP))
388 wrmsrl_safe(MSR_HWP_STATUS, 0);
389
387 rdmsrl(MSR_IA32_THERM_STATUS, msr_val); 390 rdmsrl(MSR_IA32_THERM_STATUS, msr_val);
388 391
389 /* Check for violation of core thermal thresholds*/ 392 /* Check for violation of core thermal thresholds*/
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index b5e54f2da53d..0d92d0f915e9 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -491,6 +491,58 @@ static void acpi_processor_remove(struct acpi_device *device)
491} 491}
492#endif /* CONFIG_ACPI_HOTPLUG_CPU */ 492#endif /* CONFIG_ACPI_HOTPLUG_CPU */
493 493
494#ifdef CONFIG_X86
495static bool acpi_hwp_native_thermal_lvt_set;
496static acpi_status __init acpi_hwp_native_thermal_lvt_osc(acpi_handle handle,
497 u32 lvl,
498 void *context,
499 void **rv)
500{
501 u8 sb_uuid_str[] = "4077A616-290C-47BE-9EBD-D87058713953";
502 u32 capbuf[2];
503 struct acpi_osc_context osc_context = {
504 .uuid_str = sb_uuid_str,
505 .rev = 1,
506 .cap.length = 8,
507 .cap.pointer = capbuf,
508 };
509
510 if (acpi_hwp_native_thermal_lvt_set)
511 return AE_CTRL_TERMINATE;
512
513 capbuf[0] = 0x0000;
514 capbuf[1] = 0x1000; /* set bit 12 */
515
516 if (ACPI_SUCCESS(acpi_run_osc(handle, &osc_context))) {
517 if (osc_context.ret.pointer && osc_context.ret.length > 1) {
518 u32 *capbuf_ret = osc_context.ret.pointer;
519
520 if (capbuf_ret[1] & 0x1000) {
521 acpi_handle_info(handle,
522 "_OSC native thermal LVT Acked\n");
523 acpi_hwp_native_thermal_lvt_set = true;
524 }
525 }
526 kfree(osc_context.ret.pointer);
527 }
528
529 return AE_OK;
530}
531
532void __init acpi_early_processor_osc(void)
533{
534 if (boot_cpu_has(X86_FEATURE_HWP)) {
535 acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
536 ACPI_UINT32_MAX,
537 acpi_hwp_native_thermal_lvt_osc,
538 NULL, NULL, NULL);
539 acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID,
540 acpi_hwp_native_thermal_lvt_osc,
541 NULL, NULL);
542 }
543}
544#endif
545
494/* 546/*
495 * The following ACPI IDs are known to be suitable for representing as 547 * The following ACPI IDs are known to be suitable for representing as
496 * processor devices. 548 * processor devices.
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 0e8567846f1a..c068c829b453 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -1019,6 +1019,9 @@ static int __init acpi_bus_init(void)
1019 goto error1; 1019 goto error1;
1020 } 1020 }
1021 1021
1022 /* Set capability bits for _OSC under processor scope */
1023 acpi_early_processor_osc();
1024
1022 /* 1025 /*
1023 * _OSC method may exist in module level code, 1026 * _OSC method may exist in module level code,
1024 * so it must be run after ACPI_FULL_INITIALIZATION 1027 * so it must be run after ACPI_FULL_INITIALIZATION
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index a37508ef66c1..7c188472d9c2 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -145,6 +145,12 @@ void acpi_early_processor_set_pdc(void);
145static inline void acpi_early_processor_set_pdc(void) {} 145static inline void acpi_early_processor_set_pdc(void) {}
146#endif 146#endif
147 147
148#ifdef CONFIG_X86
149void acpi_early_processor_osc(void);
150#else
151static inline void acpi_early_processor_osc(void) {}
152#endif
153
148/* -------------------------------------------------------------------------- 154/* --------------------------------------------------------------------------
149 Embedded Controller 155 Embedded Controller
150 -------------------------------------------------------------------------- */ 156 -------------------------------------------------------------------------- */