Skip to content

Commit

Permalink
Merge tag 'acpi-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/rafael/linux-pm

Pull ACPI updates from Rafael Wysocki:
 "These update the ACPICA code in the kernel to upstream revision
  20200430, fix several reference counting errors related to ACPI
  tables, add _Exx / _Lxx support to the GED driver, add a new
  acpi_evaluate_reg() helper, add new DPTF battery participant driver
  and extend the DPFT power participant driver, improve the handling of
  memory failures in the APEI code, add a blacklist entry to the
  backlight driver, update the PMIC driver and the processor idle
  driver, fix two kobject reference count leaks, and make a few janitory
  changes.

  Specifics:

   - Update the ACPICA code in the kernel to upstream revision 20200430:

      - Move acpi_gbl_next_cmd_num definition (Erik Kaneda).

      - Ignore AE_ALREADY_EXISTS status in the disassembler when parsing
        create operators (Erik Kaneda).

      - Add status checks to the dispatcher (Erik Kaneda).

      - Fix required parameters for _NIG and _NIH (Erik Kaneda).

      - Make acpi_protocol_lengths static (Yue Haibing).

   - Fix ACPI table reference counting errors in several places, mostly
     in error code paths (Hanjun Guo).

   - Extend the Generic Event Device (GED) driver to support _Exx and
     _Lxx handler methods (Ard Biesheuvel).

   - Add new acpi_evaluate_reg() helper and modify the ACPI PCI hotplug
     code to use it (Hans de Goede).

   - Add new DPTF battery participant driver and make the DPFT power
     participant driver create more sysfs device attributes (Srinivas
     Pandruvada).

   - Improve the handling of memory failures in APEI (James Morse).

   - Add new blacklist entry for Acer TravelMate 5735Z to the backlight
     driver (Paul Menzel).

   - Add i2c address for thermal control to the PMIC driver (Mauro
     Carvalho Chehab).

   - Allow the ACPI processor idle driver to work on platforms with only
     one ACPI C-state present (Zhang Rui).

   - Fix kobject reference count leaks in error code paths in two places
     (Qiushi Wu).

   - Delete unused proc filename macros and make some symbols static
     (Pascal Terjan, Zheng Zengkai, Zou Wei)"

* tag 'acpi-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (32 commits)
  ACPI: CPPC: Fix reference count leak in acpi_cppc_processor_probe()
  ACPI: sysfs: Fix reference count leak in acpi_sysfs_add_hotplug_profile()
  ACPI: GED: use correct trigger type field in _Exx / _Lxx handling
  ACPI: DPTF: Add battery participant driver
  ACPI: DPTF: Additional sysfs attributes for power participant driver
  ACPI: video: Use native backlight on Acer TravelMate 5735Z
  arm64: acpi: Make apei_claim_sea() synchronise with APEI's irq work
  ACPI: APEI: Kick the memory_failure() queue for synchronous errors
  mm/memory-failure: Add memory_failure_queue_kick()
  ACPI / PMIC: Add i2c address for thermal control
  ACPI: GED: add support for _Exx / _Lxx handler methods
  ACPI: Delete unused proc filename macros
  ACPI: hotplug: PCI: Use the new acpi_evaluate_reg() helper
  ACPI: utils: Add acpi_evaluate_reg() helper
  ACPI: debug: Make two functions static
  ACPI: sleep: Put the FACS table after using it
  ACPI: scan: Put SPCR and STAO table after using it
  ACPI: EC: Put the ACPI table after using it
  ACPI: APEI: Put the HEST table for error path
  ACPI: APEI: Put the error record serialization table for error path
  ...
  • Loading branch information
Linus Torvalds committed Jun 2, 2020
2 parents 355ba37 + 48ccded commit 118d6e9
Show file tree
Hide file tree
Showing 37 changed files with 438 additions and 98 deletions.
62 changes: 58 additions & 4 deletions Documentation/ABI/testing/sysfs-platform-dptf
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,68 @@ KernelVersion: v4.10
Contact: linux-acpi@vger.kernel.org
Description:
(RO) Display the platform power source
0x00 = DC
0x01 = AC
0x02 = USB
0x03 = Wireless Charger
bits[3:0] Current power source
0x00 = DC
0x01 = AC
0x02 = USB
0x03 = Wireless Charger
bits[7:4] Power source sequence number

