mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Add id option to VFIO hotplug
Add a new id option to the VFIO hotplug command so that it matches the VFIO coldplug semantic. This is done by refactoring the existing code for VFIO hotplug, where VmAddDeviceData structure is replaced by DeviceConfig. This structure is the one used whenever a VFIO device is coldplugged, which is why it makes sense to reuse it for the hotplug codepath. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -1796,13 +1796,7 @@ impl DeviceManager {
|
||||
}
|
||||
|
||||
#[cfg(feature = "pci_support")]
|
||||
pub fn add_device(&mut self, path: String) -> DeviceManagerResult<DeviceConfig> {
|
||||
let mut device_cfg = DeviceConfig {
|
||||
path: PathBuf::from(path),
|
||||
iommu: false,
|
||||
id: None,
|
||||
};
|
||||
|
||||
pub fn add_device(&mut self, device_cfg: &mut DeviceConfig) -> DeviceManagerResult<()> {
|
||||
let pci = if let Some(pci_bus) = &self.pci_bus {
|
||||
Arc::clone(&pci_bus)
|
||||
} else {
|
||||
@@ -1827,13 +1821,13 @@ impl DeviceManager {
|
||||
&mut pci.lock().unwrap(),
|
||||
&interrupt_manager,
|
||||
&device_fd,
|
||||
&mut device_cfg,
|
||||
device_cfg,
|
||||
)?;
|
||||
|
||||
// Update the PCIU bitmap
|
||||
self.pci_devices_up |= 1 << (device_id >> 3);
|
||||
|
||||
Ok(device_cfg)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "pci_support")]
|
||||
|
||||
Reference in New Issue
Block a user