Title: [7735] trunk/arch/blackfin: Signed-off-by: Philippe Gerum <[email protected]>
Revision
7735
Author
adamliyi
Date
2009-10-30 06:13:08 -0400 (Fri, 30 Oct 2009)

Log Message

Signed-off-by: Philippe Gerum <[email protected]>
prepare statusbitops for SMP support

Modified Paths

Diff

Modified: trunk/arch/blackfin/include/asm/ipipe.h (7734 => 7735)


--- trunk/arch/blackfin/include/asm/ipipe.h	2009-10-30 10:03:46 UTC (rev 7734)
+++ trunk/arch/blackfin/include/asm/ipipe.h	2009-10-30 10:13:08 UTC (rev 7735)
@@ -124,16 +124,6 @@
 	return 1;
 }
 
-static inline void __ipipe_lock_root(void)
-{
-	set_bit(IPIPE_SYNCDEFER_FLAG, &ipipe_root_cpudom_var(status));
-}
-
-static inline void __ipipe_unlock_root(void)
-{
-	clear_bit(IPIPE_SYNCDEFER_FLAG, &ipipe_root_cpudom_var(status));
-}
-
 void __ipipe_enable_pipeline(void);
 
 #define __ipipe_hook_critical_ipi(ipd) do { } while (0)

Modified: trunk/arch/blackfin/include/asm/ipipe_base.h (7734 => 7735)


--- trunk/arch/blackfin/include/asm/ipipe_base.h	2009-10-30 10:03:46 UTC (rev 7734)
+++ trunk/arch/blackfin/include/asm/ipipe_base.h	2009-10-30 10:13:08 UTC (rev 7735)
@@ -51,24 +51,16 @@
 
 extern unsigned long __ipipe_root_status; /* Alias to ipipe_root_cpudom_var(status) */
 
-#define __ipipe_stall_root()						\
-	do {								\
-		volatile unsigned long *p = &__ipipe_root_status;	\
-		set_bit(0, p);						\
-	} while (0)
+void __ipipe_stall_root(void);
 
-#define __ipipe_test_and_stall_root()					\
-	({								\
-		volatile unsigned long *p = &__ipipe_root_status;	\
-		test_and_set_bit(0, p);					\
-	})
+unsigned long __ipipe_test_and_stall_root(void);
 
-#define __ipipe_test_root()					\
-	({							\
-		const unsigned long *p = &__ipipe_root_status;	\
-		test_bit(0, p);					\
-	})
+unsigned long __ipipe_test_root(void);
 
+void __ipipe_lock_root(void);
+
+void __ipipe_unlock_root(void);
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* CONFIG_IPIPE */

Modified: trunk/arch/blackfin/kernel/ipipe.c (7734 => 7735)


--- trunk/arch/blackfin/kernel/ipipe.c	2009-10-30 10:03:46 UTC (rev 7734)
+++ trunk/arch/blackfin/kernel/ipipe.c	2009-10-30 10:13:08 UTC (rev 7735)
@@ -335,3 +335,74 @@
 	__clear_bit(IPIPE_STALL_FLAG, &ipipe_root_cpudom_var(status));
 	bfin_sti(bfin_irq_flags);
 }
+
+/*
+ * We could use standard atomic bitops in the following root status
+ * manipulation routines, but let's prepare for SMP support in the
+ * same move, preventing CPU migration as required.
+ */
+void __ipipe_stall_root(void)
+{
+	unsigned long *p;
+	unsigned long flags;
+
+	local_irq_save_hw(flags);
+	p = &__ipipe_root_status;
+	__set_bit(IPIPE_STALL_FLAG, p);
+	local_irq_restore_hw(flags);
+}
+EXPORT_SYMBOL(__ipipe_stall_root);
+
+unsigned long __ipipe_test_and_stall_root(void)
+{
+	unsigned long *p;
+	unsigned long flags;
+	int x;
+
+	local_irq_save_hw(flags);
+	p = &__ipipe_root_status;
+	x = __test_and_set_bit(IPIPE_STALL_FLAG, p);
+	local_irq_restore_hw(flags);
+
+	return x;
+}
+EXPORT_SYMBOL(__ipipe_test_and_stall_root);
+
+unsigned long __ipipe_test_root(void)
+{
+	const unsigned long *p;
+	unsigned long flags;
+	int x;
+
+	local_irq_save_hw_smp(flags);
+	p = &__ipipe_root_status;
+	x = test_bit(IPIPE_STALL_FLAG, p);
+	local_irq_restore_hw_smp(flags);
+
+	return x;
+}
+EXPORT_SYMBOL(__ipipe_test_root);
+
+void __ipipe_lock_root(void)
+{
+	unsigned long *p;
+	unsigned long flags;
+
+	local_irq_save_hw(flags);
+	p = &__ipipe_root_status;
+	__set_bit(IPIPE_SYNCDEFER_FLAG, p);
+	local_irq_restore_hw(flags);
+}
+EXPORT_SYMBOL(__ipipe_lock_root);
+
+void __ipipe_unlock_root(void)
+{
+	unsigned long *p;
+	unsigned long flags;
+
+	local_irq_save_hw(flags);
+	p = &__ipipe_root_status;
+	__clear_bit(IPIPE_SYNCDEFER_FLAG, p);
+	local_irq_restore_hw(flags);
+}
+EXPORT_SYMBOL(__ipipe_unlock_root);
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to