From 081ad6b6cdf3b345ada2623cf513b25a2b6c074a Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 31 Oct 2019 17:05:49 -0700 Subject: devices: virtio: do not trigger MSI-X with no vector The virtio specification allows the driver to configure a queue's MSI-X vector to the magic NO_VECTOR value (0xffff); in this case, if MSI-X is enabled, no interrupt should be delivered (neither MSI-X nor INTx). BUG=chromium:854765 TEST=./build_test.py Change-Id: Icb5e82bf9a57ded60fc8c022c4d8630b5ab70dcf Signed-off-by: Daniel Verkamp Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1898266 Reviewed-by: Zide Chen Reviewed-by: Zach Reizner Tested-by: kokoro --- devices/src/virtio/interrupt.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'devices/src/virtio') diff --git a/devices/src/virtio/interrupt.rs b/devices/src/virtio/interrupt.rs index dd17ba7..2715d12 100644 --- a/devices/src/virtio/interrupt.rs +++ b/devices/src/virtio/interrupt.rs @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -use super::{INTERRUPT_STATUS_CONFIG_CHANGED, INTERRUPT_STATUS_USED_RING}; +use super::{INTERRUPT_STATUS_CONFIG_CHANGED, INTERRUPT_STATUS_USED_RING, VIRTIO_MSI_NO_VECTOR}; use crate::pci::MsixConfig; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; @@ -40,7 +40,9 @@ impl Interrupt { if let Some(msix_config) = &self.msix_config { let mut msix_config = msix_config.lock(); if msix_config.enabled() { - msix_config.trigger(vector); + if vector != VIRTIO_MSI_NO_VECTOR { + msix_config.trigger(vector); + } return; } } -- cgit 1.4.1