diff options
author | Haren Myneni <haren@linux.vnet.ibm.com> | 2012-12-06 16:49:56 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-01-10 01:01:08 -0500 |
commit | 92779245599bb3d7fb48066b11c4bfd6aa477198 (patch) | |
tree | bea152148a83002c420fd92e59aac37bb8f18f70 | |
parent | a09688cd23d477ebd9c8f57881bfe907240cb0a1 (diff) |
powerpc: Define ppr in thread_struct
[PATCH 4/6] powerpc: Define ppr in thread_struct
ppr in thread_struct 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.
Signed-off-by: Haren Myneni <haren@us.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/include/asm/processor.h | 12 | ||||
-rw-r--r-- | arch/powerpc/kernel/asm-offsets.c | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/process.c | 2 |
3 files changed, 15 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index 87502046c0dc..37f87f069cbf 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h | |||
@@ -18,6 +18,16 @@ | |||
18 | #define TS_FPRWIDTH 1 | 18 | #define TS_FPRWIDTH 1 |
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | #ifdef CONFIG_PPC64 | ||
22 | /* Default SMT priority is set to 3. Use 11- 13bits to save priority. */ | ||
23 | #define PPR_PRIORITY 3 | ||
24 | #ifdef __ASSEMBLY__ | ||
25 | #define INIT_PPR (PPR_PRIORITY << 50) | ||
26 | #else | ||
27 | #define INIT_PPR ((u64)PPR_PRIORITY << 50) | ||
28 | #endif /* __ASSEMBLY__ */ | ||
29 | #endif /* CONFIG_PPC64 */ | ||
30 | |||
21 | #ifndef __ASSEMBLY__ | 31 | #ifndef __ASSEMBLY__ |
22 | #include <linux/compiler.h> | 32 | #include <linux/compiler.h> |
23 | #include <linux/cache.h> | 33 | #include <linux/cache.h> |
@@ -245,6 +255,7 @@ struct thread_struct { | |||
245 | #ifdef CONFIG_PPC64 | 255 | #ifdef CONFIG_PPC64 |
246 | unsigned long dscr; | 256 | unsigned long dscr; |
247 | int dscr_inherit; | 257 | int dscr_inherit; |
258 | unsigned long ppr; /* used to save/restore SMT priority */ | ||
248 | #endif | 259 | #endif |
249 | }; | 260 | }; |
250 | 261 | ||
@@ -278,6 +289,7 @@ struct thread_struct { | |||
278 | .fpr = {{0}}, \ | 289 | .fpr = {{0}}, \ |
279 | .fpscr = { .val = 0, }, \ | 290 | .fpscr = { .val = 0, }, \ |
280 | .fpexc_mode = 0, \ | 291 | .fpexc_mode = 0, \ |
292 | .ppr = INIT_PPR, \ | ||
281 | } | 293 | } |
282 | #endif | 294 | #endif |
283 | 295 | ||
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 4e23ba2f3ca7..e39ca556e87f 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -77,6 +77,7 @@ int main(void) | |||
77 | DEFINE(NMI_MASK, NMI_MASK); | 77 | DEFINE(NMI_MASK, NMI_MASK); |
78 | DEFINE(THREAD_DSCR, offsetof(struct thread_struct, dscr)); | 78 | DEFINE(THREAD_DSCR, offsetof(struct thread_struct, dscr)); |
79 | DEFINE(THREAD_DSCR_INHERIT, offsetof(struct thread_struct, dscr_inherit)); | 79 | DEFINE(THREAD_DSCR_INHERIT, offsetof(struct thread_struct, dscr_inherit)); |
80 | DEFINE(TASKTHREADPPR, offsetof(struct task_struct, thread.ppr)); | ||
80 | #else | 81 | #else |
81 | DEFINE(THREAD_INFO, offsetof(struct task_struct, stack)); | 82 | DEFINE(THREAD_INFO, offsetof(struct task_struct, stack)); |
82 | #endif /* CONFIG_PPC64 */ | 83 | #endif /* CONFIG_PPC64 */ |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 81430674e71c..3065d17f3606 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -813,6 +813,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, | |||
813 | p->thread.dscr_inherit = current->thread.dscr_inherit; | 813 | p->thread.dscr_inherit = current->thread.dscr_inherit; |
814 | p->thread.dscr = current->thread.dscr; | 814 | p->thread.dscr = current->thread.dscr; |
815 | } | 815 | } |
816 | if (cpu_has_feature(CPU_FTR_HAS_PPR)) | ||
817 | p->thread.ppr = INIT_PPR; | ||
816 | #endif | 818 | #endif |
817 | /* | 819 | /* |
818 | * The PPC64 ABI makes use of a TOC to contain function | 820 | * The PPC64 ABI makes use of a TOC to contain function |