Skip to content

Commit 056a815

Browse files
committed
Merge branches 'acpi-apei', 'acpi-wakeup', 'acpi-reboot' and 'acpi-thermal'
Merge additional APEI changes, ACPI updates related to device wakeup and system restart and ACPI thermal driver cleanups for 6.1-rc1: - Fix a memory leak in APEI by avoiding to add do not add task_work to kernel threads running when an asynchronous error is detected (Shuai Xue). - Add ACPI support for handling system wakeups via GPIO wake capable IRQs in addition to GPEs (Raul E Rangel). - Make the system reboot code put ACPI-enabled systems into the S5 (system off) state which is necessary for some platforms to work as expected (Kai-Heng Feng). - Make the white space usage in the ACPI thermal driver more consistent and drop redundant code from it (Rafael Wysocki). * acpi-apei: ACPI: APEI: do not add task_work to kernel thread to avoid memory leak * acpi-wakeup: ACPI: PM: Take wake IRQ into consideration when entering suspend-to-idle i2c: acpi: Use ACPI wake capability bit to set wake_irq ACPI: resources: Add wake_capable parameter to acpi_dev_irq_flags gpiolib: acpi: Add wake_capable variants of acpi_dev_gpio_irq_get * acpi-reboot: PM: ACPI: reboot: Reinstate S5 for reboot kernel/reboot: Add SYS_OFF_MODE_RESTART_PREPARE mode * acpi-thermal: ACPI: thermal: Drop some redundant code ACPI: thermal: Drop redundant parens from expressions ACPI: thermal: Use white space more consistently
5 parents 800b8ee + 415fed6 + a6c05e1 + 38f34db + 36f5540 commit 056a815

File tree

16 files changed

+242
-143
lines changed

16 files changed

+242
-143
lines changed

drivers/acpi/apei/ghes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ static void ghes_proc_in_irq(struct irq_work *irq_work)
985985
ghes_estatus_cache_add(generic, estatus);
986986
}
987987

988-
if (task_work_pending && current->mm != &init_mm) {
988+
if (task_work_pending && current->mm) {
989989
estatus_node->task_work.func = ghes_kick_task_work;
990990
estatus_node->task_work_cpu = smp_processor_id();
991991
ret = task_work_add(current, &estatus_node->task_work,

drivers/acpi/device_pm.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,22 @@ static int acpi_dev_pm_get_state(struct device *dev, struct acpi_device *adev,
687687
d_min = ret;
688688
wakeup = device_may_wakeup(dev) && adev->wakeup.flags.valid
689689
&& adev->wakeup.sleep_state >= target_state;
690+
} else if (device_may_wakeup(dev) && dev->power.wakeirq) {
691+
/*
692+
* The ACPI subsystem doesn't manage the wake bit for IRQs
693+
* defined with ExclusiveAndWake and SharedAndWake. Instead we
694+
* expect them to be managed via the PM subsystem. Drivers
695+
* should call dev_pm_set_wake_irq to register an IRQ as a wake
696+
* source.
697+
*
698+
* If a device has a wake IRQ attached we need to check the
699+
* _S0W method to get the correct wake D-state. Otherwise we
700+
* end up putting the device into D3Cold which will more than
701+
* likely disable wake functionality.
702+
*/
703+
wakeup = true;
690704
} else {
705+
/* ACPI GPE is specified in _PRW. */
691706
wakeup = adev->wakeup.flags.valid;
692707
}
693708

drivers/acpi/irq.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ struct acpi_irq_parse_one_ctx {
147147
* @polarity: polarity attributes of hwirq
148148
* @polarity: polarity attributes of hwirq
149149
* @shareable: shareable attributes of hwirq
150+
* @wake_capable: wake capable attribute of hwirq
150151
* @ctx: acpi_irq_parse_one_ctx updated by this function
151152
*
152153
* Description:
@@ -156,12 +157,13 @@ struct acpi_irq_parse_one_ctx {
156157
static inline void acpi_irq_parse_one_match(struct fwnode_handle *fwnode,
157158
u32 hwirq, u8 triggering,
158159
u8 polarity, u8 shareable,
160+
u8 wake_capable,
159161
struct acpi_irq_parse_one_ctx *ctx)
160162
{
161163
if (!fwnode)
162164
return;
163165
ctx->rc = 0;
164-
*ctx->res_flags = acpi_dev_irq_flags(triggering, polarity, shareable);
166+
*ctx->res_flags = acpi_dev_irq_flags(triggering, polarity, shareable, wake_capable);
165167
ctx->fwspec->fwnode = fwnode;
166168
ctx->fwspec->param[0] = hwirq;
167169
ctx->fwspec->param[1] = acpi_dev_get_irq_type(triggering, polarity);
@@ -204,7 +206,7 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
204206
fwnode = acpi_get_gsi_domain_id(irq->interrupts[ctx->index]);
205207
acpi_irq_parse_one_match(fwnode, irq->interrupts[ctx->index],
206208
irq->triggering, irq->polarity,
207-
irq->shareable, ctx);
209+
irq->shareable, irq->wake_capable, ctx);
208210
return AE_CTRL_TERMINATE;
209211
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
210212
eirq = &ares->data.extended_irq;
@@ -218,7 +220,7 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
218220
eirq->interrupts[ctx->index]);
219221
acpi_irq_parse_one_match(fwnode, eirq->interrupts[ctx->index],
220222
eirq->triggering, eirq->polarity,
221-
eirq->shareable, ctx);
223+
eirq->shareable, eirq->wake_capable, ctx);
222224
return AE_CTRL_TERMINATE;
223225
}
224226

drivers/acpi/resource.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,9 @@ EXPORT_SYMBOL_GPL(acpi_dev_resource_ext_address_space);
336336
* @triggering: Triggering type as provided by ACPI.
337337
* @polarity: Interrupt polarity as provided by ACPI.
338338
* @shareable: Whether or not the interrupt is shareable.
339+
* @wake_capable: Wake capability as provided by ACPI.
339340
*/
340-
unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable)
341+
unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable, u8 wake_capable)
341342
{
342343
unsigned long flags;
343344

@@ -351,6 +352,9 @@ unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable)
351352
if (shareable == ACPI_SHARED)
352353
flags |= IORESOURCE_IRQ_SHAREABLE;
353354

