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

[DRAFT] Prerequisite for proper device manager. #4509

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Commits on Mar 16, 2024

  1. feat: add device_manager

    Add single entity to controll all devices in the vmm.
    There are currently 2 types of devices in
    Firecraker: mmio and pio devices. Each type is
    managed by it's own device manager. This works fine
    in current setup. But with prospect of adding ACPI
    there will be 3 types of devices and all interactions
    with them will become more entangled than they are
    right now. To prevent this from happening single
    device manager will controll all devices and have
    all device specific logic inside of it.
    
    Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
    ShadowCurse committed Mar 16, 2024
    Configuration menu
    Copy the full SHA
    a4dd345 View commit details
    Browse the repository at this point in the history
  2. refactor(mmio): move KVM device registration to MMIODeviceInfo

    Now registration of KVM resources is not attached to the
    mmio_device_manager and can be performed outside of it.
    
    Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
    ShadowCurse committed Mar 16, 2024
    Configuration menu
    Copy the full SHA
    250d371 View commit details
    Browse the repository at this point in the history
  3. refactor(mmio): move cmd line update out of mmio_device_manager

    Update of cmd line with virtio devices does not need to access
    to the mmio_device_manager and can be done outside of it.
    
    Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
    ShadowCurse committed Mar 16, 2024
    Configuration menu
    Copy the full SHA
    f0d06c7 View commit details
    Browse the repository at this point in the history
  4. refactor(mmio): explicit bus device addition

    MMIODeviceManager was aware of different types
    of devices like Rtc or BootTimer. Because of this
    MMIODeviceManager had specialized methods to deal
    with such devices. This commit tries to generalize
    addition of such devices, so MMIODeviceManager will
    not differentiate between them.
    
    Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
    ShadowCurse committed Mar 16, 2024
    Configuration menu
    Copy the full SHA
    069e62a View commit details
    Browse the repository at this point in the history
  5. refactor(serial): remove generic from SerialDevice

    SerialDevice is always used with stdin as an input
    source. Setting generic parameter of SerialDevice
    to always be Stdin removes duplication of it's
    definitions all over codebase. Also it allows to make a
    simple `new` method to create SerialDevice instead
    of specifying each field separately.
    
    Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
    ShadowCurse committed Mar 16, 2024
    Configuration menu
    Copy the full SHA
    a507c22 View commit details
    Browse the repository at this point in the history
  6. refactor(mmio): move irqfd registration to MMIODeviceInfo

    MMIODeviceInfo now handles registration of irqfd.
    This registration can happen outside of MMIODeviceManager
    in the future.
    
    Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
    ShadowCurse committed Mar 16, 2024
    Configuration menu
    Copy the full SHA
    e08ef27 View commit details
    Browse the repository at this point in the history
  7. refactor(mmio): rename allocate_mmio_resources

    Rename allocate_mmio_resources into allocate_device_info
    to better specify the method output.
    
    Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
    ShadowCurse committed Mar 16, 2024
    Configuration menu
    Copy the full SHA
    d83efb3 View commit details
    Browse the repository at this point in the history
  8. refactor(mmio): remove serial device specific method

    Remove special method for serial device from MMIODeviceManager.
    Now MMIODeviceManager does not have any device specific
    methods.
    
    Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
    ShadowCurse committed Mar 16, 2024
    Configuration menu
    Copy the full SHA
    a23efd7 View commit details
    Browse the repository at this point in the history
  9. refactor(builder): remove setup_serial_device method

    setup_serial_device was only used for x86_64 PortIODeviceManager
    creation. Moving creation of serial device near creation
    of PortIODeviceManager removes a need to jump through the code
    to see how serial device is created.
    
    Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
    ShadowCurse committed Mar 16, 2024
    Configuration menu
    Copy the full SHA
    9e6c1b3 View commit details
    Browse the repository at this point in the history
  10. refactor(mmio): move MMIODeviceManager into separate module

    MMIODeviceManager's implementation was spread across 2 modules:
    mmio.rs and persist.rs. By moving all implementation into mmio
    module we wil have an easir time when it comes to add more
    device managers (e.g. ACPI device_manager).
    
    Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
    ShadowCurse committed Mar 16, 2024
    Configuration menu
    Copy the full SHA
    e7a4972 View commit details
    Browse the repository at this point in the history
  11. refactor(device_manager): use DeviceManager to save/restore state

    Before the inner `MMIODeviceManager` was responsible for state of
    devices. With this commit it will be easier to save states of other
    device types (e.g. ACPI devices).
    
    Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
    ShadowCurse committed Mar 16, 2024
    Configuration menu
    Copy the full SHA
    c782e06 View commit details
    Browse the repository at this point in the history
  12. refactor(mmio): replace register_mmio_virtio with add_device_with_info

    New `add_device_with_info` method plays a bit better with other new
    `add_*` methods.
    
    Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
    ShadowCurse committed Mar 16, 2024
    Configuration menu
    Copy the full SHA
    6864abd View commit details
    Browse the repository at this point in the history