Thread View: alt.os.development
5 messages
5 total messages
Started by vantix
Fri, 20 Nov 2026 23:50
Re: [OSDev] How to switch to long mode in x86 CPUs?
Author: vantix
Date: Fri, 20 Nov 2026 23:50
Date: Fri, 20 Nov 2026 23:50
17 lines
1904 bytes
1904 bytes
Dan Cross <cross@spitfire.i.gajendra.net> wrote: > I feel like this is where Ron Minnich's LinuxBoot stuff works > well. Replace the UEFI DXE layer with a copy of Linux and a > small userspace written in a type- and memory-safe language. > You've got a real IP stack and can do DHCP and use TCP to load > and kexec your real OS. That approach makes a lot of sense, especially compared to maintaining a custom, half-baked network stack inside early firmware. Having a minimal kernel handle hardware init and hand off via kexec (or a clean initrd-to-rootfs transition) avoids duplicating driver complexity in two places. Out of curiosity: in setups where you bypass UEFI/AGESA and initialize the fabric or early IO from your own host OS, how painful is the lack of documentation for the hidden management cores (like SMU/MPIO)? Even with openSIL shedding some light on the init flow, it still feels like a lot of black-box state machines under the hood.
Re: [OSDev] How to switch to long mode in x86 CPUs?
Author: Dan Cross
Date: Sat, 21 Nov 2026 13:48
Date: Sat, 21 Nov 2026 13:48
58 lines
3915 bytes
3915 bytes
In article <11dqmct$73j6$1@solani.org>, vantix <vantix@veloos.invalid> wrote: >Dan Cross <cross@spitfire.i.gajendra.net> wrote: >> I feel like this is where Ron Minnich's LinuxBoot stuff works >> well. Replace the UEFI DXE layer with a copy of Linux and a >> small userspace written in a type- and memory-safe language. >> You've got a real IP stack and can do DHCP and use TCP to load >> and kexec your real OS. > >That approach makes a lot of sense, especially compared to maintaining >a custom, half-baked network stack inside early firmware. Having a minimal >kernel handle hardware init and hand off via kexec (or a clean initrd-to-rootfs >transition) avoids duplicating driver complexity in two places. I'm not sure that follows. The kernel that does the hardware initialization is not necessarily the same as the one that you actually run in steady state, thus there is no guarantee that the drivers are the same. The critical observation with e.g. LinuxBoot is that having a Real(TM) kernel in the DXE layer means that you are out of the world of buggy proprietary UEFI stacks. It's also a lot faster because the overall archictecture of UEFI is almost deliberately slow. Regardless, it is still reliant on UEFI's PEI layer to set up the fabric. >Out of curiosity: in setups where you bypass UEFI/AGESA and initialize >the fabric or early IO from your own host OS, how painful is the lack of >documentation for the hidden management cores (like SMU/MPIO)? Even with >openSIL shedding some light on the init flow, it still feels like a lot >of black-box state machines under the hood. Extremely. For AMD specifically, you really need to interact with the SMU and MPIO to do a lot of the low-level fabirc init. For example, you have to send an RPC to MPIO pointing to the configuration of how you'd like to set up PHYs and PCIe lane pairs; MPIO then does the timing training and so forth. If you don't have some idea of what the RPCs are (and last time I checked, AMD had replaced the relevant constants with `SIL_RESERVED_12345`-type names in OpenSIL) then it's hard to figure out exactly what is going on. As far as guides go, our code is reasonably well documented, and is open source. We start from the (x86) reset vector in the pico bootloader, https://github.com/oxidecomputer/phbl/. Then we invoke our Unix entry point, which does the early OS startup and fabric initialization: https://github.com/oxidecomputer/illumos-gate/blob/stlouis/usr/src/uts/oxide/os/fakebop.c#L679 The actual fabric initialization starts from `zen_fabric_init`: https://github.com/oxidecomputer/illumos-gate/blob/stlouis/usr/src/uts/oxide/zen/zen_fabric.c#L3262 An interesting consequence of our design is that the kernel image is treated exactly like a "normal" ELF binary, and is loaded at its linked addresses; we invoke `_start` directly in 64-bit mode (with virtual memory enabled) via a normal `CALLQ` instruction. - Dan C.
Re: [OSDev] How to switch to long mode in x86 CPUs?
Author: vantix
Date: Sat, 21 Nov 2026 18:18
Date: Sat, 21 Nov 2026 18:18
44 lines
3166 bytes
3166 bytes
Dan Cross <cross@spitfire.i.gajendra.net> wrote: > I'm not sure that follows. The kernel that does the hardware > initialization is not necessarily the same as the one that you > actually run in steady state, thus there is no guarantee that > the drivers are the same. > > The critical observation with e.g. LinuxBoot is that having a > Real(TM) kernel in the DXE layer means that you are out of the > world of buggy proprietary UEFI stacks. It's also a lot faster > because the overall archictecture of UEFI is almost deliberately > slow. Regardless, it is still reliant on UEFI's PEI layer to > set up the fabric. Fair point -- especially on still being tied to PEI for early silicon and memory init, which only pushes the proprietary black box one stage earlier rather than eliminating it. > For example, you have to send an RPC to MPIO pointing to the > configuration of how you'd like to set up PHYs and PCIe lane > pairs; MPIO then does the timing training and so forth. If you > don't have some idea of what the RPCs are (and last time I > checked, AMD had replaced the relevant constants with > `SIL_RESERVED_12345`-type names in OpenSIL) then it's hard to > figure out exactly what is going on. Seeing `SIL_RESERVED_*` all over OpenSIL was exactly what made me wonder how viable clean-room or hobbyist early init actually is on modern Zen platforms without vendor NDA docs. Turning PHY and lane configuration into opaque firmware RPCs effectively shifts the old BIOS complexity into the management cores. > An interesting consequence of our design is that the kernel > image is treated exactly like a "normal" ELF binary, and is > loaded at its linked addresses; we invoke `_start` directly in > 64-bit mode (with virtual memory enabled) via a normal `CALLQ` > instruction. Thanks for the pointers into phbl and `zen_fabric.c` -- jumping straight into a linked 64-bit ELF `_start` with virtual memory already up is a really clean cut compared to carrying legacy boot protocols around. Since phbl already sets up virtual memory before that `CALLQ`, how minimal do you keep the initial page tables in the loader before the kernel takes over and rebuilds its own mappings?
Re: [OSDev] How to switch to long mode in x86 CPUs?
Author: Dan Cross
Date: Sat, 21 Nov 2026 19:34
Date: Sat, 21 Nov 2026 19:34
51 lines
3365 bytes
3365 bytes
In article <11dsnag$8mf6$1@solani.org>, vantix <vantix@veloos.invalid> wrote: >Dan Cross <cross@spitfire.i.gajendra.net> wrote: >> I'm not sure that follows. The kernel that does the hardware >> initialization is not necessarily the same as the one that you >> actually run in steady state, thus there is no guarantee that >> the drivers are the same. >> >> The critical observation with e.g. LinuxBoot is that having a >> Real(TM) kernel in the DXE layer means that you are out of the >> world of buggy proprietary UEFI stacks. It's also a lot faster >> because the overall archictecture of UEFI is almost deliberately >> slow. Regardless, it is still reliant on UEFI's PEI layer to >> set up the fabric. > >Fair point -- especially on still being tied to PEI for early silicon >and memory init, which only pushes the proprietary black box one stage >earlier rather than eliminating it. > >> For example, you have to send an RPC to MPIO pointing to the >> configuration of how you'd like to set up PHYs and PCIe lane >> pairs; MPIO then does the timing training and so forth. If you >> don't have some idea of what the RPCs are (and last time I >> checked, AMD had replaced the relevant constants with >> `SIL_RESERVED_12345`-type names in OpenSIL) then it's hard to >> figure out exactly what is going on. > >Seeing `SIL_RESERVED_*` all over OpenSIL was exactly what made me wonder >how viable clean-room or hobbyist early init actually is on modern Zen >platforms without vendor NDA docs. Turning PHY and lane configuration >into opaque firmware RPCs effectively shifts the old BIOS complexity >into the management cores. > >> An interesting consequence of our design is that the kernel >> image is treated exactly like a "normal" ELF binary, and is >> loaded at its linked addresses; we invoke `_start` directly in >> 64-bit mode (with virtual memory enabled) via a normal `CALLQ` >> instruction. > >Thanks for the pointers into phbl and `zen_fabric.c` -- jumping straight >into a linked 64-bit ELF `_start` with virtual memory already up is a >really clean cut compared to carrying legacy boot protocols around. > >Since phbl already sets up virtual memory before that `CALLQ`, how >minimal do you keep the initial page tables in the loader before the >kernel takes over and rebuilds its own mappings? Sorry, was this generated by an LLM? It sounds almost entirely artificial. - Dan C.
Re: [OSDev] How to switch to long mode in x86 CPUs?
Author: vantix
Date: Sat, 21 Nov 2026 19:40
Date: Sat, 21 Nov 2026 19:40
12 lines
1350 bytes
1350 bytes
Dan Cross <cross@spitfire.i.gajendra.net> schrieb: > > Sorry, was this generated by an LLM? It sounds almost entirely > artificial. > > - Dan C. > I know it sounds like I have generated that with LLM, but my english is not that good so I used Deepl (deepl.com) to translate what I want to write. Deepl use in the core an LLM for specified translations. Because of that it can look like AI generated. - Vantix
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads