Skip to contentSkip to conversation

arm: Add Kconfig symbols used for Linux asm compatibility

PATCH New Phil Edworthy 3 participants 7 messages Jun 1, 2017 – Jun 9, 2017 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 arm: Add Kconfig symbols used for Linux asm compatibility

Rather than change asm files that come from Linux, add the symbols to Kconfig. Since one of the symbols is for thumb2 builds, make CPU_V7M always select them.

---
 arch/arm/Kconfig      | 10 ++++++++++
 arch/arm/lib/Makefile |  2 --
 2 files changed, 10 insertions(+), 2 deletions(-)
arch/arm/Kconfig +10 -0
index 2a3a36e..2793651 100644
@@ -19,6 +19,15 @@ config HAS_VBAR
 config HAS_THUMB2
 	bool
 
+# Used for compatibility with asm files copied from the kernel
+config ARM_ASM_UNIFIED
+	bool
+	default y
+
+# Used for compatibility with asm files copied from the kernel
+config THUMB2_KERNEL
+	bool
+
 # If set, the workarounds for these ARM errata are applied early during U-Boot
 # startup. Note that in general these options force the workarounds to be
 # applied; no CPU-type/version detection exists, unlike the similar options in
@@ -128,6 +137,7 @@ config CPU_V7
 config CPU_V7M
 	bool
 	select HAS_THUMB2
+	select THUMB2_KERNEL
 	select SYS_CACHE_SHIFT_5
 
 config CPU_PXA
arch/arm/lib/Makefile +0 -2
index f162c14..6e1c436 100644
@@ -72,8 +72,6 @@ ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
 extra-y	+= eabi_compat.o
 endif
 
-asflags-y += -DCONFIG_ARM_ASM_UNIFIED
-
 # some files can only build in ARM or THUMB2, not THUMB1
 
 ifdef CONFIG_$(SPL_)SYS_THUMB_BUILD
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 2/2 armv7m: Fix larger builds

The branch instruction only has an 11-bit relative target address, which is sometimes not enough.

---
v3:
- Move CONFIG_ARM_ASM_UNIFIED and CONFIG_THUMB2_KERNEL to Kconfig
v2:
- Use W(b) instead of ldr+mov. Using this macro requires CONFIG_ARM_ASM_UNIFIED and CONFIG_THUMB2_KERNEL to be defined.

---
 arch/arm/cpu/armv7m/start.S | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7m/start.S +3 -1
index 49f2720..890c773 100644
@@ -5,10 +5,12 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
+#include <asm/assembler.h>
+
 .globl	reset
 .type reset, %function
 reset:
-	b	_main
+	W(b)	_main
 
 .globl	c_runtime_cpu_setup
 c_runtime_cpu_setup:
Signature · 1 line
2.7.4
#2 lore raw

PATCH v3 2/2 armv7m: Fix larger builds

Quoted 4 lines · Phil Edworthy

The branch instruction only has an 11-bit relative target address, which is sometimes not enough.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170605/a9d0527b/attachment.sig>
#3 lore raw

PATCH 1/2 arm: Add Kconfig symbols used for Linux asm compatibility

In reply to Phil Edworthy
Quoted 5 lines · Phil Edworthy

Rather than change asm files that come from Linux, add the symbols to Kconfig. Since one of the symbols is for thumb2 builds, make CPU_V7M always select them.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170605/afcb6da2/attachment.sig>
#4 lore raw

PATCH 1/2 arm: Add Kconfig symbols used for Linux asm compatibility

In reply to Phil Edworthy

Hi Albert/Tom,

Quoted 21 lines

-----Original Message-----
From: Phil Edworthy [mailto:phil.edworthy at renesas.com]
Sent: Wednesday, May 31, 2017 11:33 PM
To: Albert Aribaud <[email protected]>
Cc: Tom Rini <[email protected]>; Vikas MANOCHA <[email protected]>; Kamil Lulko <[email protected]>; u- boot at lists.denx.de; Phil Edworthy <[email protected]>
Subject: [PATCH 1/2] arm: Add Kconfig symbols used for Linux asm compatibility

Rather than change asm files that come from Linux, add the symbols to Kconfig. Since one of the symbols is for thumb2 builds, make CPU_V7M always select them.

---
 arch/arm/Kconfig      | 10 ++++++++++
 arch/arm/lib/Makefile |  2 --
 2 files changed, 10 insertions(+), 2 deletions(-)

arch/arm/Kconfig config HAS_VBAR · line 25

Quoted 7 lines
arch/arm/Kconfig renamed from arch/arm/Kconfigl +4 -0
@@ -19,6 +19,15 @@ config HAS_VBAR
 config HAS_THUMB2
 	bool
 
+# Used for compatibility with asm files copied from the kernel config
+ARM_ASM_UNIFIED
+	bool
+	default y

Is every arm arch (arm720, arm926 etc) assembly code written for unified ? Otherwise we might have run-time side effects.

Cheers,
Vikas

Quoted 28 lines
arch/arm/Kconfig renamed from arch/arm/Kconfigl +5 -0
+
+# Used for compatibility with asm files copied from the kernel config
+THUMB2_KERNEL
+	bool
+
 # If set, the workarounds for these ARM errata are applied early during U-Boot  # startup. Note that in general these options force

the workarounds to be # applied; no CPU-type/version detection exists, unlike the similar options in @@ -128,6 +137,7 @@ config CPU_V7 config CPU_V7M

arch/arm/Kconfig renamed from arch/arm/Kconfigl +1 -0
 	bool
 	select HAS_THUMB2
+	select THUMB2_KERNEL
 	select SYS_CACHE_SHIFT_5
 
 config CPU_PXA
arch/arm/lib/Makefile +0 -3
@@ -72,8 +72,6 @@ ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
 extra-y	+= eabi_compat.o
 endif
 
-asflags-y += -DCONFIG_ARM_ASM_UNIFIED
-
 # some files can only build in ARM or THUMB2, not THUMB1
 
 ifdef CONFIG_$(SPL_)SYS_THUMB_BUILD
--

2.7.4

#5 lore raw

PATCH 1/2 arm: Add Kconfig symbols used for Linux asm compatibility

Quoted 26 lines · Vikas MANOCHA

Hi Albert/Tom,

Quoted 24 lines

-----Original Message-----
From: Phil Edworthy [mailto:phil.edworthy at renesas.com]
Sent: Wednesday, May 31, 2017 11:33 PM
To: Albert Aribaud <[email protected]>
Cc: Tom Rini <[email protected]>; Vikas MANOCHA <[email protected]>; Kamil Lulko <[email protected]>; u- boot at lists.denx.de; Phil Edworthy <[email protected]>
Subject: [PATCH 1/2] arm: Add Kconfig symbols used for Linux asm compatibility

Rather than change asm files that come from Linux, add the symbols to Kconfig. Since one of the symbols is for thumb2 builds, make CPU_V7M always select them.

---
 arch/arm/Kconfig      | 10 ++++++++++
 arch/arm/lib/Makefile |  2 --
 2 files changed, 10 insertions(+), 2 deletions(-)
arch/arm/Kconfig renamed from arch/arm/Kconfigl +0 -0
@@ -19,6 +19,15 @@ config HAS_VBAR
 config HAS_THUMB2
 	bool
 
Quoted 7 lines

arch/arm/Kconfig config HAS_VBAR · line 25

Quoted 4 lines
arch/arm/Kconfig renamed from arch/arm/Kconfigl +4 -0
+# Used for compatibility with asm files copied from the kernel config
+ARM_ASM_UNIFIED
+	bool
+	default y

Is every arm arch (arm720, arm926 etc) assembly code written for unified ? Otherwise we might have run-time side effects.

I could be missing something, but this is only used by <asm/assembler.h> and in turn only by arch/arm/lib/*.S, where we already had been defining this.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170608/0a255a7a/attachment.sig>
#6 lore raw

PATCH 1/2 arm: Add Kconfig symbols used for Linux asm compatibility

Hi Tom,

Quoted 47 lines

-----Original Message-----
From: Tom Rini [mailto:trini at konsulko.com]
Sent: Thursday, June 08, 2017 5:12 PM
To: Vikas MANOCHA <[email protected]>
Cc: Phil Edworthy <[email protected]>; Albert Aribaud <[email protected]>; Kamil Lulko <[email protected]>; u-boot at lists.denx.de
Subject: Re: [PATCH 1/2] arm: Add Kconfig symbols used for Linux asm compatibility

Quoted 29 lines · Vikas MANOCHA

Hi Albert/Tom,

Quoted 27 lines

-----Original Message-----
From: Phil Edworthy [mailto:phil.edworthy at renesas.com]
Sent: Wednesday, May 31, 2017 11:33 PM
To: Albert Aribaud <[email protected]>
Cc: Tom Rini <[email protected]>; Vikas MANOCHA <[email protected]>; Kamil Lulko <[email protected]>; u- boot at lists.denx.de; Phil Edworthy <[email protected]>
Subject: [PATCH 1/2] arm: Add Kconfig symbols used for Linux asm compatibility

Rather than change asm files that come from Linux, add the symbols
to Kconfig. Since one of the symbols is for thumb2 builds, make CPU_V7M always select them.

---
 arch/arm/Kconfig      | 10 ++++++++++
 arch/arm/lib/Makefile |  2 --
 2 files changed, 10 insertions(+), 2 deletions(-)
arch/arm/Kconfig index renamed from arch/arm/Kconfig +0 -0

2a3a36e..2793651 100644

arch/arm/Kconfig renamed from arch/arm/Kconfigl +0 -0
@@ -19,6 +19,15 @@ config HAS_VBAR
 config HAS_THUMB2
 	bool
 
Quoted 7 lines

arch/arm/Kconfig config HAS_VBAR · line 25

Quoted 4 lines
arch/arm/Kconfig renamed from arch/arm/Kconfigl +4 -0
+# Used for compatibility with asm files copied from the kernel
+config ARM_ASM_UNIFIED
+	bool
+	default y

Is every arm arch (arm720, arm926 etc) assembly code written for unified ? Otherwise we might have run-time side effects.

Quoted 2 lines

I could be missing something, but this is only used by <asm/assembler.h> and in turn only by arch/arm/lib/*.S, where we already had been defining this.

Yes, you are right. I was under the impression that asm/assembler.h is being used by all arm archs everywhere like startup code, cache mgt etc.

Cheers,
Vikas

Quoted 3 lines

--
Tom