mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: store PCI MMIO allocators as slices
The allocator lists are sized from the fixed PCI segment count. They are only indexed afterwards, so boxed slices fit the use. On-behalf-of: SAP philipp.schuster@sap.com Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
This commit is contained in:
committed by
Rob Bradford
parent
8574bf4c13
commit
c2c3178038
@@ -711,8 +711,8 @@ pub(crate) struct AddressManager {
|
||||
pub(crate) mmio_bus: Arc<Bus>,
|
||||
pub(crate) vm: Arc<dyn hypervisor::Vm>,
|
||||
device_tree: Arc<Mutex<DeviceTree>>,
|
||||
pci_mmio32_allocators: Vec<Arc<Mutex<AddressAllocator>>>,
|
||||
pci_mmio64_allocators: Vec<Arc<Mutex<AddressAllocator>>>,
|
||||
pci_mmio32_allocators: Box<[Arc<Mutex<AddressAllocator>>]>,
|
||||
pci_mmio64_allocators: Box<[Arc<Mutex<AddressAllocator>>]>,
|
||||
}
|
||||
|
||||
impl DeviceRelocation for AddressManager {
|
||||
@@ -1160,7 +1160,7 @@ fn create_mmio_allocators(
|
||||
num_pci_segments: u16,
|
||||
weights: &[u32],
|
||||
alignment: u64,
|
||||
) -> Vec<Arc<Mutex<AddressAllocator>>> {
|
||||
) -> Box<[Arc<Mutex<AddressAllocator>>]> {
|
||||
let total_weight: u32 = weights.iter().sum();
|
||||
|
||||
// Start each PCI segment mmio range on an aligned boundary
|
||||
@@ -1187,7 +1187,7 @@ fn create_mmio_allocators(
|
||||
i += weight;
|
||||
}
|
||||
|
||||
mmio_allocators
|
||||
mmio_allocators.into_boxed_slice()
|
||||
}
|
||||
|
||||
fn use_64bit_bar_for_virtio_device(
|
||||
|
||||
Reference in New Issue
Block a user