What: /sys/bus/platform/devices/INT3407:00/dptf_power/battery_steady_power
Date: Jul, 2016
KernelVersion: v4.10
Contact: linux-acpi@vger.kernel.org
Description:
(RO) The maximum sustained power for battery in milliwatts.

What: /sys/bus/platform/devices/INT3407:00/dptf_power/rest_of_platform_power_mw
Date: June, 2020
KernelVersion: v5.8
Contact: linux-acpi@vger.kernel.org
Description:
(RO) Shows the rest (outside of SoC) of worst-case platform power.

What: /sys/bus/platform/devices/INT3407:00/dptf_power/prochot_confirm
Date: June, 2020
KernelVersion: v5.8
Contact: linux-acpi@vger.kernel.org
Description:
(WO) Confirm embedded controller about a prochot notification.

What: /sys/bus/platform/devices/INT3532:00/dptf_battery/max_platform_power_mw
Date: June, 2020
KernelVersion: v5.8
Contact: linux-acpi@vger.kernel.org
Description:
(RO) The maximum platform power that can be supported by the battery in milli watts.

What: /sys/bus/platform/devices/INT3532:00/dptf_battery/max_steady_state_power_mw
Date: June, 2020
KernelVersion: v5.8
Contact: linux-acpi@vger.kernel.org
Description:
(RO) The maximum sustained power for battery in milli watts.

What: /sys/bus/platform/devices/INT3532:00/dptf_battery/high_freq_impedance_mohm
Date: June, 2020
KernelVersion: v5.8
Contact: linux-acpi@vger.kernel.org
Description:
(RO) The high frequency impedance value that can be obtained from battery
fuel gauge in milli Ohms.

What: /sys/bus/platform/devices/INT3532:00/dptf_battery/no_load_voltage_mv
Date: June, 2020
KernelVersion: v5.8
Contact: linux-acpi@vger.kernel.org
Description:
(RO) The no-load voltage that can be obtained from battery fuel gauge in
milli volts.

What: /sys/bus/platform/devices/INT3532:00/dptf_battery/current_discharge_capbility_ma
Date: June, 2020
KernelVersion: v5.8
Contact: linux-acpi@vger.kernel.org
Description:
(RO) The battery discharge current capability obtained from battery fuel gauge in
milli Amps.
25 changes: 25 additions & 0 deletions arch/arm64/kernel/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/irq_work.h>
#include <linux/memblock.h>
#include <linux/of_fdt.h>
#include <linux/smp.h>
Expand Down Expand Up @@ -269,13 +270,20 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr)
int apei_claim_sea(struct pt_regs *regs)
{
int err = -ENOENT;
bool return_to_irqs_enabled;
unsigned long current_flags;

if (!IS_ENABLED(CONFIG_ACPI_APEI_GHES))
return err;

current_flags = local_daif_save_flags();

/* current_flags isn't useful here as daif doesn't tell us about pNMI */
return_to_irqs_enabled = !irqs_disabled_flags(arch_local_save_flags());

if (regs)
return_to_irqs_enabled = interrupts_enabled(regs);

/*
* SEA can interrupt SError, mask it and describe this as an NMI so
* that APEI defers the handling.
Expand All @@ -284,6 +292,23 @@ int apei_claim_sea(struct pt_regs *regs)
nmi_enter();
err = ghes_notify_sea();
nmi_exit();

/*
* APEI NMI-like notifications are deferred to irq_work. Unless
* we interrupted irqs-masked code, we can do that now.
*/
if (!err) {
if (return_to_irqs_enabled) {
local_daif_restore(DAIF_PROCCTX_NOIRQ);
__irq_enter();
irq_work_run();
__irq_exit();
} else {
pr_warn_ratelimited("APEI work queued but not completed");
err = -EINPROGRESS;
}
}

local_daif_restore(current_flags);

return err;
Expand Down
12 changes: 7 additions & 5 deletions arch/arm64/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,13 @@ static int do_sea(unsigned long addr, unsigned int esr, struct pt_regs *regs)

inf = esr_to_fault_info(esr);

/*
* Return value ignored as we rely on signal merging.
* Future patches will make this more robust.
*/
apei_claim_sea(regs);
if (user_mode(regs) && apei_claim_sea(regs) == 0) {
/*
* APEI claimed this as a firmware-first notification.
* Some processing deferred to task_work before ret_to_user().
*/
return 0;
}

if (esr & ESR_ELx_FnV)
siaddr = NULL;
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/acpi_dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ static const struct acpi_debugger_ops acpi_aml_debugger = {
.notify_command_complete = acpi_aml_notify_command_complete,
};

int __init acpi_aml_init(void)
static int __init acpi_aml_init(void)
{
int ret;

Expand All @@ -771,7 +771,7 @@ int __init acpi_aml_init(void)
return 0;
}

void __exit acpi_aml_exit(void)
static void __exit acpi_aml_exit(void)
{
if (acpi_aml_initialized) {
acpi_unregister_debugger(&acpi_aml_debugger);
Expand Down
3 changes: 2 additions & 1 deletion drivers/acpi/acpi_lpit.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,11 @@ void acpi_init_lpit(void)
struct acpi_table_lpit *lpit;

status = acpi_get_table(ACPI_SIG_LPIT, 0, (struct acpi_table_header **)&lpit);

if (ACPI_FAILURE(status))
return;

lpit_process((u64)lpit + sizeof(*lpit),
(u64)lpit + lpit->header.length);

acpi_put_table((struct acpi_table_header *)lpit);
}
7 changes: 5 additions & 2 deletions drivers/acpi/acpi_watchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void)
}

