[POWERPC] make spinlocks work in a combined kernel
authorStephen Rothwell <sfr@canb.auug.org.au>
Thu, 24 Aug 2006 03:29:33 +0000 (13:29 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 20 Sep 2006 04:01:16 +0000 (14:01 +1000)
If we build a pSeries/iSeries combined kernel, we will need this.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
arch/powerpc/lib/locks.c

index 077bed7dc52b3726ae4ebd7ecb227832fd52de95..80b482ca30dfac7e8098e0d1b8cafd3ecc82656c 100644 (file)
@@ -23,6 +23,7 @@
 #include <asm/hvcall.h>
 #include <asm/iseries/hv_call.h>
 #include <asm/smp.h>
+#include <asm/firmware.h>
 
 void __spin_yield(raw_spinlock_t *lock)
 {
@@ -39,13 +40,12 @@ void __spin_yield(raw_spinlock_t *lock)
        rmb();
        if (lock->slock != lock_value)
                return;         /* something has changed */
-#ifdef CONFIG_PPC_ISERIES
-       HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc,
-               ((u64)holder_cpu << 32) | yield_count);
-#else
-       plpar_hcall_norets(H_CONFER, get_hard_smp_processor_id(holder_cpu),
-                          yield_count);
-#endif
+       if (firmware_has_feature(FW_FEATURE_ISERIES))
+               HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc,
+                       ((u64)holder_cpu << 32) | yield_count);
+       else
+               plpar_hcall_norets(H_CONFER,
+                       get_hard_smp_processor_id(holder_cpu), yield_count);
 }
 
 /*
@@ -69,13 +69,12 @@ void __rw_yield(raw_rwlock_t *rw)
        rmb();
        if (rw->lock != lock_value)
                return;         /* something has changed */
-#ifdef CONFIG_PPC_ISERIES
-       HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc,
-               ((u64)holder_cpu << 32) | yield_count);
-#else
-       plpar_hcall_norets(H_CONFER, get_hard_smp_processor_id(holder_cpu),
-                          yield_count);
-#endif
+       if (firmware_has_feature(FW_FEATURE_ISERIES))
+               HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc,
+                       ((u64)holder_cpu << 32) | yield_count);
+       else
+               plpar_hcall_norets(H_CONFER,
+                       get_hard_smp_processor_id(holder_cpu), yield_count);
 }
 #endif