Skip to contentSkip to conversation

powerpc: Add ppr in thread_info struct

PATCH In review Haren Myneni 1 participant 1 message Sep 9, 2012 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 3/6 powerpc: Add ppr in thread_info struct

ppr in thread_info is used to save PPR and restore it before process exits from kernel.

This patch sets the default priority to 3 when tasks are created such that users can use 4 for higher priority tasks.

---
 arch/powerpc/include/asm/thread_info.h |   11 +++++++++++
 arch/powerpc/kernel/asm-offsets.c      |    1 +
 2 files changed, 12 insertions(+)
arch/powerpc/include/asm/thread_info.h +11 -0
index faf9352..ea53542 100644
@@ -46,10 +46,20 @@ struct thread_info {
 	struct restart_block restart_block;
 	unsigned long	local_flags;		/* private flags for thread */
 
+	unsigned long	ppr;			/* SMT Thread status register */
 	/* low level flags - has atomic operations done on it */
 	unsigned long	flags ____cacheline_aligned_in_smp;
 };
 
+#ifdef CONFIG_PPC64
+/* Default SMT priority to (11- 13bits). */
+/* .ppr is Used to save/restore only on P7 or later */
+#define INIT_PPR \
+	.ppr =  (3ull << 50),
+#else
+#define INIT_PPR
+#endif
+
 /*
  * macros/functions for gaining access to the thread information structure
  */
@@ -62,6 +72,7 @@ struct thread_info {
 	.restart_block = {			\
 		.fn = do_no_restart_syscall,	\
 	},					\
+	INIT_PPR				\
 	.flags =	0,			\
 }
 
arch/powerpc/kernel/asm-offsets.c +1 -0
index e899572..1c2c066 100644
@@ -128,6 +128,7 @@ int main(void)
 	DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
 
 #ifdef CONFIG_PPC64
+	DEFINE(TI_PPR,  offsetof(struct thread_info, ppr));
 	DEFINE(DCACHEL1LINESIZE, offsetof(struct ppc64_caches, dline_size));
 	DEFINE(DCACHEL1LOGLINESIZE, offsetof(struct ppc64_caches, log_dline_size));
 	DEFINE(DCACHEL1LINESPERPAGE, offsetof(struct ppc64_caches, dlines_per_page));
Signature · 1 line
1.7.10.4