Merge pull request #9687 from l8huang/vfio-pci-gk

agent: collect PCI address mapping for both vfio-pci-gk and vfio-pci device
This commit is contained in:
Alex Lyn 2024-05-26 17:48:25 +08:00 committed by GitHub
commit 028b10ce7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -896,9 +896,10 @@ async fn vfio_pci_device_handler(
} }
group = Some(devgroup); group = Some(devgroup);
pci_fixups.push((host, guestdev));
} }
// collect PCI address mapping for both vfio-pci-gk and vfio-pci device
pci_fixups.push((host, guestdev));
} }
let dev_update = if vfio_in_guest { let dev_update = if vfio_in_guest {
@ -961,6 +962,11 @@ pub async fn add_devices(
)); ));
} }
// Update cgroup to allow all devices added to guest.
insert_devices_cgroup_rule(spec, &dev_update.info, true, "rwm")
.context("Update device cgroup")?;
}
let mut sb = sandbox.lock().await; let mut sb = sandbox.lock().await;
for (host, guest) in update.pci { for (host, guest) in update.pci {
if let Some(other_guest) = sb.pcimap.insert(host, guest) { if let Some(other_guest) = sb.pcimap.insert(host, guest) {
@ -972,11 +978,6 @@ pub async fn add_devices(
)); ));
} }
} }
// Update cgroup to allow all devices added to guest.
insert_devices_cgroup_rule(spec, &dev_update.info, true, "rwm")
.context("Update device cgroup")?;
}
} }
if let Some(process) = spec.process.as_mut() { if let Some(process) = spec.process.as_mut() {