Skip to contentSkip to conversation

ARM: tegra: fix build error when THUMB2_KERNEL enabled

PATCH New Joseph Lo 2 participants 4 messages Apr 15, 2013

Subsystems (3)
lore
Share & tools
lore

Joseph Lo

author
#0 lore raw

PATCH 1/3 ARM: tegra: fix build error when THUMB2_KERNEL enabled

This patch fix the build failure when CONFIG_THUBM2_KERNEL enabled. You clould see the error message below:

arch/arm/mach-tegra/sleep-tegra30.S:69: Error: shift must be constant -- `orr r12,r12,r4,lsl r3'

---
 arch/arm/mach-tegra/sleep-tegra30.S | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-tegra/sleep-tegra30.S +3 -1
index 63a15bd..d29dfcc 100644
@@ -66,7 +66,9 @@ ENTRY(tegra30_cpu_shutdown)
 		FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG | \
 		FLOW_CTRL_CSR_ENABLE
 	mov	r4, #(1 << 4)
-	orr	r12, r12, r4, lsl r3
+ ARM(	orr	r12, r12, r4, lsl r3	)
+ THUMB(	lsl	r4, r4, r3		)
+ THUMB(	orr	r12, r12, r4		)
 	str	r12, [r1]
 
 	/* Halt this CPU. */
Signature · 1 line
1.8.2
author
#1 lore raw

PATCH 2/3 ARM: tegra: fix relocation truncated error when THUMB2_KERNEL enabled

The conditional branch instruction in Thumb2 only available to short range. The linker will fail when the conditional branch over the range. Then resulting in link error when generating kernel image. e.g.:

arch/arm/mach-tegra/reset-handler.S:47:(.text+0xf8e):
relocation truncated to fit: R_ARM_THM_JUMP19 against symbol `cpu_resume' defined in .data section in arch/arm/kernel/built-in.o

This patch using a Thumb2 instruction IT (if-then) to have a longer branch range.

---
 arch/arm/mach-tegra/reset-handler.S | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-tegra/reset-handler.S +1 -0
index 1676aba..e6de88a 100644
@@ -44,6 +44,7 @@ ENTRY(tegra_resume)
 
 	cpu_id	r0
 	cmp	r0, #0				@ CPU0?
+ THUMB(	it	ne )
 	bne	cpu_resume			@ no
 
 #ifdef CONFIG_ARCH_TEGRA_3x_SOC
Signature · 1 line
1.8.2
author
#2 lore raw

PATCH 3/3 ARM: tegra: make sure the pointer on 4 byte align when THUMB2_KERNEL enabled

In reply to Joseph Lo

When building kernel with CONFIG_THUMB2_KERNEL, the data pointer in the assembly may not on the 4 byte alignment. Then causing a data abort when accessing the pointer. This patch add a ".align" flag in the head of the pointer. And always using 32-bit ADR Thumb instruction to make sure it won't build failure.

---
 arch/arm/mach-tegra/reset-handler.S | 1 +
 arch/arm/mach-tegra/sleep.h         | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-tegra/reset-handler.S +1 -0
index e6de88a..519a8c5 100644
@@ -83,6 +83,7 @@ ENDPROC(tegra_resume)
 
 #ifdef CONFIG_CACHE_L2X0
 	.globl	l2x0_saved_regs_addr
+	.align
 l2x0_saved_regs_addr:
 	.long	0
 #endif
arch/arm/mach-tegra/sleep.h +2 -1
index 970ebd5..73a49b7 100644
@@ -92,7 +92,8 @@
 
 #ifdef CONFIG_CACHE_L2X0
 .macro l2_cache_resume, tmp1, tmp2, tmp3, phys_l2x0_saved_regs
-	adr	\tmp1, \phys_l2x0_saved_regs
+ ARM(	adr	\tmp1, \phys_l2x0_saved_regs )
+ THUMB(	adr.w	\tmp1, \phys_l2x0_saved_regs )
 	ldr	\tmp1, [\tmp1]
 	ldr	\tmp2, [\tmp1, #L2X0_R_PHY_BASE]
 	ldr	\tmp3, [\tmp2, #L2X0_CTRL]
Signature · 1 line
1.8.2
#3 lore raw

PATCH 1/3 ARM: tegra: fix build error when THUMB2_KERNEL enabled

In reply to Joseph Lo
Quoted 5 lines · Joseph Lo

This patch fix the build failure when CONFIG_THUBM2_KERNEL enabled. You clould see the error message below:

arch/arm/mach-tegra/sleep-tegra30.S:69: Error: shift must be constant -- `orr r12,r12,r4,lsl r3'

I have forwarded the series to the arm-soc maintainers to be applied there. Thanks.