diff mbox series

[v1,03/20] linker: Add SPL linker script for SoC64 devices

Message ID 20240920070242.20884-4-tien.fong.chee@intel.com
State New
Delegated to: TIEN FONG CHEE
Headers show
Series SoCFPGA: Add Boot Support for Agilex 5 in U-Boot | expand

Commit Message

Chee, Tien Fong Sept. 20, 2024, 7:02 a.m. UTC
From: Tien Fong Chee <tien.fong.chee@intel.com>

Add a new .data section for preserving the original state of the
.data section of SoC64 SPL. This new .data section is required to
make SPL reentrant after warm reset.

Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
---
 arch/arm/mach-socfpga/u-boot-spl-soc64.lds | 80 ++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 arch/arm/mach-socfpga/u-boot-spl-soc64.lds

Comments

Marek Vasut Sept. 21, 2024, 1:48 p.m. UTC | #1
On 9/20/24 9:02 AM, tien.fong.chee@intel.com wrote:
> From: Tien Fong Chee <tien.fong.chee@intel.com>
> 
> Add a new .data section for preserving the original state of the
> .data section of SoC64 SPL. This new .data section is required to
> make SPL reentrant after warm reset.
Where is the linker script copied from ? What is the original file name 
and path ?
Chee, Tien Fong Sept. 24, 2024, 5:48 a.m. UTC | #2
Hi,

> -----Original Message-----
> From: Marek Vasut <marex@denx.de>
> Sent: Saturday, September 21, 2024 9:49 PM
> To: Chee, Tien Fong <tien.fong.chee@intel.com>; u-boot@lists.denx.de
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>; Meng, Tingting
> <tingting.meng@intel.com>; Yuslaimi, Alif Zakuan
> <alif.zakuan.yuslaimi@intel.com>; Hea, Kok Kiang
> <kok.kiang.hea@intel.com>
> Subject: Re: [PATCH v1 03/20] linker: Add SPL linker script for SoC64 devices
> 
> On 9/20/24 9:02 AM, tien.fong.chee@intel.com wrote:
> > From: Tien Fong Chee <tien.fong.chee@intel.com>
> >
> > Add a new .data section for preserving the original state of the .data
> > section of SoC64 SPL. This new .data section is required to make SPL
> > reentrant after warm reset.
> Where is the linker script copied from ? What is the original file name and
> path ?

I think the script is copied from arch/arm/cpu/armv8/u-boot-spl.lds .

Regards,
Tien Fong.
Marek Vasut Sept. 24, 2024, 6:35 p.m. UTC | #3
On 9/24/24 7:48 AM, Chee, Tien Fong wrote:

Hi,

>>> Add a new .data section for preserving the original state of the .data
>>> section of SoC64 SPL. This new .data section is required to make SPL
>>> reentrant after warm reset.
>> Where is the linker script copied from ? What is the original file name and
>> path ?
> 
> I think the script is copied from arch/arm/cpu/armv8/u-boot-spl.lds .
Can arch/arm/cpu/armv8/u-boot-spl.lds be extended somehow instead , or 
are there too many differences ?
Chee, Tien Fong Sept. 25, 2024, 6:06 a.m. UTC | #4
Hi,

> -----Original Message-----
> From: Marek Vasut <marex@denx.de>
> Sent: Wednesday, September 25, 2024 2:36 AM
> To: Chee, Tien Fong <tien.fong.chee@intel.com>; u-boot@lists.denx.de
> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>; Meng, Tingting
> <tingting.meng@intel.com>; Yuslaimi, Alif Zakuan
> <alif.zakuan.yuslaimi@intel.com>; Hea, Kok Kiang
> <kok.kiang.hea@intel.com>
> Subject: Re: [PATCH v1 03/20] linker: Add SPL linker script for SoC64 devices
> 
> On 9/24/24 7:48 AM, Chee, Tien Fong wrote:
> 
> Hi,
> 
> >>> Add a new .data section for preserving the original state of the
> >>> .data section of SoC64 SPL. This new .data section is required to
> >>> make SPL reentrant after warm reset.
> >> Where is the linker script copied from ? What is the original file
> >> name and path ?
> >
> > I think the script is copied from arch/arm/cpu/armv8/u-boot-spl.lds .
> Can arch/arm/cpu/armv8/u-boot-spl.lds be extended somehow instead , or
> are there too many differences ?

