diff options
author | Will Deacon <will.deacon@arm.com> | 2014-02-04 16:53:54 +0000 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2015-06-01 16:39:55 +0100 |
commit | c7575d177ba573e0e3e92e015adfdd00c7032145 (patch) | |
tree | 431456d15f0bfe89ccb46d4e31ee78e6dade1770 | |
parent | b403f2f7f7c1b85752e2d2bcf29bed358b024626 (diff) | |
download | kvmtool-c7575d177ba573e0e3e92e015adfdd00c7032145.tar.gz |
kvm tools: pci: ensure BARs are naturally aligned
BARs must be naturally aligned, so enforce this in the PCI IO space
allocator.
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
-rw-r--r-- | pci.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -18,11 +18,13 @@ static union pci_config_address pci_config_address; */ static u32 io_space_blocks = KVM_PCI_MMIO_AREA; +/* + * BARs must be naturally aligned, so enforce this in the allocator. + */ u32 pci_get_io_space_block(u32 size) { - u32 block = io_space_blocks; - io_space_blocks += size; - + u32 block = ALIGN(io_space_blocks, size); + io_space_blocks = block + size; return block; } |