All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] arm64: tidy up POSITION_INDEPENDENT feature and enable it for Socionext SoCs
@ 2019-06-26  4:51 Masahiro Yamada
  2019-06-26  4:51 ` [U-Boot] [PATCH 1/2] arm64: add an option to switch visibility of CONFIG_SYS_INIT_SP_BSS_OFFSET Masahiro Yamada
  2019-06-26  4:51 ` [U-Boot] [PATCH 2/2] ARM: uniphier_v8_defconfig: make 64bit SoC image position independent Masahiro Yamada
  0 siblings, 2 replies; 6+ messages in thread
From: Masahiro Yamada @ 2019-06-26  4:51 UTC (permalink / raw)
  To: u-boot


1/2 needs ACK from NVIDIA folks.

I want to enable it in 2/2 for my platform.



Masahiro Yamada (2):
  arm64: add an option to switch visibility of
    CONFIG_SYS_INIT_SP_BSS_OFFSET
  ARM: uniphier_v8_defconfig: make 64bit SoC image position independent

 Makefile                                      |  4 ++--
 arch/arm/Kconfig                              | 20 ++++++++++++++-----
 .../armv8/linux-kernel-image-header-vars.h    |  2 +-
 arch/arm/lib/crt0_64.S                        |  2 +-
 arch/arm/mach-tegra/Kconfig                   |  1 +
 arch/arm/mach-tegra/tegra186/Kconfig          |  3 ---
 arch/arm/mach-tegra/tegra210/Kconfig          |  3 ---
 configs/uniphier_v8_defconfig                 |  4 +++-
 8 files changed, 23 insertions(+), 16 deletions(-)

-- 
2.17.1

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

* [U-Boot] [PATCH 1/2] arm64: add an option to switch visibility of CONFIG_SYS_INIT_SP_BSS_OFFSET
  2019-06-26  4:51 [U-Boot] [PATCH 0/2] arm64: tidy up POSITION_INDEPENDENT feature and enable it for Socionext SoCs Masahiro Yamada
@ 2019-06-26  4:51 ` Masahiro Yamada
  2019-06-27  0:45   ` AKASHI Takahiro
  2019-07-01 21:48   ` Stephen Warren
  2019-06-26  4:51 ` [U-Boot] [PATCH 2/2] ARM: uniphier_v8_defconfig: make 64bit SoC image position independent Masahiro Yamada
  1 sibling, 2 replies; 6+ messages in thread
From: Masahiro Yamada @ 2019-06-26  4:51 UTC (permalink / raw)
  To: u-boot

By default, CONFIG_SYS_INIT_SP_BSS_OFFSET was made invisible by not
giving a prompt to it.

The only way to define it is to hard-code an extra entry in SoC/board
Kconfig, like arch/arm/mach-tegra/tegra{186,210}/Kconfig.

Add a prompt to it in order to allow defconfig files to specify the
value of CONFIG_SYS_INIT_SP_BSS_OFFSET.

With this, CONFIG_SYS_INIT_SP_BSS_OFFSET would become always visible.
So, we need a new bool option to turn it off by default.

I move the 'default 524288' to the common place. This value is not too
big, but is big enough to avoid the overwrap of DT in most platforms.
If 512KB is not a suitable choice for your platform, you can change it
from your defconfig or menuconfig etc.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

Perhaps, another idea is to use "offset from TEXT_BASE",
allowing a negative offset value.

For example, include/configs/uniphier.h defines:

  #define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SYS_TEXT_BASE)

My intention is, allocate the early stack _before_ the U-Boot binary,
not after it.

With this, I do not need to care about the region conflict with
other sections.

The disadvantage of this approach is, you cannot load U-Boot
to the very start of the memory.

Just an idea.


 Makefile                                      |  4 ++--
 arch/arm/Kconfig                              | 20 ++++++++++++++-----
 .../armv8/linux-kernel-image-header-vars.h    |  2 +-
 arch/arm/lib/crt0_64.S                        |  2 +-
 arch/arm/mach-tegra/Kconfig                   |  1 +
 arch/arm/mach-tegra/tegra186/Kconfig          |  3 ---
 arch/arm/mach-tegra/tegra210/Kconfig          |  3 ---
 7 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/Makefile b/Makefile
