[tip:tools/kvm] kvm tools: pci: ensure BARs are naturally aligned

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  8c0b01c23724857ad3aa1f284b22ac7047f591c5
Gitweb:     http://git.kernel.org/tip/8c0b01c23724857ad3aa1f284b22ac7047f591c5
Author:     Will Deacon <will.deacon@xxxxxxx>
AuthorDate: Tue, 4 Feb 2014 16:53:54 +0000
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Sun, 16 Feb 2014 21:54:07 +0200

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@xxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/pci.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/kvm/pci.c b/tools/kvm/pci.c
index e735352..c4442c8 100644
--- a/tools/kvm/pci.c
+++ b/tools/kvm/pci.c
@@ -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;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux