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

Method make_pvmemcontrol_device

vmm/src/device_manager.rs:3549–3588  ·  view source on GitHub ↗
(
        &mut self,
    )

Source from the content-addressed store, hash-verified

3547
3548 #[cfg(feature = "pvmemcontrol")]
3549 fn make_pvmemcontrol_device(
3550 &mut self,
3551 ) -> DeviceManagerResult<(
3552 Arc<PvmemcontrolBusDevice>,
3553 Arc<Mutex<PvmemcontrolPciDevice>>,
3554 )> {
3555 let id = String::from(PVMEMCONTROL_DEVICE_NAME);
3556 let pci_segment_id = 0x0_u16;
3557
3558 let (pci_segment_id, pci_device_bdf, resources) =
3559 self.pci_resources(&id, pci_segment_id, None)?;
3560
3561 info!("Creating pvmemcontrol device: id = {id}");
3562 let (pvmemcontrol_pci_device, pvmemcontrol_bus_device) =
3563 devices::pvmemcontrol::PvmemcontrolDevice::make_device(
3564 id.clone(),
3565 self.memory_manager.lock().unwrap().guest_memory(),
3566 );
3567
3568 let pvmemcontrol_pci_device = Arc::new(Mutex::new(pvmemcontrol_pci_device));
3569 let pvmemcontrol_bus_device = Arc::new(pvmemcontrol_bus_device);
3570
3571 let new_resources = self.add_pci_device(
3572 pvmemcontrol_bus_device.clone(),
3573 pvmemcontrol_pci_device.clone(),
3574 pci_segment_id,
3575 pci_device_bdf,
3576 resources,
3577 )?;
3578
3579 let mut node = device_node!(id, pvmemcontrol_pci_device);
3580
3581 node.resources = new_resources;
3582 node.pci_bdf = Some(pci_device_bdf);
3583 node.pci_device_handle = None;
3584
3585 self.device_tree.lock().unwrap().insert(id, node);
3586
3587 Ok((pvmemcontrol_bus_device, pvmemcontrol_pci_device))
3588 }
3589
3590 fn make_virtio_balloon_devices(&mut self) -> DeviceManagerResult<()> {
3591 if let Some(balloon_config) = &self.config.lock().unwrap().balloon {

Callers 1

create_devicesMethod · 0.80

Calls 6

newFunction · 0.85
pci_resourcesMethod · 0.80
add_pci_deviceMethod · 0.80
cloneMethod · 0.45
guest_memoryMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected