aboutsummaryrefslogtreecommitdiff
path: root/include/asm-powerpc/paca.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-powerpc/paca.h')
-rw-r--r--include/asm-powerpc/paca.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h
index c6a5b173566..fcd7b428ed0 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -21,7 +21,18 @@
#include <asm/mmu.h>
register struct paca_struct *local_paca asm("r13");
+
+#if defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_SMP)
+extern unsigned int debug_smp_processor_id(void); /* from linux/smp.h */
+/*
+ * Add standard checks that preemption cannot occur when using get_paca():
+ * otherwise the paca_struct it points to may be the wrong one just after.
+ */
+#define get_paca() ((void) debug_smp_processor_id(), local_paca)
+#else
#define get_paca() local_paca
+#endif
+
#define get_lppaca() (get_paca()->lppaca_ptr)
#define get_slb_shadow() (get_paca()->slb_shadow_ptr)