Skip to content

Commit 5dc581a

Browse files
committed
irqchip/apple-aic, PCI: apple: Let PCIe MSIs wake the system from s2idle
enable_irq_wake() fails for every PCIe device interrupt on Apple silicon: AIC has neither an irq_set_wake callback nor IRQCHIP_SKIP_SET_WAKE, and the pcie-apple MSI chips do not forward the request to it. Wakeup interrupts are therefore disabled with all the others in suspend-to-idle, and only the SMC (lid, power button), whose mailbox interrupt is IRQF_NO_SUSPEND, can wake the machine. A keyboard on a Thunderbolt dock, whose xHCI and root port PME interrupts are MSIs, cannot. AIC needs no programming to wake a CPU from s2idle: any interrupt left unmasked does. Mark both AIC chips IRQCHIP_SKIP_SET_WAKE, and forward irq_set_wake from the pcie-apple MSI bottom chip and the per-device PCI/MSI chips to the parent. Which devices may wake is still governed by their power/wakeup setting. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: RJ Skerry-Ryan <[email protected]>
1 parent 37e9742 commit 5dc581a

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

‎drivers/irqchip/irq-apple-aic.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ static struct irq_chip aic_chip = {
478478
.irq_eoi = aic_irq_eoi,
479479
.irq_set_affinity = aic_irq_set_affinity,
480480
.irq_set_type = aic_irq_set_type,
481+
.flags = IRQCHIP_SKIP_SET_WAKE,
481482
};
482483

483484
static struct irq_chip aic2_chip = {
@@ -486,6 +487,7 @@ static struct irq_chip aic2_chip = {
486487
.irq_unmask = aic_irq_unmask,
487488
.irq_eoi = aic_irq_eoi,
488489
.irq_set_type = aic_irq_set_type,
490+
.flags = IRQCHIP_SKIP_SET_WAKE,
489491
};
490492

491493
/*

‎drivers/pci/controller/pcie-apple.c‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ static struct irq_chip apple_msi_bottom_chip = {
431431
.irq_eoi = irq_chip_eoi_parent,
432432
.irq_set_affinity = irq_chip_set_affinity_parent,
433433
.irq_set_type = irq_chip_set_type_parent,
434+
.irq_set_wake = irq_chip_set_wake_parent,
434435
.irq_compose_msi_msg = apple_msi_compose_msg,
435436
};
436437

@@ -1641,6 +1642,23 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
16411642
return ret;
16421643
}
16431644

1645+
/*
1646+
* The per-device PCI/MSI chips come from the generic template, which has no
1647+
* irq_set_wake. Forward it to the parent so a wakeup-enabled device (or a
1648+
* root port's PME interrupt) stays armed through suspend-to-idle.
1649+
*/
1650+
static bool apple_msi_init_dev_msi_info(struct device *dev,
1651+
struct irq_domain *domain,
1652+
struct irq_domain *real_parent,
1653+
struct msi_domain_info *info)
1654+
{
1655+
if (!msi_lib_init_dev_msi_info(dev, domain, real_parent, info))
1656+
return false;
1657+
if (!info->chip->irq_set_wake)
1658+
info->chip->irq_set_wake = irq_chip_set_wake_parent;
1659+
return true;
1660+
}
1661+
16441662
static const struct msi_parent_ops apple_msi_parent_ops = {
16451663
.supported_flags = (MSI_GENERIC_FLAGS_MASK |
16461664
MSI_FLAG_PCI_MSIX |
@@ -1650,7 +1668,7 @@ static const struct msi_parent_ops apple_msi_parent_ops = {
16501668
MSI_FLAG_PCI_MSI_MASK_PARENT),
16511669
.chip_flags = MSI_CHIP_FLAG_SET_EOI,
16521670
.bus_select_token = DOMAIN_BUS_PCI_MSI,
1653-
.init_dev_msi_info = msi_lib_init_dev_msi_info,
1671+
.init_dev_msi_info = apple_msi_init_dev_msi_info,
16541672
};
16551673

16561674
static int apple_msi_init(struct apple_pcie *pcie)

0 commit comments

Comments
 (0)