From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Igor Mammedov 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> Subject: [Qemu-devel] [PATCH 1/4] pc: sanitize i440fx_init() arguments List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mst@redhat.com, armbru@redhat.com, blauwirbel@gmail.com, kraxel@redhat.com, aliguori@amazon.com, pbonzini@redhat.com, afaerber@suse.de * 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); -- 1.7.1