From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Evans Subject: [PATCH V2 22/23] kvm tools: Arch-specific define for PCI MMIO allocation area Date: Fri, 09 Dec 2011 17:55:54 +1100 Message-ID: <4EE1B0FA.8090901@ozlabs.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: penberg@kernel.org, asias.hejun@gmail.com, levinsasha928@gmail.com, gorcunov@gmail.com To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Return-path: In-Reply-To: Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org pci_get_io_space_block() used to grab addresses from KVM_32BIT_GAP_START + 0x1000000, which is x86-specific. Create a new define, KVM_PCI_MMIO_AREA, to specify a bus address these allocations can come from. Signed-off-by: Matt Evans --- tools/kvm/pci.c | 8 ++++++-- tools/kvm/x86/include/kvm/kvm-arch.h | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/kvm/pci.c b/tools/kvm/pci.c index 95df169..59b2618 100644 --- a/tools/kvm/pci.c +++ b/tools/kvm/pci.c @@ -11,8 +11,12 @@ static struct pci_device_header *pci_devices[PCI_MAX_DEVICES]; static union pci_config_address pci_config_address; -/* This is within our PCI gap - in an unused area */ -static u32 io_space_blocks = KVM_32BIT_GAP_START + 0x1000000; +/* This is within our PCI gap - in an unused area. + * Note this is a PCI *bus address*, is used to assign BARs etc.! + * (That's why it can still 32bit even with 64bit guests-- 64bit + * PCI isn't currently supported.) + */ +static u32 io_space_blocks = KVM_PCI_MMIO_AREA; u32 pci_get_io_space_block(u32 size) { diff --git a/tools/kvm/x86/include/kvm/kvm-arch.h b/tools/kvm/x86/include/kvm/kvm-arch.h index 02aa8b9..686b1b8 100644 --- a/tools/kvm/x86/include/kvm/kvm-arch.h +++ b/tools/kvm/x86/include/kvm/kvm-arch.h @@ -18,6 +18,11 @@ #define KVM_MMIO_START KVM_32BIT_GAP_START +/* This is the address that pci_get_io_space_block() starts allocating + * from. Note that this is a PCI bus address (though same on x86). + */ +#define KVM_PCI_MMIO_AREA (KVM_MMIO_START + 0x1000000) + struct kvm { int sys_fd; /* For system ioctls(), i.e. /dev/kvm */ int vm_fd; /* For VM ioctls() */