[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <178f30ff62c0317061f019b3dbbc079073f104c3.1663656058.git.christophe.leroy@csgroup.eu>
Date: Tue, 20 Sep 2022 08:41:28 +0200
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>
Cc: Christophe Leroy <christophe.leroy@...roup.eu>,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: [PATCH] powerpc/irq: Modernise inline assembly in irq_soft_mask_{set,return}
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@...roup.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
Powered by blists - more mailing lists