LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/ps3: Use cpu_relax() in ps3_create_spu()
@ 2026-07-20 23:11 Thorsten Blum
  2026-07-31  7:09 ` Christophe Leroy (CS GROUP)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Thorsten Blum @ 2026-07-20 23:11 UTC (permalink / raw)
  To: Geoff Levand, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP)
  Cc: Thorsten Blum, linuxppc-dev, linux-kernel

Use cpu_relax() to wait for the execution status SPE_EX_STATE_EXECUTED.
Drop the comments while at it.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/powerpc/platforms/ps3/spu.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c
index e4e0b45e1b9d..8545c72385de 100644
--- a/arch/powerpc/platforms/ps3/spu.c
+++ b/arch/powerpc/platforms/ps3/spu.c
@@ -13,6 +13,7 @@
 #include <linux/export.h>
 #include <linux/io.h>
 #include <linux/mm.h>
+#include <linux/processor.h>
 
 #include <asm/spu.h>
 #include <asm/spu_priv1.h>
@@ -363,12 +364,9 @@ static int __init ps3_create_spu(struct spu *spu, void *data)
 	if (result)
 		goto fail_enable;
 
-	/* Make sure the spu is in SPE_EX_STATE_EXECUTED. */
-
-	/* need something better here!!! */
-	while (in_be64(&spu_pdata(spu)->shadow->spe_execution_status)
-		!= SPE_EX_STATE_EXECUTED)
-		(void)0;
+	while (in_be64(&spu_pdata(spu)->shadow->spe_execution_status) !=
+	       SPE_EX_STATE_EXECUTED)
+		cpu_relax();
 
 	return result;
 


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

* Re: [PATCH] powerpc/ps3: Use cpu_relax() in ps3_create_spu()
  2026-07-20 23:11 [PATCH] powerpc/ps3: Use cpu_relax() in ps3_create_spu() Thorsten Blum
@ 2026-07-31  7:09 ` Christophe Leroy (CS GROUP)
  2026-08-03  6:57 ` Madhavan Srinivasan
  2026-08-05  9:09 ` Geert Uytterhoeven
  2 siblings, 0 replies; 4+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-07-31  7:09 UTC (permalink / raw)
  To: Thorsten Blum, Geoff Levand, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin
  Cc: linuxppc-dev, linux-kernel



Le 21/07/2026 à 01:11, Thorsten Blum a écrit :
> Use cpu_relax() to wait for the execution status SPE_EX_STATE_EXECUTED.
> Drop the comments while at it.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>

> ---
>   arch/powerpc/platforms/ps3/spu.c | 10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c
> index e4e0b45e1b9d..8545c72385de 100644
> --- a/arch/powerpc/platforms/ps3/spu.c
> +++ b/arch/powerpc/platforms/ps3/spu.c
> @@ -13,6 +13,7 @@
>   #include <linux/export.h>
>   #include <linux/io.h>
>   #include <linux/mm.h>
> +#include <linux/processor.h>
>   
>   #include <asm/spu.h>
>   #include <asm/spu_priv1.h>
> @@ -363,12 +364,9 @@ static int __init ps3_create_spu(struct spu *spu, void *data)
>   	if (result)
>   		goto fail_enable;
>   
> -	/* Make sure the spu is in SPE_EX_STATE_EXECUTED. */
> -
> -	/* need something better here!!! */
> -	while (in_be64(&spu_pdata(spu)->shadow->spe_execution_status)
> -		!= SPE_EX_STATE_EXECUTED)
> -		(void)0;
> +	while (in_be64(&spu_pdata(spu)->shadow->spe_execution_status) !=
> +	       SPE_EX_STATE_EXECUTED)
> +		cpu_relax();
>   
>   	return result;
>   



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

* Re: [PATCH] powerpc/ps3: Use cpu_relax() in ps3_create_spu()
  2026-07-20 23:11 [PATCH] powerpc/ps3: Use cpu_relax() in ps3_create_spu() Thorsten Blum
  2026-07-31  7:09 ` Christophe Leroy (CS GROUP)
@ 2026-08-03  6:57 ` Madhavan Srinivasan
  2026-08-05  9:09 ` Geert Uytterhoeven
  2 siblings, 0 replies; 4+ messages in thread
From: Madhavan Srinivasan @ 2026-08-03  6:57 UTC (permalink / raw)
  To: Geoff Levand, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP), Thorsten Blum
  Cc: linuxppc-dev, linux-kernel

On Tue, 21 Jul 2026 01:11:53 +0200, Thorsten Blum wrote:
> Use cpu_relax() to wait for the execution status SPE_EX_STATE_EXECUTED.
> Drop the comments while at it.
> 
> 

Applied to powerpc/next.

[1/1] powerpc/ps3: Use cpu_relax() in ps3_create_spu()
      https://git.kernel.org/powerpc/c/6050e3196d97c679ea06c035dbb3c64264c01281

cheers


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

* Re: [PATCH] powerpc/ps3: Use cpu_relax() in ps3_create_spu()
  2026-07-20 23:11 [PATCH] powerpc/ps3: Use cpu_relax() in ps3_create_spu() Thorsten Blum
  2026-07-31  7:09 ` Christophe Leroy (CS GROUP)
  2026-08-03  6:57 ` Madhavan Srinivasan
@ 2026-08-05  9:09 ` Geert Uytterhoeven
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2026-08-05  9:09 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Geoff Levand, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), linuxppc-dev,
	linux-kernel

Hi Thorsten,

On Tue, 21 Jul 2026 at 01:12, Thorsten Blum <thorsten.blum@linux.dev> wrote:
> Use cpu_relax() to wait for the execution status SPE_EX_STATE_EXECUTED.
> Drop the comments while at it.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Thanks for your patch!

> --- a/arch/powerpc/platforms/ps3/spu.c
> +++ b/arch/powerpc/platforms/ps3/spu.c
> @@ -13,6 +13,7 @@
>  #include <linux/export.h>
>  #include <linux/io.h>
>  #include <linux/mm.h>
> +#include <linux/processor.h>
>
>  #include <asm/spu.h>
>  #include <asm/spu_priv1.h>
> @@ -363,12 +364,9 @@ static int __init ps3_create_spu(struct spu *spu, void *data)
>         if (result)
>                 goto fail_enable;
>
> -       /* Make sure the spu is in SPE_EX_STATE_EXECUTED. */
> -
> -       /* need something better here!!! */
> -       while (in_be64(&spu_pdata(spu)->shadow->spe_execution_status)
> -               != SPE_EX_STATE_EXECUTED)
> -               (void)0;
> +       while (in_be64(&spu_pdata(spu)->shadow->spe_execution_status) !=
> +              SPE_EX_STATE_EXECUTED)
> +               cpu_relax();

I think we still need something better here, like proper timeout
handling using read_poll_timeout()?

>
>         return result;

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds


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

end of thread, other threads:[~2026-08-05  9:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20 23:11 [PATCH] powerpc/ps3: Use cpu_relax() in ps3_create_spu() Thorsten Blum
2026-07-31  7:09 ` Christophe Leroy (CS GROUP)
2026-08-03  6:57 ` Madhavan Srinivasan
2026-08-05  9:09 ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox