mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 05:35:20 +00:00
pci: vfio: naturally align bar
According to PCIe specification, a 64-bit MMIO BAR should be naturally aligned. In addition to being more compliant with the specification, natural aligned BARs are mapped with the largest possible page size by the host iommu driver, which should speed up boot time and reduce IOTLB thrashing for virtual machines with VFIO devices. Signed-off-by: Thomas Barrett <tbarrett@crusoeenergy.com>
This commit is contained in:
parent
af49b10cf2
commit
c9f94be7ab
@ -696,8 +696,11 @@ impl VfioCommon {
|
||||
.allocate(
|
||||
restored_bar_addr,
|
||||
region_size,
|
||||
Some(std::cmp::max(
|
||||
// SAFETY: FFI call. Trivially safe.
|
||||
Some(unsafe { sysconf(_SC_PAGESIZE) as GuestUsize }),
|
||||
unsafe { sysconf(_SC_PAGESIZE) as GuestUsize },
|
||||
region_size,
|
||||
)),
|
||||
)
|
||||
.ok_or(PciDeviceError::IoAllocationFailed(region_size))?
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user