diff options
author | Nicolas Pitre <nicolas.pitre@linaro.org> | 2012-11-27 15:55:33 -0500 |
---|---|---|
committer | Nicolas Pitre <nicolas.pitre@linaro.org> | 2013-07-30 09:02:15 -0400 |
commit | c052de2693498bee6ff2e1b5bcd32309c4f8780b (patch) | |
tree | 60239a7327fdfb812549a66a16b6992abf636a0a /arch/arm/common | |
parent | 71ce1deeff8f9341ae3b21983e9bdde28e8c96fe (diff) |
ARM: bL_switcher: simplify stack isolation
We now have a dedicated thread for each logical CPU. That's plenty
of stack space for our needs.
Signed-off-by: Nicolas Pitre <nico@linaro.org>
Diffstat (limited to 'arch/arm/common')
-rw-r--r-- | arch/arm/common/bL_switcher.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c index 407c4cc64c0b..4caca71c906f 100644 --- a/arch/arm/common/bL_switcher.c +++ b/arch/arm/common/bL_switcher.c | |||
@@ -53,12 +53,6 @@ static void bL_do_switch(void *_unused) | |||
53 | { | 53 | { |
54 | unsigned mpidr, cpuid, clusterid, ob_cluster, ib_cluster; | 54 | unsigned mpidr, cpuid, clusterid, ob_cluster, ib_cluster; |
55 | 55 | ||
56 | /* | ||
57 | * We now have a piece of stack borrowed from the init task's. | ||
58 | * Let's also switch to init_mm right away to match it. | ||
59 | */ | ||
60 | cpu_switch_mm(init_mm.pgd, &init_mm); | ||
61 | |||
62 | pr_debug("%s\n", __func__); | 56 | pr_debug("%s\n", __func__); |
63 | 57 | ||
64 | mpidr = read_mpidr(); | 58 | mpidr = read_mpidr(); |
@@ -93,22 +87,21 @@ static void bL_do_switch(void *_unused) | |||
93 | } | 87 | } |
94 | 88 | ||
95 | /* | 89 | /* |
96 | * Stack isolation. To ensure 'current' remains valid, we just borrow | 90 | * Stack isolation. To ensure 'current' remains valid, we just use another |
97 | * a slice of the init/idle task which should be fairly lightly used. | 91 | * piece of our thread's stack space which should be fairly lightly used. |
98 | * The borrowed area starts just above the thread_info structure located | 92 | * The selected area starts just above the thread_info structure located |
99 | * at the very bottom of the stack, aligned to a cache line. | 93 | * at the very bottom of the stack, aligned to a cache line, and indexed |
94 | * with the cluster number. | ||
100 | */ | 95 | */ |
101 | #define STACK_SIZE 256 | 96 | #define STACK_SIZE 512 |
102 | extern void call_with_stack(void (*fn)(void *), void *arg, void *sp); | 97 | extern void call_with_stack(void (*fn)(void *), void *arg, void *sp); |
103 | static int bL_switchpoint(unsigned long _arg) | 98 | static int bL_switchpoint(unsigned long _arg) |
104 | { | 99 | { |
105 | unsigned int mpidr = read_mpidr(); | 100 | unsigned int mpidr = read_mpidr(); |
106 | unsigned int cpuid = MPIDR_AFFINITY_LEVEL(mpidr, 0); | ||
107 | unsigned int clusterid = MPIDR_AFFINITY_LEVEL(mpidr, 1); | 101 | unsigned int clusterid = MPIDR_AFFINITY_LEVEL(mpidr, 1); |
108 | unsigned int cpu_index = cpuid + clusterid * MAX_CPUS_PER_CLUSTER; | 102 | void *stack = current_thread_info() + 1; |
109 | void *stack = &init_thread_info + 1; | ||
110 | stack = PTR_ALIGN(stack, L1_CACHE_BYTES); | 103 | stack = PTR_ALIGN(stack, L1_CACHE_BYTES); |
111 | stack += cpu_index * STACK_SIZE + STACK_SIZE; | 104 | stack += clusterid * STACK_SIZE + STACK_SIZE; |
112 | call_with_stack(bL_do_switch, (void *)_arg, stack); | 105 | call_with_stack(bL_do_switch, (void *)_arg, stack); |
113 | BUG(); | 106 | BUG(); |
114 | } | 107 | } |