Merge branch 'acpi-processor'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 1 Apr 2016 23:17:36 +0000 (01:17 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 1 Apr 2016 23:17:36 +0000 (01:17 +0200)
* acpi-processor:
  ACPI / processor: Request native thermal interrupt handling via _OSC

1  2 
arch/x86/kernel/cpu/mcheck/therm_throt.c
drivers/acpi/bus.c
drivers/acpi/internal.h

@@@ -190,7 -190,7 +190,7 @@@ static int therm_throt_process(bool new
        /* if we just entered the thermal event */
        if (new_event) {
                if (event == THERMAL_THROTTLING_EVENT)
 -                      printk(KERN_CRIT "CPU%d: %s temperature above threshold, cpu clock throttled (total events = %lu)\n",
 +                      pr_crit("CPU%d: %s temperature above threshold, cpu clock throttled (total events = %lu)\n",
                                this_cpu,
                                level == CORE_LEVEL ? "Core" : "Package",
                                state->count);
        }
        if (old_event) {
                if (event == THERMAL_THROTTLING_EVENT)
 -                      printk(KERN_INFO "CPU%d: %s temperature/speed normal\n",
 -                              this_cpu,
 +                      pr_info("CPU%d: %s temperature/speed normal\n", this_cpu,
                                level == CORE_LEVEL ? "Core" : "Package");
                return 1;
        }
@@@ -384,6 -385,9 +384,9 @@@ static void intel_thermal_interrupt(voi
  {
        __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*/
  
  static void unexpected_thermal_interrupt(void)
  {
 -      printk(KERN_ERR "CPU%d: Unexpected LVT thermal interrupt!\n",
 -                      smp_processor_id());
 +      pr_err("CPU%d: Unexpected LVT thermal interrupt!\n",
 +              smp_processor_id());
  }
  
  static void (*smp_thermal_vector)(void) = unexpected_thermal_interrupt;
@@@ -498,7 -502,7 +501,7 @@@ void intel_init_thermal(struct cpuinfo_
  
        if ((l & MSR_IA32_MISC_ENABLE_TM1) && (h & APIC_DM_SMI)) {
                if (system_state == SYSTEM_BOOTING)
 -                      printk(KERN_DEBUG "CPU%d: Thermal monitoring handled by SMI\n", cpu);
 +                      pr_debug("CPU%d: Thermal monitoring handled by SMI\n", cpu);
                return;
        }
  
        l = apic_read(APIC_LVTTHMR);
        apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED);
  
 -      printk_once(KERN_INFO "CPU0: Thermal monitoring enabled (%s)\n",
 -                     tm2 ? "TM2" : "TM1");
 +      pr_info_once("CPU0: Thermal monitoring enabled (%s)\n",
 +                    tm2 ? "TM2" : "TM1");
  
        /* enable thermal throttle processing */
        atomic_set(&therm_throt_en, 1);
diff --combined drivers/acpi/bus.c
@@@ -479,38 -479,24 +479,38 @@@ static void acpi_device_remove_notify_h
                               Device Matching
     -------------------------------------------------------------------------- */
  
 -static struct acpi_device *acpi_primary_dev_companion(struct acpi_device *adev,
 -                                                    const struct device *dev)
 +/**
 + * acpi_get_first_physical_node - Get first physical node of an ACPI device
 + * @adev:     ACPI device in question
 + *
 + * Return: First physical node of ACPI device @adev
 + */
 +struct device *acpi_get_first_physical_node(struct acpi_device *adev)
  {
        struct mutex *physical_node_lock = &adev->physical_node_lock;
 +      struct device *phys_dev;
  
        mutex_lock(physical_node_lock);
        if (list_empty(&adev->physical_node_list)) {
 -              adev = NULL;
 +              phys_dev = NULL;
        } else {
                const struct acpi_device_physical_node *node;
  
                node = list_first_entry(&adev->physical_node_list,
                                        struct acpi_device_physical_node, node);
 -              if (node->dev != dev)
 -                      adev = NULL;
 +
 +              phys_dev = node->dev;
        }
        mutex_unlock(physical_node_lock);
 -      return adev;
 +      return phys_dev;
 +}
 +
 +static struct acpi_device *acpi_primary_dev_companion(struct acpi_device *adev,
 +                                                    const struct device *dev)
 +{
 +      const struct device *phys_dev = acpi_get_first_physical_node(adev);
 +
 +      return phys_dev && phys_dev == dev ? adev : NULL;
  }
  
  /**
@@@ -1019,6 -1005,9 +1019,9 @@@ static int __init acpi_bus_init(void
                goto error1;
        }
  
+       /* Set capability bits for _OSC under processor scope */
+       acpi_early_processor_osc();
        /*
         * _OSC method may exist in module level code,
         * so it must be run after ACPI_FULL_INITIALIZATION
diff --combined drivers/acpi/internal.h
@@@ -20,7 -20,6 +20,7 @@@
  
  #define PREFIX "ACPI: "
  
 +void acpi_initrd_initialize_tables(void);
  acpi_status acpi_os_initialize1(void);
  void init_acpi_device_notify(void);
  int acpi_scan_init(void);
@@@ -30,11 -29,6 +30,11 @@@ void acpi_processor_init(void)
  void acpi_platform_init(void);
  void acpi_pnp_init(void);
  void acpi_int340x_thermal_init(void);
 +#ifdef CONFIG_ARM_AMBA
 +void acpi_amba_init(void);
 +#else
 +static inline void acpi_amba_init(void) {}
 +#endif
  int acpi_sysfs_init(void);
  void acpi_container_init(void);
  void acpi_memory_hotplug_init(void);
@@@ -112,7 -106,6 +112,7 @@@ bool acpi_device_is_present(struct acpi
  bool acpi_device_is_battery(struct acpi_device *adev);
  bool acpi_device_is_first_physical_node(struct acpi_device *adev,
                                        const struct device *dev);
 +struct device *acpi_get_first_physical_node(struct acpi_device *adev);
  
  /* --------------------------------------------------------------------------
                       Device Matching and Notification
@@@ -145,6 -138,12 +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_osc(void);
+ #else
+ static inline void acpi_early_processor_osc(void) {}
+ #endif
  /* --------------------------------------------------------------------------
                                    Embedded Controller
     -------------------------------------------------------------------------- */