index 6335834d12e1..9a5afd3098ce 100644
--- a/Makefile
+++ b/Makefile
@@ -874,7 +874,7 @@ ifneq ($(CONFIG_BUILD_TARGET),)
 ALL-y += $(CONFIG_BUILD_TARGET:"%"=%)
 endif
 
-ifneq ($(CONFIG_SYS_INIT_SP_BSS_OFFSET),)
+ifdef CONFIG_INIT_SP_RELATIVE
 ALL-y += init_sp_bss_offset_check
 endif
 
@@ -1155,7 +1155,7 @@ binary_size_check: u-boot-nodtb.bin FORCE
 		fi \
 	fi
 
-ifneq ($(CONFIG_SYS_INIT_SP_BSS_OFFSET),)
+ifdef CONFIG_INIT_SP_RELATIVE
 ifneq ($(CONFIG_SYS_MALLOC_F_LEN),)
 subtract_sys_malloc_f_len = space=$$(($${space} - $(CONFIG_SYS_MALLOC_F_LEN)))
 else
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f5a7630e4f99..87541977259c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -20,15 +20,25 @@ config POSITION_INDEPENDENT
 	  information that is embedded into the binary to support U-Boot
 	  relocating itself to the top-of-RAM later during execution.
 
-config SYS_INIT_SP_BSS_OFFSET
-	int
+config INIT_SP_RELATIVE
+	bool "Specify the early stack pointer relative to the .bss section"
 	help
 	  U-Boot typically uses a hard-coded value for the stack pointer
-	  before relocation. Define this option to instead calculate the
+	  before relocation. Enable this option to instead calculate the
 	  initial SP at run-time. This is useful to avoid hard-coding addresses
 	  into U-Boot, so that can be loaded and executed at arbitrary
-	  addresses and thus avoid using arbitrary addresses at runtime. This
-	  option's value is the offset added to &_bss_start in order to
+	  addresses and thus avoid using arbitrary addresses at runtime.
+
+	  If this option is enabled, the early stack pointer is set to
+	  &_bss_start with a offset value added. The offset is specified by
+	  SYS_INIT_SP_BSS_OFFSET.
+
+config SYS_INIT_SP_BSS_OFFSET
+	int "Early stack offset from the .bss base address"
+	depends on INIT_SP_RELATIVE
+	default 524288
+	help
+	  This option's value is the offset added to &_bss_start in order to
 	  calculate the stack pointer. This offset should be large enough so
 	  that the early malloc region, global data (gd), and early stack usage
 	  do not overlap any appended DTB.
diff --git a/arch/arm/cpu/armv8/linux-kernel-image-header-vars.h b/arch/arm/cpu/armv8/linux-kernel-image-header-vars.h
index fa6e86d1c24b..b4220e4936f0 100644
--- a/arch/arm/cpu/armv8/linux-kernel-image-header-vars.h
+++ b/arch/arm/cpu/armv8/linux-kernel-image-header-vars.h
@@ -48,7 +48,7 @@
 #define __MAX(a, b)		(((a) > (b)) ? (a) : (b))
 #define __CODE_DATA_SIZE	(__bss_start - _start)
 #define __BSS_SIZE		(__bss_end - __bss_start)
-#ifdef CONFIG_SYS_INIT_SP_BSS_OFFSET
+#ifdef CONFIG_INIT_SP_RELATIVE
 #define __MAX_EXTRA_RAM_USAGE	__MAX(__BSS_SIZE, CONFIG_SYS_INIT_SP_BSS_OFFSET)
 #else
 #define __MAX_EXTRA_RAM_USAGE	__BSS_SIZE
diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
index d6b632aa87d1..e76b25a03e8c 100644
--- a/arch/arm/lib/crt0_64.S
+++ b/arch/arm/lib/crt0_64.S
@@ -72,7 +72,7 @@ ENTRY(_main)
 	ldr	x0, =(CONFIG_TPL_STACK)
 #elif defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
 	ldr	x0, =(CONFIG_SPL_STACK)
