Commit Graph

12 Commits

Author SHA1 Message Date
Wei Liu
ac0aa8aa5e vfio_user: fix two clippy warnings
Signed-off-by: Wei Liu <liuwe@microsoft.com>
2022-08-09 17:20:14 +00:00
Rob Bradford
2716bc3311 build: Fix beta clippy issue (derive_partial_eq_without_eq)
warning: you are deriving `PartialEq` and can implement `Eq`
  --> vmm/src/serial_manager.rs:59:30
   |
59 | #[derive(Debug, Clone, Copy, PartialEq)]
   |                              ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2022-06-30 20:50:45 +01:00
Bo Chen
c614dcb9f7 vfio_user: Embed retry of getting region caps into 'get_region_info'
Signed-off-by: Bo Chen <chen.bo@intel.com>
2022-05-04 13:53:47 +02:00
Bo Chen
b9fb849b83 vfio_user: Parse region capability 'VFIO_REGION_INFO_CAP_SPARSE_MMAP'
Fixes: #4018

Signed-off-by: Bo Chen <chen.bo@intel.com>
2022-05-04 13:53:47 +02:00
Bo Chen
0c00da1dd8 vfio_user: Split the function for getting device regions
To prepare the support of region capabilities, this commit factorizes
the `VFIO_USER_DEVICE_GET_REGION_INFO` operation in its own function. In
this process, it also removes the need of the hard-coded arbitrary value
for `vfio_region_info.argsz` (the maximum size of the reply payload).

Signed-off-by: Bo Chen <chen.bo@intel.com>
2022-05-04 13:53:47 +02:00
Bo Chen
28fb2d3235 vfio_user: Import "std::mem::size_of" for shorter reference
Signed-off-by: Bo Chen <chen.bo@intel.com>
2022-05-04 13:53:47 +02:00
Sebastien Boeuf
028961ac9f vfio_user: Shutdown the communication with the backend
Whenever a vfio-user device is dropped, the communication between the
VMM and the backend should be shutdown.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2022-03-18 12:45:26 +01:00
Ziye Yang
e91409956d vfio_user: Replace info! with debug!
In my opinion, it is enough to use debug!

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2021-11-29 10:20:16 +01:00
Wei Liu
d8becc742c vfio_user: add safety comments for impl ByteValued
Signed-off-by: Wei Liu <liuwe@microsoft.com>
2021-11-17 14:40:51 +00:00
Sebastien Boeuf
620aaf234e vfio_user: DmaUnmap expects a reply with payload
The current code was expecting a reply with only the header, which
wasn't reading the rest of payload that was provided. This was causing
the following replies to be completely wrong as they were shifted by the
previous payload that wasn't read.

The simple way to fix this issue is by reading the header and the
expected payload when getting a reply from a DmaUnmap request.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-08-17 09:03:43 -07:00
Rob Bradford
d13eea3ba1 vfio_user: Fix debug output to include reply for DeviceGetRegionInfo
The reply was being printed before it had been read so it was just
showing the default values.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-08-12 13:19:04 +01:00
Rob Bradford
2e236c53c8 vfio_user: Implement client side support
Implement (most) of the client side (i.e. VMM side) of the vfio-user
protocol:

https://github.com/nutanix/libvfio-user/blob/master/docs/vfio-user.rst

Items that are not implemented (because they are optimisations or unused
due to alternative solutions:

* VFIO_USER_DMA_READ/WRITE - this is a way for the server to read guest
  memory if the guest memory is not shared by fd where the client
  doesn't support it. However since we do support sharing the memory by
  fd this is not required.
* VFIO_USER_GET_REGION_IO_FDS - an optimisation to bypass the VMM by
  having KVM talk directly to the backend using ioregionfd
* VFIO_USER_DIRTY_PAGES - for the implementation of live migration

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-08-10 16:01:00 +01:00