From patchwork Tue Dec 6 03:43:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Evans X-Patchwork-Id: 129522 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2E6801007D5 for ; Tue, 6 Dec 2011 14:42:17 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932889Ab1LFDmP (ORCPT ); Mon, 5 Dec 2011 22:42:15 -0500 Received: from ozlabs.org ([203.10.76.45]:38869 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932871Ab1LFDmP (ORCPT ); Mon, 5 Dec 2011 22:42:15 -0500 Received: from [10.61.2.183] (ibmaus65.lnk.telstra.net [165.228.126.9]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPSA id 63EA41007D4; Tue, 6 Dec 2011 14:42:13 +1100 (EST) Message-ID: <4EDD8F46.4070102@ozlabs.org> Date: Tue, 06 Dec 2011 14:43:02 +1100 From: Matt Evans User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.23) Gecko/20110921 Thunderbird/3.1.15 MIME-Version: 1.0 To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Subject: [PATCH 27/28] kvm tools: Arch-specific define for PCI MMIO allocation area References: In-Reply-To: Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@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(-) -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/tools/kvm/pci.c b/tools/kvm/pci.c index 8282e23..045c1c5 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() */