Merge branches 'acpi-processor', 'acpi-cppc', 'acpi-apei' and 'acpi-sleep'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 25 Jul 2016 11:42:25 +0000 (13:42 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 25 Jul 2016 11:42:25 +0000 (13:42 +0200)
* acpi-processor:
  ACPI: enable ACPI_PROCESSOR_IDLE on ARM64
  arm64: add support for ACPI Low Power Idle(LPI)
  drivers: firmware: psci: initialise idle states using ACPI LPI
  cpuidle: introduce CPU_PM_CPU_IDLE_ENTER macro for ARM{32, 64}
  arm64: cpuidle: drop __init section marker to arm_cpuidle_init
  ACPI / processor_idle: Add support for Low Power Idle(LPI) states
  ACPI / processor_idle: introduce ACPI_PROCESSOR_CSTATE

* acpi-cppc:
  mailbox: pcc: Add PCC request and free channel declarations
  ACPI / CPPC: Prevent cpc_desc_ptr points to the invalid data
  ACPI: CPPC: Return error if _CPC is invalid on a CPU

* acpi-apei:
  ACPI / APEI: Add Boot Error Record Table (BERT) support
  ACPI / einj: Make error paths more talkative
  ACPI / einj: Convert EINJ_PFX to proper pr_fmt

* acpi-sleep:
  ACPI: Execute _PTS before system reboot

1  2  3  4  5 
Documentation/kernel-parameters.txt
drivers/acpi/Kconfig
drivers/acpi/bus.c
include/acpi/processor.h
include/linux/acpi.h

@@@@@@ -582,6 -582,6 -582,6 -582,9 -582,6 +582,9 @@@@@@ bytes respectively. Such letter suffixe
     
        bootmem_debug   [KNL] Enable bootmem allocator debug messages.
     
+++ +   bert_disable    [ACPI]
+++ +                   Disable BERT OS support on buggy BIOSes.
+++ +
        bttv.card=      [HW,V4L] bttv (bt848 + bt878 based grabber cards)
        bttv.radio=     Most important insmod options are available as
                        kernel args too.
                        Address Range Mirroring feature even if your box
                        doesn't support it.
     
 ++++   efivar_ssdt=    [EFI; X86] Name of an EFI variable that contains an SSDT
 ++++                   that is to be dynamically loaded by Linux. If there are
 ++++                   multiple variables with the same name but with different
 ++++                   vendor GUIDs, all of them will be loaded. See
 ++++                   Documentation/acpi/ssdt-overlays.txt for details.
 ++++
 ++++
        eisa_irq_edge=  [PARISC,HW]
                        See header of drivers/parisc/eisa.c.
     
diff --combined drivers/acpi/Kconfig
@@@@@@ -213,6 -213,10 -213,6 -213,6 -213,6 +213,10 @@@@@@ config ACPI_CPU_FREQ_PS
        bool
        select THERMAL
     
+ +++config ACPI_PROCESSOR_CSTATE
+ +++   def_bool y
+ +++   depends on IA64 || X86
+ +++
     config ACPI_PROCESSOR_IDLE
        bool
        select CPU_IDLE
@@@@@@ -234,7 -238,7 -234,7 -234,7 -234,7 +238,7 @@@@@@ config ACPI_CPPC_LI
     config ACPI_PROCESSOR
        tristate "Processor"
        depends on X86 || IA64 || ARM64
- ---   select ACPI_PROCESSOR_IDLE if X86 || IA64
+ +++   select ACPI_PROCESSOR_IDLE
        select ACPI_CPU_FREQ_PSS if X86 || IA64
        default y
        help
@@@@@@ -291,8 -295,8 -291,8 -291,8 -291,8 +295,8 @@@@@@ config ACPI_THERMA
     config ACPI_NUMA
        bool "NUMA support"
        depends on NUMA
 ----   depends on (X86 || IA64)
 ----   default y if IA64_GENERIC || IA64_SGI_SN2
 ++++   depends on (X86 || IA64 || ARM64)
 ++++   default y if IA64_GENERIC || IA64_SGI_SN2 || ARM64
     
     config ACPI_CUSTOM_DSDT_FILE
        string "Custom DSDT Table file to include"
@@@@@@ -311,12 -315,9 -311,9 -311,9 -311,9 +315,12 @@@@@@ config ACPI_CUSTOM_DSD
        bool
        default ACPI_CUSTOM_DSDT_FILE != ""
     
 ++++config ARCH_HAS_ACPI_TABLE_UPGRADE
 ++++   def_bool n
 ++++
     config ACPI_TABLE_UPGRADE
        bool "Allow upgrading ACPI tables via initrd"
 ----   depends on BLK_DEV_INITRD && X86
 ++++   depends on BLK_DEV_INITRD && ARCH_HAS_ACPI_TABLE_UPGRADE
        default y
        help
          This option provides functionality to upgrade arbitrary ACPI tables
@@@@@@ -524,12 -525,4 -521,4 -521,4 -521,4 +528,12 @@@@@@ config XPOWER_PMIC_OPREGIO
     
     endif
     
 ++++config ACPI_CONFIGFS
 ++++   tristate "ACPI configfs support"
 ++++   select CONFIGFS_FS
 ++++   help
 ++++     Select this option to enable support for ACPI configuration from
 ++++     userspace. The configurable ACPI groups will be visible under
 ++++     /config/acpi, assuming configfs is mounted under /config.
 ++++
     endif      # ACPI
diff --combined drivers/acpi/bus.c
     #include <linux/acpi.h>
     #include <linux/slab.h>
     #include <linux/regulator/machine.h>
 ++++#include <linux/workqueue.h>
 ++++#include <linux/reboot.h>
 ++++#include <linux/delay.h>
     #ifdef CONFIG_X86
     #include <asm/mpspec.h>
     #endif
@@@@@@ -177,17 -174,22 -174,22 -174,22 -174,22 +177,17 @@@@@@ void acpi_bus_detach_private_data(acpi_
     EXPORT_SYMBOL_GPL(acpi_bus_detach_private_data);
     
     static void acpi_print_osc_error(acpi_handle handle,
 ----   struct acpi_osc_context *context, char *error)
 ++++                            struct acpi_osc_context *context, char *error)
     {
 ----   struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER};
        int i;
     
 ----   if (ACPI_FAILURE(acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer)))
 ----           printk(KERN_DEBUG "%s: %s\n", context->uuid_str, error);
 ----   else {
 ----           printk(KERN_DEBUG "%s (%s): %s\n",
 ----                  (char *)buffer.pointer, context->uuid_str, error);
 ----           kfree(buffer.pointer);
 ----   }
 ----   printk(KERN_DEBUG "_OSC request data:");
 ++++   acpi_handle_debug(handle, "(%s): %s\n", context->uuid_str, error);
 ++++
 ++++   pr_debug("_OSC request data:");
        for (i = 0; i < context->cap.length; i += sizeof(u32))
 ----           printk(" %x", *((u32 *)(context->cap.pointer + i)));
 ----   printk("\n");
 ++++           pr_debug(" %x", *((u32 *)(context->cap.pointer + i)));
 ++++
 ++++   pr_debug("\n");
     }
     
     acpi_status acpi_str_to_uuid(char *str, u8 *uuid)
