diff options
author | Daniel Verkamp <dverkamp@chromium.org> | 2019-11-19 09:47:33 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-12-06 01:45:44 +0000 |
commit | bb712d649f82f623d9d2ed25f9ab758fa4343e19 (patch) | |
tree | dbee8a3200cda942f78f324846e72b0515ff3996 /devices/src/virtio/vhost | |
parent | 277ea5f4b4e2e2fed0b07f68451514cef521a95a (diff) | |
download | crosvm-bb712d649f82f623d9d2ed25f9ab758fa4343e19.tar crosvm-bb712d649f82f623d9d2ed25f9ab758fa4343e19.tar.gz crosvm-bb712d649f82f623d9d2ed25f9ab758fa4343e19.tar.bz2 crosvm-bb712d649f82f623d9d2ed25f9ab758fa4343e19.tar.lz crosvm-bb712d649f82f623d9d2ed25f9ab758fa4343e19.tar.xz crosvm-bb712d649f82f623d9d2ed25f9ab758fa4343e19.tar.zst crosvm-bb712d649f82f623d9d2ed25f9ab758fa4343e19.zip |
devices: virtio: enable MSI-X for all devices
All virtio devices can use the same generic calculation for number of MSI-X vectors required: number of queues plus one for configuration changes. Move this calculation to the VirtioPciDevice implementation and remove the Option to unconditionally enable MSI-X support for all PCI virtio devices. BUG=chromium:854765 TEST=Verify all virtio interrupts in /proc/interrupts are PCI-MSI Change-Id: I5905ab52840e7617b0b342ec6ca3f75dccd16e4d Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1925169 Reviewed-by: Zide Chen <zide.chen@intel.com> Reviewed-by: Dylan Reid <dgreid@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'devices/src/virtio/vhost')
-rw-r--r-- | devices/src/virtio/vhost/net.rs | 7 | ||||
-rw-r--r-- | devices/src/virtio/vhost/vsock.rs | 7 |
2 files changed, 2 insertions, 12 deletions
diff --git a/devices/src/virtio/vhost/net.rs b/devices/src/virtio/vhost/net.rs index 5834aa7..2082a0f 100644 --- a/devices/src/virtio/vhost/net.rs +++ b/devices/src/virtio/vhost/net.rs @@ -21,7 +21,6 @@ use crate::virtio::{Interrupt, Queue, VirtioDevice, TYPE_NET}; const QUEUE_SIZE: u16 = 256; const NUM_QUEUES: usize = 2; const QUEUE_SIZES: &[u16] = &[QUEUE_SIZE; NUM_QUEUES]; -const NUM_MSIX_VECTORS: u16 = NUM_QUEUES as u16; pub struct Net<T: TapT, U: VhostNetT<T>> { workers_kill_evt: Option<EventFd>, @@ -82,7 +81,7 @@ where | 1 << virtio_sys::vhost::VIRTIO_F_VERSION_1; let mut vhost_interrupt = Vec::new(); - for _ in 0..NUM_MSIX_VECTORS { + for _ in 0..NUM_QUEUES { vhost_interrupt.push(EventFd::new().map_err(Error::VhostIrqCreate)?); } @@ -150,10 +149,6 @@ where TYPE_NET } - fn msix_vectors(&self) -> u16 { - NUM_MSIX_VECTORS - } - fn queue_max_sizes(&self) -> &[u16] { QUEUE_SIZES } diff --git a/devices/src/virtio/vhost/vsock.rs b/devices/src/virtio/vhost/vsock.rs index 231e134..32f2c99 100644 --- a/devices/src/virtio/vhost/vsock.rs +++ b/devices/src/virtio/vhost/vsock.rs @@ -17,7 +17,6 @@ use crate::virtio::{copy_config, Interrupt, Queue, VirtioDevice, TYPE_VSOCK}; const QUEUE_SIZE: u16 = 256; const NUM_QUEUES: usize = 3; const QUEUE_SIZES: &[u16] = &[QUEUE_SIZE; NUM_QUEUES]; -const NUM_MSIX_VECTORS: u16 = NUM_QUEUES as u16; pub struct Vsock { worker_kill_evt: Option<EventFd>, @@ -43,7 +42,7 @@ impl Vsock { | 1 << virtio_sys::vhost::VIRTIO_F_VERSION_1; let mut interrupts = Vec::new(); - for _ in 0..NUM_MSIX_VECTORS { + for _ in 0..NUM_QUEUES { interrupts.push(EventFd::new().map_err(Error::VhostIrqCreate)?); } @@ -112,10 +111,6 @@ impl VirtioDevice for Vsock { TYPE_VSOCK } - fn msix_vectors(&self) -> u16 { - NUM_MSIX_VECTORS - } - fn queue_max_sizes(&self) -> &[u16] { QUEUE_SIZES } |