Dear coreboot community,
I am looking for feedback on the following topic.
x86 Pre-memory stages do not support the `.data' section and as a result developers are required to include runtime initialization code instead of relying on C global variable definition.
To illustrate the impact of this lack of .data section support, here are two limitations I personally ran into: 1. The inclusion of libgfxinit in romstage last year has required some changes in libgfxinit to ensure data is initialized at runtime. In addition, we had to manually map some .data symbols in the _bss region. 2. CBFS cache is currently not supported in pre-memory stages and enabling it would require to add an initialization function and find a generic spot to call it.
Instead of going though these workarounds and as it was suggested on [[RFC] VGA Text mode in romstage] last year, I believe we could add support for a `.data' section. I have been working on a solution for eXecute-In-Place (XIP) pre-memory stages (`bootblock', `verstage' and `romstage') which deliver good results (cf. https://review.coreboot.org/c/coreboot/+/77289).
In short this patch: 1. creates a new ELF segment to hold the `.data' section 2. creates a `.data' section with its Virtual Memory Address (VMA) within Cache-as-RAM (CAR) boundaries and its Load Memory Address (LMA) following the .text section (at `_etext').
cbfstools is also updated: - To process this new segment and `.data' section - To place the .data section content right after the code (cf. `parse_elf_to_xip_stage' function)
At the moment, this patch makes cbfstool detects the presence of the segment automatically and assume this is a "data" segment. But we could add a new parameter to make this new behavior less automatic if you think this would be better.
This patch also adds a piece of assembly code (or C-code for bootblock) to copy the `.data' section content to Cache-As-RAM at runtime.
Regards,
Hi,
Any feedback on this topic ?
I made some significant changes and made sure to cover all the cases we identified including non-XIP stages. Cf. https://review.coreboot.org/q/topic:x86-pre-ram-data-section
Thanks, Jeremy
"Compostella, Jeremy" jeremy.compostella@intel.com writes:
Dear coreboot community,
I am looking for feedback on the following topic.
x86 Pre-memory stages do not support the `.data' section and as a result developers are required to include runtime initialization code instead of relying on C global variable definition.
To illustrate the impact of this lack of .data section support, here are two limitations I personally ran into:
- The inclusion of libgfxinit in romstage last year has required some changes in libgfxinit to ensure data is initialized at runtime. In addition, we had to manually map some .data symbols in the _bss region.
- CBFS cache is currently not supported in pre-memory stages and enabling it would require to add an initialization function and find a generic spot to call it.
Instead of going though these workarounds and as it was suggested on [[RFC] VGA Text mode in romstage] last year, I believe we could add support for a `.data' section. I have been working on a solution for eXecute-In-Place (XIP) pre-memory stages (`bootblock', `verstage' and `romstage') which deliver good results (cf. https://review.coreboot.org/c/coreboot/+/77289).
In short this patch:
- creates a new ELF segment to hold the `.data' section
- creates a `.data' section with its Virtual Memory Address (VMA) within Cache-as-RAM (CAR) boundaries and its Load Memory Address (LMA) following the .text section (at `_etext').
cbfstools is also updated:
- To process this new segment and `.data' section
- To place the .data section content right after the code (cf. `parse_elf_to_xip_stage' function)
At the moment, this patch makes cbfstool detects the presence of the segment automatically and assume this is a "data" segment. But we could add a new parameter to make this new behavior less automatic if you think this would be better.
This patch also adds a piece of assembly code (or C-code for bootblock) to copy the `.data' section content to Cache-As-RAM at runtime.
Regards,
Hi Jeremy, I've added it to the agenda for today's leadership meeting. Martin
Sep 5, 2023, 15:30 by jeremy.compostella@intel.com:
Hi,
Any feedback on this topic ?
I made some significant changes and made sure to cover all the cases we identified including non-XIP stages. Cf. https://review.coreboot.org/q/topic:x86-pre-ram-data-section
Thanks, Jeremy
"Compostella, Jeremy" jeremy.compostella@intel.com writes:
Dear coreboot community,
I am looking for feedback on the following topic.
x86 Pre-memory stages do not support the `.data' section and as a result developers are required to include runtime initialization code instead of relying on C global variable definition.
To illustrate the impact of this lack of .data section support, here are two limitations I personally ran into:
- The inclusion of libgfxinit in romstage last year has required some
changes in libgfxinit to ensure data is initialized at runtime. In addition, we had to manually map some .data symbols in the _bss region. 2. CBFS cache is currently not supported in pre-memory stages and enabling it would require to add an initialization function and find a generic spot to call it.
Instead of going though these workarounds and as it was suggested on [[RFC] VGA Text mode in romstage] last year, I believe we could add support for a `.data' section. I have been working on a solution for eXecute-In-Place (XIP) pre-memory stages (`bootblock', `verstage' and `romstage') which deliver good results (cf. https://review.coreboot.org/c/coreboot/+/77289).
In short this patch:
- creates a new ELF segment to hold the `.data' section
- creates a `.data' section with its Virtual Memory Address (VMA)
within Cache-as-RAM (CAR) boundaries and its Load Memory Address (LMA) following the .text section (at `_etext').
cbfstools is also updated:
- To process this new segment and `.data' section
- To place the .data section content right after the
code (cf. `parse_elf_to_xip_stage' function)
At the moment, this patch makes cbfstool detects the presence of the segment automatically and assume this is a "data" segment. But we could add a new parameter to make this new behavior less automatic if you think this would be better.
This patch also adds a piece of assembly code (or C-code for bootblock) to copy the `.data' section content to Cache-As-RAM at runtime.
Regards,
coreboot mailing list -- coreboot@coreboot.org To unsubscribe send an email to coreboot-leave@coreboot.org