if (acpi_watchdog_uses_rtc(wdat)) {
acpi_put_table((struct acpi_table_header *)wdat);
pr_info("Skipping WDAT on this system because it uses RTC SRAM\n");
return NULL;
}
Expand Down Expand Up @@ -117,12 +118,12 @@ void __init acpi_watchdog_init(void)

/* Watchdog disabled by BIOS */
if (!(wdat->flags & ACPI_WDAT_ENABLED))
return;
goto fail_put_wdat;

/* Skip legacy PCI WDT devices */
if (wdat->pci_segment != 0xff || wdat->pci_bus != 0xff ||
wdat->pci_device != 0xff || wdat->pci_function != 0xff)
return;
goto fail_put_wdat;

INIT_LIST_HEAD(&resource_list);

Expand Down Expand Up @@ -188,4 +189,6 @@ void __init acpi_watchdog_init(void)

fail_free_resource_list:
resource_list_free(&resource_list);
fail_put_wdat:
acpi_put_table((struct acpi_table_header *)wdat);
}
1 change: 1 addition & 0 deletions drivers/acpi/acpica/acglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ ACPI_GLOBAL(struct acpi_external_file *, acpi_gbl_external_file_list);
#ifdef ACPI_DEBUGGER
ACPI_INIT_GLOBAL(u8, acpi_gbl_abort_method, FALSE);
ACPI_INIT_GLOBAL(acpi_thread_id, acpi_gbl_db_thread_id, ACPI_INVALID_THREAD_ID);
ACPI_INIT_GLOBAL(u32, acpi_gbl_next_cmd_num, 1);

