Skip to contentSkip to conversation

powerpc: Add support for setting SPRN_TIDR

RFC PATCH New Sukadev Bhattiprolu 1 participant 1 message Sep 6, 2017 PowerPC

lore
Share & tools
lore
#0 lore raw

RFC PATCH v3 1/1 powerpc: Add support for setting SPRN_TIDR

We need the SPRN_TIDR to be set for use with fast thread-wakeup (core- to-core wakeup) and also with CAPI.

Each thread in a process needs to have a unique id within the process. But as explained below, for now, we assign globally unique thread ids to all threads in the system.

---
Changelog[v3]
- Merge changes with and address comments to Christophe's patch. (i.e drop CONFIG_PPC_VAS; use CONFIG_PPC64; check CPU_ARCH_300 before setting TIDR). Defer following to separate patches:
- emulation parts of Christophe's patch,
- setting TIDR for tasks other than 'current'
- setting feature bit in AT_HWCAP2

Changelog[v2]
- Michael Ellerman: Use an interface to assign TIDR so it is assigned to only threads that need it; move assignment to restore_sprs(). Drop lint from rebase;

---
 arch/powerpc/include/asm/processor.h |   1 +
 arch/powerpc/include/asm/switch_to.h |   3 +
 arch/powerpc/kernel/process.c        | 120 +++++++++++++++++++++++++++++++++++
 3 files changed, 124 insertions(+)
arch/powerpc/include/asm/processor.h +1 -0
index fab7ff8..58cc212 100644
@@ -329,6 +329,7 @@ struct thread_struct {
 	 */
 	int		dscr_inherit;
 	unsigned long	ppr;	/* used to save/restore SMT priority */
+	unsigned long	tidr;
 #endif
 #ifdef CONFIG_PPC_BOOK3S_64
 	unsigned long	tar;
arch/powerpc/include/asm/switch_to.h +3 -0
index 17c8380..f5da32f 100644
@@ -91,4 +91,7 @@ static inline void clear_task_ebb(struct task_struct *t)
 #endif
 }
 
+extern int set_thread_tidr(struct task_struct *t);
+extern void clear_thread_tidr(struct task_struct *t);
+
 #endif /* _ASM_POWERPC_SWITCH_TO_H */
arch/powerpc/kernel/process.c +120 -0

147 lines not on this page · raw message

Signature · 1 line
2.7.4