mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Fix kexec reboot on ARM
@ 2011-12-14  4:02 Peter Chubb
  2011-12-14  8:08 ` Russell King - ARM Linux
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Chubb @ 2011-12-14  4:02 UTC (permalink / raw)
  To: linux-kernel, linux, kexec


When kexec() runs, it eventually sets up a 1-to-1 memory map, then
invokes cpu_reset(). When it invokes cpu_reset (which turns
off the MMU), it does so at its virtual address.  Across the code that
disables the MMU, virtual and physical addresses have to be the same,
otherwise after disabling the MMU, the PC is invalid.

The simplest fix is to invoke cpu_reset() at its one-to-one mapped
address.

I've tested on KZM (arm v6) and Beagleboard (omap)

---
 arch/arm/kernel/machine_kexec.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Index: linux-2.6/arch/arm/kernel/machine_kexec.c
===================================================================
--- linux-2.6.orig/arch/arm/kernel/machine_kexec.c	2011-12-04 21:11:53.280725573 +1100
+++ linux-2.6/arch/arm/kernel/machine_kexec.c	2011-12-14 14:37:08.227654151 +1100
@@ -120,5 +120,13 @@ void machine_kexec(struct kimage *image)
 	cpu_proc_fin();
 	outer_inv_all();
 	flush_cache_all();
-	cpu_reset(reboot_code_buffer_phys);
+        /*
+         * cpu_reset disables the MMU, so branch to its (1-to-1 mapped)
+         * physical address not its virtual one.
+         */
+        {
+            void (*cpu_reset_phys)(unsigned long dest) =
+                virt_to_phys(cpu_reset);
+            cpu_reset_phys(reboot_code_buffer_phys);
+        }
 }


--
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
http://www.ertos.nicta.com.au           ERTOS within National ICT Australia

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix kexec reboot on ARM
  2011-12-14  4:02 [PATCH] Fix kexec reboot on ARM Peter Chubb
@ 2011-12-14  8:08 ` Russell King - ARM Linux
  2011-12-14  8:08   ` Russell King - ARM Linux
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King - ARM Linux @ 2011-12-14  8:08 UTC (permalink / raw)
  To: Peter Chubb; +Cc: linux-kernel, kexec

On Wed, Dec 14, 2011 at 03:02:10PM +1100, Peter Chubb wrote:
> 
> When kexec() runs, it eventually sets up a 1-to-1 memory map, then
> invokes cpu_reset(). When it invokes cpu_reset (which turns
> off the MMU), it does so at its virtual address.  Across the code that
> disables the MMU, virtual and physical addresses have to be the same,
> otherwise after disabling the MMU, the PC is invalid.
> 
> The simplest fix is to invoke cpu_reset() at its one-to-one mapped
> address.
> 
> I've tested on KZM (arm v6) and Beagleboard (omap)

NAK.

Three reasons:

1. You've not signed-off the patch (please read
   Documentation/SubmittingPatches)
2. pre-ARMv6 do not expect this, and it will break where
   PHYS_OFFSET >= PAGE_OFFSET
3. Have you seen what's already queued for the next merge window?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix kexec reboot on ARM
  2011-12-14  8:08 ` Russell King - ARM Linux
@ 2011-12-14  8:08   ` Russell King - ARM Linux
  2011-12-14 10:36     ` Peter Chubb
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King - ARM Linux @ 2011-12-14  8:08 UTC (permalink / raw)
  To: Peter Chubb; +Cc: linux-kernel, kexec

On Wed, Dec 14, 2011 at 08:08:02AM +0000, Russell King - ARM Linux wrote:
> On Wed, Dec 14, 2011 at 03:02:10PM +1100, Peter Chubb wrote:
> > 
> > When kexec() runs, it eventually sets up a 1-to-1 memory map, then
> > invokes cpu_reset(). When it invokes cpu_reset (which turns
> > off the MMU), it does so at its virtual address.  Across the code that
> > disables the MMU, virtual and physical addresses have to be the same,
> > otherwise after disabling the MMU, the PC is invalid.
> > 
> > The simplest fix is to invoke cpu_reset() at its one-to-one mapped
> > address.
> > 
> > I've tested on KZM (arm v6) and Beagleboard (omap)
> 
> NAK.
> 
> Three reasons:
> 
> 1. You've not signed-off the patch (please read
>    Documentation/SubmittingPatches)
> 2. pre-ARMv6 do not expect this, and it will break where
>    PHYS_OFFSET >= PAGE_OFFSET
> 3. Have you seen what's already queued for the next merge window?

And 4. You didn't cc the linux-arm-kernel mailing list with your patch.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix kexec reboot on ARM
  2011-12-14  8:08   ` Russell King - ARM Linux
@ 2011-12-14 10:36     ` Peter Chubb
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Chubb @ 2011-12-14 10:36 UTC (permalink / raw)
  To: Russell King - ARM Linux; +Cc: Peter Chubb, linux-kernel, kexec

>>>>> "Russell" == Russell King <- ARM Linux <linux@arm.linux.org.uk>> writes:

Russell> On Wed, Dec 14, 2011 at 08:08:02AM +0000, Russell King - ARM
Russell> Linux wrote:
>> On Wed, Dec 14, 2011 at 03:02:10PM +1100, Peter Chubb wrote:
>> > 
>> > When kexec() runs, it eventually sets up a 1-to-1 memory map,
>> then > invokes cpu_reset(). When it invokes cpu_reset (which turns
>> > off the MMU), it does so at its virtual address.  Across the code
>> that > disables the MMU, virtual and physical addresses have to be
>> the same, > otherwise after disabling the MMU, the PC is invalid.
>> > 
>> > The simplest fix is to invoke cpu_reset() at its one-to-one
>> mapped > address.
>> > 
>> > I've tested on KZM (arm v6) and Beagleboard (omap)
>> 
>> NAK.
>> 
>> Three reasons:
>> 
>> 1. You've not signed-off the patch (please read
>> Documentation/SubmittingPatches) 2. pre-ARMv6 do not expect this,
>> and it will break where PHYS_OFFSET >= PAGE_OFFSET 3. Have you seen
>> what's already queued for the next merge window?

Russell> And 4. You didn't cc the linux-arm-kernel mailing list with
Russell> your patch.

Sure, last time I tried to cc linux-arm it bounced.  And I wasn't
expecting this to be accepted yet (hence no signed-off-by: line), just
wanted comment.

If there's already a patch queued to fix this then fine.


--
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
http://www.ertos.nicta.com.au           ERTOS within National ICT Australia
--
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
http://www.ertos.nicta.com.au           ERTOS within National ICT Australia

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-14 10:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-14  4:02 [PATCH] Fix kexec reboot on ARM Peter Chubb
2011-12-14  8:08 ` Russell King - ARM Linux
2011-12-14  8:08   ` Russell King - ARM Linux
2011-12-14 10:36     ` Peter Chubb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®