-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[RFC] Support PVH boot protocol #1818
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Define ELF Note header structure and constants necessary for parsing the PVH entry point address encoded in kernel ELF header. Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com> Acked-by: Liam Merwick <liam.merwick@oracle.com>
Introduce the layout and define the start_info, module list and memory map table entry structures used by the PVH boot protocol. The hvm_start_info structure is akin to bootparams in Linux boot protocol, specifying the small set of parameters required by the PVH protocol. Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com> Acked-by: Liam Merwick <liam.merwick@oracle.com>
Parse the ELF header looking for a PVH Note section and retrieve the encoded PVH entry point address if there is one. This PVH entry point address is returned alongside the typical ELF entry point used for direct boot. The vmm crate can now determine whether a PVH entry point is available and choose to configure its guests to boot using either PVH or Linux 64-bit protocol. Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com> Acked-by: Liam Merwick <liam.merwick@oracle.com>
In order to properly configure the initial vCPU register state and boot parameters in guest memory, we must specify which boot protocol to use with the kernel entry point address. Create an EntryPoint struct that contains the required information. This structure will later be used in the vCPU configuration methods to set the appropriate initial conditions for the guest. Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com> Acked-by: Liam Merwick <liam.merwick@oracle.com>
Set the initial values of the KVM vCPU registers as specified in the PVH boot ABI: https://xenbits.xen.org/docs/unstable/misc/pvh.html Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com> Acked-by: Liam Merwick <liam.merwick@oracle.com>
Fill the hvm_start_info and related structures as specified in the PVH boot protocol. Write the data structures to guest memory at the GPA that will be stored in %rbx when the guest starts. Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com> Acked-by: Liam Merwick <liam.merwick@oracle.com>
Enable the optional "pvh" feature to build a Firecracker binary that is able to boot Linux guests using the PVH boot protocol. Build a firecracker binary with the PVH capability by running: tools/devtool build [--release] -- --features pvh and the resulting Firecracker binary will use the PVH boot protocol as the preferred choice for booting a guest, if the guest kernel supports it. Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com> Acked-by: Liam Merwick <liam.merwick@oracle.com>
lauralt
added
the
Status: Awaiting review
Indicates that a pull request is ready to be reviewed
label
Apr 27, 2020
Hi @aljimenezb, Firecracker intends to consume |
3 tasks
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reason for This PR
The x86/HVM direct boot ABI is intended for use cases targeted by Firecracker, where legacy hardware and software support within the guest is not needed, and it allows booting guests directly into the uncompressed kernel binary, without the need for firmware.
The ABI is already supported by Linux and FreeBSD:
https://xenbits.xen.org/docs/unstable/misc/pvh.html
Examples of current use of the PVH boot protocol are the latest QEMU microvm machine type, and Intel Cloud Hypervisor/RustVMM. A limitation is that the PVH protocol is not available for aarch64.
The current patches are fully functional, and can coexist with current implementation that uses Linux 64-bit protocol, but the ability to use PVH to launch guests has been configured as an optional feature for this RFC.
If there is interest in adding this functionality to Firecracker, additional changes needed are to expand the integration tests, and provide a new API option to allow specifying the default boot protocol.
Description of Changes
Parse the PVH entry point address encoded in the kernel binary, and return it alongside the default entry point.
If the PVH optional feature is enabled use it as the preferred method to boot the guest. Configure the guest initial state (regs/sregs) as required by the PVH ABI.
Copy the set of boot parameters [hvm_start_info, memory map entries, (optional) initramfs module entry] required by PVH into guest memory.
rust-vmm
.This functionality is already available in RustVMM, where the linux-loader crate is capable of parsing the PVH entry point, and the rest of the changes described above must be implemented by the VMM. This PR Boot configurator: trait (and associated objects) that write boot params in guest memory rust-vmm/linux-loader#31 aims to have more of that functionality directly available on the linux-loader crate.
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license.
PR Checklist
git commit -s
).unsafe
code is properly documented.firecracker/swagger.yaml
.CHANGELOG.md
.