We think can use arch/arm/cpu/armv8/u-boot-spl.lds, because we just noticed the CONFIG_SPL_RECOVER_DATA_SECTION was added into lds and this should be the same design with current patch.

Thanks.

Best regards,
Tien Fong
Marek Vasut Sept. 25, 2024, 12:50 p.m. UTC | #5
On 9/25/24 8:06 AM, Chee, Tien Fong wrote:

Hi,

>>>>> Add a new .data section for preserving the original state of the
>>>>> .data section of SoC64 SPL. This new .data section is required to
>>>>> make SPL reentrant after warm reset.
>>>> Where is the linker script copied from ? What is the original file
>>>> name and path ?
>>>
>>> I think the script is copied from arch/arm/cpu/armv8/u-boot-spl.lds .
>> Can arch/arm/cpu/armv8/u-boot-spl.lds be extended somehow instead , or
>> are there too many differences ?
> 
> We think can use arch/arm/cpu/armv8/u-boot-spl.lds, because we just noticed the CONFIG_SPL_RECOVER_DATA_SECTION was added into lds and this should be the same design with current patch.
Excellent !
diff mbox series

Patch

diff --git a/arch/arm/mach-socfpga/u-boot-spl-soc64.lds b/arch/arm/mach-socfpga/u-boot-spl-soc64.lds
new file mode 100644
index 00000000000..91cf8dd3139
--- /dev/null
+++ b/arch/arm/mach-socfpga/u-boot-spl-soc64.lds
@@ -0,0 +1,80 @@ 
+/*
+ * (C) Copyright 2013
+ * David Feng <fenghua@phytium.com.cn>
+ *
+ * (C) Copyright 2002
+ * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
+ *
+ * (C) Copyright 2010
+ * Texas Instruments, <www.ti.com>
+ *	Aneesh V <aneesh@ti.com>
+ *
+ * Copyright (C) 2024 Intel Corporation <www.intel.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,
+		LENGTH = CONFIG_SPL_MAX_SIZE }
+MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR,
+		LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
+
+OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
+OUTPUT_ARCH(aarch64)
+ENTRY(_start)
+SECTIONS
+{
+	__image_copy_start = ADDR(.text);
+	.text : {
+		. = ALIGN(8);
+		CPUDIR/start.o (.text*)
+		*(.text*)
+	} >.sram
+
+	.rodata : {
+		. = ALIGN(8);
+		*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
+	} >.sram
+
+	.data : {
+		. = ALIGN(8);
+		/* Run time .data section starting at this location */
+		__data_start = .;
+		*(.data*)
+		/* Run time .data section ending at this location */
+		__data_end = .;
+	} >.sram
+
+	. = ALIGN(8);
+	/* Preserve original .data section starting at this location */
+	__preserve_data_start = .;
+	. = __preserve_data_start + (__data_end - __data_start);
+	/* Preserve original .data section ending at this location */
+	__preserve_data_end = .;
+
+	. = ALIGN(8);
+	__u_boot_list . : {
+		KEEP(*(SORT(__u_boot_list*)));
+	} >.sram
+
+	. = ALIGN(8);
+	__image_copy_end = .;
+
+	_end = .;
+
+	_image_binary_end = .;
+
+	.bss : {
+		__bss_start = .;
+		*(.bss*)
+		. = ALIGN(8);
+		__bss_end = .;
+	} >.sdram
+
+	/DISCARD/ : { *(.dynsym) }
+	/DISCARD/ : { *(.dynstr*) }
+	/DISCARD/ : { *(.dynamic*) }
+	/DISCARD/ : { *(.plt*) }
+	/DISCARD/ : { *(.interp*) }
+	/DISCARD/ : { *(.gnu*) }
+}