From patchwork Wed Oct 16 08:49:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 283882 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 73E7C2C0369 for ; Wed, 16 Oct 2013 19:51:11 +1100 (EST) Received: from localhost ([::1]:45904 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWMov-0005V1-B8 for incoming@patchwork.ozlabs.org; Wed, 16 Oct 2013 04:51:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWMoN-0005Ms-Mh for qemu-devel@nongnu.org; Wed, 16 Oct 2013 04:50:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VWMoF-0004xa-1d for qemu-devel@nongnu.org; Wed, 16 Oct 2013 04:50:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14006) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWMoE-0004xV-OM for qemu-devel@nongnu.org; Wed, 16 Oct 2013 04:50:26 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9G8oN1g017545 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 16 Oct 2013 04:50:23 -0400 Received: from dell-pet610-01.lab.eng.brq.redhat.com (dell-pet610-01.lab.eng.brq.redhat.com [10.34.42.20]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r9G8oIDO026450; Wed, 16 Oct 2013 04:50:21 -0400 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 16 Oct 2013 10:49:11 +0200 Message-Id: <1381913354-8815-2-git-send-email-imammedo@redhat.com> In-Reply-To: <1381913354-8815-1-git-send-email-imammedo@redhat.com> References: <1381913354-8815-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: mst@redhat.com, armbru@redhat.com, blauwirbel@gmail.com, kraxel@redhat.com, aliguori@amazon.com, pbonzini@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH 1/4] pc: sanitize i440fx_init() arguments X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org * rename pci_hole_start to below_4g_mem_size to reflect what is really passed in and move pci_hole_size calculation inside i440fx. * remove ram_size arg from function signature, since it could be retrieved as below_4g_mem_size + above_4g_mem_size sum, internally. Signed-off-by: Igor Mammedov --- hw/i386/pc_piix.c | 3 +-- hw/pci-host/piix.c | 11 ++++++----- include/hw/i386/pc.h | 4 +--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index c6042c7..2fed5fd 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -145,9 +145,8 @@ static void pc_init1(QEMUMachineInitArgs *args, if (pci_enabled) { pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi, - system_memory, system_io, args->ram_size, + system_memory, system_io, below_4g_mem_size, - 0x100000000ULL - below_4g_mem_size, above_4g_mem_size, pci_memory, ram_memory); } else { diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index c041149..5b9cc1f 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -311,9 +311,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, ISABus **isa_bus, qemu_irq *pic, MemoryRegion *address_space_mem, MemoryRegion *address_space_io, - ram_addr_t ram_size, - hwaddr pci_hole_start, - hwaddr pci_hole_size, + hwaddr below_4g_mem_size, ram_addr_t above_4g_mem_size, MemoryRegion *pci_address_space, MemoryRegion *ram_memory) @@ -327,6 +325,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, unsigned i; I440FXState *i440fx; uint64_t pci_hole64_size; + ram_addr_t ram_size = below_4g_mem_size + above_4g_mem_size; dev = qdev_create(NULL, TYPE_I440FX_PCI_HOST_BRIDGE); s = PCI_HOST_BRIDGE(dev); @@ -355,8 +354,10 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, } memory_region_init_alias(&f->pci_hole, OBJECT(d), "pci-hole", f->pci_address_space, - pci_hole_start, pci_hole_size); - memory_region_add_subregion(f->system_memory, pci_hole_start, &f->pci_hole); + below_4g_mem_size, + 0x100000000ULL - below_4g_mem_size); + memory_region_add_subregion(f->system_memory, below_4g_mem_size, + &f->pci_hole); pci_hole64_size = pci_host_get_hole64_size(i440fx->pci_hole64_size); diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 6083839..95fc6cc 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -166,9 +166,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, ISABus **isa_bus, qemu_irq *pic, MemoryRegion *address_space_mem, MemoryRegion *address_space_io, - ram_addr_t ram_size, - hwaddr pci_hole_start, - hwaddr pci_hole_size, + hwaddr below_4g_mem_size, ram_addr_t above_4g_mem_size, MemoryRegion *pci_memory, MemoryRegion *ram_memory);