mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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:
committed by
Samuel Ortiz
parent
de21c9ba4f
commit
c7cabc88b4
@@ -358,10 +358,13 @@ impl DeviceRelocation for AddressManager {
|
||||
|
||||
let any_dev = pci_dev.as_any();
|
||||
if let Some(virtio_pci_dev) = any_dev.downcast_ref::<VirtioPciDevice>() {
|
||||
for (event, addr, _) in virtio_pci_dev.ioeventfds() {
|
||||
let io_addr = IoEventAddress::Mmio(addr);
|
||||
self.vm_fd
|
||||
.register_ioevent(event.as_raw_fd(), &io_addr, NoDatamatch)?;
|
||||
let bar_addr = virtio_pci_dev.config_bar_addr();
|
||||
if bar_addr == new_base {
|
||||
for (event, addr, _) in virtio_pci_dev.ioeventfds(new_base) {
|
||||
let io_addr = IoEventAddress::Mmio(addr);
|
||||
self.vm_fd
|
||||
.register_ioevent(event.as_raw_fd(), &io_addr, NoDatamatch)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1200,7 +1203,8 @@ impl DeviceManager {
|
||||
.allocate_bars(&mut allocator)
|
||||
.map_err(DeviceManagerError::AllocateBars)?;
|
||||
|
||||
for (event, addr, _) in virtio_pci_device.ioeventfds() {
|
||||
let bar_addr = virtio_pci_device.config_bar_addr();
|
||||
for (event, addr, _) in virtio_pci_device.ioeventfds(bar_addr) {
|
||||
let io_addr = IoEventAddress::Mmio(addr);
|
||||
vm_fd
|
||||
.register_ioevent(event.as_raw_fd(), &io_addr, NoDatamatch)
|
||||
|
||||
Reference in New Issue
Block a user