Commit graph

562 commits

Author SHA1 Message Date
Viresh Kumar
b1f572160d vhost-user-backend: Update path to vhost crate
Reference the local path instead of via crates.io.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2022-10-11 12:28:25 +05:30
Viresh Kumar
40006d0b39 Merge remote-tracking branch 'vhost-user-backend/main' into workspace
This merges vhost-user-backend into this workspace along with its git
history.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2022-10-11 12:27:44 +05:30
Viresh Kumar
d4c021dea3 Convert to a workspace
Convert the vhost git repository into a crate, which hosts vhost crate
for now. Support for vhost-user-backend and other crates will be added
later on.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2022-10-11 11:59:25 +05:30
Sebastien Boeuf
f87156b776 vhost_kern: vdpa: Add missing ioctls
New ioctls have been recently introduced to interact with vDPA devices.

This patch is based on Linux kernel v6.0, adding the list of missing
ioctls:

- VHOST_VDPA_GET_CONFIG_SIZE
- VHOST_VDPA_GET_VQS_COUNT
- VHOST_VDPA_GET_GROUP_NUM
- VHOST_VDPA_GET_AS_NUM
- VHOST_VDPA_GET_VRING_GROUP
- VHOST_VDPA_SET_GROUP_ASID
- VHOST_VDPA_SUSPEND

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2022-10-10 16:02:38 +02:00
Sebastien Boeuf
787a424a86 vhost_user: Fix warning about unsafe not needed
There's no need to specify unsafe given the whole function is already
considered unsafe.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2022-10-10 16:02:38 +02:00
dependabot[bot]
edae1a5257 build(deps): bump rust-vmm-ci from 99fe2eb to 5f36cc9
Bumps [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci) from `99fe2eb` to `5f36cc9`.
- [Release notes](https://github.com/rust-vmm/rust-vmm-ci/releases)
- [Commits](99fe2eb2e0...5f36cc9604)

---
updated-dependencies:
- dependency-name: rust-vmm-ci
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-20 16:04:12 +02:00
Sergio Lopez
d6c8008bbd Release v0.7.0
This release includes:

- Started using caret dependencies
- Updated dependency nix 0.24 -> 0.25
- Updated depepdency log 0.4.6 -> 0.4.17
- Updated dependency vhost 0.4 -> 0.5
- Updated dependency virtio-queue 0.5.0 -> 0.6

Signed-off-by: Sergio Lopez <slp@redhat.com>
2022-09-14 10:59:31 +02:00
Sergio Lopez
917e85a3d5 Update dependencies and switch to caret versions
Update libc, log, vhost, virtio-queue and vm-memory
dependencies. Also, take this opportunity to specify the dependencies
with caret versions.

Switching to a newer vhost required some small changes to accommodate
the fact that VhostUserError::InvalidOperation now requires an
argument.

Signed-off-by: Sergio Lopez <slp@redhat.com>
2022-09-09 16:52:02 +02:00
wanglei01
796b9d9dfc release 0.5.0
See CHANGELOG.md file for details.

Signed-off-by: wanglei01 <wllenyj@linux.alibaba.com>
2022-09-07 16:09:23 +08:00
dependabot[bot]
610d4ee95c build(deps): update nix requirement from 0.24 to 0.25
Updates the requirements on [nix](https://github.com/nix-rust/nix) to permit the latest version.
- [Release notes](https://github.com/nix-rust/nix/releases)
- [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nix-rust/nix/compare/v0.24.0...v0.25.0)

---
updated-dependencies:
- dependency-name: nix
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-25 10:53:06 +03:00
wanglei01
88b57518c3 update dependency requirements
Use caret requirements for dependencies.

Fixes: rust-vmm/community#131

Signed-off-by: wanglei01 <wllenyj@linux.alibaba.com>
2022-08-25 09:43:33 +03:00
Alex Bennée
ebaac3c6b1 vhost_user: update link to the vhost-user spec
The spec has been converted to .rst and now generated a nicer rendered
version whenever it is updated in QEMU's master branch. Lets use it
instead.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2022-08-04 08:39:34 +02:00
Alex Bennée
e128197954 vhost_user: expand error messages for clarity
The InvalidOperation error type covers a wide range of error cases
which can be inscrutable when passed to the user. To help with this
we:

  - add a textual reason field to the error message
  - create InactiveFeature for use of un-neogitated features
  - create InactiveOperation for use of un-negotiated protocol extensions

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2022-08-04 08:39:34 +02:00
Alex Bennée
102d14e3b5 vhost_user: re-factor feature/proto bit checking
We can wrap up the feature checking into helpers to reduce the amount
of boilerplate code while enabling us to use a more idiomatic ?; exit
path on error.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2022-08-04 08:39:34 +02:00
Sebastien Boeuf
b056e0efc7 Release v0.6.0
This release includes:
- Fix vring initialization logic
- Bump to virtio-queue v0.5.0

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2022-07-29 17:38:12 +02:00
Andreea Florescu
8cfe7cec2c integrate virtio-queue
The virtio-queue interface is updated to take into consideration error
cases and to export a single Queue.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
2022-07-27 16:34:17 +02:00
Sebastien Boeuf
a94e14e81a handler: Fix vring initialization logic
Since it's the guest decision to rely on polling or interrupts to be
notified about used descriptors in the used ring, we can't expect an
EventFd to be set through SET_VRING_CALL if the guest chose the polling
method.

On the other hand, we always expect an EventFd to be provided through
SET_VRING_KICK since the current way of handling new descriptors is
exclusively by receiving an event through an eventfd (no polling mode
has been implemented).

That's why a vring should be initialized based on its state and if the
EventFd related to VRING_KICK has been set.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2022-07-22 09:02:58 +02:00
Jiang Liu
9f5a27225b Prepare for releasing v0.5.1
Prepare for releasing v0.5.1 to upgrade vmm-sys-util to 0.10.0

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-07-19 22:12:37 +08:00
dependabot[bot]
6749863466 build(deps): update vmm-sys-util requirement from 0.9 to 0.10
Updates the requirements on [vmm-sys-util](https://github.com/rust-vmm/vmm-sys-util) to permit the latest version.
- [Release notes](https://github.com/rust-vmm/vmm-sys-util/releases)
- [Changelog](https://github.com/rust-vmm/vmm-sys-util/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-vmm/vmm-sys-util/compare/v0.9.0...v0.10.0)

---
updated-dependencies:
- dependency-name: vmm-sys-util
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-19 01:38:10 +08:00
Sergio Lopez
9ff4acb259 Release v0.5.0
This release aligns its dependencies with rust-vmm's vhost
infrastructure by moving to virtio-queue v0.4.0.

Signed-off-by: Sergio Lopez <slp@redhat.com>
2022-07-05 17:37:48 +02:00
dependabot[bot]
5dc8b56185 build(deps): update virtio-queue requirement from 0.3 to 0.4
Updates the requirements on [virtio-queue](https://github.com/rust-vmm/vm-virtio) to permit the latest version.
- [Release notes](https://github.com/rust-vmm/vm-virtio/releases)
- [Commits](https://github.com/rust-vmm/vm-virtio/compare/virtio-queue-v0.3.0...virtio-queue-v0.4.0)

---
updated-dependencies:
- dependency-name: virtio-queue
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-05 10:01:37 +02:00
Sergio Lopez
ea2e3647f5 Release v0.4.0
This release aligns its dependencies with rust-vmm's vhost
infrastructure by moving to virtio-queue v0.3.0 and relaxing the
vm-memory dependency to require ">=0.7".

Signed-off-by: Sergio Lopez <slp@redhat.com>
2022-06-01 11:22:09 +02:00
Rob Bradford
14f58eda14 build: Bump virtio-queue version to 0.3
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2022-05-11 11:55:21 +02:00
Rob Bradford
12b37dcb07 build: Relax vm-memory dependency
This allows the use of newer versions of the vm-memory crate when
combined with other dependencies.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2022-05-11 11:55:21 +02:00
dependabot[bot]
7545d23e24 Update nix requirement from 0.23 to 0.24
Updates the requirements on [nix](https://github.com/nix-rust/nix) to permit the latest version.
- [Release notes](https://github.com/nix-rust/nix/releases)
- [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nix-rust/nix/compare/v0.23.0...v0.24.1)

---
updated-dependencies:
- dependency-name: nix
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-26 10:59:13 +02:00
Sebastien Boeuf
9f1bd2b99e Release v0.3.0
This release includes the latest rust-vmm/vhost crate (v0.4.0).

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2022-03-25 16:45:57 +01:00
dependabot[bot]
4fde808bd8 Update vhost requirement from 0.3 to 0.4
Updates the requirements on [vhost](https://github.com/rust-vmm/vhost) to permit the latest version.
- [Release notes](https://github.com/rust-vmm/vhost/releases)
- [Changelog](https://github.com/rust-vmm/vhost/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-vmm/vhost/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: vhost
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-21 18:22:29 +08:00
Sebastien Boeuf
7772f02e1a Release v0.4.0
This release contains some fixes for the CI as well as the CODEOWNERS
file. It fixes the implementation of get_iova_range() for vDPA, and
finally it implements its own version of the VhostKernBackend::valid()
method for vDPA.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2022-03-19 00:05:42 +08:00
Sebastien Boeuf
4fa43567d6 vhost_kern: vdpa: Override valid()
Since vDPA could be dealing with IOVAs corresponding to GVAs, it
wouldn't make sense to go through the validation of the descriptor
table address, available ring address and used ring address against
the guest memory representation we have access to.

For this reason, we override the default implementation of the valid()
method from the VhostKernBackend trait, to provide a simpler
implementation.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2022-03-18 18:39:03 +08:00
dependabot[bot]
171603c6b5 build(deps): bump rust-vmm-ci from d216a46 to 99fe2eb
Bumps [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci) from `d216a46` to `99fe2eb`.
- [Release notes](https://github.com/rust-vmm/rust-vmm-ci/releases)
- [Commits](d216a46879...99fe2eb2e0)

---
updated-dependencies:
- dependency-name: rust-vmm-ci
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-18 11:31:45 +02:00
Stefano Garzarella
c605e7a62a vhost_kern/vdpa: fix get_iova_range()
A wrong ioctl request was used in get_iova_range().
Unfortunately, there was no test, otherwise the ioctl would fail.

Let's fix this by using the right ioctl request.
We also add a test by checking the values we expect from
a vDPA-block simulator that returns [0, u64::MAX] range.

Fixes  #106

Reported-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-03-12 11:24:55 +08:00
Sebastien Boeuf
355a9ce13c Release v0.2.0
This release implements AsRawFd for VringEpollHandler, as well as adds a
way for running the vhost-user daemon as a client.

Both of these are required by Cloud Hypervisor to rely on the
vhost-user-backend crate.

Fixes #62

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2022-03-07 12:39:35 +01:00
dependabot[bot]
ebb6d93fe0 Update virtio-queue requirement from 0.1 to 0.2
Updates the requirements on [virtio-queue](https://github.com/rust-vmm/vm-virtio) to permit the latest version.
- [Release notes](https://github.com/rust-vmm/vm-virtio/releases)
- [Commits](https://github.com/rust-vmm/vm-virtio/compare/virtio-queue-v0.1.0...virtio-queue-v0.2.0)

---
updated-dependencies:
- dependency-name: virtio-queue
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-07 10:12:30 +02:00
dependabot[bot]
6e66d2c1a4 Bump rust-vmm-ci from d216a46 to 99fe2eb
Bumps [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci) from `d216a46` to `99fe2eb`.
- [Release notes](https://github.com/rust-vmm/rust-vmm-ci/releases)
- [Commits](d216a46879...99fe2eb2e0)

---
updated-dependencies:
- dependency-name: rust-vmm-ci
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-02 10:37:02 +01:00
Laura Loghin
4bc87adf80 fix CODEOWNERS file
The gatekeeper-PullAssigner was not correctly added in
the codeowners file (with its github handle). Removed it
from the file, so that the codewners are automatically
requested to review a new PR.
Since I was here, also reordered alphabetically the users.

Signed-off-by: Laura Loghin <lauralg@amazon.com>
2022-02-16 15:55:50 +01:00
Sebastien Boeuf
bbc892ba45 lib: Allow the daemon to run as a client
In order to support vhost-user client mode, we introduce a new method
start_client() to VhostUserDaemon. It allows the daemon to connect to
the VMM side running as the server in this case.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2022-02-03 17:13:29 +08:00
Sebastien Boeuf
1c4ee49a89 Implement AsRawFd for VringEpollHandler
In order to let the consumer of the crate access directly the file
descriptor related to the VringEpollHandler, we implement the AsRawFd
trait.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2022-02-03 00:15:43 +08:00
Sergii Glushchenko
8b4f6d4f36 Fix warnings and adjust test coverage
Signed-off-by: Sergii Glushchenko <gsserge@amazon.com>
2022-01-25 09:10:00 +01:00
dependabot[bot]
8b4e5d8f80 build(deps): bump rust-vmm-ci from b6858b2 to d216a46
Bumps [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci) from `b6858b2` to `d216a46`.
- [Release notes](https://github.com/rust-vmm/rust-vmm-ci/releases)
- [Commits](b6858b232d...d216a46879)

---
updated-dependencies:
- dependency-name: rust-vmm-ci
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-25 09:10:00 +01:00
Sergii Glushchenko
9517235567 Fix clippy warnings and adjust test coverage
Signed-off-by: Sergii Glushchenko <gsserge@amazon.com>
2022-01-24 12:54:10 +02:00
dependabot[bot]
4204d5237d Bump rust-vmm-ci from b6858b2 to d216a46
Bumps [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci) from `b6858b2` to `d216a46`.
- [Release notes](https://github.com/rust-vmm/rust-vmm-ci/releases)
- [Commits](b6858b232d...d216a46879)

---
updated-dependencies:
- dependency-name: rust-vmm-ci
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-24 12:54:10 +02:00
dependabot[bot]
4e1101f6c0 build(deps): bump rust-vmm-ci from aee82cf to b6858b2
Bumps [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci) from `aee82cf` to `b6858b2`.
- [Release notes](https://github.com/rust-vmm/rust-vmm-ci/releases)
- [Commits](aee82cf0a4...b6858b232d)

---
updated-dependencies:
- dependency-name: rust-vmm-ci
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-18 09:11:16 +01:00
dependabot[bot]
8fc1a935a0 Bump rust-vmm-ci from aee82cf to b6858b2
Bumps [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci) from `aee82cf` to `b6858b2`.
- [Release notes](https://github.com/rust-vmm/rust-vmm-ci/releases)
- [Commits](aee82cf0a4...b6858b232d)

---
updated-dependencies:
- dependency-name: rust-vmm-ci
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-17 16:03:13 +01:00
dependabot[bot]
c193fa966d Update nix requirement from 0.22 to 0.23
Updates the requirements on [nix](https://github.com/nix-rust/nix) to permit the latest version.
- [Release notes](https://github.com/nix-rust/nix/releases)
- [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nix-rust/nix/compare/v0.22.0...v0.23.1)

---
updated-dependencies:
- dependency-name: nix
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-03 17:49:02 +08:00
Sergio Lopez
79a6c58569 Add an initial CHANGELOG.md for v0.1.0
Add an initial CHANGELOG.md using the rust-vmm template, indicating
that v0.1.0 is the first release

Signed-off-by: Sergio Lopez <slp@redhat.com>
2021-12-22 21:21:55 +08:00
Liu Jiang
48070ccb7c Add test case to cover VhostUserHandler
Previous patch causes dramatic code coverage decrease, it actually
disclose some issue in the code coverage test. Then we add test case
to cover VhostUserHandler, it actually increases the code coverage.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-22 18:58:54 +08:00
Liu Jiang
4e16112122 Refine test case to increase code coverage
Try to increase code coverage by adding more test code. But it actually
causes dramatic decreases in code coverage:(

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-22 18:58:54 +08:00
Liu Jiang
72d754b9ee Simplify trait/impl bound declarations
Currently trait bound declarations is a little over complex when
defines traits or implements traits/structs. Let's simplfy it.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-22 18:58:54 +08:00
Liu Jiang
eb393cf3db Simple syntax only change to keep some order
Some idea tools advises to keep all methods in the same order as trait
definition when implementation the trait for structure.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-22 18:58:54 +08:00
Liu Jiang
a6c815d631 Avoid unwrap() in VhostUserDaemon::start()
The SlaveListener::accept() may return Ok(None), handle this case to
avoid unexpected panic.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-22 18:58:54 +08:00