ACPI_GLOBAL(u8, acpi_gbl_db_opt_no_ini_methods);
ACPI_GLOBAL(u8, acpi_gbl_db_opt_no_region_support);
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/acpica/acpredef.h
Original file line number Diff line number Diff line change
Expand Up @@ -640,10 +640,10 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
{{"_NIC", METHOD_0ARGS, /* ACPI 6.3 */
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},

{{"_NIG", METHOD_1ARGS(ACPI_TYPE_BUFFER), /* ACPI 6.3 */
{{"_NIG", METHOD_0ARGS, /* ACPI 6.3 */
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},

{{"_NIH", METHOD_0ARGS, /* ACPI 6.3 */
{{"_NIH", METHOD_1ARGS(ACPI_TYPE_BUFFER), /* ACPI 6.3 */
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},

{{"_NTT", METHOD_0ARGS,
Expand Down
1 change: 0 additions & 1 deletion drivers/acpi/acpica/dbhistry.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ static HISTORY_INFO acpi_gbl_history_buffer[HISTORY_SIZE];
static u16 acpi_gbl_lo_history = 0;
static u16 acpi_gbl_num_history = 0;
static u16 acpi_gbl_next_history_index = 0;
u32 acpi_gbl_next_cmd_num = 1;

/*******************************************************************************
*
Expand Down
22 changes: 16 additions & 6 deletions drivers/acpi/acpica/dsfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
arg->common.value.string, ACPI_TYPE_ANY,
ACPI_IMODE_LOAD_PASS1, flags,
walk_state, &node);
if (ACPI_FAILURE(status)) {
if ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE)
&& status == AE_ALREADY_EXISTS) {
status = AE_OK;
} else if (ACPI_FAILURE(status)) {
ACPI_ERROR_NAMESPACE(walk_state->scope_info,
arg->common.value.string, status);
return_ACPI_STATUS(status);
Expand Down Expand Up @@ -514,13 +517,20 @@ acpi_ds_create_field(union acpi_parse_object *op,
info.region_node = region_node;

status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}

if (info.region_node->object->region.space_id ==
ACPI_ADR_SPACE_PLATFORM_COMM
&& !(region_node->object->field.internal_pcc_buffer =
ACPI_ALLOCATE_ZEROED(info.region_node->object->region.
length))) {
return_ACPI_STATUS(AE_NO_MEMORY);
ACPI_ADR_SPACE_PLATFORM_COMM) {
region_node->object->field.internal_pcc_buffer =
ACPI_ALLOCATE_ZEROED(info.region_node->object->region.
length);
if (!region_node->object->field.internal_pcc_buffer) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
}

return_ACPI_STATUS(status);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/exfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ACPI_MODULE_NAME("exfield")
*/
#define ACPI_INVALID_PROTOCOL_ID 0x80
#define ACPI_MAX_PROTOCOL_ID 0x0F
const u8 acpi_protocol_lengths[] = {
static const u8 acpi_protocol_lengths[] = {
ACPI_INVALID_PROTOCOL_ID, /* 0 - reserved */
ACPI_INVALID_PROTOCOL_ID, /* 1 - reserved */
0x00, /* 2 - ATTRIB_QUICK */
Expand Down
6 changes: 4 additions & 2 deletions drivers/acpi/apei/bert.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ static int __init bert_init(void)
rc = bert_check_table(bert_tab);
if (rc) {
pr_err(FW_BUG "table invalid.\n");
return rc;
goto out_put_bert_tab;
}

region_len = bert_tab->region_length;
apei_resources_init(&bert_resources);
rc = apei_resources_add(&bert_resources, bert_tab->address,
region_len, true);
if (rc)
return rc;
goto out_put_bert_tab;
rc = apei_resources_request(&bert_resources, "APEI BERT");
if (rc)
goto out_fini;
Expand All @@ -142,6 +142,8 @@ static int __init bert_init(void)
apei_resources_release(&bert_resources);
out_fini:
apei_resources_fini(&bert_resources);
out_put_bert_tab:
acpi_put_table((struct acpi_table_header *)bert_tab);

return rc;
}
Expand Down
5 changes: 4 additions & 1 deletion drivers/acpi/apei/einj.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ static int __init einj_init(void)
rc = einj_check_table(einj_tab);
if (rc) {
pr_warn(FW_BUG "Invalid EINJ table.\n");
return -EINVAL;
goto err_put_table;
}

rc = -ENOMEM;
Expand Down Expand Up @@ -760,6 +760,8 @@ static int __init einj_init(void)
err_fini:
apei_resources_fini(&einj_resources);
debugfs_remove_recursive(einj_debug_dir);
err_put_table:
acpi_put_table((struct acpi_table_header *)einj_tab);

return rc;
}
Expand All @@ -780,6 +782,7 @@ static void __exit einj_exit(void)
apei_resources_release(&einj_resources);
apei_resources_fini(&einj_resources);
debugfs_remove_recursive(einj_debug_dir);
acpi_put_table((struct acpi_table_header *)einj_tab);
}

module_init(einj_init);
Expand Down
4 changes: 3 additions & 1 deletion drivers/acpi/apei/erst.c
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ static int __init erst_init(void)
rc = erst_check_table(erst_tab);
if (rc) {
pr_err(FW_BUG "ERST table is invalid.\n");
goto err;
goto err_put_erst_tab;
}

apei_resources_init(&erst_resources);
Expand Down Expand Up @@ -1196,6 +1196,8 @@ static int __init erst_init(void)
apei_resources_release(&erst_resources);
err_fini:
apei_resources_fini(&erst_resources);
err_put_erst_tab:
acpi_put_table((struct acpi_table_header *)erst_tab);
err:
erst_disable = 1;
return rc;
Expand Down
Loading

0 comments on commit 118d6e9

Please sign in to comment.