mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-03-20 07:58:55 +00:00
vmm: Unregister old ioeventfds when reprogramming PCI BAR
Now that kvm-ioctls has been updated, the function unregister_ioevent() can be used to remove eventfd previously associated with some specific PIO or MMIO guest address. Particularly, it is useful for the PCI BAR reprogramming case, as we want to ensure the eventfd will only get triggered by the new BAR address, and not the old one. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
587a420429
commit
3fa5df4161
@ -360,6 +360,10 @@ impl DeviceRelocation for AddressManager {
|
||||
if let Some(virtio_pci_dev) = any_dev.downcast_ref::<VirtioPciDevice>() {
|
||||
let bar_addr = virtio_pci_dev.config_bar_addr();
|
||||
if bar_addr == new_base {
|
||||
for (event, addr, _) in virtio_pci_dev.ioeventfds(old_base) {
|
||||
let io_addr = IoEventAddress::Mmio(addr);
|
||||
self.vm_fd.unregister_ioevent(event, &io_addr)?;
|
||||
}
|
||||
for (event, addr, _) in virtio_pci_dev.ioeventfds(new_base) {
|
||||
let io_addr = IoEventAddress::Mmio(addr);
|
||||
self.vm_fd.register_ioevent(event, &io_addr, NoDatamatch)?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user