summary refs log tree commit diff
path: root/devices/src/virtio/virtio_device.rs
diff options
context:
space:
mode:
authorZide Chen <zide.chen@intel.corp-partner.google.com>2019-09-13 14:21:05 -0700
committerCommit Bot <commit-bot@chromium.org>2019-10-24 20:46:37 +0000
commit1d15851b275b72aa08d13ac7bde9dd8464cfeed0 (patch)
treecd2eaa677385f881b8bf472d16a8836e3e1b225d /devices/src/virtio/virtio_device.rs
parent1955fd1fb317841ecdf31666a5d88021670ae035 (diff)
downloadcrosvm-1d15851b275b72aa08d13ac7bde9dd8464cfeed0.tar
crosvm-1d15851b275b72aa08d13ac7bde9dd8464cfeed0.tar.gz
crosvm-1d15851b275b72aa08d13ac7bde9dd8464cfeed0.tar.bz2
crosvm-1d15851b275b72aa08d13ac7bde9dd8464cfeed0.tar.lz
crosvm-1d15851b275b72aa08d13ac7bde9dd8464cfeed0.tar.xz
crosvm-1d15851b275b72aa08d13ac7bde9dd8464cfeed0.tar.zst
crosvm-1d15851b275b72aa08d13ac7bde9dd8464cfeed0.zip
devices: implement msix capability structure
The MSI-X feature is ported from Cloud-hypervisor commit 69e27288a2e.
(https://github.com/intel/cloud-hypervisor.git)

In this commit:

- add a new "msix" module to the pci crate.
- implement the MSI-X Capability Structure.
- implement per virtio device msix_vectors() function which represents the
  supported MSI-X vector for this device.

BUG=chromium:854765
TEST=launch Crosvm on eve and Linux
TEST=cargo test -p devices
TEST=./bin/clippy
TEST=./build_test.py --x86_64-sysroot /build/eve

Change-Id: I5498b15a3bf115e34764e6610407b3ba204dae7f
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.corp-partner.google.com>
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1873356
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
Diffstat (limited to 'devices/src/virtio/virtio_device.rs')
-rw-r--r--devices/src/virtio/virtio_device.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/devices/src/virtio/virtio_device.rs b/devices/src/virtio/virtio_device.rs
index d024d33..fa80b48 100644
--- a/devices/src/virtio/virtio_device.rs
+++ b/devices/src/virtio/virtio_device.rs
@@ -34,6 +34,11 @@ pub trait VirtioDevice: Send {
     /// The virtio device type.
     fn device_type(&self) -> u32;
 
+    /// number of MSI-X vectors. 0 means MSI-X not supported.
+    fn msix_vectors(&self) -> u16 {
+        0
+    }
+
     /// The maximum size of each queue that this device supports.
     fn queue_max_sizes(&self) -> &[u16];