-#elif defined(CONFIG_SYS_INIT_SP_BSS_OFFSET)
+#elif defined(CONFIG_INIT_SP_RELATIVE)
 	adr	x0, __bss_start
 	add	x0, x0, #CONFIG_SYS_INIT_SP_BSS_OFFSET
 #else
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 97e22ead5985..ff9f29f2d5d0 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -86,6 +86,7 @@ config TEGRA_ARMV7_COMMON
 config TEGRA_ARMV8_COMMON
 	bool "Tegra 64-bit common options"
 	select ARM64
+	select INIT_SP_RELATIVE
 	select LINUX_KERNEL_IMAGE_HEADER
 	select POSITION_INDEPENDENT
 	select TEGRA_COMMON
diff --git a/arch/arm/mach-tegra/tegra186/Kconfig b/arch/arm/mach-tegra/tegra186/Kconfig
index 479c0955eec6..b2e53b58caf8 100644
--- a/arch/arm/mach-tegra/tegra186/Kconfig
+++ b/arch/arm/mach-tegra/tegra186/Kconfig
@@ -21,9 +21,6 @@ endchoice
 config SYS_SOC
 	default "tegra186"
 
-config SYS_INIT_SP_BSS_OFFSET
-	default 524288
-
 source "board/nvidia/p2771-0000/Kconfig"
 
 endif
diff --git a/arch/arm/mach-tegra/tegra210/Kconfig b/arch/arm/mach-tegra/tegra210/Kconfig
index 250738aed312..3637473051b8 100644
--- a/arch/arm/mach-tegra/tegra210/Kconfig
+++ b/arch/arm/mach-tegra/tegra210/Kconfig
@@ -40,9 +40,6 @@ endchoice
 config SYS_SOC
 	default "tegra210"
 
-config SYS_INIT_SP_BSS_OFFSET
-	default 524288
-
 source "board/nvidia/e2220-1170/Kconfig"
 source "board/nvidia/p2371-0000/Kconfig"
 source "board/nvidia/p2371-2180/Kconfig"
-- 
2.17.1

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

* [U-Boot] [PATCH 2/2] ARM: uniphier_v8_defconfig: make 64bit SoC image position independent
  2019-06-26  4:51 [U-Boot] [PATCH 0/2] arm64: tidy up POSITION_INDEPENDENT feature and enable it for Socionext SoCs Masahiro Yamada
  2019-06-26  4:51 ` [U-Boot] [PATCH 1/2] arm64: add an option to switch visibility of CONFIG_SYS_INIT_SP_BSS_OFFSET Masahiro Yamada
@ 2019-06-26  4:51 ` Masahiro Yamada
  1 sibling, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2019-06-26  4:51 UTC (permalink / raw)
  To: u-boot

For a planned new SoC in this SoC family, the base address of the
DRAM will be changed from 0x80000000 to 0x20000000.

The PIE support will be useful to maintain multiple similar SoCs
whose DRAM addresses are different.

Now CONFIG_SYS_TEXT_BASE is not important. I just set it to 0
to ensure CONFIG_POSITION_INDEPENDENT is working.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 configs/uniphier_v8_defconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/configs/uniphier_v8_defconfig b/configs/uniphier_v8_defconfig
index 83f78776b7d2..3908ff80d6b0 100644
--- a/configs/uniphier_v8_defconfig
+++ b/configs/uniphier_v8_defconfig
@@ -1,7 +1,9 @@
 CONFIG_ARM=y
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_INIT_SP_RELATIVE=y
 CONFIG_ARM_SMCCC=y
 CONFIG_ARCH_UNIPHIER=y
-CONFIG_SYS_TEXT_BASE=0x84000000
+CONFIG_SYS_TEXT_BASE=0x00000000
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_NR_DRAM_BANKS=3
 CONFIG_ARCH_UNIPHIER_V8_MULTI=y
-- 
2.17.1

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

* [U-Boot] [PATCH 1/2] arm64: add an option to switch visibility of CONFIG_SYS_INIT_SP_BSS_OFFSET
  2019-06-26  4:51 ` [U-Boot] [PATCH 1/2] arm64: add an option to switch visibility of CONFIG_SYS_INIT_SP_BSS_OFFSET Masahiro Yamada
@ 2019-06-27  0:45   ` AKASHI Takahiro
  2019-06-27  7:55     ` Masahiro Yamada
  2019-07-01 21:48   ` Stephen Warren
  1 sibling, 1 reply; 6+ messages in thread
