mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-02 01:45:21 +00:00
virtio-devices: transport: Naturally align capability PCI bar
The PCI bar should be naturally aligned i.e. aligned to the size of the bar itself. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
0b00442022
commit
bfc65bff2a
@ -832,14 +832,22 @@ impl PciDevice for VirtioPciDevice {
|
|||||||
let (virtio_pci_bar_addr, region_type) = if self.use_64bit_bar {
|
let (virtio_pci_bar_addr, region_type) = if self.use_64bit_bar {
|
||||||
let region_type = PciBarRegionType::Memory64BitRegion;
|
let region_type = PciBarRegionType::Memory64BitRegion;
|
||||||
let addr = allocator
|
let addr = allocator
|
||||||
.allocate_mmio_addresses(self.settings_bar_addr, CAPABILITY_BAR_SIZE, None)
|
.allocate_mmio_addresses(
|
||||||
|
self.settings_bar_addr,
|
||||||
|
CAPABILITY_BAR_SIZE,
|
||||||
|
Some(CAPABILITY_BAR_SIZE),
|
||||||
|
)
|
||||||
.ok_or(PciDeviceError::IoAllocationFailed(CAPABILITY_BAR_SIZE))?;
|
.ok_or(PciDeviceError::IoAllocationFailed(CAPABILITY_BAR_SIZE))?;
|
||||||
ranges.push((addr, CAPABILITY_BAR_SIZE, region_type));
|
ranges.push((addr, CAPABILITY_BAR_SIZE, region_type));
|
||||||
(addr, region_type)
|
(addr, region_type)
|
||||||
} else {
|
} else {
|
||||||
let region_type = PciBarRegionType::Memory32BitRegion;
|
let region_type = PciBarRegionType::Memory32BitRegion;
|
||||||
let addr = allocator
|
let addr = allocator
|
||||||
.allocate_mmio_hole_addresses(self.settings_bar_addr, CAPABILITY_BAR_SIZE, None)
|
.allocate_mmio_hole_addresses(
|
||||||
|
self.settings_bar_addr,
|
||||||
|
CAPABILITY_BAR_SIZE,
|
||||||
|
Some(CAPABILITY_BAR_SIZE),
|
||||||
|
)
|
||||||
.ok_or(PciDeviceError::IoAllocationFailed(CAPABILITY_BAR_SIZE))?;
|
.ok_or(PciDeviceError::IoAllocationFailed(CAPABILITY_BAR_SIZE))?;
|
||||||
ranges.push((addr, CAPABILITY_BAR_SIZE, region_type));
|
ranges.push((addr, CAPABILITY_BAR_SIZE, region_type));
|
||||||
(addr, region_type)
|
(addr, region_type)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user