* [PATCH 0/4] Consistently enter the kernel in ARM state
@ 2011-06-20 13:40 Dave Martin
2011-06-20 13:40 ` [PATCH 1/4] ARM: head: Always Enter " Dave Martin
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Dave Martin @ 2011-06-20 13:40 UTC (permalink / raw)
To: linux-arm-kernel
This series rationalises the kernel entry requirements so that
Image is entered in ARM state, just like zImage.
This should enable Image to be booted reliably for Thumb-2 kernels,
just like zImage.
The Booting documentation is updated to describe the requirement:
this resolves the ARM/Thumb ambiguity for Thumb-2 kernels; for ARM
kernels there is no implied change.
Dave Martin (4):
ARM: head: Always Enter the kernel in ARM state
ARM: head-nommu: Always enter the kernel in ARM state
ARM: zImage: Jump to the decompressed kernel entry point in ARM state
ARM: Documentation: clarify entry requirements for ARM versus Thumb-2
Documentation/arm/Booting | 5 +++++
arch/arm/boot/compressed/head.S | 3 ++-
arch/arm/kernel/head-nommu.S | 8 ++++++++
arch/arm/kernel/head.S | 8 ++++++++
4 files changed, 23 insertions(+), 1 deletions(-)
--
1.7.4.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] ARM: head: Always Enter the kernel in ARM state
2011-06-20 13:40 [PATCH 0/4] Consistently enter the kernel in ARM state Dave Martin
@ 2011-06-20 13:40 ` Dave Martin
2011-06-20 13:40 ` [PATCH 2/4] ARM: head-nommu: Always enter " Dave Martin
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Dave Martin @ 2011-06-20 13:40 UTC (permalink / raw)
To: linux-arm-kernel
This makes Image directly bootable; otherwise the kernel is reliant
on the zImage decompressor to switch to the correct instruction
set.
Signed-off-by: Dave Martin <dave.martin@linaro.org>
---
arch/arm/kernel/head.S | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 278c1b0..742b610 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -71,8 +71,16 @@
* crap here - that's what the boot loader (or in extreme, well justified
* circumstances, zImage) is for.
*/
+ .arm
+
__HEAD
ENTRY(stext)
+
+ THUMB( adr r9, BSYM(1f) ) @ Kernel is always entered in ARM.
+ THUMB( bx r9 ) @ If this is a Thumb-2 kernel,
+ THUMB( .thumb ) @ switch to Thumb now.
+ THUMB(1: )
+
setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode
@ and irqs disabled
mrc p15, 0, r9, c0, c0 @ get processor id
--
1.7.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] ARM: head-nommu: Always enter the kernel in ARM state
2011-06-20 13:40 [PATCH 0/4] Consistently enter the kernel in ARM state Dave Martin
2011-06-20 13:40 ` [PATCH 1/4] ARM: head: Always Enter " Dave Martin
@ 2011-06-20 13:40 ` Dave Martin
2011-06-20 13:40 ` [PATCH 3/4] ARM: zImage: Jump to the decompressed kernel entry point " Dave Martin
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Dave Martin @ 2011-06-20 13:40 UTC (permalink / raw)
To: linux-arm-kernel
This makes Image directly bootable; otherwise the kernel is reliant
on the zImage decompressor to switch to the correct instruction
set.
Signed-off-by: Dave Martin <dave.martin@linaro.org>
---
arch/arm/kernel/head-nommu.S | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index 6b1e0ad..d46f259 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -32,8 +32,16 @@
* numbers for r1.
*
*/
+ .arm
+
__HEAD
ENTRY(stext)
+
+ THUMB( adr r9, BSYM(1f) ) @ Kernel is always entered in ARM.
+ THUMB( bx r9 ) @ If this is a Thumb-2 kernel,
+ THUMB( .thumb ) @ switch to Thumb now.
+ THUMB(1: )
+
setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode
@ and irqs disabled
#ifndef CONFIG_CPU_CP15
--
1.7.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] ARM: zImage: Jump to the decompressed kernel entry point in ARM state
2011-06-20 13:40 [PATCH 0/4] Consistently enter the kernel in ARM state Dave Martin
2011-06-20 13:40 ` [PATCH 1/4] ARM: head: Always Enter " Dave Martin
2011-06-20 13:40 ` [PATCH 2/4] ARM: head-nommu: Always enter " Dave Martin
@ 2011-06-20 13:40 ` Dave Martin
2011-06-20 13:40 ` [PATCH 4/4] ARM: Documentation: clarify entry requirements for ARM versus Thumb-2 Dave Martin
2011-06-20 14:01 ` [PATCH 0/4] Consistently enter the kernel in ARM state Nicolas Pitre
4 siblings, 0 replies; 7+ messages in thread
From: Dave Martin @ 2011-06-20 13:40 UTC (permalink / raw)
To: linux-arm-kernel
This change is required in order to enter the kernel correctly
now that the main kernel entry point expects to be called in
ARM state.
Signed-off-by: Dave Martin <dave.martin@linaro.org>
---
arch/arm/boot/compressed/head.S | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index f9da419..51af709 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -353,7 +353,8 @@ not_relocated: mov r0, #0
mov r0, #0 @ must be zero
mov r1, r7 @ restore architecture number
mov r2, r8 @ restore atags pointer
- mov pc, r4 @ call kernel
+ ARM( mov pc, r4 ) @ call kernel
+ THUMB( bx r4 ) @ entry point is always ARM
.align 2
.type LC0, #object
--
1.7.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] ARM: Documentation: clarify entry requirements for ARM versus Thumb-2
2011-06-20 13:40 [PATCH 0/4] Consistently enter the kernel in ARM state Dave Martin
` (2 preceding siblings ...)
2011-06-20 13:40 ` [PATCH 3/4] ARM: zImage: Jump to the decompressed kernel entry point " Dave Martin
@ 2011-06-20 13:40 ` Dave Martin
2011-06-20 14:01 ` [PATCH 0/4] Consistently enter the kernel in ARM state Nicolas Pitre
4 siblings, 0 replies; 7+ messages in thread
From: Dave Martin @ 2011-06-20 13:40 UTC (permalink / raw)
To: linux-arm-kernel
Currently, the kernel entry requirements are not explicit about
whether the kernel should be entered in ARM or Thumb-2.
Now that the boot protocol consistently requires the kernel Image
or zImage to be entered in ARM state, document this requirement
explicitly.
A different rule will be needed for Cortex-M class CPUs as and when
support for these lands upstream, since these CPUs don't support
the ARM instruction set at all: a note is added to the effect that
the kernel must be entered in Thumb on such systems.
Signed-off-by: Dave Martin <dave.martin@linaro.org>
---
Documentation/arm/Booting | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/Documentation/arm/Booting b/Documentation/arm/Booting
index 4e686a2..a341d87 100644
--- a/Documentation/arm/Booting
+++ b/Documentation/arm/Booting
@@ -164,3 +164,8 @@ In either case, the following conditions must be met:
- The boot loader is expected to call the kernel image by jumping
directly to the first instruction of the kernel image.
+ On CPUs supporting the ARM instruction set, the entry must be
+ made in ARM state, even for a Thumb-2 kernel.
+
+ On CPUs supporting only the Thumb instruction set such as
+ Cortex-M class CPUs, the entry must be made in Thumb state.
--
1.7.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 0/4] Consistently enter the kernel in ARM state
2011-06-20 13:40 [PATCH 0/4] Consistently enter the kernel in ARM state Dave Martin
` (3 preceding siblings ...)
2011-06-20 13:40 ` [PATCH 4/4] ARM: Documentation: clarify entry requirements for ARM versus Thumb-2 Dave Martin
@ 2011-06-20 14:01 ` Nicolas Pitre
2011-06-20 14:17 ` Dave Martin
4 siblings, 1 reply; 7+ messages in thread
From: Nicolas Pitre @ 2011-06-20 14:01 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 20 Jun 2011, Dave Martin wrote:
> This series rationalises the kernel entry requirements so that
> Image is entered in ARM state, just like zImage.
>
> This should enable Image to be booted reliably for Thumb-2 kernels,
> just like zImage.
>
> The Booting documentation is updated to describe the requirement:
> this resolves the ARM/Thumb ambiguity for Thumb-2 kernels; for ARM
> kernels there is no implied change.
>
> Dave Martin (4):
> ARM: head: Always Enter the kernel in ARM state
> ARM: head-nommu: Always enter the kernel in ARM state
> ARM: zImage: Jump to the decompressed kernel entry point in ARM state
I'm afraid the above 3 patches will have to be folded together,
otherwise a Thumb2 kernel won't boot if the last patch is not applied,
which might cause problems with git bisect.
Otherwise you can add "Acked-by Nicolas Pitre <nicolas.pitre@linaro.org>"
to all of them.
Nicolas
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 0/4] Consistently enter the kernel in ARM state
2011-06-20 14:01 ` [PATCH 0/4] Consistently enter the kernel in ARM state Nicolas Pitre
@ 2011-06-20 14:17 ` Dave Martin
0 siblings, 0 replies; 7+ messages in thread
From: Dave Martin @ 2011-06-20 14:17 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jun 20, 2011 at 10:01:11AM -0400, Nicolas Pitre wrote:
> On Mon, 20 Jun 2011, Dave Martin wrote:
>
> > This series rationalises the kernel entry requirements so that
> > Image is entered in ARM state, just like zImage.
> >
> > This should enable Image to be booted reliably for Thumb-2 kernels,
> > just like zImage.
> >
> > The Booting documentation is updated to describe the requirement:
> > this resolves the ARM/Thumb ambiguity for Thumb-2 kernels; for ARM
> > kernels there is no implied change.
> >
> > Dave Martin (4):
> > ARM: head: Always Enter the kernel in ARM state
> > ARM: head-nommu: Always enter the kernel in ARM state
> > ARM: zImage: Jump to the decompressed kernel entry point in ARM state
>
> I'm afraid the above 3 patches will have to be folded together,
> otherwise a Thumb2 kernel won't boot if the last patch is not applied,
> which might cause problems with git bisect.
Hmm, I was wondering about that.
> Otherwise you can add "Acked-by Nicolas Pitre <nicolas.pitre@linaro.org>"
> to all of them.
I'll fold the patches together. It's a small series, so that shouldn't
cause trouble for people.
Thanks for the feedback.
Cheers
---Dave
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-06-20 14:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-20 13:40 [PATCH 0/4] Consistently enter the kernel in ARM state Dave Martin
2011-06-20 13:40 ` [PATCH 1/4] ARM: head: Always Enter " Dave Martin
2011-06-20 13:40 ` [PATCH 2/4] ARM: head-nommu: Always enter " Dave Martin
2011-06-20 13:40 ` [PATCH 3/4] ARM: zImage: Jump to the decompressed kernel entry point " Dave Martin
2011-06-20 13:40 ` [PATCH 4/4] ARM: Documentation: clarify entry requirements for ARM versus Thumb-2 Dave Martin
2011-06-20 14:01 ` [PATCH 0/4] Consistently enter the kernel in ARM state Nicolas Pitre
2011-06-20 14:17 ` Dave Martin
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).