From: AKASHI Takahiro @ 2019-06-27  0:45 UTC (permalink / raw)
  To: u-boot

Yamada-san,

On Wed, Jun 26, 2019 at 01:51:46PM +0900, Masahiro Yamada wrote:
> By default, CONFIG_SYS_INIT_SP_BSS_OFFSET was made invisible by not
> giving a prompt to it.
> 
> The only way to define it is to hard-code an extra entry in SoC/board
> Kconfig, like arch/arm/mach-tegra/tegra{186,210}/Kconfig.
> 
> Add a prompt to it in order to allow defconfig files to specify the
> value of CONFIG_SYS_INIT_SP_BSS_OFFSET.
> 
> With this, CONFIG_SYS_INIT_SP_BSS_OFFSET would become always visible.
> So, we need a new bool option to turn it off by default.
> 
> I move the 'default 524288' to the common place. This value is not too
> big, but is big enough to avoid the overwrap of DT in most platforms.
> If 512KB is not a suitable choice for your platform, you can change it
> from your defconfig or menuconfig etc.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
> Perhaps, another idea is to use "offset from TEXT_BASE",
> allowing a negative offset value.
> 
> For example, include/configs/uniphier.h defines:
> 
>   #define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SYS_TEXT_BASE)
> 
> My intention is, allocate the early stack _before_ the U-Boot binary,
> not after it.
> 
> With this, I do not need to care about the region conflict with
> other sections.
> 
> The disadvantage of this approach is, you cannot load U-Boot
> to the very start of the memory.
> 
> Just an idea.
> 
> 
>  Makefile                                      |  4 ++--
>  arch/arm/Kconfig                              | 20 ++++++++++++++-----
>  .../armv8/linux-kernel-image-header-vars.h    |  2 +-
>  arch/arm/lib/crt0_64.S                        |  2 +-
>  arch/arm/mach-tegra/Kconfig                   |  1 +
>  arch/arm/mach-tegra/tegra186/Kconfig          |  3 ---
>  arch/arm/mach-tegra/tegra210/Kconfig          |  3 ---
>  7 files changed, 20 insertions(+), 15 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 6335834d12e1..9a5afd3098ce 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -874,7 +874,7 @@ ifneq ($(CONFIG_BUILD_TARGET),)
>  ALL-y += $(CONFIG_BUILD_TARGET:"%"=%)
>  endif
>  
> -ifneq ($(CONFIG_SYS_INIT_SP_BSS_OFFSET),)
> +ifdef CONFIG_INIT_SP_RELATIVE
>  ALL-y += init_sp_bss_offset_check

This config/target will create a dependency of u-boot.dtb target,
and it will cause an error in building dtbs for qemu_arm64
which doesn't expect any dtb. You will see messages like:
>>>
Device Tree Source is not correctly specified.
Please define 'CONFIG_DEFAULT_DEVICE_TREE'
or build with 'DEVICE_TREE=<device_tree>' argument

/home/akashi/arm/armv8/linaro/u-boot/dts/Makefile:28: recipe for target 'arch/arm/dts/unset.dtb' failed
make[2]: *** [arch/arm/dts/unset.dtb] Error 1
/home/akashi/arm/armv8/linaro/u-boot/Makefile:1052: recipe for target 'dts/dt.dtb' failed
make[1]: *** [dts/dt.dtb] Error 2
<<<

-Takahiro Akashi