@@@@@@ -300,6 -302,14 -302,6 -302,6 -302,6 +300,14 @@@@@@ out_kfree
     EXPORT_SYMBOL(acpi_run_osc);
     
     bool osc_sb_apei_support_acked;
+ +++
+ +++/*
+ +++ * ACPI 6.0 Section 8.4.4.2 Idle State Coordination
+ +++ * OSPM supports platform coordinated low power idle(LPI) states
+ +++ */
+ +++bool osc_pc_lpi_support_confirmed;
+ +++EXPORT_SYMBOL_GPL(osc_pc_lpi_support_confirmed);
+ +++
     static u8 sb_uuid_str[] = "0811B06E-4A27-44F9-8D60-3CBBC22E7B48";
     static void acpi_bus_osc_support(void)
     {
                capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PPC_OST_SUPPORT;
     
        capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT;
+ +++   capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PCLPI_SUPPORT;
     
        if (!ghes_disable)
                capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_APEI_SUPPORT;
                return;
        if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) {
                u32 *capbuf_ret = context.ret.pointer;
- ---           if (context.ret.length > OSC_SUPPORT_DWORD)
+ +++           if (context.ret.length > OSC_SUPPORT_DWORD) {
                        osc_sb_apei_support_acked =
                                capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT;
+ +++                   osc_pc_lpi_support_confirmed =
+ +++                           capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_PCLPI_SUPPORT;
+ +++           }
                kfree(context.ret.pointer);
        }
        /* do we need to check other returned cap? Sounds no */
