-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unify the kvm-ioctls and kvm-bindings READMEs. While doing this, I dropped parts of the kvm-bindings readme that covered how to add the crate as a dependency in `Cargo.toml`. My reasoning for this is that the steps were fairly outdated (predating rust edition 2018, due to advising for use of `extern crate`), and also should be fairly obvious for anyone who has used Rust before. Note that this version of the README assumes that renames of the repository and CI pipelines have already taken place. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
- Loading branch information
1 parent
aeb6bf7
commit 13123da
Showing
3 changed files
with
91 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
[![Build Status](https://badge.buildkite.com/9e0e6c88972a3248a0908506d6946624da84e4e18c0870c4d0.svg)](https://buildkite.com/rust-vmm/kvm-ci) | ||
|
||
# `kvm` - Rust Bindings and Wrappers Linux's Kernel Virtual Machine APIs | ||
|
||
This repository contains the `kvm-bindings` and `kvm-ioctls` crates. | ||
|
||
## kvm-ioctls | ||
|
||
[![crates.io](https://img.shields.io/crates/v/kvm-ioctls.svg)](https://crates.io/crates/kvm-ioctls) | ||
|
||
The kvm-ioctls crate provides safe wrappers over the | ||
[KVM API](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt), a set | ||
of ioctls used for creating and configuring Virtual Machines (VMs) on Linux. | ||
The ioctls are accessible through four structures: | ||
- `Kvm` - wrappers over system ioctls | ||
- `VmFd` - wrappers over VM ioctls | ||
- `VcpuFd` - wrappers over vCPU ioctls | ||
- `DeviceFd` - wrappers over device ioctls | ||
|
||
For further details check the | ||
[KVM API](https://www.kernel.org/doc/Documentation/virtual/kvm/api.txt) as well | ||
as the code documentation. | ||
|
||
## kvm-bindings | ||
|
||
[![crates.io](https://img.shields.io/crates/v/kvm-bindings.svg)](https://crates.io/crates/kvm-bindings) | ||
|
||
Rust FFI bindings to KVM, generated using | ||
[bindgen](https://crates.io/crates/bindgen). It currently has support for the | ||
following target architectures: | ||
- x86\_64 | ||
- arm64 | ||
- riscv64 | ||
|
||
The bindings exported by this crate are statically generated using header files | ||
associated with a specific kernel version, and are not automatically synced with | ||
the kernel version running on a particular host. The user must ensure that | ||
specific structures, members, or constants are supported and valid for the | ||
kernel version they are using. For example, the `immediate_exit` field from the | ||
`kvm_run` structure is only meaningful if the `KVM_CAP_IMMEDIATE_EXIT` | ||
capability is available. Using invalid fields or features may lead to undefined | ||
behaviour. | ||
|
||
This crate also offers safe wrappers over FAM structs - FFI structs that have | ||
a Flexible Array Member in their definition. | ||
These safe wrappers can be used if the `fam-wrappers` feature is enabled for | ||
this crate. Note that enabling the `fam-wrappers` feature enables the `vmm-sys-util` | ||
dependency. | ||
|
||
### Serialization | ||
|
||
The crate also has an optional dependency on [`serde`](serde.rs) when enabling the | ||
`serde` feature, to allow serialization of bindings. Serialization of | ||
bindings happens as opaque binary blobs via [`zerocopy`](https://google.github.io/comprehensive-rust/bare-metal/useful-crates/zerocopy.html). | ||
Due to the kernel's ABI compatibility, this means that bindings serialized | ||
in version `x` of `kvm-bindings` can be deserialized in version `y` of the | ||
crate, even if the bindings have had been regenerated in the meantime. | ||
|
||
### Regenerating Bindings | ||
|
||
Please see [`CONTRIBUTING.md`](kvm-bindings/CONTRIBUTING.md) in the `kvm-bindings` | ||
crate for details on how to generate the bindings or add support for new architectures. | ||
|
||
## Supported Platforms | ||
|
||
The kvm-ioctls can be used on x86\_64, aarch64 and riscv64 (experimental). | ||
|
||
## Running the tests | ||
|
||
Our Continuous Integration (CI) pipeline is implemented on top of | ||
[Buildkite](https://buildkite.com/). | ||
For the complete list of tests, check our | ||
[CI pipeline](https://buildkite.com/rust-vmm/kvm-ci). | ||
|
||
Each individual test runs in a container. To reproduce a test locally, you can | ||
use the dev-container on x86\_64, arm64 and riscv64. | ||
|
||
```bash | ||
# For running riscv64 tests, replace v47 with v47-riscv. This provides an | ||
# emulated riscv64 environment on a x86_64 host. | ||
docker run --device=/dev/kvm \ | ||
-it \ | ||
--security-opt seccomp=unconfined \ | ||
--volume $(pwd)/kvm:/kvm \ | ||
rustvmm/dev:v47 | ||
cd kvm | ||
cargo test | ||
``` | ||
|
||
For more details about the integration tests that are run for `kvm`, | ||
check the [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci) readme. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.