>  endif
>  
> @@ -1155,7 +1155,7 @@ binary_size_check: u-boot-nodtb.bin FORCE
>  		fi \
>  	fi
>  
> -ifneq ($(CONFIG_SYS_INIT_SP_BSS_OFFSET),)
> +ifdef CONFIG_INIT_SP_RELATIVE
>  ifneq ($(CONFIG_SYS_MALLOC_F_LEN),)
>  subtract_sys_malloc_f_len = space=$$(($${space} - $(CONFIG_SYS_MALLOC_F_LEN)))
>  else
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index f5a7630e4f99..87541977259c 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -20,15 +20,25 @@ config POSITION_INDEPENDENT
>  	  information that is embedded into the binary to support U-Boot
>  	  relocating itself to the top-of-RAM later during execution.
>  
> -config SYS_INIT_SP_BSS_OFFSET
> -	int
> +config INIT_SP_RELATIVE
> +	bool "Specify the early stack pointer relative to the .bss section"
>  	help
>  	  U-Boot typically uses a hard-coded value for the stack pointer
> -	  before relocation. Define this option to instead calculate the
> +	  before relocation. Enable this option to instead calculate the
>  	  initial SP at run-time. This is useful to avoid hard-coding addresses
>  	  into U-Boot, so that can be loaded and executed at arbitrary
> -	  addresses and thus avoid using arbitrary addresses at runtime. This
> -	  option's value is the offset added to &_bss_start in order to
> +	  addresses and thus avoid using arbitrary addresses at runtime.
> +
> +	  If this option is enabled, the early stack pointer is set to
> +	  &_bss_start with a offset value added. The offset is specified by
> +	  SYS_INIT_SP_BSS_OFFSET.
> +
> +config SYS_INIT_SP_BSS_OFFSET
> +	int "Early stack offset from the .bss base address"
> +	depends on INIT_SP_RELATIVE
> +	default 524288
> +	help
> +	  This option's value is the offset added to &_bss_start in order to
>  	  calculate the stack pointer. This offset should be large enough so
>  	  that the early malloc region, global data (gd), and early stack usage
>  	  do not overlap any appended DTB.
> diff --git a/arch/arm/cpu/armv8/linux-kernel-image-header-vars.h b/arch/arm/cpu/armv8/linux-kernel-image-header-vars.h
> index fa6e86d1c24b..b4220e4936f0 100644
> --- a/arch/arm/cpu/armv8/linux-kernel-image-header-vars.h
> +++ b/arch/arm/cpu/armv8/linux-kernel-image-header-vars.h
> @@ -48,7 +48,7 @@
>  #define __MAX(a, b)		(((a) > (b)) ? (a) : (b))
>  #define __CODE_DATA_SIZE	(__bss_start - _start)
>  #define __BSS_SIZE		(__bss_end - __bss_start)
> -#ifdef CONFIG_SYS_INIT_SP_BSS_OFFSET
> +#ifdef CONFIG_INIT_SP_RELATIVE
>  #define __MAX_EXTRA_RAM_USAGE	__MAX(__BSS_SIZE, CONFIG_SYS_INIT_SP_BSS_OFFSET)
>  #else
>  #define __MAX_EXTRA_RAM_USAGE	__BSS_SIZE
> diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
> index d6b632aa87d1..e76b25a03e8c 100644
> --- a/arch/arm/lib/crt0_64.S
> +++ b/arch/arm/lib/crt0_64.S
> @@ -72,7 +72,7 @@ ENTRY(_main)
>  	ldr	x0, =(CONFIG_TPL_STACK)
>  #elif defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
>  	ldr	x0, =(CONFIG_SPL_STACK)
> -#elif defined(CONFIG_SYS_INIT_SP_BSS_OFFSET)
> +#elif defined(CONFIG_INIT_SP_RELATIVE)
>  	adr	x0, __bss_start
>  	add	x0, x0, #CONFIG_SYS_INIT_SP_BSS_OFFSET
>  #else
> diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
> index 97e22ead5985..ff9f29f2d5d0 100644
> --- a/arch/arm/mach-tegra/Kconfig
> +++ b/arch/arm/mach-tegra/Kconfig
> @@ -86,6 +86,7 @@ config TEGRA_ARMV7_COMMON
>  config TEGRA_ARMV8_COMMON
>  	bool "Tegra 64-bit common options"
>  	select ARM64
> +	select INIT_SP_RELATIVE
>  	select LINUX_KERNEL_IMAGE_HEADER
>  	select POSITION_INDEPENDENT
>  	select TEGRA_COMMON
> diff --git a/arch/arm/mach-tegra/tegra186/Kconfig b/arch/arm/mach-tegra/tegra186/Kconfig
> index 479c0955eec6..b2e53b58caf8 100644
> --- a/arch/arm/mach-tegra/tegra186/Kconfig
> +++ b/arch/arm/mach-tegra/tegra186/Kconfig
> @@ -21,9 +21,6 @@ endchoice
>  config SYS_SOC
>  	default "tegra186"
>  
> -config SYS_INIT_SP_BSS_OFFSET
> -	default 524288
> -
>  source "board/nvidia/p2771-0000/Kconfig"
>  
>  endif
> diff --git a/arch/arm/mach-tegra/tegra210/Kconfig b/arch/arm/mach-tegra/tegra210/Kconfig
> index 250738aed312..3637473051b8 100644
> --- a/arch/arm/mach-tegra/tegra210/Kconfig
> +++ b/arch/arm/mach-tegra/tegra210/Kconfig
> @@ -40,9 +40,6 @@ endchoice
>  config SYS_SOC
>  	default "tegra210"
>  
> -config SYS_INIT_SP_BSS_OFFSET
> -	default 524288
> -
>  source "board/nvidia/e2220-1170/Kconfig"
>  source "board/nvidia/p2371-0000/Kconfig"
>  source "board/nvidia/p2371-2180/Kconfig"
> -- 
> 2.17.1
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

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