@@@@@@ -473,56 -487,6 -475,6 -475,6 -475,6 +485,56 @@@@@@ static void acpi_device_remove_notify_h
                                           acpi_device_notify);
     }
     
 ++++/* Handle events targeting \_SB device (at present only graceful shutdown) */
 ++++
 ++++#define ACPI_SB_NOTIFY_SHUTDOWN_REQUEST 0x81
 ++++#define ACPI_SB_INDICATE_INTERVAL  10000
 ++++
 ++++static void sb_notify_work(struct work_struct *dummy)
 ++++{
 ++++   acpi_handle sb_handle;
 ++++
 ++++   orderly_poweroff(true);
 ++++
 ++++   /*
 ++++    * After initiating graceful shutdown, the ACPI spec requires OSPM
 ++++    * to evaluate _OST method once every 10seconds to indicate that
 ++++    * the shutdown is in progress
 ++++    */
 ++++   acpi_get_handle(NULL, "\\_SB", &sb_handle);
 ++++   while (1) {
 ++++           pr_info("Graceful shutdown in progress.\n");
 ++++           acpi_evaluate_ost(sb_handle, ACPI_OST_EC_OSPM_SHUTDOWN,
 ++++                           ACPI_OST_SC_OS_SHUTDOWN_IN_PROGRESS, NULL);
 ++++           msleep(ACPI_SB_INDICATE_INTERVAL);
 ++++   }
 ++++}
 ++++
 ++++static void acpi_sb_notify(acpi_handle handle, u32 event, void *data)
 ++++{
 ++++   static DECLARE_WORK(acpi_sb_work, sb_notify_work);
 ++++
 ++++   if (event == ACPI_SB_NOTIFY_SHUTDOWN_REQUEST) {
 ++++           if (!work_busy(&acpi_sb_work))
 ++++                   schedule_work(&acpi_sb_work);
 ++++   } else
 ++++           pr_warn("event %x is not supported by \\_SB device\n", event);
 ++++}
 ++++
 ++++static int __init acpi_setup_sb_notify_handler(void)
 ++++{
 ++++   acpi_handle sb_handle;
 ++++
 ++++   if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &sb_handle)))
 ++++           return -ENXIO;
 ++++
 ++++   if (ACPI_FAILURE(acpi_install_notify_handler(sb_handle, ACPI_DEVICE_NOTIFY,
 ++++                                           acpi_sb_notify, NULL)))
 ++++           return -EINVAL;
 ++++
 ++++   return 0;
 ++++}
 ++++
     /* --------------------------------------------------------------------------
                                  Device Matching
        -------------------------------------------------------------------------- */
@@@@@@ -1009,7 -973,8 -961,8 -961,8 -961,8 +1021,7 @@@@@@ void __init acpi_early_init(void
     /**
      * acpi_subsystem_init - Finalize the early initialization of ACPI.
      *
 ---- * Switch over the platform to the ACPI mode (if possible), initialize the
 ---- * handling of ACPI events, install the interrupt and global lock handlers.
 ++++ * Switch over the platform to the ACPI mode (if possible).
      *
      * Doing this too early is generally unsafe, but at the same time it needs to be
      * done before all things that really depend on ACPI.  The right spot appears to
@@@@@@ -1037,13 -1002,6 -990,6 -990,6 -990,6 +1049,13 @@@@@@ void __init acpi_subsystem_init(void
        }
     }
     
 ++++static acpi_status acpi_bus_table_handler(u32 event, void *table, void *context)
 ++++{
 ++++   acpi_scan_table_handler(event, table, context);
 ++++
 ++++   return acpi_sysfs_table_handler(event, table, context);
 ++++}
 ++++
     static int __init acpi_bus_init(void)
     {
        int result;
         * _PDC control method may load dynamic SSDT tables,
         * and we need to install the table handler before that.
         */
 ++++   status = acpi_install_table_handler(acpi_bus_table_handler, NULL);
 ++++
        acpi_sysfs_init();
     
        acpi_early_processor_set_pdc();
@@@@@@ -1180,7 -1136,6 -1124,6 -1124,6 -1124,6 +1192,7 @@@@@@ static int __init acpi_init(void
        acpi_sleep_proc_init();
        acpi_wakeup_device_init();
        acpi_debugger_init();
 ++++   acpi_setup_sb_notify_handler();
        return 0;
     }
     
diff --combined include/acpi/processor.h
     #define ACPI_CSTATE_SYSTEMIO       0
     #define ACPI_CSTATE_FFH            1
     #define ACPI_CSTATE_HALT   2
+ +++#define ACPI_CSTATE_INTEGER        3
     
     #define ACPI_CX_DESC_LEN   32
     
@@@@@@ -67,9 -68,25 -67,9 -67,9 -67,9 +68,25 @@@@@@ struct acpi_processor_cx 
        char desc[ACPI_CX_DESC_LEN];
     };
     
