]> Pileus Git - ~andy/linux/commitdiff
powerpc: Define ppr in thread_struct
authorHaren Myneni <haren@linux.vnet.ibm.com>
Thu, 6 Dec 2012 21:49:56 +0000 (21:49 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 10 Jan 2013 06:01:08 +0000 (17:01 +1100)
[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>
arch/powerpc/include/asm/processor.h
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kernel/process.c

index 87502046c0dcfa9ed80ea856643abe05762aca13..37f87f069cbf1ba3b5e0d59fc74856ec0d914f7e 100644 (file)
 #define TS_FPRWIDTH 1
 #endif
 
+#ifdef CONFIG_PPC64
+/* Default SMT priority is set to 3. Use 11- 13bits to save priority. */
+#define PPR_PRIORITY 3
+#ifdef __ASSEMBLY__
+#define INIT_PPR (PPR_PRIORITY << 50)
+#else
+#define INIT_PPR ((u64)PPR_PRIORITY << 50)
+#endif /* __ASSEMBLY__ */
+#endif /* CONFIG_PPC64 */
+
 #ifndef __ASSEMBLY__
 #include <linux/compiler.h>
 #include <linux/cache.h>
@@ -245,6 +255,7 @@ struct thread_struct {
 #ifdef CONFIG_PPC64
        unsigned long   dscr;
        int             dscr_inherit;
+       unsigned long   ppr;    /* used to save/restore SMT priority */
 #endif
 };
 
@@ -278,6 +289,7 @@ struct thread_struct {
        .fpr = {{0}}, \
        .fpscr = { .val = 0, }, \
        .fpexc_mode = 0, \
+       .ppr = INIT_PPR, \
 }
 #endif
 
index 4e23ba2f3ca7622d7f2fe66f6d0925bae26f0cf1..e39ca556e87ff03d2a0b8e294af38fc0dcc058f5 100644 (file)
@@ -77,6 +77,7 @@ int main(void)
        DEFINE(NMI_MASK, NMI_MASK);
        DEFINE(THREAD_DSCR, offsetof(struct thread_struct, dscr));
        DEFINE(THREAD_DSCR_INHERIT, offsetof(struct thread_struct, dscr_inherit));
+       DEFINE(TASKTHREADPPR, offsetof(struct task_struct, thread.ppr));
 #else
        DEFINE(THREAD_INFO, offsetof(struct task_struct, stack));
 #endif /* CONFIG_PPC64 */
index 81430674e71c4a81c40546456061714d9937f5d6..3065d17f3606e38e140c3d96eb96671ef9c31d3f 100644 (file)
@@ -813,6 +813,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
                p->thread.dscr_inherit = current->thread.dscr_inherit;
                p->thread.dscr = current->thread.dscr;
        }
+       if (cpu_has_feature(CPU_FTR_HAS_PPR))
+               p->thread.ppr = INIT_PPR;
 #endif
        /*
         * The PPC64 ABI makes use of a TOC to contain function