vm-virtio: initialize MSI-X vectors with VIRTIO_MSI_NO_VECTOR

In case of the virtio frontend driver doesn't need interupts for
certain queue event, it may explicitly write VIRTIO_MSI_NO_VECTOR
to the virtio common configuration, or it may doesn't configure
the event type vector at all.

This patch initializes both MSI-X configuration vector and queue vector
with VIRTIO_MSI_NO_VECTOR, so that the backend drivers won't trigger
unexpected interrupts to the guest.

Signed-off-by: Zide Chen <zide.chen@intel.com>
This commit is contained in:
Zide Chen
2021-03-16 11:19:28 -07:00
committed by Sebastien Boeuf
parent 40a3c31df4
commit f685f0e0b2
4 changed files with 8 additions and 8 deletions

View File

@@ -8,7 +8,7 @@
//
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
use crate::VirtioIommuRemapping;
use crate::{VirtioIommuRemapping, VIRTIO_MSI_NO_VECTOR};
use std::cmp::min;
use std::convert::TryInto;
use std::fmt::{self, Display};
@@ -438,7 +438,7 @@ impl Queue {
max_size,
size: max_size,
ready: false,
vector: 0,
vector: VIRTIO_MSI_NO_VECTOR,
desc_table: GuestAddress(0),
avail_ring: GuestAddress(0),
used_ring: GuestAddress(0),
@@ -486,7 +486,7 @@ impl Queue {
self.size = self.max_size;
self.next_avail = Wrapping(0);
self.next_used = Wrapping(0);
self.vector = 0;
self.vector = VIRTIO_MSI_NO_VECTOR;
self.desc_table = GuestAddress(0);
self.avail_ring = GuestAddress(0);
self.used_ring = GuestAddress(0);