Skip to content

Commit 118d6e9

Browse files
committed
Merge tag 'acpi-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/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 ...
2 parents 355ba37 + 48ccded commit 118d6e9

37 files changed

+438
-98
lines changed

Documentation/ABI/testing/sysfs-platform-dptf

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,68 @@ KernelVersion: v4.10
2727
2828
Description:
2929
(RO) Display the platform power source
30-
0x00 = DC
31-
0x01 = AC
32-
0x02 = USB
33-
0x03 = Wireless Charger
30+
bits[3:0] Current power source
31+
0x00 = DC
32+
0x01 = AC
33+
0x02 = USB
34+
0x03 = Wireless Charger
35+
bits[7:4] Power source sequence number
3436

3537
What: /sys/bus/platform/devices/INT3407:00/dptf_power/battery_steady_power
3638
Date: Jul, 2016
3739
KernelVersion: v4.10
3840
3941
Description:
4042
(RO) The maximum sustained power for battery in milliwatts.
43+
44+
What: /sys/bus/platform/devices/INT3407:00/dptf_power/rest_of_platform_power_mw
45+
Date: June, 2020
46+
KernelVersion: v5.8
47+
48+
Description:
49+
(RO) Shows the rest (outside of SoC) of worst-case platform power.
50+
51+
What: /sys/bus/platform/devices/INT3407:00/dptf_power/prochot_confirm
52+
Date: June, 2020
53+
KernelVersion: v5.8
54+
55+
Description:
56+
(WO) Confirm embedded controller about a prochot notification.
57+
58+
What: /sys/bus/platform/devices/INT3532:00/dptf_battery/max_platform_power_mw
59+
Date: June, 2020
60+
KernelVersion: v5.8
61+
62+
Description:
63+
(RO) The maximum platform power that can be supported by the battery in milli watts.
64+
65+
What: /sys/bus/platform/devices/INT3532:00/dptf_battery/max_steady_state_power_mw
66+
Date: June, 2020
67+
KernelVersion: v5.8
68+
69+
Description:
70+
(RO) The maximum sustained power for battery in milli watts.
71+
72+
What: /sys/bus/platform/devices/INT3532:00/dptf_battery/high_freq_impedance_mohm
73+
Date: June, 2020
74+
KernelVersion: v5.8
75+
76+
Description:
77+
(RO) The high frequency impedance value that can be obtained from battery
78+
fuel gauge in milli Ohms.
79+
80+
What: /sys/bus/platform/devices/INT3532:00/dptf_battery/no_load_voltage_mv
81+
Date: June, 2020
82+
KernelVersion: v5.8
83+
84+
Description:
85+
(RO) The no-load voltage that can be obtained from battery fuel gauge in
86+
milli volts.
87+
88+
What: /sys/bus/platform/devices/INT3532:00/dptf_battery/current_discharge_capbility_ma
89+
Date: June, 2020
90+
KernelVersion: v5.8
91+
92+
Description:
93+
(RO) The battery discharge current capability obtained from battery fuel gauge in
94+
milli Amps.

arch/arm64/kernel/acpi.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/init.h>
2020
#include <linux/irq.h>
2121
#include <linux/irqdomain.h>
22+
#include <linux/irq_work.h>
2223
#include <linux/memblock.h>
2324
#include <linux/of_fdt.h>
2425
#include <linux/smp.h>
@@ -269,13 +270,20 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr)
269270
int apei_claim_sea(struct pt_regs *regs)
270271
{
271272
int err = -ENOENT;
273+
bool return_to_irqs_enabled;
272274
unsigned long current_flags;
273275

274276
if (!IS_ENABLED(CONFIG_ACPI_APEI_GHES))
275277
return err;
276278

277279
current_flags = local_daif_save_flags();
278280

281+
/* current_flags isn't useful here as daif doesn't tell us about pNMI */
282+
return_to_irqs_enabled = !irqs_disabled_flags(arch_local_save_flags());
283+
284+
if (regs)
285+
return_to_irqs_enabled = interrupts_enabled(regs);
286+
279287
/*
280288
* SEA can interrupt SError, mask it and describe this as an NMI so
281289
* that APEI defers the handling.
@@ -284,6 +292,23 @@ int apei_claim_sea(struct pt_regs *regs)
284292
nmi_enter();
285293
err = ghes_notify_sea();
286294
nmi_exit();
295+
296+
/*
297+
* APEI NMI-like notifications are deferred to irq_work. Unless
298+
* we interrupted irqs-masked code, we can do that now.
299+
*/
300+
if (!err) {
301+
if (return_to_irqs_enabled) {
302+
local_daif_restore(DAIF_PROCCTX_NOIRQ);
303+
__irq_enter();
304+
irq_work_run();
305+
__irq_exit();
306+
} else {
307+
pr_warn_ratelimited("APEI work queued but not completed");
308+
err = -EINPROGRESS;
309+
}
310+
}
311+
287312
local_daif_restore(current_flags);
288313

289314
return err;

arch/arm64/mm/fault.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -635,11 +635,13 @@ static int do_sea(unsigned long addr, unsigned int esr, struct pt_regs *regs)
635635

636636
inf = esr_to_fault_info(esr);
637637

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

644646
if (esr & ESR_ELx_FnV)
645647
siaddr = NULL;

drivers/acpi/acpi_dbg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ static const struct acpi_debugger_ops acpi_aml_debugger = {
745745
.notify_command_complete = acpi_aml_notify_command_complete,
746746
};
747747

748-
int __init acpi_aml_init(void)
748+
static int __init acpi_aml_init(void)
749749
{
750750
int ret;
751751

@@ -771,7 +771,7 @@ int __init acpi_aml_init(void)
771771
return 0;
772772
}
773773

774-
void __exit acpi_aml_exit(void)
774+
static void __exit acpi_aml_exit(void)
775775
{
776776
if (acpi_aml_initialized) {
777777
acpi_unregister_debugger(&acpi_aml_debugger);

drivers/acpi/acpi_lpit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,11 @@ void acpi_init_lpit(void)
151151
struct acpi_table_lpit *lpit;
152152

153153
status = acpi_get_table(ACPI_SIG_LPIT, 0, (struct acpi_table_header **)&lpit);
154-
155154
if (ACPI_FAILURE(status))
156155
return;
157156

158157
lpit_process((u64)lpit + sizeof(*lpit),
159158
(u64)lpit + lpit->header.length);
159+
160+
acpi_put_table((struct acpi_table_header *)lpit);
160161
}

drivers/acpi/acpi_watchdog.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void)
7373
}
7474

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

