From: lorenzo.pieralisi@arm.com (Lorenzo Pieralisi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv5 3/7] arm64: Move cpu_resume into the text section
Date: Tue, 18 Nov 2014 10:35:30 +0000 [thread overview]
Message-ID: <20141118103530.GA2128@red-moon> (raw)
In-Reply-To: <1416272105-14787-4-git-send-email-lauraa@codeaurora.org>
On Tue, Nov 18, 2014 at 12:55:01AM +0000, Laura Abbott wrote:
> The function cpu_resume currently lives in the .data section.
> There's no reason for it to be there since we can use relative
> instructions without a problem. Move a few cpu_resume data
> structures out of the assembly file so the .data annotation
> can be dropped completely and cpu_resume ends up in the read
> only text section.
>
> Reviewed-by: Kees Cook <keescook@chromium.org>
> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Reviewed-by: Mark Rutland <mark.rutland@arm.com>
> Tested-by: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
That's nice, thank you:
Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Tested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> ---
> v5: Dropped the .data annoation completely per suggestion of
> Lorenzo. Dropped mpidr_hash_ptr per suggestion of Ard.
> Moved sleep_save_sp and sleep_idmap_phys from assembly per
> suggestion of Mark.
>
> Please let me know if your Tested-by/Reviewed-by/Acked-by
> still stands.
> ---
> arch/arm64/kernel/sleep.S | 29 ++++++-----------------------
> arch/arm64/kernel/suspend.c | 4 ++--
> 2 files changed, 8 insertions(+), 25 deletions(-)
>
> diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S
> index a564b44..3f836b2 100644
> --- a/arch/arm64/kernel/sleep.S
> +++ b/arch/arm64/kernel/sleep.S
> @@ -147,14 +147,12 @@ cpu_resume_after_mmu:
> ret
> ENDPROC(cpu_resume_after_mmu)
>
> - .data
> ENTRY(cpu_resume)
> bl el2_setup // if in EL2 drop to EL1 cleanly
> #ifdef CONFIG_SMP
> mrs x1, mpidr_el1
> - adr x4, mpidr_hash_ptr
> - ldr x5, [x4]
> - add x8, x4, x5 // x8 = struct mpidr_hash phys address
> + adrp x8, mpidr_hash
> + add x8, x8, #:lo12:mpidr_hash // x8 = struct mpidr_hash phys address
> /* retrieve mpidr_hash members to compute the hash */
> ldr x2, [x8, #MPIDR_HASH_MASK]
> ldp w3, w4, [x8, #MPIDR_HASH_SHIFTS]
> @@ -164,14 +162,15 @@ ENTRY(cpu_resume)
> #else
> mov x7, xzr
> #endif
> - adr x0, sleep_save_sp
> + adrp x0, sleep_save_sp
> + add x0, x0, #:lo12:sleep_save_sp
> ldr x0, [x0, #SLEEP_SAVE_SP_PHYS]
> ldr x0, [x0, x7, lsl #3]
> /* load sp from context */
> ldr x2, [x0, #CPU_CTX_SP]
> - adr x1, sleep_idmap_phys
> + adrp x1, sleep_idmap_phys
> /* load physical address of identity map page table in x1 */
> - ldr x1, [x1]
> + ldr x1, [x1, #:lo12:sleep_idmap_phys]
> mov sp, x2
> /*
> * cpu_do_resume expects x0 to contain context physical address
> @@ -182,24 +181,8 @@ ENTRY(cpu_resume)
> ENDPROC(cpu_resume)
>
> .align 3
> -mpidr_hash_ptr:
> /*
> * offset of mpidr_hash symbol from current location
> * used to obtain run-time mpidr_hash address with MMU off
> */
> .quad mpidr_hash - .
> -/*
> - * physical address of identity mapped page tables
> - */
> - .type sleep_idmap_phys, #object
> -ENTRY(sleep_idmap_phys)
> - .quad 0
> -/*
> - * struct sleep_save_sp {
> - * phys_addr_t *save_ptr_stash;
> - * phys_addr_t save_ptr_stash_phys;
> - * };
> - */
> - .type sleep_save_sp, #object
> -ENTRY(sleep_save_sp)
> - .space SLEEP_SAVE_SP_SZ // struct sleep_save_sp
> diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
> index 13ad4db..3771b72 100644
> --- a/arch/arm64/kernel/suspend.c
> +++ b/arch/arm64/kernel/suspend.c
> @@ -126,8 +126,8 @@ int __cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
> return ret;
> }
>
> -extern struct sleep_save_sp sleep_save_sp;
> -extern phys_addr_t sleep_idmap_phys;
> +struct sleep_save_sp sleep_save_sp;
> +phys_addr_t sleep_idmap_phys;
>
> static int __init cpu_suspend_init(void)
> {
> --
> Qualcomm Innovation Center, Inc.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
>
>
next prev parent reply other threads:[~2014-11-18 10:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-18 0:54 [PATCHv5 0/7] Better page protections for arm64 Laura Abbott
2014-11-18 0:54 ` [PATCHv5 1/7] arm64: Treat handle_arch_irq as a function pointer Laura Abbott
2014-11-18 0:55 ` [PATCHv5 2/7] arm64: Switch to adrp for loading the stub vectors Laura Abbott
2014-11-18 0:55 ` [PATCHv5 3/7] arm64: Move cpu_resume into the text section Laura Abbott
2014-11-18 10:35 ` Lorenzo Pieralisi [this message]
2014-11-18 10:49 ` Mark Rutland
2014-11-18 21:20 ` Laura Abbott
2014-11-18 0:55 ` [PATCHv5 4/7] arm64: Move some head.text functions to executable section Laura Abbott
2014-11-18 11:41 ` Mark Rutland
2014-11-18 21:27 ` Laura Abbott
2014-11-18 0:55 ` [PATCHv5 5/7] arm64: Factor out fixmap initialiation from ioremap Laura Abbott
2014-11-18 0:55 ` [PATCHv5 6/7] arm64: use fixmap for text patching when text is RO Laura Abbott
2014-11-18 0:55 ` [PATCHv5 7/7] arm64: add better page protections to arm64 Laura Abbott
2014-11-19 16:31 ` Mark Rutland
2014-11-19 17:38 ` Ard Biesheuvel
2014-11-19 18:06 ` Ard Biesheuvel
2014-11-19 18:46 ` Mark Rutland
2014-11-19 18:56 ` Ard Biesheuvel
2014-11-19 19:20 ` Laura Abbott
2014-11-21 1:08 ` Laura Abbott
2014-11-20 12:04 ` Steve Capper
2014-11-21 1:02 ` Laura Abbott
2014-11-19 22:33 ` [PATCHv5 0/7] Better page protections for arm64 Kees Cook
2014-11-19 22:37 ` Laura Abbott
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=20141118103530.GA2128@red-moon \
--to=lorenzo.pieralisi@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).