MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / add_vfio_devices

Method add_vfio_devices

vmm/src/device_manager.rs:4065–4082  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

4063 }
4064
4065 fn add_vfio_devices(&mut self) -> DeviceManagerResult<Vec<PciBdf>> {
4066 let mut iommu_attached_device_ids = Vec::new();
4067 let mut devices = self.config.lock().unwrap().devices.take();
4068
4069 if let Some(device_list_cfg) = &mut devices {
4070 for device_cfg in device_list_cfg.iter_mut() {
4071 let (device_id, _) = self.add_passthrough_device(device_cfg)?;
4072 if device_cfg.pci_common.iommu && self.iommu_device.is_some() {
4073 iommu_attached_device_ids.push(device_id);
4074 }
4075 }
4076 }
4077
4078 // Update the list of devices
4079 self.config.lock().unwrap().devices = devices;
4080
4081 Ok(iommu_attached_device_ids)
4082 }
4083
4084 fn add_vfio_user_device(
4085 &mut self,

Callers 1

add_pci_devicesMethod · 0.80

Calls 5

newFunction · 0.85
takeMethod · 0.80
iter_mutMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected