-
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
Add ACPI support for x86_64 #4428
Conversation
7bf45b1
to
563824e
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4428 +/- ##
==========================================
+ Coverage 81.56% 82.01% +0.45%
==========================================
Files 243 253 +10
Lines 29899 31026 +1127
==========================================
+ Hits 24387 25447 +1060
- Misses 5512 5579 +67
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
4c33fb5
to
9348abd
Compare
7b66f75
to
743c14e
Compare
Right now we handle guest interrupt lines (GSIs) and physical memory inside the MMIO device manager. With ACPI we will add a new device type for which we will need to allocate GSIs and memory. With the current way we do things, this means that we would need an extra pair of GSI and memory allocators. This commit introduces a resource manager at the VMM level for handling GSIs and guest physical memory allocations. Each device manager will get a reference to this object for handling resources globally. Signed-off-by: Babis Chalios <bchalios@amazon.es>
Add a lib crate for handling ACPI tables. The crate exports types representing the various tables we handle and methods for creating them, modifying them and writing them in guest memory. The crate is based on the cloudhypervisor implementation: https://github.com/rust-vmm/acpi_tables. We reuse the logic for creating AML bytecode but we diverge from the way they create and manipulate the tables. They rely mainly on the SdtHeader type and work with byte offsets, whereas we define concrete types for each table and use those. Signed-off-by: Babis Chalios <bchalios@amazon.es>
Initial ACPI setup for x86. We have FADT in Hardware Reduced mode. This means that we declare to the guest that we don't implement in "hardware" some features, such as control and event registers. We also have MADT, which essentially replaces the functionality of MPTable; we define on IO-APIC and one LocalAPIC structure per vCPU. All vCPUs are marked as online by default. Finally, we have an empty DSDT. This will be populated with info about VirtIO, legacy and ACPI devices in future commits. Signed-off-by: Babis Chalios <bchalios@amazon.es>
Use AML bytecode in DSDT ACPI table to define VirtIO devices as well as passing them as kernel command line arguments. Also, pass AML for legacy devices, as the kernel doesn't pick up the console or i8042 unless we do. For the time being, we are keeping the old way of booting, i.e. MPTable plus VirtIO devices via command line arguments to allow for some sort of backwards compatibility with kernels that are not built with ACPI support. Signed-off-by: Babis Chalios <bchalios@amazon.es>
This test is looking for the MMIO address range of virtio-net devices and then uses it to update the MAC address of the devices by writing under `/dev/mem`. The test was using the kernel command line to find the address range. With ACPI we don't pass this range via kernel command line any more, so adapt the test to look for this information under /proc/iomem. Signed-off-by: Babis Chalios <bchalios@amazon.es>
Configurations for 4.14, 5.10 and 6.1 guest kernels with ACPI support. This, also updates other configuration options that are enabled automatically while building the kernels. These options were taken from the saved config files from built kernels for our CI. ACPI configuration increases kernel image files size. 4.14 kernel goes from 19MB to 19.4MB. 5.10 goes from 26.3MB to 28.9MB. 6.1 goes from 26.5MB to 29.1MB. Also, add a configuration for guest 5.10 without ACPI so that we keep testing MPTable and passing VirtIO devices via kernel command line paramters, for as long as these are in the deprecation period. Once we drop support for these two, we can remove this from our test matrix. Signed-off-by: Babis Chalios <bchalios@amazon.es>
Starting from 5.10.211 the 5.10 guest kernels don't build neither for x86_64 nor Aarch64 with our kernel configs. There is a missing header file in arch/x86/kernel/paravirt.c, so when we build with CONFIG_PARAVIRT on, the build fails. Pin the 5.10 guest kernel version to the latest one working for us (5.10.210) until this issue is fixed upstream. Signed-off-by: Babis Chalios <bchalios@amazon.es>
Mention the kernel requirements for booting with ACPI support. Also mention how users can disable the legacy way of booting (via MPTable and command line parameters for VirtIO devices). Signed-off-by: Babis Chalios <bchalios@amazon.es>
Mention that we now support ACPI on x86_64 microVMs. Also, announce the deprecation of MPTable and suggest that Firecracker users should migrate to using kernels with ACPI support. Signed-off-by: Babis Chalios <bchalios@amazon.es>
Thanks for posting CHANGELOG for each version! |
Changes
Add minimal ACPI support for x86. We implement ACPI in Hardware Reduced mode. For the time being we support FADT, MADT for interrupt controllers and DSDT for passing info about VirtIO and legacy devices. This changes the way that we expose vCPUs, interrupt controllers and devices to the guest.
We pass information about vCPUs and interrupt controllers via MADT table. As a result, we do not need MPTable any more. We deprecate support for MPTable; it will be removed in a future release.
We pass information about VirtIO devices as AML bytecode in the DSDT table. As a result, we do not need to pass VirtIO devices as command line parameters any more.
Reason
We want to implement ACPI in order to support the Virtual Machine Generation ID device 1. Support for this device will come as a follow up PR.
1 https://learn.microsoft.com/en-us/windows/win32/hyperv_v2/virtual-machine-generation-identifier
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md
.PR Checklist
PR.
CHANGELOG.md
.TODO
s link to an issue.contribution quality standards.
rust-vmm
.