Skip to content
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

Merged
merged 9 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ and this project adheres to

### Added

- [#4428](https://github.com/firecracker-microvm/firecracker/pull/4428): Added
wearyzen marked this conversation as resolved.
Show resolved Hide resolved
ACPI support to Firecracker for x86_64 microVMs. Currently, we pass ACPI
tables with information about the available vCPUs, interrupt controllers,
VirtIO and legacy x86 devices to the guest. This allows booting kernels
without MPTable support. Please see our
[kernel policy documentation](docs/kernel-policy.md) for more information
regarding relevant kernel configurations.

### Changed

- [#4492](https://github.com/firecracker-microvm/firecracker/pull/4492): Changed
Expand All @@ -25,6 +33,11 @@ and this project adheres to
the `start_time_us` and `start_time_cpu_us` metrics. These parameters were
never meant to be used by end customers, and we recommend doing any such time
adjustments outside Firecracker.
- Booting with microVM kernels that rely on MPTable on x86_64 is deprecated and
support will be removed in v2.0 or later. We suggest to users of Firecracker
to use guest kernels with ACPI support. For x86_64 microVMs, ACPI will be the
only way Firecracker passes hardware information to the guest once MPTable
support is removed.

### Fixed

Expand Down
39 changes: 39 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
members = ["src/clippy-tracing", "src/cpu-template-helper", "src/firecracker", "src/jailer", "src/log-instrument", "src/log-instrument-macros", "src/rebase-snap", "src/seccompiler", "src/snapshot-editor"]
default-members = ["src/clippy-tracing", "src/cpu-template-helper", "src/firecracker", "src/rebase-snap", "src/seccompiler", "src/snapshot-editor"]
members = ["src/acpi-tables", "src/clippy-tracing", "src/cpu-template-helper", "src/firecracker", "src/jailer", "src/log-instrument", "src/log-instrument-macros", "src/rebase-snap", "src/seccompiler", "src/snapshot-editor"]
ShadowCurse marked this conversation as resolved.
Show resolved Hide resolved
default-members = ["src/clippy-tracing", "src/cpu-template-helper", "src/firecracker", "src/rebase-snap", "src/seccompiler", "src/snapshot-editor", "src/acpi-tables"]
resolver = "2"

[workspace.lints.rust]
Expand Down
3 changes: 3 additions & 0 deletions DEPRECATED.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ a future major Firecracker release, in accordance with our
`rebase-snap` tool
- \[[#4500](https://github.com/firecracker-microvm/firecracker/pull/4500)\] The
`--start-time-cpu-us` and `--start-time-us` CLI arguments
- \[[#4428](https://github.com/firecracker-microvm/firecracker/pull/4428)\]
Booting microVMs using MPTable and command line parameters for VirtIO devices.
The functionality is substituted with ACPI.
40 changes: 39 additions & 1 deletion docs/kernel-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ The configuration items that may be relevant for Firecracker are:
- guest RNG - `CONFIG_RANDOM_TRUST_CPU`
- use CPU RNG instructions (if present) to initialize RNG. Available for >=
5.10
- ACPI support - `CONFIG_ACPI` and `CONFIG_PCI`

There are also guest config options which are dependant on the platform on which
Firecracker is run:
Expand Down Expand Up @@ -81,16 +82,53 @@ the minimal configuration for a guest kernel for a successful microVM boot is:
- `CONFIG_VIRTIO_BLK=y`
- x86_64
- `CONFIG_VIRTIO_BLK=y`
- `CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y`
- `CONFIG_ACPI=y`
- `CONFIG_PCI=y`
- `CONFIG_KVM_GUEST=y`.

*Optional*: To enable boot logs set `CONFIG_SERIAL_8250_CONSOLE=y` and
`CONFIG_PRINTK=y` in the guest kernel config.

##### Booting with ACPI (x86_64 only):

Firecracker supports booting kernels with ACPI support. The relevant
configurations for the guest kernel are:

- `CONFIG_ACPI=y`
- `CONFIG_PCI=y`

Please note that Firecracker does not support PCI devices. The `CONFIG_PCI`
option is needed for ACPI initialization inside the guest.

ACPI supersedes the legacy way of booting a microVM, i.e. via MPTable and
command line parameters for VirtIO devices.

We suggest that users disable MPTable and passing VirtIO devices via kernel
command line parameters. These boot mechanisms are now deprecated. Users can
disable these features by disabling the corresponding guest kernel configuration
parameters:

wearyzen marked this conversation as resolved.
Show resolved Hide resolved
- `CONFIG_X86_MPPARSE=n`
- `CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=n`

During the deprecation period Firecracker will continue to support the legacy
way of booting a microVM. Firecracker will be able to boot kernels with the
following configurations:

- Only ACPI
- Only legacy mechanisms
- Both ACPI and legacy mechanisms

## Caveats

- When using a 4.14 host and a 5.10 guest, we disable the SVE extension in the
guest. This is due to the introduction of the SVE extension in Graviton3,
which causes the default 5.10 guest (with SVE support enabled), to crash if
run with a 4.14 host which does not support SVE.
- [Snapshot compatibility across kernel versions](snapshotting/snapshot-support.md#snapshot-compatibility-across-kernel-versions)
- When booting with kernels that support both ACPI and legacy boot mechanisms
Firecracker passes VirtIO devices to the guest twice, once through ACPI and a
second time via kernel command line parameters. In these cases, the guest
tries to initialize devices twice. The second time, initialization fails and
the guest will emit warning messages in `dmesg`, however the devices will work
correctly.
Loading
Loading