From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 4/6] arm64: pass stack base to secondary_start_kernel
Date: Wed, 12 Jul 2017 23:33:01 +0100 [thread overview]
Message-ID: <1499898783-25732-5-git-send-email-mark.rutland@arm.com> (raw)
In-Reply-To: <1499898783-25732-1-git-send-email-mark.rutland@arm.com>
In subsequent patches, we'll want the base of the secondary stack in
secondary_start_kernel.
Pass the stack base down, as we do in the primary path, and add the
offset in secondary_start_kernel. Unfortunately, we can't encode
STACK_START_SP in an add immediate, so use a mov immedaite, which has
greater range.
This is far from a hot path, so the overhead shouldn't matter.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
---
arch/arm64/kernel/head.S | 3 ++-
arch/arm64/kernel/smp.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index a58ecda..db77cac 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -613,7 +613,8 @@ __secondary_switched:
adr_l x0, secondary_data
ldr x1, [x0, #CPU_BOOT_STACK] // get secondary_data.stack
- mov sp, x1
+ mov x3, #THREAD_START_SP
+ add sp, x1, x3
ldr x2, [x0, #CPU_BOOT_TASK]
msr tpidr_el1, x2
mov x29, #0
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 6e0e16a..269c957 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -154,7 +154,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
* page tables.
*/
secondary_data.task = idle;
- secondary_data.stack = task_stack_page(idle) + THREAD_START_SP;
+ secondary_data.stack = task_stack_page(idle);
update_cpu_boot_status(CPU_MMU_OFF);
__flush_dcache_area(&secondary_data, sizeof(secondary_data));
--
1.9.1
next prev parent reply other threads:[~2017-07-12 22:33 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-12 22:32 [RFC PATCH 0/6] arm64: alternative VMAP_STACK implementation Mark Rutland
2017-07-12 22:32 ` [RFC PATCH 1/6] arm64: use tpidr_el1 for current, free sp_el0 Mark Rutland
2017-07-14 1:30 ` Will Deacon
2017-07-12 22:32 ` [RFC PATCH 2/6] arm64: avoid open-coding THREAD_SIZE{,_ORDER} Mark Rutland
2017-07-13 10:18 ` James Morse
2017-07-13 11:26 ` Mark Rutland
2017-07-12 22:33 ` [RFC PATCH 3/6] arm64: pad stacks to PAGE_SIZE for VMAP_STACK Mark Rutland
2017-07-12 22:33 ` Mark Rutland [this message]
2017-07-12 22:33 ` [RFC PATCH 5/6] arm64: keep track of current stack Mark Rutland
2017-07-12 22:33 ` [RFC PATCH 6/6] arm64: add VMAP_STACK and detect out-of-bounds SP Mark Rutland
2017-07-13 6:58 ` Ard Biesheuvel
2017-07-13 10:49 ` Mark Rutland
2017-07-13 11:49 ` Ard Biesheuvel
2017-07-13 16:10 ` Mark Rutland
2017-07-13 17:55 ` [kernel-hardening] " Mark Rutland
2017-07-13 18:28 ` Ard Biesheuvel
2017-07-14 10:32 ` Mark Rutland
2017-07-14 10:48 ` Ard Biesheuvel
2017-07-14 12:27 ` Ard Biesheuvel
2017-07-14 14:06 ` Mark Rutland
2017-07-14 14:14 ` Ard Biesheuvel
2017-07-14 14:39 ` Robin Murphy
2017-07-14 15:03 ` Robin Murphy
2017-07-14 15:15 ` Ard Biesheuvel
2017-07-14 15:25 ` Mark Rutland
2017-07-14 21:27 ` Mark Rutland
2017-07-16 0:03 ` Ard Biesheuvel
2017-07-18 21:53 ` Laura Abbott
2017-07-19 8:08 ` Ard Biesheuvel
[not found] ` <aa086315-722b-bff3-90bb-f479229ed104@redhat.com>
2017-07-20 5:35 ` Ard Biesheuvel
2017-07-20 8:36 ` James Morse
2017-07-20 8:56 ` Ard Biesheuvel
2017-07-20 17:30 ` Ard Biesheuvel
2017-07-20 19:10 ` Laura Abbott
2017-07-14 12:52 ` Mark Rutland
2017-07-14 12:55 ` Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1499898783-25732-5-git-send-email-mark.rutland@arm.com \
--to=mark.rutland@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).