All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xilinx: versal: Enable CONFIG_POSITION_INDEPENDENT
@ 2021-05-12 12:35 Michal Simek
  2021-05-19  8:05 ` Michal Simek
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Simek @ 2021-05-12 12:35 UTC (permalink / raw)
  To: u-boot

From: T Karthik Reddy <t.karthik.reddy@xilinx.com>

U-Boot expects to be linked to a specific hard-coded address and to
be loaded to and run from that address. CONFIG_POSITION_INDEPENDENT
config lifts that restriction & allowing the code to be loaded to
and executed from almost any address.

As we enabled CONFIG_POSITION_INDEPENDENT, CONFIG_INIT_SP_RELATIVE
is enabled by default, where it will set the early stack pointer at
runtime by adding an offset value to &_bss_start. The offset value
is taken from SYS_INIT_SP_BSS_OFFSET.

SYS_INIT_SP_BSS_OFFSET offset should be large enough so that the
early malloc region, global data (gd), and early stack should fit.
With commit d8fabcc424bd ("arm64: versal: Increase SYS_MALLOC_F_LEN")
SYS_MALLOC_F_LEN is increased from 32KB to 1MB, so we need to
accommodate this space with SYS_INIT_SP_BSS_OFFSET. Hence increasing
SYS_INIT_SP_BSS_OFFSET to 1.5MB.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Acked-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 configs/xilinx_versal_virt_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/xilinx_versal_virt_defconfig b/configs/xilinx_versal_virt_defconfig
index 707693713a7e..f4e9a80728d7 100644
--- a/configs/xilinx_versal_virt_defconfig
+++ b/configs/xilinx_versal_virt_defconfig
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_POSITION_INDEPENDENT=y
+CONFIG_SYS_INIT_SP_BSS_OFFSET=1572864
 CONFIG_ARCH_VERSAL=y
 CONFIG_SYS_TEXT_BASE=0x8000000
 CONFIG_SYS_MALLOC_F_LEN=0x100000
-- 
2.31.1

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

* [PATCH] xilinx: versal: Enable CONFIG_POSITION_INDEPENDENT
  2021-05-12 12:35 [PATCH] xilinx: versal: Enable CONFIG_POSITION_INDEPENDENT Michal Simek
@ 2021-05-19  8:05 ` Michal Simek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Simek @ 2021-05-19  8:05 UTC (permalink / raw)
  To: u-boot

st 12. 5. 2021 v 14:35 odes?latel Michal Simek <michal.simek@xilinx.com> napsal:
>
> From: T Karthik Reddy <t.karthik.reddy@xilinx.com>
>
> U-Boot expects to be linked to a specific hard-coded address and to
> be loaded to and run from that address. CONFIG_POSITION_INDEPENDENT
> config lifts that restriction & allowing the code to be loaded to
> and executed from almost any address.
>
> As we enabled CONFIG_POSITION_INDEPENDENT, CONFIG_INIT_SP_RELATIVE
> is enabled by default, where it will set the early stack pointer at
> runtime by adding an offset value to &_bss_start. The offset value
> is taken from SYS_INIT_SP_BSS_OFFSET.
>
> SYS_INIT_SP_BSS_OFFSET offset should be large enough so that the
> early malloc region, global data (gd), and early stack should fit.
> With commit d8fabcc424bd ("arm64: versal: Increase SYS_MALLOC_F_LEN")
> SYS_MALLOC_F_LEN is increased from 32KB to 1MB, so we need to
> accommodate this space with SYS_INIT_SP_BSS_OFFSET. Hence increasing
> SYS_INIT_SP_BSS_OFFSET to 1.5MB.
>
> Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
> Acked-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  configs/xilinx_versal_virt_defconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/configs/xilinx_versal_virt_defconfig b/configs/xilinx_versal_virt_defconfig
> index 707693713a7e..f4e9a80728d7 100644
> --- a/configs/xilinx_versal_virt_defconfig
> +++ b/configs/xilinx_versal_virt_defconfig
> @@ -1,5 +1,6 @@
>  CONFIG_ARM=y
>  CONFIG_POSITION_INDEPENDENT=y
> +CONFIG_SYS_INIT_SP_BSS_OFFSET=1572864
>  CONFIG_ARCH_VERSAL=y
>  CONFIG_SYS_TEXT_BASE=0x8000000
>  CONFIG_SYS_MALLOC_F_LEN=0x100000
> --
> 2.31.1
>

Applied.
M


-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs

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

end of thread, other threads:[~2021-05-19  8:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 12:35 [PATCH] xilinx: versal: Enable CONFIG_POSITION_INDEPENDENT Michal Simek
2021-05-19  8:05 ` Michal Simek

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.