linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv4 3/7] arm64: Move cpu_resume into the text section
Date: Tue, 28 Oct 2014 12:43:15 +0000	[thread overview]
Message-ID: <20141028124314.GD9796@leverpostej> (raw)
In-Reply-To: <CAKv+Gu_UWxdLvqnDWhF7YY0uWE=TYXf4P=5RyvTfPCpY7i25JQ@mail.gmail.com>

On Tue, Oct 28, 2014 at 08:22:00AM +0000, Ard Biesheuvel wrote:
> On 28 October 2014 09:10, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> > On 27 October 2014 21:12, Laura Abbott <lauraa@codeaurora.org> 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 it to the text section where it belongs.
> >>
> >> Reviewed-by: Kees Cook <keescook@chromium.org>
> >> Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
> >> ---
> >>  arch/arm64/kernel/sleep.S | 12 +++++++-----
> >>  1 file changed, 7 insertions(+), 5 deletions(-)
> >>
> >
> > Hi Laura,
> >
> > Apologies for waiting until v4 to bring this up, but I have some minor comments.
> >
> >> diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S
> >> index a564b44..5762b16 100644
> >> --- a/arch/arm64/kernel/sleep.S
> >> +++ b/arch/arm64/kernel/sleep.S
> >> @@ -147,12 +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
> >> +       adrp    x4, mpidr_hash_ptr
> >> +       add     x4, x4, #:lo12:mpidr_hash_ptr
> >
> > Instead of this change, you could put mpidr_hash_ptr itself in .text as well.
> >
> 
> Actually, looking more closely, it appears mpidr_hash_ptr can be
> dropped completely:
> the address obtained by adrp/add is PC relative, so the whole sequence
> could just be
> 
> adrp x8, mpidr_hash
> add x8, x8, #:lo12:mpidr_hash // x8 = struct mpidr_hash phys address
> 
> (and the ldr and add below can be dropped, and so can mpidr_hash_ptr at the end)

Also, if you update arch/arm64/kernel/suspend.c to drop the extern from
sleep_save_sp and sleep_idmap_phys, you can drop all of the .data from
sleep.S

I gave all of that a go locally and my Juno happily booted to userspace
with cpuidle running. I had to apply Marc's timer fix to get cpuidle to
work at all with v3.18-rc2, but that should be fixed for -rc3.

So with those changes:

Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>

Thanks,
Mark.

  reply	other threads:[~2014-10-28 12:43 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1414440752-9411-1-git-send-email-lauraa@codeaurora.org>
2014-10-27 20:12 ` [PATCHv4 1/7] arm64: Treat handle_arch_irq as a function pointer Laura Abbott
2014-10-28  8:11   ` Ard Biesheuvel
2014-10-28 10:25   ` Mark Rutland
2014-10-27 20:12 ` [PATCHv4 2/7] arm64: Switch to ldr for loading the stub vectors Laura Abbott
2014-10-28  8:23   ` Ard Biesheuvel
2014-10-28  9:51   ` Marc Zyngier
2014-10-28 10:27   ` Mark Rutland
2014-10-27 20:12 ` [PATCHv4 3/7] arm64: Move cpu_resume into the text section Laura Abbott
2014-10-28  8:10   ` Ard Biesheuvel
2014-10-28  8:22     ` Ard Biesheuvel
2014-10-28 12:43       ` Mark Rutland [this message]
2014-10-28 15:26         ` Lorenzo Pieralisi
2014-10-28 15:31           ` Mark Rutland
2014-10-30 16:49             ` Laura Abbott
2014-10-27 20:12 ` [PATCHv4 4/7] arm64: Move some head.text functions to executable section Laura Abbott
2014-10-28  8:35   ` Ard Biesheuvel
2014-10-28 11:10     ` Mark Rutland
2014-10-30 17:06       ` Laura Abbott
2014-10-30 18:45         ` Mark Rutland
2014-10-27 20:12 ` [PATCHv4 5/7] arm64: Factor out fixmap initialiation from ioremap Laura Abbott
2014-10-28 14:17   ` Mark Rutland
2014-10-27 20:12 ` [PATCHv4 6/7] arm64: use fixmap for text patching when text is RO Laura Abbott
2014-10-27 20:12 ` [PATCHv4 7/7] arm64: add better page protections to arm64 Laura Abbott
2014-10-28 11:29   ` Steve Capper
2014-10-28 11:44     ` Ard Biesheuvel
2014-10-28 13:40       ` Steve Capper
2014-10-30 17:12     ` Laura Abbott
2014-10-28 14:20   ` Mark Rutland
2014-10-30 17:17     ` Laura Abbott
2014-10-27 20:19 ` [PATCHv4 0/7] Better page protections for arm64 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=20141028124314.GD9796@leverpostej \
    --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).