Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/47970 )
Change subject: arch/x86: Top-align .init in bootblock ......................................................................
arch/x86: Top-align .init in bootblock
Link .init section near the end of bootblock program. It contains _start16bit, gdtptr and gdt that must be addressable from realmode, thus within top 64 KiB.
Change-Id: If7b9737650362ac7cd82685cfdfaf18bd2429238 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/arch/x86/bootblock.ld M src/arch/x86/memlayout.ld M src/lib/program.ld 3 files changed, 28 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/70/47970/1
diff --git a/src/arch/x86/bootblock.ld b/src/arch/x86/bootblock.ld index a0da25e..bb22413 100644 --- a/src/arch/x86/bootblock.ld +++ b/src/arch/x86/bootblock.ld @@ -12,8 +12,27 @@ #endif
SECTIONS { - /* Trigger an error if I have an unuseable start address */ - _bogus = ASSERT(_start16bit >= 0xffff0000, "_start16bit too low. Please report."); + . = _ebootblock - CONFIG_C_ENV_BOOTBLOCK_SIZE; + + _bootblock = .; + + INCLUDE "bootblock/lib/program.ld" + + . = ID_SECTION - EARLYASM_SZ; + . = CONFIG(SIPI_VECTOR_IN_ROM) ? ALIGN(4096) : ALIGN(16); + BOOTBLOCK_TOP = .; + .init (.) : { + *(.init._start); + *(.init); + KEEP(*(.id.keep)); + } + + /* + * Allocation reserves extra space here. Alignment requirements + * may cause the total size of a section to change when the start + * address gets applied. + */ + EARLYASM_SZ = SIZEOF(.init) + (CONFIG(SIPI_VECTOR_IN_ROM) ? 4096 : 16);
. = ID_SECTION; .flashrom_id (.): { @@ -34,4 +53,9 @@ . = 15; BYTE(0x00); } + _ebootblock = .; } + +_bogus1 = ASSERT(_bootblock & 0x80000000, "_bootblock too low, invalid ld script"); +_bogus2 = ASSERT(_start16bit & 0x80000000, "_start16bit too low, invalid ld script"); +_bogus3 = ASSERT(_start16bit >= 0xffff0000, "_start16bit too low. Please report."); diff --git a/src/arch/x86/memlayout.ld b/src/arch/x86/memlayout.ld index 52694fa..a0b0f53 100644 --- a/src/arch/x86/memlayout.ld +++ b/src/arch/x86/memlayout.ld @@ -28,8 +28,6 @@
#include "car.ld" #elif ENV_BOOTBLOCK - BOOTBLOCK(0xffffffff - CONFIG_C_ENV_BOOTBLOCK_SIZE + 1, - CONFIG_C_ENV_BOOTBLOCK_SIZE)
#include "car.ld"
diff --git a/src/lib/program.ld b/src/lib/program.ld index 98e88e2..b825f4f 100644 --- a/src/lib/program.ld +++ b/src/lib/program.ld @@ -15,9 +15,11 @@ _text = .; *(.text._start); *(.text.stage_entry); +#if !(ENV_X86 && ENV_BOOTBLOCK) KEEP(*(.id.keep)); *(.init._start); *(.init); +#endif *(.text); *(.text.*);
Hello build bot (Jenkins), Julius Werner,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/47970
to look at the new patch set (#2).
Change subject: arch/x86: Top-align .init in bootblock ......................................................................
arch/x86: Top-align .init in bootblock
Link .init section near the end of bootblock program. It contains _start16bit, gdtptr and gdt that must be addressable from realmode, thus within top 64 KiB.
Change-Id: If7b9737650362ac7cd82685cfdfaf18bd2429238 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/arch/x86/bootblock.ld M src/arch/x86/memlayout.ld M src/lib/program.ld 3 files changed, 27 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/70/47970/2
Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47970 )
Change subject: arch/x86: Top-align .init in bootblock ......................................................................
Patch Set 2: Code-Review+2
(1 comment)
https://review.coreboot.org/c/coreboot/+/47970/2/src/arch/x86/bootblock.ld File src/arch/x86/bootblock.ld:
https://review.coreboot.org/c/coreboot/+/47970/2/src/arch/x86/bootblock.ld@5... PS2, Line 59: _bogus1 = ASSERT(_bootblock & 0x80000000, "_bootblock too low, invalid ld script"); : _bogus2 = ASSERT(_start16bit & 0x80000000, "_start16bit too low, invalid ld script"); Those are a bit weird?
Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47970 )
Change subject: arch/x86: Top-align .init in bootblock ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/47970/2/src/arch/x86/bootblock.ld File src/arch/x86/bootblock.ld:
https://review.coreboot.org/c/coreboot/+/47970/2/src/arch/x86/bootblock.ld@5... PS2, Line 59: _bogus1 = ASSERT(_bootblock & 0x80000000, "_bootblock too low, invalid ld script"); : _bogus2 = ASSERT(_start16bit & 0x80000000, "_start16bit too low, invalid ld script");
Those are a bit weird?
Yeah, need to add some commentary there. Not being fluent with linker scripts, I had some broken attempts that resulted with close to 4 GiB bootblock.bin files and I could not make integer comparison operators catch the errors here.
Hello build bot (Jenkins), Julius Werner, Arthur Heymans,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/47970
to look at the new patch set (#3).
Change subject: arch/x86: Top-align .init in bootblock ......................................................................
arch/x86: Top-align .init in bootblock
Link .init section near the end of bootblock program. It contains _start16bit, gdtptr and gdt that must be addressable from realmode, thus within top 64 KiB.
Change-Id: If7b9737650362ac7cd82685cfdfaf18bd2429238 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/arch/x86/bootblock.ld M src/arch/x86/memlayout.ld M src/lib/program.ld 3 files changed, 26 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/70/47970/3
Hello build bot (Jenkins), Julius Werner, Arthur Heymans,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/47970
to look at the new patch set (#4).
Change subject: arch/x86: Top-align .init in bootblock ......................................................................
arch/x86: Top-align .init in bootblock
Link .init section near the end of bootblock program. It contains _start16bit, gdtptr and gdt that must be addressable from realmode, thus within top 64 KiB.
Change-Id: If7b9737650362ac7cd82685cfdfaf18bd2429238 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/arch/x86/bootblock.ld M src/arch/x86/memlayout.ld M src/lib/program.ld M src/soc/amd/common/block/cpu/noncar/memlayout_x86.ld 4 files changed, 44 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/70/47970/4
Hello build bot (Jenkins), Jason Glenesk, Marshall Dawson, Julius Werner, Arthur Heymans, Felix Held,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/47970
to look at the new patch set (#6).
Change subject: arch/x86: Top-align .init in bootblock ......................................................................
arch/x86: Top-align .init in bootblock
Link .init section near the end of bootblock program. It contains _start16bit, gdtptr and gdt that must be addressable from realmode, thus within top 64 KiB.
Change-Id: If7b9737650362ac7cd82685cfdfaf18bd2429238 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/arch/x86/bootblock.ld M src/arch/x86/memlayout.ld M src/cpu/x86/entry16.S M src/lib/program.ld M src/soc/amd/common/block/cpu/noncar/memlayout_x86.ld 5 files changed, 44 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/70/47970/6
Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47970 )
Change subject: arch/x86: Top-align .init in bootblock ......................................................................
Patch Set 7: Code-Review+2
Attention is currently required from: Raul Rangel. Hello build bot (Jenkins), Jason Glenesk, Marshall Dawson, Julius Werner, Arthur Heymans, Felix Held,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/47970
to look at the new patch set (#10).
Change subject: arch/x86: Top-align .init in bootblock ......................................................................
arch/x86: Top-align .init in bootblock
Link .init section near the end of bootblock program. It contains _start16bit, gdtptr and gdt that must be addressable from realmode, thus within top 64 KiB.
Change-Id: If7b9737650362ac7cd82685cfdfaf18bd2429238 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/arch/x86/bootblock.ld M src/arch/x86/memlayout.ld M src/cpu/x86/entry16.S M src/lib/program.ld M src/soc/amd/common/block/cpu/noncar/memlayout_x86.ld 5 files changed, 48 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/70/47970/10
Attention is currently required from: Kyösti Mälkki. Raul Rangel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47970 )
Change subject: arch/x86: Top-align .init in bootblock ......................................................................
Patch Set 10:
(1 comment)
File src/cpu/x86/entry16.S:
https://review.coreboot.org/c/coreboot/+/47970/comment/53c95945_08e57422 PS10, Line 36: 4kB Should we clean up the comment?
Attention is currently required from: Raul Rangel. Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47970 )
Change subject: arch/x86: Top-align .init in bootblock ......................................................................
Patch Set 10:
(1 comment)
File src/cpu/x86/entry16.S:
https://review.coreboot.org/c/coreboot/+/47970/comment/d782bc33_7a22863b PS10, Line 36: 4kB
Should we clean up the comment?
This still applies to certain CPUs.
Attention is currently required from: Raul Rangel, Kyösti Mälkki. Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47970 )
Change subject: arch/x86: Top-align .init in bootblock ......................................................................
Patch Set 10: Code-Review+2
Attention is currently required from: Raul Rangel, Kyösti Mälkki. Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47970 )
Change subject: arch/x86: Top-align .init in bootblock ......................................................................
Patch Set 10:
(1 comment)
File src/arch/x86/bootblock.ld:
https://review.coreboot.org/c/coreboot/+/47970/comment/e2914758_055a6c18 PS2, Line 59: _bogus1 = ASSERT(_bootblock & 0x80000000, "_bootblock too low, invalid ld script"); : _bogus2 = ASSERT(_start16bit & 0x80000000, "_start16bit too low, invalid ld script");
Yeah, need to add some commentary there. […]
Done
Attention is currently required from: Raul Rangel. Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47970 )
Change subject: arch/x86: Top-align .init in bootblock ......................................................................
Patch Set 10:
(1 comment)
File src/cpu/x86/entry16.S:
https://review.coreboot.org/c/coreboot/+/47970/comment/466c368b_a2fb2eb2 PS10, Line 36: 4kB
This still applies to certain CPUs.
Ack
Kyösti Mälkki has submitted this change. ( https://review.coreboot.org/c/coreboot/+/47970 )
Change subject: arch/x86: Top-align .init in bootblock ......................................................................
arch/x86: Top-align .init in bootblock
Link .init section near the end of bootblock program. It contains _start16bit, gdtptr and gdt that must be addressable from realmode, thus within top 64 KiB.
Change-Id: If7b9737650362ac7cd82685cfdfaf18bd2429238 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/47970 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Arthur Heymans arthur@aheymans.xyz --- M src/arch/x86/bootblock.ld M src/arch/x86/memlayout.ld M src/cpu/x86/entry16.S M src/lib/program.ld M src/soc/amd/common/block/cpu/noncar/memlayout_x86.ld 5 files changed, 48 insertions(+), 5 deletions(-)
Approvals: build bot (Jenkins): Verified Arthur Heymans: Looks good to me, approved
diff --git a/src/arch/x86/bootblock.ld b/src/arch/x86/bootblock.ld index 479259f..6595262 100644 --- a/src/arch/x86/bootblock.ld +++ b/src/arch/x86/bootblock.ld @@ -12,8 +12,27 @@ #endif
SECTIONS { - /* Trigger an error if I have an unusable start address */ - _bogus = ASSERT(_start16bit >= 0xffff0000, "_start16bit too low. Please report."); + . = _ebootblock - CONFIG_C_ENV_BOOTBLOCK_SIZE; + + _bootblock = .; + + INCLUDE "bootblock/lib/program.ld" + + . = MIN(_ID_SECTION, _FIT_POINTER) - EARLYASM_SZ; + . = CONFIG(SIPI_VECTOR_IN_ROM) ? ALIGN(4096) : ALIGN(16); + BOOTBLOCK_TOP = .; + .init (.) : { + *(.init._start); + *(.init); + *(.init.*); + } + + /* + * Allocation reserves extra space here. Alignment requirements + * may cause the total size of a section to change when the start + * address gets applied. + */ + EARLYASM_SZ = SIZEOF(.init) + (CONFIG(SIPI_VECTOR_IN_ROM) ? 4096 : 16);
. = _ID_SECTION; .id (.): { @@ -37,4 +56,13 @@ . = 15; BYTE(0x00); } + _ebootblock = .; } + +/* + * Tests _bogus1 and _bogus2 are here to detect case of symbol addresses truncated + * to 32 bits and intermediate files reaching size of close to 4 GiB. + */ +_bogus1 = ASSERT(_bootblock & 0x80000000, "_bootblock too low, invalid ld script"); +_bogus2 = ASSERT(_start16bit & 0x80000000, "_start16bit too low, invalid ld script"); +_bogus3 = ASSERT(_start16bit >= 0xffff0000, "_start16bit too low. Please report."); diff --git a/src/arch/x86/memlayout.ld b/src/arch/x86/memlayout.ld index 52694fa..a0b0f53 100644 --- a/src/arch/x86/memlayout.ld +++ b/src/arch/x86/memlayout.ld @@ -28,8 +28,6 @@
#include "car.ld" #elif ENV_BOOTBLOCK - BOOTBLOCK(0xffffffff - CONFIG_C_ENV_BOOTBLOCK_SIZE + 1, - CONFIG_C_ENV_BOOTBLOCK_SIZE)
#include "car.ld"
diff --git a/src/cpu/x86/entry16.S b/src/cpu/x86/entry16.S index 501d01d..e1bfbf1 100644 --- a/src/cpu/x86/entry16.S +++ b/src/cpu/x86/entry16.S @@ -35,7 +35,6 @@ /* Symbol _start16bit must reachable from the reset vector, and be aligned to * 4kB to start AP CPUs with Startup IPI message without RAM. */ -.align 4096 .code16 .globl _start16bit .type _start16bit, @function diff --git a/src/lib/program.ld b/src/lib/program.ld index 3eebd6c..7027747 100644 --- a/src/lib/program.ld +++ b/src/lib/program.ld @@ -13,9 +13,11 @@ .text . : { _program = .; _text = .; +#if !(ENV_X86 && ENV_BOOTBLOCK) *(.init._start); *(.init); *(.init.*); +#endif *(.text._start); *(.text.stage_entry); KEEP(*(.metadata_hash_anchor)); diff --git a/src/soc/amd/common/block/cpu/noncar/memlayout_x86.ld b/src/soc/amd/common/block/cpu/noncar/memlayout_x86.ld index 352472e..e1f2765 100644 --- a/src/soc/amd/common/block/cpu/noncar/memlayout_x86.ld +++ b/src/soc/amd/common/block/cpu/noncar/memlayout_x86.ld @@ -110,6 +110,22 @@ _TOO_LOW = _X86_RESET_VECTOR - 0xfff0; _bogus = ASSERT(_start16bit >= _TOO_LOW, "_start16bit too low. Please report.");
+ . = _X86_RESET_VECTOR - EARLYASM_SZ; + . = ALIGN(16); + BOOTBLOCK_TOP = .; + .init (.) : { + *(.init._start); + *(.init); + *(.init.*); + } + + /* + * Allocation reserves extra space here. Alignment requirements + * may cause the total size of a section to change when the start + * address gets applied. + */ + EARLYASM_SZ = SIZEOF(.init) + 16; + . = BOOTBLOCK_END - 0x10; _X86_RESET_VECTOR = .; .reset . : {