355+
if (wake_capable == ACPI_WAKE_CAPABLE)
356+
flags |= IORESOURCE_IRQ_WAKECAPABLE;
357+
354358
return flags | IORESOURCE_IRQ;
355359
}
356360
EXPORT_SYMBOL_GPL(acpi_dev_irq_flags);
@@ -468,7 +472,7 @@ static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
468472

469473
static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
470474
u8 triggering, u8 polarity, u8 shareable,
471-
bool check_override)
475+
u8 wake_capable, bool check_override)
472476
{
473477
int irq, p, t;
474478

@@ -501,7 +505,7 @@ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
501505
}
502506
}
503507

504-
res->flags = acpi_dev_irq_flags(triggering, polarity, shareable);
508+
res->flags = acpi_dev_irq_flags(triggering, polarity, shareable, wake_capable);
505509
irq = acpi_register_gsi(NULL, gsi, triggering, polarity);
506510
if (irq >= 0) {
507511
res->start = irq;
@@ -549,7 +553,8 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
549553
}
550554
acpi_dev_get_irqresource(res, irq->interrupts[index],
551555
irq->triggering, irq->polarity,
552-
irq->shareable, true);
556+
irq->shareable, irq->wake_capable,
557+
true);
553558
break;
554559
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
555560
ext_irq = &ares->data.extended_irq;
@@ -560,7 +565,8 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
560565
if (is_gsi(ext_irq))
561566
acpi_dev_get_irqresource(res, ext_irq->interrupts[index],
562567
ext_irq->triggering, ext_irq->polarity,
563-
ext_irq->shareable, false);
568+
ext_irq->shareable, ext_irq->wake_capable,
569+
false);
564570
else
565571
irqresource_disabled(res, 0);
566572
break;

drivers/acpi/sleep.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,14 @@ int __init acpi_sleep_init(void)
10881088
register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
10891089
SYS_OFF_PRIO_FIRMWARE,
10901090
acpi_power_off, NULL);
1091+
1092+
/*
1093+
* Windows uses S5 for reboot, so some BIOSes depend on it to
1094+
* perform proper reboot.
1095+
*/
1096+
register_sys_off_handler(SYS_OFF_MODE_RESTART_PREPARE,
1097+
SYS_OFF_PRIO_FIRMWARE,
1098+
acpi_power_off_prepare, NULL);
10911099
} else {
10921100
acpi_no_s5 = true;
10931101
}

0 commit comments

Comments
 (0)