+ +++struct acpi_lpi_state {
+ +++   u32 min_residency;
+ +++   u32 wake_latency; /* worst case */
+ +++   u32 flags;
+ +++   u32 arch_flags;
+ +++   u32 res_cnt_freq;
+ +++   u32 enable_parent_state;
+ +++   u64 address;
+ +++   u8 index;
+ +++   u8 entry_method;
+ +++   char desc[ACPI_CX_DESC_LEN];
+ +++};
+ +++
     struct acpi_processor_power {
        int count;
- ---   struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
+ +++   union {
+ +++           struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
+ +++           struct acpi_lpi_state lpi_states[ACPI_PROCESSOR_MAX_POWER];
+ +++   };
        int timer_broadcast_on_state;
     };
     
@@@@@@ -189,6 -206,7 -189,6 -189,6 -189,6 +206,7 @@@@@@ struct acpi_processor_flags 
        u8 bm_control:1;
        u8 bm_check:1;
        u8 has_cst:1;
+ +++   u8 has_lpi:1;
        u8 power_setup_done:1;
        u8 bm_rld_set:1;
        u8 need_hotplug_init:1;
@@@@@@ -242,7 -260,7 -242,7 -242,7 -242,7 +260,7 @@@@@@ extern int acpi_processor_get_performan
     DECLARE_PER_CPU(struct acpi_processor *, processors);
     extern struct acpi_processor_errata errata;
     
- ---#ifdef ARCH_HAS_POWER_INIT
+ +++#if defined(ARCH_HAS_POWER_INIT) && defined(CONFIG_ACPI_PROCESSOR_CSTATE)
     void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
                                        unsigned int cpu);
     int acpi_processor_ffh_cstate_probe(unsigned int cpu,
@@@@@@ -309,7 -327,6 -309,6 -309,6 -309,6 +327,7 @@@@@@ static inline int acpi_processor_get_bi
     
     /* in processor_core.c */
     phys_cpuid_t acpi_get_phys_id(acpi_handle, int type, u32 acpi_id);
 ++++phys_cpuid_t acpi_map_madt_entry(u32 acpi_id);
     int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id);
     int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
     
@@@@@@ -372,7 -389,7 -371,7 -371,7 -371,7 +390,7 @@@@@@ extern struct cpuidle_driver acpi_idle_
     #ifdef CONFIG_ACPI_PROCESSOR_IDLE
     int acpi_processor_power_init(struct acpi_processor *pr);
     int acpi_processor_power_exit(struct acpi_processor *pr);
- ---int acpi_processor_cst_has_changed(struct acpi_processor *pr);
+ +++int acpi_processor_power_state_has_changed(struct acpi_processor *pr);
     int acpi_processor_hotplug(struct acpi_processor *pr);
     #else
     static inline int acpi_processor_power_init(struct acpi_processor *pr)
@@@@@@ -385,7 -402,7 -384,7 -384,7 -384,7 +403,7 @@@@@@ static inline int acpi_processor_power_
        return -ENODEV;
     }
     
- ---static inline int acpi_processor_cst_has_changed(struct acpi_processor *pr)
+ +++static inline int acpi_processor_power_state_has_changed(struct acpi_processor *pr)
     {
        return -ENODEV;
     }
diff --combined include/linux/acpi.h
@@@@@@ -208,6 -208,7 -208,7 -208,7 -208,7 +208,6 @@@@@@ void acpi_boot_table_init (void)
     int acpi_mps_check (void);
     int acpi_numa_init (void);
     
 ----void early_acpi_table_init(void *data, size_t size);
     int acpi_table_init (void);
     int acpi_table_parse(char *id, acpi_tbl_table_handler handler);
     int __init acpi_parse_entries(char *id, unsigned long table_size,
@@@@@@ -231,26 -232,12 -232,12 -232,12 -232,12 +231,26 @@@@@@ int acpi_table_parse_madt(enum acpi_mad
     int acpi_parse_mcfg (struct acpi_table_header *header);
     void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
     
 ----/* the following four functions are architecture-dependent */
 ++++/* the following numa functions are architecture-dependent */
     void acpi_numa_slit_init (struct acpi_table_slit *slit);
 ++++
 ++++#if defined(CONFIG_X86) || defined(CONFIG_IA64)
     void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
 ++++#else
 ++++static inline void
 ++++acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) { }
 ++++#endif
 ++++
     void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa);
 ++++
 ++++#ifdef CONFIG_ARM64
 ++++void acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa);
 ++++#else
 ++++static inline void
 ++++acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa) { }
 ++++#endif
 ++++
     int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
 ----void acpi_numa_arch_fixup(void);
     
     #ifndef PHYS_CPUID_INVALID
     typedef u32 phys_cpuid_t;
