powerpc/64: Implement and use soft_enabled_set_return API
authorMadhavan Srinivasan <maddy@linux.vnet.ibm.com>
Wed, 20 Dec 2017 03:55:47 +0000 (09:25 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 19 Jan 2018 11:36:59 +0000 (22:36 +1100)
Add a new wrapper function, soft_enabled_set_return(), added to do the
paca->soft_enabled updates requiring a set-return.

Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/hw_irq.h

index f9791884af0882c3741c56f7860c6c5707ad8651..c1764fabf181ee0e127c77e9de8b54f1c1c862d6 100644 (file)
@@ -76,6 +76,20 @@ static inline notrace void soft_enabled_set(unsigned long enable)
                : "memory");
 }
 
+static inline notrace unsigned long soft_enabled_set_return(unsigned long enable)
+{
+       unsigned long flags;
+
+       asm volatile(
+               "lbz %0,%1(13); stb %2,%1(13)"
+               : "=&r" (flags)
+               : "i" (offsetof(struct paca_struct, soft_enabled)),
+                 "r" (enable)
+               : "memory");
+
+       return flags;
+}
+
 static inline unsigned long arch_local_save_flags(void)
 {
        return soft_enabled_return();
@@ -95,16 +109,7 @@ static inline void arch_local_irq_enable(void)
 
 static inline unsigned long arch_local_irq_save(void)
 {
-       unsigned long flags;
-
-       asm volatile(
-               "lbz %0,%1(13); stb %2,%1(13)"
-               : "=&r" (flags)
-               : "i" (offsetof(struct paca_struct, soft_enabled)),
-                 "r" (IRQS_DISABLED)
-               : "memory");
-
-       return flags;
+       return soft_enabled_set_return(IRQS_DISABLED);
 }
 
 static inline bool arch_irqs_disabled_flags(unsigned long flags)