From 1d15851b275b72aa08d13ac7bde9dd8464cfeed0 Mon Sep 17 00:00:00 2001 From: Zide Chen Date: Fri, 13 Sep 2019 14:21:05 -0700 Subject: 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 Signed-off-by: Zide Chen Signed-off-by: Sainath Grandhi Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1873356 Reviewed-by: Daniel Verkamp Tested-by: kokoro Commit-Queue: Stephen Barber --- devices/src/virtio/virtio_device.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'devices/src/virtio/virtio_device.rs') 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]; -- cgit 1.4.1