All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] riscv: Fix IPI not initialized in riscv_cpu_setup()
@ 2026-09-04  6:07 Nikita Shubin
  2026-09-04  6:20 ` Michal Simek
  0 siblings, 1 reply; 6+ messages in thread
From: Nikita Shubin @ 2026-09-04  6:07 UTC (permalink / raw)
  To: Yao Zi, Michal Simek, u-boot
  Cc: Tim Ouyang, Leo Liang, Tom Rini, Nikita Shubin

If riscv_cpu_setup() is skipped we end up with riscv_init_ipi() not
being called.

But we still use riscv_send_ipi() in spl_invoke_opensbi(), so even if
CONFIG_PHASE_CPU not set we still need init IPI and clear pending IPIs
on harts.

Fixes: d8810e1d4f82 ("riscv: Skip riscv_cpu_setup() when CPU driver is disabled")
Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
---
 arch/riscv/cpu/cpu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c
index 3bec7c7cb6d..a65e6951384 100644
--- a/arch/riscv/cpu/cpu.c
+++ b/arch/riscv/cpu/cpu.c
@@ -639,7 +639,7 @@ int riscv_cpu_setup(void)
 	struct udevice *dev;
 
 	if (!CONFIG_IS_ENABLED(CPU))
-		return 0;
+		goto init_riscv_ipi;
 
 	uclass_find_first_device(UCLASS_CPU, &dev);
 	if (!dev) {
@@ -687,6 +687,7 @@ int riscv_cpu_setup(void)
 #endif
 	}
 
+init_riscv_ipi:
 #if CONFIG_IS_ENABLED(SMP)
 	ret = riscv_init_ipi();
 	if (ret)

---
base-commit: cc557af4553382f6f50e3ed62b9577054e7bc54f
change-id: 20260904-fix_skipped_ipi_init-aa5575f55bc4

Best regards,
-- 
Nikita Shubin


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] riscv: Fix IPI not initialized in riscv_cpu_setup()
  2026-09-04  6:07 [PATCH] riscv: Fix IPI not initialized in riscv_cpu_setup() Nikita Shubin
@ 2026-09-04  6:20 ` Michal Simek
  2026-09-25 10:19   ` Nikita Shubin
  0 siblings, 1 reply; 6+ messages in thread
From: Michal Simek @ 2026-09-04  6:20 UTC (permalink / raw)
  To: Nikita Shubin, Yao Zi, u-boot; +Cc: Tim Ouyang, Leo Liang, Tom Rini



On 9/4/26 08:07, Nikita Shubin wrote:
> If riscv_cpu_setup() is skipped we end up with riscv_init_ipi() not
> being called.
> 
> But we still use riscv_send_ipi() in spl_invoke_opensbi(), so even if
> CONFIG_PHASE_CPU not set we still need init IPI and clear pending IPIs
> on harts.
> 
> Fixes: d8810e1d4f82 ("riscv: Skip riscv_cpu_setup() when CPU driver is disabled")
> Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
> ---
>   arch/riscv/cpu/cpu.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c
> index 3bec7c7cb6d..a65e6951384 100644
> --- a/arch/riscv/cpu/cpu.c
> +++ b/arch/riscv/cpu/cpu.c
> @@ -639,7 +639,7 @@ int riscv_cpu_setup(void)
>   	struct udevice *dev;
>   
>   	if (!CONFIG_IS_ENABLED(CPU))
> -		return 0;
> +		goto init_riscv_ipi;
>   
>   	uclass_find_first_device(UCLASS_CPU, &dev);
>   	if (!dev) {
> @@ -687,6 +687,7 @@ int riscv_cpu_setup(void)
>   #endif
>   	}
>   
> +init_riscv_ipi:
>   #if CONFIG_IS_ENABLED(SMP)
>   	ret = riscv_init_ipi();
>   	if (ret)
> 
> ---
> base-commit: cc557af4553382f6f50e3ed62b9577054e7bc54f
> change-id: 20260904-fix_skipped_ipi_init-aa5575f55bc4
> 
> Best regards,

There are 2 other approaches how to do it in the code but it is up to maintainer 
to decide. No issue from my side to solve it via goto. Obviously one big if 
(CONFIG_IS_ENABLED(CPU)) is another one. Or move it to own function.

Anyway
Acked-by: Michal Simek <michal.simek@amd.com>

Thanks,
Michal

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] riscv: Fix IPI not initialized in riscv_cpu_setup()
  2026-09-04  6:20 ` Michal Simek
@ 2026-09-25 10:19   ` Nikita Shubin
  2026-09-25 11:38     ` Yao Zi
  0 siblings, 1 reply; 6+ messages in thread
From: Nikita Shubin @ 2026-09-25 10:19 UTC (permalink / raw)
  To: Michal Simek, Yao Zi, u-boot; +Cc: Tim Ouyang, Leo Liang, Tom Rini

