[tip: irq/drivers] irqchip/riscv-aplic: Do not mark the syscore registered flag ro_after_init

From: tip-bot2 for Vladimir Kondratiev

Date: Mon Nov 09 2026 - 04:30:35 EST


The following commit has been merged into the irq/drivers branch of tip:

Commit-ID: 401632b77cc38bb6de44a2e83ed7c777e540119c
Gitweb: https://git.kernel.org/tip/401632b77cc38bb6de44a2e83ed7c777e540119c
Author: Vladimir Kondratiev <vladimir.kondratiev@xxxxxxxxxxxx>
AuthorDate: Tue, 20 Oct 2026 18:38:48 +03:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Mon, 09 Nov 2026 10:20:17 +01:00

irqchip/riscv-aplic: Do not mark the syscore registered flag ro_after_init

aplic_syscore_registered is marked __ro_after_init, but it is written
from aplic_probe(), which can run after init. With MSI, aplic_msi_setup()
returns -EPROBE_DEFER while the MSI parent (IMSIC) is not ready, so the
later successful probe writes the flag after it has been made read-only.
That write faults.

Drop the __ro_after_init annotation so the flag stays writable.

Fixes: b330fbfd34d7 ("irqchip/riscv-aplic: Register syscore operations only once")
Signed-off-by: Vladimir Kondratiev <vladimir.kondratiev@xxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Link: https://patch.msgid.link/20261020-aplic-async-probe-v5-1-c4861c2aafca@xxxxxxxxxxxx
---
drivers/irqchip/irq-riscv-aplic-main.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-riscv-aplic-main.c b/drivers/irqchip/irq-riscv-aplic-main.c
index 1676d64..a2c4d14 100644
--- a/drivers/irqchip/irq-riscv-aplic-main.c
+++ b/drivers/irqchip/irq-riscv-aplic-main.c
@@ -116,7 +116,11 @@ static struct syscore aplic_syscore = {
.ops = &aplic_syscore_ops,
};

-static bool aplic_syscore_registered __ro_after_init;
+/*
+ * Not __ro_after_init: probe can be deferred (e.g. MSI mode waiting for the
+ * IMSIC) and complete after the init memory is made read-only.
+ */
+static bool aplic_syscore_registered;

static void aplic_syscore_init(void)
{