vmm: Conditionally update ioeventfds for virtio PCI device

The specific part of PCI BAR reprogramming that happens for a virtio PCI
device is the update of the ioeventfds addresses KVM should listen to.
This should not be triggered for every BAR reprogramming associated with
the virtio device since a virtio PCI device might have multiple BARs.

The update of the ioeventfds addresses should only happen when the BAR
related to those addresses is being moved.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2019-10-30 09:13:29 -07:00
committed by Samuel Ortiz
parent de21c9ba4f
commit c7cabc88b4
4 changed files with 29 additions and 26 deletions

View File

@@ -362,9 +362,12 @@ impl VirtioPciDevice {
}
}
pub fn ioeventfds(&self) -> Vec<(&EventFd, u64, u64)> {
let bar0 = self.configuration.get_bar_addr(self.settings_bar as usize);
let notify_base = bar0 + NOTIFICATION_BAR_OFFSET;
pub fn config_bar_addr(&self) -> u64 {
self.configuration.get_bar_addr(self.settings_bar as usize)
}
pub fn ioeventfds(&self, bar_addr: u64) -> Vec<(&EventFd, u64, u64)> {
let notify_base = bar_addr + NOTIFICATION_BAR_OFFSET;
self.queue_evts()
.iter()
.enumerate()