mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 11:22:26 +00:00
vmm: Use the PCI segment allocator for pmem and fs cache allocations
Use the MMIO address space allocator associated with the segment that the devices are on. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
cd9d1cf8fc
commit
a26ce353d3
@ -2293,11 +2293,11 @@ impl DeviceManager {
|
|||||||
let (cache_base, cache_size) = if let Some((base, size)) = cache_range {
|
let (cache_base, cache_size) = if let Some((base, size)) = cache_range {
|
||||||
// The memory needs to be 2MiB aligned in order to support
|
// The memory needs to be 2MiB aligned in order to support
|
||||||
// hugepages.
|
// hugepages.
|
||||||
self.address_manager
|
self.pci_segments[fs_cfg.pci_segment as usize]
|
||||||
.allocator
|
.allocator
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.allocate_mmio_addresses(
|
.allocate(
|
||||||
Some(GuestAddress(base)),
|
Some(GuestAddress(base)),
|
||||||
size as GuestUsize,
|
size as GuestUsize,
|
||||||
Some(0x0020_0000),
|
Some(0x0020_0000),
|
||||||
@ -2309,12 +2309,11 @@ impl DeviceManager {
|
|||||||
let size = fs_cfg.cache_size;
|
let size = fs_cfg.cache_size;
|
||||||
// The memory needs to be 2MiB aligned in order to support
|
// The memory needs to be 2MiB aligned in order to support
|
||||||
// hugepages.
|
// hugepages.
|
||||||
let base = self
|
let base = self.pci_segments[fs_cfg.pci_segment as usize]
|
||||||
.address_manager
|
|
||||||
.allocator
|
.allocator
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.allocate_mmio_addresses(None, size as GuestUsize, Some(0x0020_0000))
|
.allocate(None, size as GuestUsize, Some(0x0020_0000))
|
||||||
.ok_or(DeviceManagerError::FsRangeAllocation)?;
|
.ok_or(DeviceManagerError::FsRangeAllocation)?;
|
||||||
|
|
||||||
(base.raw_value(), size)
|
(base.raw_value(), size)
|
||||||
@ -2491,11 +2490,11 @@ impl DeviceManager {
|
|||||||
let (region_base, region_size) = if let Some((base, size)) = region_range {
|
let (region_base, region_size) = if let Some((base, size)) = region_range {
|
||||||
// The memory needs to be 2MiB aligned in order to support
|
// The memory needs to be 2MiB aligned in order to support
|
||||||
// hugepages.
|
// hugepages.
|
||||||
self.address_manager
|
self.pci_segments[pmem_cfg.pci_segment as usize]
|
||||||
.allocator
|
.allocator
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.allocate_mmio_addresses(
|
.allocate(
|
||||||
Some(GuestAddress(base)),
|
Some(GuestAddress(base)),
|
||||||
size as GuestUsize,
|
size as GuestUsize,
|
||||||
Some(0x0020_0000),
|
Some(0x0020_0000),
|
||||||
@ -2506,12 +2505,11 @@ impl DeviceManager {
|
|||||||
} else {
|
} else {
|
||||||
// The memory needs to be 2MiB aligned in order to support
|
// The memory needs to be 2MiB aligned in order to support
|
||||||
// hugepages.
|
// hugepages.
|
||||||
let base = self
|
let base = self.pci_segments[pmem_cfg.pci_segment as usize]
|
||||||
.address_manager
|
|
||||||
.allocator
|
.allocator
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.allocate_mmio_addresses(None, size as GuestUsize, Some(0x0020_0000))
|
.allocate(None, size as GuestUsize, Some(0x0020_0000))
|
||||||
.ok_or(DeviceManagerError::PmemRangeAllocation)?;
|
.ok_or(DeviceManagerError::PmemRangeAllocation)?;
|
||||||
|
|
||||||
(base.raw_value(), size)
|
(base.raw_value(), size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user