-
Notifications
You must be signed in to change notification settings - Fork 419
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
Bring back bzImage direct kernel boot support for x86_64 #6200
Conversation
/// * `entry_point` - Description of the boot entry to set up. | ||
pub fn setup_regs(vcpu: &Arc<dyn hypervisor::Vcpu>, entry_point: EntryPoint) -> Result<()> { | ||
let regs = match entry_point.setup_header { | ||
None => StandardRegisters { | ||
rflags: 0x0000000000000002u64, | ||
rip: entry_point.entry_addr.raw_value(), | ||
rbx: PVH_INFO_START.raw_value(), | ||
..Default::default() | ||
}, | ||
Some(_) => StandardRegisters { | ||
rflags: 0x0000000000000002u64, | ||
rip: entry_point.entry_addr.raw_value(), | ||
rsp: BOOT_STACK_POINTER.raw_value(), | ||
rsi: ZERO_PAGE_START.raw_value(), | ||
..Default::default() | ||
}, |
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.
Note: It is possible to combine the initial register state to point to the PVH start info and the zero page at the same time. But this violates some of the stated assumptions on initial register state from the protocols. It works just fine with regular Linux kernels, but someone somewhere might get very unhappy, so I decided to switch it correctly.
@@ -1195,8 +1221,10 @@ impl Vm { | |||
arch::configure_system( | |||
&mem, | |||
arch::layout::CMDLINE_START, | |||
arch::layout::CMDLINE_MAX_SIZE, |
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.
This was providing the actual cmdline length previously, but that's harder to get now, since the code changed a bit. This value only goes into the zero page for the guest kernel to interpret, and I verified the kernels see a correct cmdline. There might still be concerns about that, though.
I obviously forgot to fix some tests after the rebase from LTS. I'll take care of those (as well as the missing sign-off). But let me know if you have other fundamental issues with bringing back bzImage support this way. |
ab61921
to
3334d39
Compare
This is so nice! I've booted the NixOS netboot binaries without issue:
|
@rbradford Do you have a suggestion how to workaround the commit message check failure?
|
The commit message check is not a blocking check - it's only there to check that nothing has gone wrong. You don't need to do anything. |
Thanks for your PR. FYI, we don't generally review a PR until most of the checks are green - I think you have a build issue under the |
Thanks for letting me know. Yes I spotted the build issue. I'll fix it in time and will be looking forward to further feedback. |
Allow cloud-hypervisor to direct boot the bzImage kernel format using the regular 32 bit entry point. This can share the memory and vcpu setup with the regular PVH boot code, but requires the setup of the 'zero page'. Signed-off-by: Stefan Nuernberger <stefan.nuernberger@cyberus-technology.de>
Signed-off-by: Stefan Nuernberger <stefan.nuernberger@cyberus-technology.de>
Signed-off-by: Stefan Nuernberger <stefan.nuernberger@cyberus-technology.de>
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.
I'm fine with this - thank you for your contribution!
Oak switched to using nix to compile linux kernel which produces a single bzImage. PR6200 brings bzImage support to CH. PR6200: cloud-hypervisor/cloud-hypervisor#6200 Change-Id: I663c9bd7a281d3d49a47d221e31d7e9eead790c4 Signed-off-by: Yu Ding <dingelish@google.com>
Fixes: #5766
This feature was previously removed in favor of just supporting uncompressed PVH ELF binaries for simplicity. However, direct bzImage support has a couple benefits that would be nice.
/boot
directlyBy using the regular 32 bit entry point, the necessary code changes are rather small. Most of the machine setup can be shared with the PVH setup. We just need to provide the zero page and point to it in the initial register state. The boot variant is auto-detected with no further switches needed. I opted to just use the availability of the
setup_header
as a marker for the boot protocol instead of an explicit enum (as was done before). While being explicit is mostly good, here it would lead to more code churn and more special cases to handle.Most of this code is a partial revert of the previously existing code.
I ran the x86_64 integration tests using both
vmlinux
andbzImage
as the direct boot kernel with the same results as far as I could get those to work (using./scripts/dev_cli.sh
docker setup). I added one simple boot test that uses the bzImage explicitly in the integration tests.For visibility: @parthy @blitz