* [U-Boot] [PATCH 1/2] arm64: add an option to switch visibility of CONFIG_SYS_INIT_SP_BSS_OFFSET
  2019-06-27  0:45   ` AKASHI Takahiro
@ 2019-06-27  7:55     ` Masahiro Yamada
  0 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2019-06-27  7:55 UTC (permalink / raw)
  To: u-boot

Hi AKASHI-san

On Thu, Jun 27, 2019 at 9:44 AM AKASHI Takahiro
<takahiro.akashi@linaro.org> wrote:
>
> Yamada-san,
>
> On Wed, Jun 26, 2019 at 01:51:46PM +0900, Masahiro Yamada wrote:
> > By default, CONFIG_SYS_INIT_SP_BSS_OFFSET was made invisible by not
> > giving a prompt to it.
> >
> > The only way to define it is to hard-code an extra entry in SoC/board
> > Kconfig, like arch/arm/mach-tegra/tegra{186,210}/Kconfig.
> >
> > Add a prompt to it in order to allow defconfig files to specify the
> > value of CONFIG_SYS_INIT_SP_BSS_OFFSET.
> >
> > With this, CONFIG_SYS_INIT_SP_BSS_OFFSET would become always visible.
> > So, we need a new bool option to turn it off by default.
> >
> > I move the 'default 524288' to the common place. This value is not too
> > big, but is big enough to avoid the overwrap of DT in most platforms.
> > If 512KB is not a suitable choice for your platform, you can change it
> > from your defconfig or menuconfig etc.
> >
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> > ---
> >
> > Perhaps, another idea is to use "offset from TEXT_BASE",
> > allowing a negative offset value.
> >
> > For example, include/configs/uniphier.h defines:
> >
> >   #define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SYS_TEXT_BASE)
> >
> > My intention is, allocate the early stack _before_ the U-Boot binary,
> > not after it.
> >
> > With this, I do not need to care about the region conflict with
> > other sections.
> >
> > The disadvantage of this approach is, you cannot load U-Boot
> > to the very start of the memory.
> >
> > Just an idea.
> >
> >
> >  Makefile                                      |  4 ++--
> >  arch/arm/Kconfig                              | 20 ++++++++++++++-----
> >  .../armv8/linux-kernel-image-header-vars.h    |  2 +-
> >  arch/arm/lib/crt0_64.S                        |  2 +-
> >  arch/arm/mach-tegra/Kconfig                   |  1 +
> >  arch/arm/mach-tegra/tegra186/Kconfig          |  3 ---
> >  arch/arm/mach-tegra/tegra210/Kconfig          |  3 ---
> >  7 files changed, 20 insertions(+), 15 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 6335834d12e1..9a5afd3098ce 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -874,7 +874,7 @@ ifneq ($(CONFIG_BUILD_TARGET),)
> >  ALL-y += $(CONFIG_BUILD_TARGET:"%"=%)
> >  endif
> >
> > -ifneq ($(CONFIG_SYS_INIT_SP_BSS_OFFSET),)
> > +ifdef CONFIG_INIT_SP_RELATIVE
> >  ALL-y += init_sp_bss_offset_check
>
> This config/target will create a dependency of u-boot.dtb target,
> and it will cause an error in building dtbs for qemu_arm64
> which doesn't expect any dtb. You will see messages like:
> >>>
> Device Tree Source is not correctly specified.
> Please define 'CONFIG_DEFAULT_DEVICE_TREE'
> or build with 'DEVICE_TREE=<device_tree>' argument
>
> /home/akashi/arm/armv8/linaro/u-boot/dts/Makefile:28: recipe for target 'arch/arm/dts/unset.dtb' failed
> make[2]: *** [arch/arm/dts/unset.dtb] Error 1
> /home/akashi/arm/armv8/linaro/u-boot/Makefile:1052: recipe for target 'dts/dt.dtb' failed
> make[1]: *** [dts/dt.dtb] Error 2
> <<<