Hi Yao Zi!

A shy ping on this patch.

Thanks !

On Fri, 2026-09-04 at 08:20 +0200, Michal Simek wrote:
> 
> 
> On 9/4/26 08:07, Nikita Shubin wrote:
> > If riscv_cpu_setup() is skipped we end up with riscv_init_ipi() not
> > being called.
> > 
> > But we still use riscv_send_ipi() in spl_invoke_opensbi(), so even
> > if
> > CONFIG_PHASE_CPU not set we still need init IPI and clear pending
> > IPIs
> > on harts.
> > 
> > Fixes: d8810e1d4f82 ("riscv: Skip riscv_cpu_setup() when CPU driver
> > is disabled")
> > Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
> > ---
> >   arch/riscv/cpu/cpu.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c
> > index 3bec7c7cb6d..a65e6951384 100644
> > --- a/arch/riscv/cpu/cpu.c
> > +++ b/arch/riscv/cpu/cpu.c
> > @@ -639,7 +639,7 @@ int riscv_cpu_setup(void)
> >   	struct udevice *dev;
> >   
> >   	if (!CONFIG_IS_ENABLED(CPU))
> > -		return 0;
> > +		goto init_riscv_ipi;
> >   
> >   	uclass_find_first_device(UCLASS_CPU, &dev);
> >   	if (!dev) {
> > @@ -687,6 +687,7 @@ int riscv_cpu_setup(void)
> >   #endif
> >   	}
> >   
> > +init_riscv_ipi:
> >   #if CONFIG_IS_ENABLED(SMP)
> >   	ret = riscv_init_ipi();
> >   	if (ret)
> > 
> > ---
> > base-commit: cc557af4553382f6f50e3ed62b9577054e7bc54f
> > change-id: 20260904-fix_skipped_ipi_init-aa5575f55bc4
> > 
> > Best regards,
> 
> There are 2 other approaches how to do it in the code but it is up to
> maintainer 
> to decide. No issue from my side to solve it via goto. Obviously one
> big if 
> (CONFIG_IS_ENABLED(CPU)) is another one. Or move it to own function.
> 
> Anyway
> Acked-by: Michal Simek <michal.simek@amd.com>
> 
> Thanks,
> Michal

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] riscv: Fix IPI not initialized in riscv_cpu_setup()
  2026-09-25 10:19   ` Nikita Shubin
@ 2026-09-25 11:38     ` Yao Zi
  2026-09-29  4:58       ` Nikita Shubin
  0 siblings, 1 reply; 6+ messages in thread
From: Yao Zi @ 2026-09-25 11:38 UTC (permalink / raw)
  To: Nikita Shubin, Michal Simek, Yao Zi, u-boot
  Cc: Tim Ouyang, Leo Liang, Tom Rini

On Fri, Sep 25, 2026 at 01:19:15PM +0300, Nikita Shubin wrote:
> Hi Yao Zi!
> 
> A shy ping on this patch.
> 
> Thanks !

Sorry for the delay.

> On Fri, 2026-09-04 at 08:20 +0200, Michal Simek wrote:
> > 
> > 
> > On 9/4/26 08:07, Nikita Shubin wrote:
> > > If riscv_cpu_setup() is skipped we end up with riscv_init_ipi() not
> > > being called.
> > > 
> > > But we still use riscv_send_ipi() in spl_invoke_opensbi(), so even
> > > if
> > > CONFIG_PHASE_CPU not set we still need init IPI and clear pending
> > > IPIs
> > > on harts.
> > > 
> > > Fixes: d8810e1d4f82 ("riscv: Skip riscv_cpu_setup() when CPU driver
> > > is disabled")
> > > Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
> > > ---
> > >   arch/riscv/cpu/cpu.c | 3 ++-
> > >   1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c
> > > index 3bec7c7cb6d..a65e6951384 100644
> > > --- a/arch/riscv/cpu/cpu.c
> > > +++ b/arch/riscv/cpu/cpu.c
> > > @@ -639,7 +639,7 @@ int riscv_cpu_setup(void)
> > >   	struct udevice *dev;
> > >   
> > >   	if (!CONFIG_IS_ENABLED(CPU))
> > > -		return 0;
> > > +		goto init_riscv_ipi;
> > >   
> > >   	uclass_find_first_device(UCLASS_CPU, &dev);
> > >   	if (!dev) {
> > > @@ -687,6 +687,7 @@ int riscv_cpu_setup(void)
> > >   #endif
> > >   	}
> > >   
> > > +init_riscv_ipi:
> > >   #if CONFIG_IS_ENABLED(SMP)
> > >   	ret = riscv_init_ipi();
> > >   	if (ret)
> > > 
> > > ---
> > > base-commit: cc557af4553382f6f50e3ed62b9577054e7bc54f
> > > change-id: 20260904-fix_skipped_ipi_init-aa5575f55bc4
> > > 
> > > Best regards,
> > 
> > There are 2 other approaches how to do it in the code but it is up to
> > maintainer 
> > to decide. No issue from my side to solve it via goto. Obviously one
> > big if 
> > (CONFIG_IS_ENABLED(CPU)) is another one. Or move it to own function.
> > 
> > Anyway
> > Acked-by: Michal Simek <michal.simek@amd.com>

I think it's likely a bad idea to have IPI stuff in riscv_cpu_setup(),
but this fix itself is okay. I should have noticed it when reviewing.

Reviewed-by: Yao Zi <me@ziyao.cc>

However, I'm RISC-V's reviewer instead of maintainer, so I couldn't pick
the patch for you though.

> > Thanks,
> > Michal

Best regards,
Yao Zi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] riscv: Fix IPI not initialized in riscv_cpu_setup()
  2026-09-25 11:38     ` Yao Zi
