vmm: release vIOMMU VFIO container on device eject

Currently ejecting a device leaks its mapping keeping the container fd
open. Remove the mapping so the fd can be closed.

Assisted-by: Claude:Opus-4.8
Signed-off-by: Dylan Reid <dgreid@fb.com>
This commit is contained in:
Dylan Reid
2026-06-09 21:02:00 -07:00
committed by Rob Bradford
parent 686b8b40ec
commit 0487035512
2 changed files with 85 additions and 0 deletions

View File

@@ -5020,6 +5020,13 @@ impl DeviceManager {
}
};
if let Some(iommu) = &self.iommu_device {
iommu
.lock()
.unwrap()
.remove_external_mapping(pci_device_bdf.into());
}
if remove_dma_handler {
for virtio_mem_device in self.virtio_mem_devices.iter() {
let source = VirtioMemMappingSource::Device(pci_device_bdf.into());