Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

irqchip/riscv-aplic: Restrict genpd notifier to device tree only

On ACPI systems, the aplic's pm_domain is set to acpi_general_pm_domain,
which provides its own power management callbacks (e.g., runtime_suspend
via acpi_subsys_runtime_suspend).

aplic_pm_add() unconditionally calls dev_pm_genpd_add_notifier() when
dev->pm_domain is non‑NULL, leading to a comparison between runtime_suspend
and genpd_runtime_suspend. This results in the following errors when ACPI
is enabled:

riscv-aplic RSCV0002:00: failed to create APLIC context
riscv-aplic RSCV0002:00: error -ENODEV: failed to setup APLIC in MSI mode

Fix this by checking for dev->of_node before adding or removing the genpd
notifier, ensuring it is only used for device tree based systems.

Fixes: 95a8ddde3660 ("irqchip/riscv-aplic: Preserve APLIC states across suspend/resume")
Signed-off-by: Jessica Liu <liu.xuemei1@zte.com.cn>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260331093029749vRpdH-0qoEqjS0Wnn9M4x@zte.com.cn

authored by

Jessica Liu and committed by
Thomas Gleixner
af416cd9 7aaa8047

+2 -2
+2 -2
drivers/irqchip/irq-riscv-aplic-main.c
··· 150 150 struct device *dev = priv->dev; 151 151 152 152 list_del(&priv->head); 153 - if (dev->pm_domain) 153 + if (dev->pm_domain && dev->of_node) 154 154 dev_pm_genpd_remove_notifier(dev); 155 155 } 156 156 ··· 165 165 166 166 priv->saved_hw_regs.srcs = srcs; 167 167 list_add(&priv->head, &aplics); 168 - if (dev->pm_domain) { 168 + if (dev->pm_domain && dev->of_node) { 169 169 priv->genpd_nb.notifier_call = aplic_pm_notifier; 170 170 ret = dev_pm_genpd_add_notifier(dev, &priv->genpd_nb); 171 171 if (ret)