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>
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>
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>
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>
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>
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>
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>
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>
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>
Fix a bug in SlaveReqHandler::set_config(), it should remove the
message header of the buffer passed to backend.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
The vhost crate is written from scratch, so it should be licensed to
Alibaba Cloud instead of Google.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
By relaxing the dependency to ">=0.6" this crate can be used in projects
using newer vm-memory without pulling in duplicates of the crate.
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
vhost_vdpa_config has a flexible array member (buf).
Let's use vmm_sys_util::fam module to handle it in get_config()
and set_config().
This simplifies the code and reduces the unsafe block to just
the ioctl call.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This function is not used and possible users can call directly
`parse` on structures implementing VhostIotlbMsgParser trait.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
crates.io does not allow publishing crates which have wildcards in
their dependencies. We had one for "serial_test", so replace the
wildcard pointing it to the current major/minor ("0.5").
Signed-off-by: Sergio Lopez <slp@redhat.com>
vDPA simulators are available since Linux 5.7.
The CI may have an older kernel, so to avoid CI failures, for now
we skip the tests if we don't find the device.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Add dma_map/dma_unmap functions in VhostVdpa trait and implement
them in VhostKernVdpa using the IOTLB messages support provided
by VhostIotlbBackend.
Add also a specific test in vhost_kern/vdpa.rs.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Add a vhost-vdpa in-kernel implementation of VhostVdpa trait.
Tests are serialized since the device supports only a single user
at a time.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Add new VhostVdpa trait to handle vhost-vdpa devices and a new
vhost-vdpa building feature.
vhost-vdpa devices is based on vhost backend, for this reason
VhostVdpa trait requires VhostBackend.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Implement VhostIotlbBackend trait for vhost_kern handling both
vhost_msg and vhost_msg_v2 messages according to acked backend
features.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This new VhostIotlbBackend trait will be implemented by the backends
that support IOTLB messages.
Add also VhostIotlbMsg struct and related enums to handle IOTLB
messages properly.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Add new VhostKernFeatures trait to handle the backend features
supported by the backend and acked by the fronted.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
VHOST_ACCESS_* and VHOST_IOTLB_* constants are assigned to c_uchar
fields and VHOST_IOTLB_MSG to a c_int field.
Let's set the proper types to avoid casts when assigning them.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
recv_with_fds from vmm-sys-util was never safe, but was incorrectly
not marked as safe. Handle it safely in every function where we have
enough information to know that calling it will be safe, and propogate
the unsafe to any function where we don't.
Fortunately this is quite straightforward now all of the high-level
methods have the guarantee that they're returning ByteValued types.
Signed-off-by: Alyssa Ross <hi@alyssa.is>
These error enums are required to handle various errors during
memfd_create, ftruncate and memfd sealing operations.
Signed-off-by: Harshavardhan Unnibhavi <harshanavkis@gmail.com>
Implement FromRawFd for Listener, using the underlying UnixListener
FromRawFd implementation.
This is useful when the listener socket is inherited as a file
descriptor from a parent (such as libvirt or a jailer).
Signed-off-by: Sergio Lopez <slp@redhat.com>