* [PATCH] irqchip/riscv-aplic: adapt to syscore API passing context data
@ 2025-12-24 11:11 Sanjay Chitroda
2026-01-02 9:37 ` Keke Ming
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Sanjay Chitroda @ 2025-12-24 11:11 UTC (permalink / raw)
To: Anup Patel, Thomas Gleixner, Paul Walmsley, Palmer Dabbelt,
Albert Ou
Cc: Alexandre Ghiti, linux-riscv, linux-kernel, sanjayembeddedse,
virendrasinhchauhan1206
From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
linux-next commit a97fbc3ee3e2 ("syscore: Pass context data to callbacks")
changed the syscore API to register per-instance context alongside the
syscore operations and to pass that context into callbacks. As a result,
drivers must no longer rely on global state or implicit data access in
their syscore suspend/resume handlers.
The RISC-V APLIC driver started preserving state across suspend/resume,
but its syscore usage still assumed the old API. Building against
linux-next after a97fbc3ee3e2 fails because the callbacks don’t receive
the necessary driver context.
Update irq-riscv-aplic to the new syscore API:
* register syscore with driver-private context,
* pass the context to save/restore helpers,
* stop using implicit globals in syscore paths.
This fixes the compilation error and restores correct APLIC state
handling across suspend/resume with the new syscore interface.
Fixes: a97fbc3ee3e2 ("syscore: Pass context data to callbacks")
Fixes: 1c546bb433618843 ("irqchip/riscv-aplic: Preserve APLIC states across suspend/resume")
Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
drivers/irqchip/irq-riscv-aplic-main.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/irqchip/irq-riscv-aplic-main.c b/drivers/irqchip/irq-riscv-aplic-main.c
index b760942e57f9..1283d6e69f5b 100644
--- a/drivers/irqchip/irq-riscv-aplic-main.c
+++ b/drivers/irqchip/irq-riscv-aplic-main.c
@@ -89,7 +89,7 @@ static void aplic_save_states(struct aplic_priv *priv)
}
}
-static int aplic_syscore_suspend(void)
+static int aplic_syscore_suspend(void *data)
{
struct aplic_priv *priv;
@@ -99,7 +99,7 @@ static int aplic_syscore_suspend(void)
return 0;
}
-static void aplic_syscore_resume(void)
+static void aplic_syscore_resume(void *data)
{
struct aplic_priv *priv;
@@ -107,11 +107,15 @@ static void aplic_syscore_resume(void)
aplic_restore_states(priv);
}
-static struct syscore_ops aplic_syscore_ops = {
+static const struct syscore_ops aplic_syscore_ops = {
.suspend = aplic_syscore_suspend,
.resume = aplic_syscore_resume,
};
+static struct syscore aplic_syscore = {
+ .ops = &aplic_syscore_ops,
+};
+
static int aplic_pm_notifier(struct notifier_block *nb, unsigned long action, void *data)
{
struct aplic_priv *priv = container_of(nb, struct aplic_priv, genpd_nb);
@@ -372,7 +376,7 @@ static int aplic_probe(struct platform_device *pdev)
dev_err_probe(dev, rc, "failed to setup APLIC in %s mode\n",
msi_mode ? "MSI" : "direct");
else
- register_syscore_ops(&aplic_syscore_ops);
+ register_syscore(&aplic_syscore);
#ifdef CONFIG_ACPI
if (!acpi_disabled)
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] irqchip/riscv-aplic: adapt to syscore API passing context data
2025-12-24 11:11 [PATCH] irqchip/riscv-aplic: adapt to syscore API passing context data Sanjay Chitroda
@ 2026-01-02 9:37 ` Keke Ming
2026-01-03 15:51 ` Anup Patel
2026-01-09 11:51 ` Thomas Gleixner
2 siblings, 0 replies; 5+ messages in thread
From: Keke Ming @ 2026-01-02 9:37 UTC (permalink / raw)
To: sanjayembeddedse
Cc: alex, anup, aou, linux-kernel, linux-riscv, palmer, pjw, tglx,
virendrasinhchauhan1206, Keke Ming
On Wed, Dec 24, 2025 at 16:41:46 +0530, Sanjay Chitroda wrote:
> The RISC-V APLIC driver started preserving state across suspend/resume,
> but its syscore usage still assumed the old API. Building against
> linux-next after a97fbc3ee3e2 fails because the callbacks don’t receive
> the necessary driver context.
Tested this on riscv64 (cross-compiled on x86_64) using linux-next
(next-20251219). Without this patch, the build fails with:
drivers/irqchip/irq-riscv-aplic-main.c:111:20: error: initialization of
‘int (*)(void *)’ from incompatible pointer type ‘int (*)(void)’
This patch correctly fixes the compilation error by updating the APLIC
driver to the new syscore API.
Tested-by: Keke Ming <ming.jvle@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] irqchip/riscv-aplic: adapt to syscore API passing context data
2025-12-24 11:11 [PATCH] irqchip/riscv-aplic: adapt to syscore API passing context data Sanjay Chitroda
2026-01-02 9:37 ` Keke Ming
@ 2026-01-03 15:51 ` Anup Patel
2026-01-09 11:51 ` Thomas Gleixner
2 siblings, 0 replies; 5+ messages in thread
From: Anup Patel @ 2026-01-03 15:51 UTC (permalink / raw)
To: Sanjay Chitroda
Cc: Anup Patel, Thomas Gleixner, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Alexandre Ghiti, linux-riscv, linux-kernel,
virendrasinhchauhan1206
On Wed, Dec 24, 2025 at 4:42 PM Sanjay Chitroda
<sanjayembeddedse@gmail.com> wrote:
>
> From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
>
> linux-next commit a97fbc3ee3e2 ("syscore: Pass context data to callbacks")
> changed the syscore API to register per-instance context alongside the
> syscore operations and to pass that context into callbacks. As a result,
> drivers must no longer rely on global state or implicit data access in
> their syscore suspend/resume handlers.
>
> The RISC-V APLIC driver started preserving state across suspend/resume,
> but its syscore usage still assumed the old API. Building against
> linux-next after a97fbc3ee3e2 fails because the callbacks don’t receive
> the necessary driver context.
>
> Update irq-riscv-aplic to the new syscore API:
> * register syscore with driver-private context,
> * pass the context to save/restore helpers,
> * stop using implicit globals in syscore paths.
>
> This fixes the compilation error and restores correct APLIC state
> handling across suspend/resume with the new syscore interface.
>
> Fixes: a97fbc3ee3e2 ("syscore: Pass context data to callbacks")
> Fixes: 1c546bb433618843 ("irqchip/riscv-aplic: Preserve APLIC states across suspend/resume")
> Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> ---
> drivers/irqchip/irq-riscv-aplic-main.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/irqchip/irq-riscv-aplic-main.c b/drivers/irqchip/irq-riscv-aplic-main.c
> index b760942e57f9..1283d6e69f5b 100644
> --- a/drivers/irqchip/irq-riscv-aplic-main.c
> +++ b/drivers/irqchip/irq-riscv-aplic-main.c
> @@ -89,7 +89,7 @@ static void aplic_save_states(struct aplic_priv *priv)
> }
> }
>
> -static int aplic_syscore_suspend(void)
> +static int aplic_syscore_suspend(void *data)
> {
> struct aplic_priv *priv;
>
> @@ -99,7 +99,7 @@ static int aplic_syscore_suspend(void)
> return 0;
> }
>
> -static void aplic_syscore_resume(void)
> +static void aplic_syscore_resume(void *data)
> {
> struct aplic_priv *priv;
>
> @@ -107,11 +107,15 @@ static void aplic_syscore_resume(void)
> aplic_restore_states(priv);
> }
>
> -static struct syscore_ops aplic_syscore_ops = {
> +static const struct syscore_ops aplic_syscore_ops = {
> .suspend = aplic_syscore_suspend,
> .resume = aplic_syscore_resume,
> };
>
> +static struct syscore aplic_syscore = {
> + .ops = &aplic_syscore_ops,
> +};
> +
> static int aplic_pm_notifier(struct notifier_block *nb, unsigned long action, void *data)
> {
> struct aplic_priv *priv = container_of(nb, struct aplic_priv, genpd_nb);
> @@ -372,7 +376,7 @@ static int aplic_probe(struct platform_device *pdev)
> dev_err_probe(dev, rc, "failed to setup APLIC in %s mode\n",
> msi_mode ? "MSI" : "direct");
> else
> - register_syscore_ops(&aplic_syscore_ops);
> + register_syscore(&aplic_syscore);
>
> #ifdef CONFIG_ACPI
> if (!acpi_disabled)
> --
> 2.34.1
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
LGTM.
Reviewed-by: Anup Patel <anup@brainfault.org>
Regards,
Anup
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] irqchip/riscv-aplic: adapt to syscore API passing context data
2025-12-24 11:11 [PATCH] irqchip/riscv-aplic: adapt to syscore API passing context data Sanjay Chitroda
2026-01-02 9:37 ` Keke Ming
2026-01-03 15:51 ` Anup Patel
@ 2026-01-09 11:51 ` Thomas Gleixner
2026-01-13 14:51 ` Sanjay Embedded_SE
2 siblings, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2026-01-09 11:51 UTC (permalink / raw)
To: Sanjay Chitroda, Anup Patel, Paul Walmsley, Palmer Dabbelt,
Albert Ou
Cc: Alexandre Ghiti, linux-riscv, linux-kernel, sanjayembeddedse,
virendrasinhchauhan1206
On Wed, Dec 24 2025 at 16:41, Sanjay Chitroda wrote:
>
> Fixes: a97fbc3ee3e2 ("syscore: Pass context data to callbacks")
> Fixes: 1c546bb433618843 ("irqchip/riscv-aplic: Preserve APLIC states across suspend/resume")
This commit does not exist and the patch does not apply as this got fixed
already with an update folded in on Dec. 16th:
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=irq/drivers&id=95a8ddde36601d0a645475fb080ed118db59c8c3
I have no idea which tree you are working against.
Thanks,
tglx
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] irqchip/riscv-aplic: adapt to syscore API passing context data
2026-01-09 11:51 ` Thomas Gleixner
@ 2026-01-13 14:51 ` Sanjay Embedded_SE
0 siblings, 0 replies; 5+ messages in thread
From: Sanjay Embedded_SE @ 2026-01-13 14:51 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Anup Patel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, linux-riscv, linux-kernel,
virendrasinhchauhan1206
>> Tested this on riscv64 (cross-compiled on x86_64) using linux-next
>> (next-20251219). Without this patch, the build fails with:
>>
>> drivers/irqchip/irq-riscv-aplic-main.c:111:20: error: initialization of
>> ‘int (*)(void *)’ from incompatible pointer type ‘int (*)(void)’
>>
>> This patch correctly fixes the compilation error by updating the APLIC
>> driver to the new syscore API.
>>
>> Tested-by: Keke Ming <ming.jvle@gmail.com>
> This commit does not exist and the patch does not apply as this got fixed
> already with an update folded in on Dec. 16th:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=irq/drivers&id=95a8ddde36601d0a645475fb080ed118db59c8c3
>
> I have no idea which tree you are working against.
>
> Thanks,
>
> tglx
Thank you for providing details on already merge changes.
Issue was reproducible on the linux-next branch and the same was
confirmed and validated by Keke Ming also.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-13 14:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-24 11:11 [PATCH] irqchip/riscv-aplic: adapt to syscore API passing context data Sanjay Chitroda
2026-01-02 9:37 ` Keke Ming
2026-01-03 15:51 ` Anup Patel
2026-01-09 11:51 ` Thomas Gleixner
2026-01-13 14:51 ` Sanjay Embedded_SE
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox