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

Commits on Mar 25, 2024

  1. vmm: handle uniformly GSIs and memory of a guest

    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 <[email protected]>
    bchalios committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    4977d9c View commit details
    Browse the repository at this point in the history
  2. acpi: create acpi-tables crate

    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 <[email protected]>
    bchalios committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    426fccf View commit details
    Browse the repository at this point in the history
  3. acpi: add ACPI support in Firecracker

    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 <[email protected]>
    bchalios committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    b282e36 View commit details
    Browse the repository at this point in the history
  4. acpi: define x86 devices in ACPI DSDT table

    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 <[email protected]>
    bchalios committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    dd1baed View commit details
    Browse the repository at this point in the history
  5. acpi: fix test_net_change_mac_address test

    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 <[email protected]>
    bchalios committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    a59f15c View commit details
    Browse the repository at this point in the history
  6. acpi: x86 guest kernel configs for ACPI support

    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 <[email protected]>
    bchalios committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    6be74ff View commit details
    Browse the repository at this point in the history
  7. ci: hardcode guest kernel version 5.10

    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 <[email protected]>
    bchalios committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    5b9961a View commit details
    Browse the repository at this point in the history
  8. docs: add info about ACPI-related kernel configuration

    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 <[email protected]>
    bchalios committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    751a014 View commit details
    Browse the repository at this point in the history
  9. acpi: add CHANGELOG entry about ACPI support

    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 <[email protected]>
    bchalios committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    df09c5d View commit details
    Browse the repository at this point in the history