Nope. I do not see any build error for qemu_arm64_defconfig

Probably because you *locally* defined
CONFIG_INIT_SP_RELATIVE=y



Moreover, the line causing this issue is this:

init_sp_bss_offset_check: u-boot.dtb FORCE


..., which was added by the following commit:

commit 5fed97af20da955625cc06563a725b49cebb99eb
Author: Stephen Warren <swarren@nvidia.com>
Date:   Tue Jan 9 12:52:14 2018 -0700

    Makefile: ensure DTB doesn't overflow into initial stack



If you want to fix it, a patch is welcome,
but my patch is innocent.

Thanks.

-- 
Best Regards
Masahiro Yamada

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

* [U-Boot] [PATCH 1/2] arm64: add an option to switch visibility of CONFIG_SYS_INIT_SP_BSS_OFFSET
  2019-06-26  4:51 ` [U-Boot] [PATCH 1/2] arm64: add an option to switch visibility of CONFIG_SYS_INIT_SP_BSS_OFFSET Masahiro Yamada
  2019-06-27  0:45   ` AKASHI Takahiro
@ 2019-07-01 21:48   ` Stephen Warren
  1 sibling, 0 replies; 6+ messages in thread
From: Stephen Warren @ 2019-07-01 21:48 UTC (permalink / raw)
  To: u-boot

On 6/25/19 10:51 PM, Masahiro Yamada wrote:
> By default, CONFIG_SYS_INIT_SP_BSS_OFFSET was made invisible by not
> giving a prompt to it.
> 
> The only way to define it is to hard-code an extra entry in SoC/board
> Kconfig, like arch/arm/mach-tegra/tegra{186,210}/Kconfig.
> 
> Add a prompt to it in order to allow defconfig files to specify the
> value of CONFIG_SYS_INIT_SP_BSS_OFFSET.
> 
> With this, CONFIG_SYS_INIT_SP_BSS_OFFSET would become always visible.
> So, we need a new bool option to turn it off by default.
> 
> I move the 'default 524288' to the common place. This value is not too
> big, but is big enough to avoid the overwrap of DT in most platforms.
> If 512KB is not a suitable choice for your platform, you can change it
> from your defconfig or menuconfig etc.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Acked-by: Stephen Warren <swarren@nvidia.com>

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

end of thread, other threads:[~2019-07-01 21:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-26  4:51 [U-Boot] [PATCH 0/2] arm64: tidy up POSITION_INDEPENDENT feature and enable it for Socionext SoCs Masahiro Yamada
2019-06-26  4:51 ` [U-Boot] [PATCH 1/2] arm64: add an option to switch visibility of CONFIG_SYS_INIT_SP_BSS_OFFSET Masahiro Yamada
2019-06-27  0:45   ` AKASHI Takahiro
2019-06-27  7:55     ` Masahiro Yamada
2019-07-01 21:48   ` Stephen Warren
2019-06-26  4:51 ` [U-Boot] [PATCH 2/2] ARM: uniphier_v8_defconfig: make 64bit SoC image position independent Masahiro Yamada

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.