@@@@@@ -457,8 -444,12 -444,8 -444,8 -444,8 +457,12 @@@@@@ acpi_status acpi_run_osc(acpi_handle ha
     #define OSC_SB_HOTPLUG_OST_SUPPORT         0x00000008
     #define OSC_SB_APEI_SUPPORT                        0x00000010
     #define OSC_SB_CPC_SUPPORT                 0x00000020
+ +++#define OSC_SB_CPCV2_SUPPORT                       0x00000040
+ +++#define OSC_SB_PCLPI_SUPPORT                       0x00000080
+ +++#define OSC_SB_OSLPI_SUPPORT                       0x00000100
     
     extern bool osc_sb_apei_support_acked;
+ +++extern bool osc_pc_lpi_support_confirmed;
     
     /* PCI Host Bridge _OSC: Capabilities DWORD 2: Support Field */
     #define OSC_PCI_EXT_CONFIG_SUPPORT         0x00000001
@@@@@@ -545,24 -536,6 -532,6 -532,6 -532,6 +549,24 @@@@@@ void acpi_walk_dep_device_list(acpi_han
     struct platform_device *acpi_create_platform_device(struct acpi_device *);
     #define ACPI_PTR(_ptr)     (_ptr)
     
 ++++static inline void acpi_device_set_enumerated(struct acpi_device *adev)
 ++++{
 ++++   adev->flags.visited = true;
 ++++}
 ++++
 ++++static inline void acpi_device_clear_enumerated(struct acpi_device *adev)
 ++++{
 ++++   adev->flags.visited = false;
 ++++}
 ++++
 ++++enum acpi_reconfig_event  {
 ++++   ACPI_RECONFIG_DEVICE_ADD = 0,
 ++++   ACPI_RECONFIG_DEVICE_REMOVE,
 ++++};
 ++++
 ++++int acpi_reconfig_notifier_register(struct notifier_block *nb);
 ++++int acpi_reconfig_notifier_unregister(struct notifier_block *nb);
 ++++
     #else      /* !CONFIG_ACPI */
     
     #define acpi_disabled 1
@@@@@@ -619,6 -592,7 -588,7 -588,7 -588,7 +623,6 @@@@@@ static inline const char *acpi_dev_name
        return NULL;
     }
     
 ----static inline void early_acpi_table_init(void *data, size_t size) { }
     static inline void acpi_early_init(void) { }
     static inline void acpi_subsystem_init(void) { }
     
@@@@@@ -708,24 -682,6 -678,6 -678,6 -678,6 +712,24 @@@@@@ static inline enum dev_dma_attr acpi_ge
     
     #define ACPI_PTR(_ptr)     (NULL)
     
 ++++static inline void acpi_device_set_enumerated(struct acpi_device *adev)
 ++++{
 ++++}
 ++++
 ++++static inline void acpi_device_clear_enumerated(struct acpi_device *adev)
 ++++{
 ++++}
 ++++
 ++++static inline int acpi_reconfig_notifier_register(struct notifier_block *nb)
 ++++{
 ++++   return -EINVAL;
 ++++}
 ++++
 ++++static inline int acpi_reconfig_notifier_unregister(struct notifier_block *nb)
 ++++{
 ++++   return -EINVAL;
 ++++}
 ++++
     #endif     /* !CONFIG_ACPI */
     
     #ifdef CONFIG_ACPI
@@@@@@ -1045,10 -1001,4 -997,4 -997,4 -997,4 +1049,10 @@@@@@ static inline struct fwnode_handle *acp
     #define acpi_probe_device_table(t) ({ int __r = 0; __r;})
     #endif
     
 ++++#ifdef CONFIG_ACPI_TABLE_UPGRADE
 ++++void acpi_table_upgrade(void);
 ++++#else
 ++++static inline void acpi_table_upgrade(void) { }
 ++++#endif
 ++++
     #endif     /*_LINUX_ACPI_H*/