118119
/* Watchdog disabled by BIOS */
119120
if (!(wdat->flags & ACPI_WDAT_ENABLED))
120-
return;
121+
goto fail_put_wdat;
121122

122123
/* Skip legacy PCI WDT devices */
123124
if (wdat->pci_segment != 0xff || wdat->pci_bus != 0xff ||
124125
wdat->pci_device != 0xff || wdat->pci_function != 0xff)
125-
return;
126+
goto fail_put_wdat;
126127

127128
INIT_LIST_HEAD(&resource_list);
128129

@@ -188,4 +189,6 @@ void __init acpi_watchdog_init(void)
188189

189190
fail_free_resource_list:
190191
resource_list_free(&resource_list);
192+
fail_put_wdat:
193+
acpi_put_table((struct acpi_table_header *)wdat);
191194
}

drivers/acpi/acpica/acglobal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ ACPI_GLOBAL(struct acpi_external_file *, acpi_gbl_external_file_list);
290290
#ifdef ACPI_DEBUGGER
291291
ACPI_INIT_GLOBAL(u8, acpi_gbl_abort_method, FALSE);
292292
ACPI_INIT_GLOBAL(acpi_thread_id, acpi_gbl_db_thread_id, ACPI_INVALID_THREAD_ID);
293+
ACPI_INIT_GLOBAL(u32, acpi_gbl_next_cmd_num, 1);
293294

294295
ACPI_GLOBAL(u8, acpi_gbl_db_opt_no_ini_methods);
295296
ACPI_GLOBAL(u8, acpi_gbl_db_opt_no_region_support);

drivers/acpi/acpica/acpredef.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,10 +640,10 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
640640
{{"_NIC", METHOD_0ARGS, /* ACPI 6.3 */
641641
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
642642

643-
{{"_NIG", METHOD_1ARGS(ACPI_TYPE_BUFFER), /* ACPI 6.3 */
643+
{{"_NIG", METHOD_0ARGS, /* ACPI 6.3 */
644644
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
645645

646-
{{"_NIH", METHOD_0ARGS, /* ACPI 6.3 */
646+
{{"_NIH", METHOD_1ARGS(ACPI_TYPE_BUFFER), /* ACPI 6.3 */
647647
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
648648

649649
{{"_NTT", METHOD_0ARGS,

drivers/acpi/acpica/dbhistry.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ static HISTORY_INFO acpi_gbl_history_buffer[HISTORY_SIZE];
2727
static u16 acpi_gbl_lo_history = 0;
2828
static u16 acpi_gbl_num_history = 0;
2929
static u16 acpi_gbl_next_history_index = 0;
30-
u32 acpi_gbl_next_cmd_num = 1;
3130

3231
/*******************************************************************************
3332
*

drivers/acpi/acpica/dsfield.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
177177
arg->common.value.string, ACPI_TYPE_ANY,
178178
ACPI_IMODE_LOAD_PASS1, flags,
179179
walk_state, &node);
180-
if (ACPI_FAILURE(status)) {
180+
if ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE)
181+
&& status == AE_ALREADY_EXISTS) {
182+
status = AE_OK;
183+
} else if (ACPI_FAILURE(status)) {
181184
ACPI_ERROR_NAMESPACE(walk_state->scope_info,
182185
arg->common.value.string, status);
183186
return_ACPI_STATUS(status);
@@ -514,13 +517,20 @@ acpi_ds_create_field(union acpi_parse_object *op,
514517
info.region_node = region_node;
515518

516519
status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
520+
if (ACPI_FAILURE(status)) {
521+
return_ACPI_STATUS(status);
522+
}
523+
517524
if (info.region_node->object->region.space_id ==
518-
ACPI_ADR_SPACE_PLATFORM_COMM
519-
&& !(region_node->object->field.internal_pcc_buffer =
520-
ACPI_ALLOCATE_ZEROED(info.region_node->object->region.
521-
length))) {
522-
return_ACPI_STATUS(AE_NO_MEMORY);
525+
ACPI_ADR_SPACE_PLATFORM_COMM) {
526+
region_node->object->field.internal_pcc_buffer =
527+
ACPI_ALLOCATE_ZEROED(info.region_node->object->region.
528+
length);
529+
if (!region_node->object->field.internal_pcc_buffer) {
530+
return_ACPI_STATUS(AE_NO_MEMORY);
531+
}
523532
}
533+
524534
return_ACPI_STATUS(status);
525535
}
526536

0 commit comments

Comments
 (0)