linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/irq: Refactor irq_soft_mask_{set,or}_return()
@ 2022-09-20  6:41 Christophe Leroy
  2022-09-23  6:28 ` Nicholas Piggin
  2022-10-04 13:25 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe Leroy @ 2022-09-20  6:41 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin; +Cc: linuxppc-dev, linux-kernel

This partialy reapply commit ef5b570d3700 ("powerpc/irq: Don't
open code irq_soft_mask helpers") which was reverted by
commit 684c68d92e2e ("Revert "powerpc/irq: Don't open code
irq_soft_mask helpers"")

irq_soft_mask_set_return() and irq_soft_mask_or_return()
are overset of irq_soft_mask_set().

Have them use irq_soft_mask_set() instead of duplicating it.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/include/asm/hw_irq.h | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index 983551859891..e8de249339d8 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -157,36 +157,18 @@ static inline notrace void irq_soft_mask_set(unsigned long mask)
 
 static inline notrace unsigned long irq_soft_mask_set_return(unsigned long mask)
 {
-	unsigned long flags;
-
-#ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG
-	WARN_ON(mask && !(mask & IRQS_DISABLED));
-#endif
+	unsigned long flags = irq_soft_mask_return();
 
-	asm volatile(
-		"lbz %0,%1(13); stb %2,%1(13)"
-		: "=&r" (flags)
-		: "i" (offsetof(struct paca_struct, irq_soft_mask)),
-		  "r" (mask)
-		: "memory");
+	irq_soft_mask_set(mask);
 
 	return flags;
 }
 
 static inline notrace unsigned long irq_soft_mask_or_return(unsigned long mask)
 {
-	unsigned long flags, tmp;
+	unsigned long flags = irq_soft_mask_return();
 
-	asm volatile(
-		"lbz %0,%2(13); or %1,%0,%3; stb %1,%2(13)"
-		: "=&r" (flags), "=r" (tmp)
-		: "i" (offsetof(struct paca_struct, irq_soft_mask)),
-		  "r" (mask)
-		: "memory");
-
-#ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG
-	WARN_ON((mask | flags) && !((mask | flags) & IRQS_DISABLED));
-#endif
+	irq_soft_mask_set(flags | mask);
 
 	return flags;
 }
-- 
2.37.1


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

* Re: [PATCH] powerpc/irq: Refactor irq_soft_mask_{set,or}_return()
  2022-09-20  6:41 [PATCH] powerpc/irq: Refactor irq_soft_mask_{set,or}_return() Christophe Leroy
@ 2022-09-23  6:28 ` Nicholas Piggin
  2022-10-04 13:25 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Nicholas Piggin @ 2022-09-23  6:28 UTC (permalink / raw)
  To: Christophe Leroy, Michael Ellerman; +Cc: linuxppc-dev, linux-kernel

On Tue Sep 20, 2022 at 4:41 PM AEST, Christophe Leroy wrote:
> This partialy reapply commit ef5b570d3700 ("powerpc/irq: Don't
> open code irq_soft_mask helpers") which was reverted by
> commit 684c68d92e2e ("Revert "powerpc/irq: Don't open code
> irq_soft_mask helpers"")
>
> irq_soft_mask_set_return() and irq_soft_mask_or_return()
> are overset of irq_soft_mask_set().
>
> Have them use irq_soft_mask_set() instead of duplicating it.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>

Reviewed-by: Nicholas Piggin <npiggin@gmail.com>

> ---
>  arch/powerpc/include/asm/hw_irq.h | 26 ++++----------------------
>  1 file changed, 4 insertions(+), 22 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
> index 983551859891..e8de249339d8 100644
> --- a/arch/powerpc/include/asm/hw_irq.h
> +++ b/arch/powerpc/include/asm/hw_irq.h
> @@ -157,36 +157,18 @@ static inline notrace void irq_soft_mask_set(unsigned long mask)
>  
>  static inline notrace unsigned long irq_soft_mask_set_return(unsigned long mask)
>  {
> -	unsigned long flags;
> -
> -#ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG
> -	WARN_ON(mask && !(mask & IRQS_DISABLED));
> -#endif
> +	unsigned long flags = irq_soft_mask_return();
>  
> -	asm volatile(
> -		"lbz %0,%1(13); stb %2,%1(13)"
> -		: "=&r" (flags)
> -		: "i" (offsetof(struct paca_struct, irq_soft_mask)),
> -		  "r" (mask)
> -		: "memory");
> +	irq_soft_mask_set(mask);
>  
>  	return flags;
>  }
>  
>  static inline notrace unsigned long irq_soft_mask_or_return(unsigned long mask)
>  {
> -	unsigned long flags, tmp;
> +	unsigned long flags = irq_soft_mask_return();
>  
> -	asm volatile(
> -		"lbz %0,%2(13); or %1,%0,%3; stb %1,%2(13)"
> -		: "=&r" (flags), "=r" (tmp)
> -		: "i" (offsetof(struct paca_struct, irq_soft_mask)),
> -		  "r" (mask)
> -		: "memory");
> -
> -#ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG
> -	WARN_ON((mask | flags) && !((mask | flags) & IRQS_DISABLED));
> -#endif
> +	irq_soft_mask_set(flags | mask);
>  
>  	return flags;
>  }
> -- 
> 2.37.1


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

* Re: [PATCH] powerpc/irq: Refactor irq_soft_mask_{set,or}_return()
  2022-09-20  6:41 [PATCH] powerpc/irq: Refactor irq_soft_mask_{set,or}_return() Christophe Leroy
  2022-09-23  6:28 ` Nicholas Piggin
@ 2022-10-04 13:25 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2022-10-04 13:25 UTC (permalink / raw)
  To: Nicholas Piggin, Christophe Leroy, Michael Ellerman
  Cc: linuxppc-dev, linux-kernel

On Tue, 20 Sep 2022 08:41:08 +0200, Christophe Leroy wrote:
> This partialy reapply commit ef5b570d3700 ("powerpc/irq: Don't
> open code irq_soft_mask helpers") which was reverted by
> commit 684c68d92e2e ("Revert "powerpc/irq: Don't open code
> irq_soft_mask helpers"")
> 
> irq_soft_mask_set_return() and irq_soft_mask_or_return()
> are overset of irq_soft_mask_set().
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/irq: Refactor irq_soft_mask_{set,or}_return()
      https://git.kernel.org/powerpc/c/4af83545538a4fa80d14b9247ffc0db556e6a556

cheers

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

end of thread, other threads:[~2022-10-04 13:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-20  6:41 [PATCH] powerpc/irq: Refactor irq_soft_mask_{set,or}_return() Christophe Leroy
2022-09-23  6:28 ` Nicholas Piggin
2022-10-04 13:25 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).