All of lore.kernel.org
 help / color / mirror / Atom feed
From: dave.martin@linaro.org (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm: proc-v7: pc phy addresses before disable MMU
Date: Mon, 3 Oct 2011 15:32:39 +0100	[thread overview]
Message-ID: <20111003143239.GC2117@arm.com> (raw)
In-Reply-To: <4E7DA3C0.7000208@stericsson.com>

On Sat, Sep 24, 2011 at 11:32:48AM +0200, Per F?rlin wrote:
> On 09/24/2011 10:13 AM, Mika Westerberg wrote:
> > On Sat, Sep 24, 2011 at 10:02:50AM +0200, Per Forlin wrote:
> >> PC runs virtual addresses when calling cpu_v7_reset(). The MMU
> >> is switched off and "mov pc, r0" sets pc back to
> >> virtual addresses even though the MMU is switched off.
> >> This will result in a crash if the pipeline delay after
> >> MMU disable is one instruction. To prevent this set PC
> >> to physical addresses before disabling the MMU.
> >>
> >> Signed-off-by: Per Fransson <per.xx.fransson@stericsson.com>
> >> Signed-off-by: Per Forlin <per.forlin@stericsson.com>
> >> ---
> >>  arch/arm/mm/proc-v7.S |    1 +
> >>  1 files changed, 1 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
> >> index 9049c07..f26e831 100644
> >> --- a/arch/arm/mm/proc-v7.S
> >> +++ b/arch/arm/mm/proc-v7.S
> >> @@ -64,6 +64,7 @@ ENDPROC(cpu_v7_proc_fin)
> >>   */
> >>  	.align	5
> >>  ENTRY(cpu_v7_reset)
> >> +	sub	pc, pc, #PAGE_OFFSET+4		@ go to physical addresses
> > 
> > This only works on machines where PHYS_OFFSET is zero.
> > 
> You are right! Russell was very quick to point out the same thing. 

For reference, I'll also point out that except for "mov pc,<Rm>", 
almost no instruction involving an explicit reference to the pc will
safely do what you want in Thumb-2 kernels, due to the variable instruction
size.

Cheers
---Dave

      parent reply	other threads:[~2011-10-03 14:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-24  8:02 [PATCH] arm: proc-v7: pc phy addresses before disable MMU Per Forlin
2011-09-24  8:06 ` Russell King - ARM Linux
2011-09-24  8:13 ` Mika Westerberg
2011-09-24  9:32   ` Per Förlin
2011-09-24 11:00     ` Will Deacon
2011-09-24 12:55       ` Per Förlin
2011-09-24 13:02         ` Russell King - ARM Linux
2011-09-30  5:37           ` Per Förlin
2011-09-30  8:34             ` Will Deacon
2011-09-30  9:34               ` Per Förlin
2011-09-30  9:38                 ` Will Deacon
2011-10-03 14:32     ` Dave Martin [this message]

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=20111003143239.GC2117@arm.com \
    --to=dave.martin@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.