summaryrefslogtreecommitdiffstats
path: root/arch/parisc/include/asm/smp.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/parisc/include/asm/smp.h')
-rw-r--r--arch/parisc/include/asm/smp.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/arch/parisc/include/asm/smp.h b/arch/parisc/include/asm/smp.h
index b9a18db4b05a..16d41127500e 100644
--- a/arch/parisc/include/asm/smp.h
+++ b/arch/parisc/include/asm/smp.h
@@ -34,8 +34,23 @@ extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
#endif /* !ASSEMBLY */
-#define raw_smp_processor_id() (current_thread_info()->cpu)
-
+/*
+ * This is particularly ugly: it appears we can't actually get the definition
+ * of task_struct here, but we need access to the CPU this task is running on.
+ * Instead of using task_struct we're using TASK_CPU which is extracted from
+ * asm-offsets.h by kbuild to get the current processor ID.
+ *
+ * This also needs to be safeguarded when building asm-offsets.s because at
+ * that time TASK_CPU is not defined yet. It could have been guarded by
+ * TASK_CPU itself, but we want the build to fail if TASK_CPU is missing
+ * when building something else than asm-offsets.s
+ */
+#ifdef GENERATING_ASM_OFFSETS
+#define raw_smp_processor_id() (0)
+#else
+#include <asm/asm-offsets.h>
+#define raw_smp_processor_id() (*(unsigned int *)((void *)current + TASK_CPU))
+#endif
#else /* CONFIG_SMP */
static inline void smp_send_all_nop(void) { return; }