Go to file
Manos Pitsidianakis a1e013286f Move all crates to workspace root
Having all the workspace crates under the crates/ directory is
unnecessary. Rust documentation itself recommends all crates to be in
the root directory:

https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html#creating-the-second-package-in-the-workspace

I paste the text content here, in case the online page ever changes or
becomes unavailable:

    ## Creating the Second Package in the Workspace

    Next, let’s create another member package in the workspace and call it add_one. Change the top-level Cargo.toml to specify the add_one path in the members list:

    Filename: Cargo.toml

    [workspace]

    members = [
        "adder",
        "add_one",
    ]

    Then generate a new library crate named add_one:

    $ cargo new add_one --lib
         Created library `add_one` package

    Your add directory should now have these directories and files:

    ├── Cargo.lock
    ├── Cargo.toml
    ├── add_one
    │   ├── Cargo.toml
    │   └── src
    │       └── lib.rs
    ├── adder
    │   ├── Cargo.toml
    │   └── src
    │       └── main.rs
    └── target

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-10-16 12:03:57 +05:30
.cargo Ignore advisory: RUSTSEC-2021-0145 2022-11-30 12:01:14 +05:30
.github dependabot: enable update grouping 2023-10-06 12:58:11 +05:30
rust-vmm-ci@9751aaa0d0 build(deps): bump rust-vmm-ci from 665f31f to 9751aaa 2023-10-03 09:03:40 +05:30
staging Add new workspace under staging/ subdirectory 2023-10-11 16:25:00 +05:30
vhost-device-gpio Move all crates to workspace root 2023-10-16 12:03:57 +05:30
vhost-device-i2c Move all crates to workspace root 2023-10-16 12:03:57 +05:30
vhost-device-rng Move all crates to workspace root 2023-10-16 12:03:57 +05:30
vhost-device-scmi Move all crates to workspace root 2023-10-16 12:03:57 +05:30
vhost-device-scsi Move all crates to workspace root 2023-10-16 12:03:57 +05:30
vhost-device-vsock Move all crates to workspace root 2023-10-16 12:03:57 +05:30
.gitignore Add .gitignore 2021-08-19 09:52:14 +03:00
.gitmodules Initial commit 2021-05-26 10:18:40 +03:00
Cargo.lock build(deps): bump the vhost-device group with 6 updates 2023-10-16 11:58:26 +05:30
Cargo.toml Move all crates to workspace root 2023-10-16 12:03:57 +05:30
CODEOWNERS CODEOWNERS: add stefano-garzarella 2022-10-13 09:41:24 +02:00
coverage_config_x86_64.json tests: adjust code coverage after tool updates 2023-09-13 15:58:52 +01:00
LICENSE-APACHE Initial commit 2021-05-26 10:18:40 +03:00
LICENSE-BSD-3-Clause Add BSD-3-Clause license for the crates 2022-10-27 11:19:40 -06:00
README.md Move all crates to workspace root 2023-10-16 12:03:57 +05:30

vhost-device

Design

This repository hosts various 'vhost-user' device backends in their own crates. See their individual README.md files for specific information about those crates.

Here is the list of device backends that we support:

For vhost-user device backends that have no final specification merged into the VIRTIO specification, or have partial functionality, we have a staging workspace. More information may be found in its README file.

Here is the list of device backends in staging:

  • Currently none.

Testing and Code Coverage

Like the wider rust-vmm project we expect new features to come with comprehensive code coverage. However as a multi-binary repository there are cases where avoiding a drop in coverage can be hard and an exception to the approach is allowable. These are:

  • adding a new binary target (aim at least 60% overall coverage)
  • expanding the main function (a small drop is acceptable)

However any new feature added to an existing binary should not cause a drop in coverage. The general aim should be to always improve coverage.

Separation of Concerns

The binaries built by this repository can be run with any VMM which can act as a vhost-user frontend. Typically they have been tested with QEMU although the rust-vmm project does provide a vhost-user frontend crate for rust based VMMs.

While it's possible to implement all parts of the backend inside the vhost-device workspace consideration should be given to separating the VirtQueue handling and response logic to a crate in vm-virtio devices. This way a monolithic rust-vmm VMM implementation can reuse the core logic to service the virtio requests directly in the application.

Build dependency

The GPIO crate needs a local installation of libgpiod library to be available. If your distro ships libgpiod >= v2.0, then you should be fine.

Otherwise, you will need to build libgpiod yourself:

git clone --depth 1 --branch v2.0.x https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/
cd libgpiod
./autogen.sh --prefix="$PWD/install/"
make install

In order to inform tools about the build location, you can now set:

export PKG_CONFIG_PATH="<PATH-TO-LIBGPIOD>/install/lib/pkgconfig/"

To prevent setting this in every terminal session, you can also configure cargo to set it automatically.

Xen support

Supporting Xen requires special handling while mapping the guest memory. The vm-memory crate implements xen memory mapping support via a separate feature xen, and this crate uses the same feature name to enable Xen support.

It was decided by the rust-vmm maintainers to keep the interface simple and build the crate for either standard Unix memory mapping or Xen, and not both.