mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
pci: Add support for reserving but not allocating slots
This can be used in a two pass approach where all configs that can hold PCI devices are evaluated to reserve any specific PCI device IDs they may need. Those device IDs will later be allocated when the devices are added to the bus. The tri-state Free, Reserved, Allocated also catches the problem of hotplugging a device with a specific, already used, device ID. Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
@@ -498,7 +498,7 @@ pub enum DeviceManagerError {
|
||||
|
||||
/// Could not reserve the PCI device ID.
|
||||
#[error("Could not reserve the PCI device ID")]
|
||||
GetPciDeviceId(#[source] pci::PciRootError),
|
||||
ReservePciDeviceId(#[source] pci::PciRootError),
|
||||
|
||||
/// Could not give the PCI device ID back.
|
||||
#[error("Could not give the PCI device ID back")]
|
||||
@@ -4550,8 +4550,8 @@ impl DeviceManager {
|
||||
.pci_bus
|
||||
.lock()
|
||||
.unwrap()
|
||||
.get_device_id(pci_device_bdf.device() as usize)
|
||||
.map_err(DeviceManagerError::GetPciDeviceId)?;
|
||||
.allocate_device_id(Some(pci_device_bdf.device()))
|
||||
.map_err(DeviceManagerError::AllocatePciDeviceId)?;
|
||||
|
||||
(pci_segment_id, pci_device_bdf, resources)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user