-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stage1: Rustify stage1 and update IGVM VTOM on TDP platforms #517
base: main
Are you sure you want to change the base?
Conversation
This fails CI as stage1/stage1.o and stage1/reset.o no longer exist. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Peter,
I like this change, it will simplify the build process and allows more sharing of constants and code between the different stages.
Can you please adapt the CI files to make it pass with these changes and have a look at using the existing x86-64-unknown-none
target? I tried that already but ran into linker errors due to 32-bit relocations in 64-bit code. But maybe there is a way around that.
bf1e886
to
d3bc843
Compare
48b3764
to
38d508e
Compare
Hi Joerg, I sidestepped the ld issue on the CI system using |
87814a6
to
bcf1823
Compare
Remove sections that don't exist in the object files. Signed-off-by: Peter Fang <[email protected]>
stage1/types.h is no longer in use so remove it. Signed-off-by: Peter Fang <[email protected]>
Run make with "RELEASE=1" when building a release image. Signed-off-by: Peter Fang <[email protected]>
Move stage1/*.S to a Rust crate. This allows for better interfacing with other crates and reduces the amount of hard-coding and chances of breakage. Replace label-based relative addressing with raw pointer arithmetics to avoid the "relocation truncated to fit" errors caused by the use of relocation type R_X86_64_32S in 32-bit code. Signed-off-by: Peter Fang <[email protected]>
Only turn on zerocopy's alloc feature in kernel/Cargo.toml. This ensures bootlib can be used without requiring a global memory allocator. Signed-off-by: Peter Fang <[email protected]>
Turn numerous stage2 parameters into constants and use them in igvmbuilder/stage1/stage2 code. This allows for better stage2 configuration and creates necessary dependencies among these components to reduce the possibility of breakage when there's a change in stage2. Signed-off-by: Peter Fang <[email protected]>
Stage2 has gotten larger in size so increase the size of the stage2 area to 800K (0x808000 - 0x8D0000). Also, do sanity check in stage1 to make sure the stage2 image size doesn't exceed 800K when loading stage2. The memory regions are still hard-coded in gen_meta.c. This can be tackled in the future if we decide to export these Rust constants. Signed-off-by: Peter Fang <[email protected]>
When loading stage2 in stage1, make sure the amount of data pushed down the stage2 stack matches the size of Stage2LaunchInfo. Signed-off-by: Peter Fang <[email protected]>
On TDP platforms, VTOM is always set to 0 initially. Its value can be derived during boot time by probing %ebx. This commit updates IgvmParamBlock.vtom in addition to Stage2LaunchInfo.vtom during IGVM boot. It ensures Stage2 & the SVSM kernel can use VTOM as expected. Signed-off-by: Peter Fang <[email protected]>
VTOM shall never be 0 on TDP platforms. Crash the system if this is the case. Signed-off-by: Peter Fang <[email protected]>
stage1/*.S no longer exists. Update CI to build the object files for svsm.bin & stage1-trampoline.bin instead. Add a new clippy job for stage1 as well. Signed-off-by: Peter Fang <[email protected]>
bcf1823
to
4db9393
Compare
Move stage1/*.S to a Rust crate. This allows for better interfacing with other crates and reduces hard-coding and chances of breakage.
Update IgvmParamBlock.vtom in addition to Stage2LaunchInfo.vtom during IGVM boot. It ensures Stage2 & the SVSM kernel can use VTOM as expected.