@ 2026-09-29  4:58       ` Nikita Shubin
  2026-09-29 18:12         ` Leo Liang
  0 siblings, 1 reply; 6+ messages in thread
From: Nikita Shubin @ 2026-09-29  4:58 UTC (permalink / raw)
  To: u-boot, Tim Ouyang, Leo Liang; +Cc: Tom Rini, Yao Zi, Michal Simek

Hi Tim Ouyang and Leo Liang !

Any comments on this ?

Thanks !

On Fri, 2026-09-25 at 11:38 +0000, Yao Zi wrote:
> On Fri, Sep 25, 2026 at 01:19:15PM +0300, Nikita Shubin wrote:
> > Hi Yao Zi!
> > 
> > A shy ping on this patch.
> > 
> > Thanks !
> 
> Sorry for the delay.
> 
> > On Fri, 2026-09-04 at 08:20 +0200, Michal Simek wrote:
> > > 
> > > 
> > > On 9/4/26 08:07, Nikita Shubin wrote:
> > > > If riscv_cpu_setup() is skipped we end up with riscv_init_ipi()
> > > > not
> > > > being called.
> > > > 
> > > > But we still use riscv_send_ipi() in spl_invoke_opensbi(), so
> > > > even
> > > > if
> > > > CONFIG_PHASE_CPU not set we still need init IPI and clear
> > > > pending
> > > > IPIs
> > > > on harts.
> > > > 
> > > > Fixes: d8810e1d4f82 ("riscv: Skip riscv_cpu_setup() when CPU
> > > > driver
> > > > is disabled")
> > > > Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
> > > > ---
> > > >   arch/riscv/cpu/cpu.c | 3 ++-
> > > >   1 file changed, 2 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c
> > > > index 3bec7c7cb6d..a65e6951384 100644
> > > > --- a/arch/riscv/cpu/cpu.c
> > > > +++ b/arch/riscv/cpu/cpu.c
> > > > @@ -639,7 +639,7 @@ int riscv_cpu_setup(void)
> > > >   	struct udevice *dev;
> > > >   
> > > >   	if (!CONFIG_IS_ENABLED(CPU))
> > > > -		return 0;
> > > > +		goto init_riscv_ipi;
> > > >   
> > > >   	uclass_find_first_device(UCLASS_CPU, &dev);
> > > >   	if (!dev) {
> > > > @@ -687,6 +687,7 @@ int riscv_cpu_setup(void)
> > > >   #endif
> > > >   	}
> > > >   
> > > > +init_riscv_ipi:
> > > >   #if CONFIG_IS_ENABLED(SMP)
> > > >   	ret = riscv_init_ipi();
> > > >   	if (ret)
> > > > 
> > > > ---
> > > > base-commit: cc557af4553382f6f50e3ed62b9577054e7bc54f
> > > > change-id: 20260904-fix_skipped_ipi_init-aa5575f55bc4
> > > > 
> > > > Best regards,
> > > 
> > > There are 2 other approaches how to do it in the code but it is
> > > up to
> > > maintainer 
> > > to decide. No issue from my side to solve it via goto. Obviously
> > > one
> > > big if 
> > > (CONFIG_IS_ENABLED(CPU)) is another one. Or move it to own
> > > function.
> > > 
> > > Anyway
> > > Acked-by: Michal Simek <michal.simek@amd.com>
> 
> I think it's likely a bad idea to have IPI stuff in
> riscv_cpu_setup(),
> but this fix itself is okay. I should have noticed it when reviewing.
> 
> Reviewed-by: Yao Zi <me@ziyao.cc>
> 
> However, I'm RISC-V's reviewer instead of maintainer, so I couldn't
> pick
> the patch for you though.
> 
> > > Thanks,
> > > Michal
> 
> Best regards,
> Yao Zi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] riscv: Fix IPI not initialized in riscv_cpu_setup()
  2026-09-29  4:58       ` Nikita Shubin
@ 2026-09-29 18:12         ` Leo Liang
  0 siblings, 0 replies; 6+ messages in thread
From: Leo Liang @ 2026-09-29 18:12 UTC (permalink / raw)
  To: Nikita Shubin; +Cc: u-boot, Tim Ouyang, Tom Rini, Yao Zi, Michal Simek

Hi Nikita,

On Tue, Sep 29, 2026 at 12:58 PM Nikita Shubin
<nikita.shubin@maquefel.me> wrote:
>
> Hi Tim Ouyang and Leo Liang !
>
> Any comments on this ?
>
> Thanks !

Thanks for the patch.
Reviewed-by: Leo Yu-Chi Liang <leo.liang@sifive.com>

>
> On Fri, 2026-09-25 at 11:38 +0000, Yao Zi wrote:
> > On Fri, Sep 25, 2026 at 01:19:15PM +0300, Nikita Shubin wrote:
> > > Hi Yao Zi!
> > >
> > > A shy ping on this patch.
> > >
> > > Thanks !
> >
> > Sorry for the delay.
> >
> > > On Fri, 2026-09-04 at 08:20 +0200, Michal Simek wrote:
> > > >
> > > >
> > > > On 9/4/26 08:07, Nikita Shubin wrote:
> > > > > If riscv_cpu_setup() is skipped we end up with riscv_init_ipi()
> > > > > not
> > > > > being called.
> > > > >
> > > > > But we still use riscv_send_ipi() in spl_invoke_opensbi(), so
> > > > > even
> > > > > if
> > > > > CONFIG_PHASE_CPU not set we still need init IPI and clear
> > > > > pending
> > > > > IPIs
> > > > > on harts.
> > > > >
> > > > > Fixes: d8810e1d4f82 ("riscv: Skip riscv_cpu_setup() when CPU
> > > > > driver
> > > > > is disabled")
> > > > > Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
> > > > > ---
> > > > >   arch/riscv/cpu/cpu.c | 3 ++-
> > > > >   1 file changed, 2 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c
> > > > > index 3bec7c7cb6d..a65e6951384 100644
> > > > > --- a/arch/riscv/cpu/cpu.c
> > > > > +++ b/arch/riscv/cpu/cpu.c
> > > > > @@ -639,7 +639,7 @@ int riscv_cpu_setup(void)
> > > > >         struct udevice *dev;
> > > > >
> > > > >         if (!CONFIG_IS_ENABLED(CPU))
> > > > > -               return 0;
> > > > > +               goto init_riscv_ipi;
> > > > >
> > > > >         uclass_find_first_device(UCLASS_CPU, &dev);
> > > > >         if (!dev) {
> > > > > @@ -687,6 +687,7 @@ int riscv_cpu_setup(void)
> > > > >   #endif
> > > > >         }
> > > > >
> > > > > +init_riscv_ipi:
> > > > >   #if CONFIG_IS_ENABLED(SMP)
> > > > >         ret = riscv_init_ipi();
> > > > >         if (ret)
> > > > >
> > > > > ---
> > > > > base-commit: cc557af4553382f6f50e3ed62b9577054e7bc54f
> > > > > change-id: 20260904-fix_skipped_ipi_init-aa5575f55bc4
> > > > >
> > > > > Best regards,
> > > >
> > > > There are 2 other approaches how to do it in the code but it is
> > > > up to
> > > > maintainer
> > > > to decide. No issue from my side to solve it via goto. Obviously
> > > > one
> > > > big if
> > > > (CONFIG_IS_ENABLED(CPU)) is another one. Or move it to own
> > > > function.
> > > >
> > > > Anyway
> > > > Acked-by: Michal Simek <michal.simek@amd.com>
> >
> > I think it's likely a bad idea to have IPI stuff in
> > riscv_cpu_setup(),
> > but this fix itself is okay. I should have noticed it when reviewing.
> >
> > Reviewed-by: Yao Zi <me@ziyao.cc>
> >
> > However, I'm RISC-V's reviewer instead of maintainer, so I couldn't
> > pick
> > the patch for you though.
> >
> > > > Thanks,
> > > > Michal
> >
> > Best regards,
> > Yao Zi

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-09-29 18:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-04  6:07 [PATCH] riscv: Fix IPI not initialized in riscv_cpu_setup() Nikita Shubin
2026-09-04  6:20 ` Michal Simek
2026-09-25 10:19   ` Nikita Shubin
2026-09-25 11:38     ` Yao Zi
2026-09-29  4:58       ` Nikita Shubin
2026-09-29 18:12         ` Leo Liang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.