Messages in this thread Patch in this message | | | From | Christophe Leroy <> | Subject | [PATCH] powerpc/irq: Modernise inline assembly in irq_soft_mask_{set,return} | Date | Tue, 20 Sep 2022 08:41:28 +0200 |
| |
local_paca is declared as global register asm("r13"), it is therefore garantied to always ever be r13.
It is therefore not required to opencode r13 in the assembly, use a reference to local_paca->irq_soft_mask instead.
This also allows removing the 'memory' clobber in irq_soft_mask_set() as GCC now knows what is being modified in memory.
Using %X modifier will give GCC a bit more flexibility on the code generation.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> --- arch/powerpc/include/asm/hw_irq.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h index e8de249339d8..dbe037ff4474 100644 --- a/arch/powerpc/include/asm/hw_irq.h +++ b/arch/powerpc/include/asm/hw_irq.h @@ -115,10 +115,7 @@ static inline notrace unsigned long irq_soft_mask_return(void) { unsigned long flags; - asm volatile( - "lbz %0,%1(13)" - : "=r" (flags) - : "i" (offsetof(struct paca_struct, irq_soft_mask))); + asm volatile("lbz%X1 %0,%1" : "=r" (flags) : "m" (local_paca->irq_soft_mask)); return flags; } @@ -147,12 +144,7 @@ static inline notrace void irq_soft_mask_set(unsigned long mask) if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) WARN_ON(mask && !(mask & IRQS_DISABLED)); - asm volatile( - "stb %0,%1(13)" - : - : "r" (mask), - "i" (offsetof(struct paca_struct, irq_soft_mask)) - : "memory"); + asm volatile("stb%X0 %1,%0" : "=m" (local_paca->irq_soft_mask) : "r" (mask)); } static inline notrace unsigned long irq_soft_mask_set_return(unsigned long mask) -- 2.37.1
| |