From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwINI-0005yn-9Z for qemu-devel@nongnu.org; Wed, 24 Aug 2011 14:40:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QwINF-0005YJ-Qb for qemu-devel@nongnu.org; Wed, 24 Aug 2011 14:40:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51268) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwINF-0005YE-HZ for qemu-devel@nongnu.org; Wed, 24 Aug 2011 14:40:25 -0400 From: Avi Kivity Date: Wed, 24 Aug 2011 21:40:20 +0300 Message-Id: <1314211220-22010-1-git-send-email-avi@redhat.com> In-Reply-To: References: Subject: [Qemu-devel] [PATCH] ppc_oldworld, ppc_newworld: fix escc BAR related crash List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel@nongnu.org ppc maps the escc mmio region both at a fixed offset (as a sysbus area) and as part of a PCI BAR. This crashes, since a MemoryRegion may have only one parent. Use an alias so we have a separate MemoryRegion for the BAR. Signed-off-by: Avi Kivity --- hw/ppc_newworld.c | 5 ++++- hw/ppc_oldworld.c | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c index 4727e07..fbd443d 100644 --- a/hw/ppc_newworld.c +++ b/hw/ppc_newworld.c @@ -146,6 +146,7 @@ static void ppc_core99_init (ram_addr_t ram_size, MacIONVRAMState *nvr; int bios_size; MemoryRegion *pic_mem, *dbdma_mem, *cuda_mem, *escc_mem; + MemoryRegion *escc_bar = g_new(MemoryRegion, 1); MemoryRegion *ide_mem[3]; int ppc_boot_device; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; @@ -328,6 +329,8 @@ static void ppc_core99_init (ram_addr_t ram_size, escc_mem = escc_init(0x80013000, pic[0x25], pic[0x24], serial_hds[0], serial_hds[1], ESCC_CLOCK, 4); + memory_region_init_alias(escc_bar, "escc-bar", + escc_mem, 0, memory_region_size(escc_mem)); for(i = 0; i < nb_nics; i++) pci_nic_init_nofail(&nd_table[i], "ne2k_pci", NULL); @@ -350,7 +353,7 @@ static void ppc_core99_init (ram_addr_t ram_size, adb_mouse_init(&adb_bus); macio_init(pci_bus, PCI_DEVICE_ID_APPLE_UNI_N_KEYL, 0, pic_mem, - dbdma_mem, cuda_mem, NULL, 3, ide_mem, escc_mem); + dbdma_mem, cuda_mem, NULL, 3, ide_mem, escc_bar); if (usb_enabled) { usb_ohci_init_pci(pci_bus, -1); diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c index 0071fc9..235d2ef 100644 --- a/hw/ppc_oldworld.c +++ b/hw/ppc_oldworld.c @@ -83,7 +83,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size, MacIONVRAMState *nvr; int bios_size; MemoryRegion *pic_mem, *dbdma_mem, *cuda_mem; - MemoryRegion *escc_mem, *ide_mem[2]; + MemoryRegion *escc_mem, *escc_bar = g_new(MemoryRegion, 1), *ide_mem[2]; uint16_t ppc_boot_device; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; void *fw_cfg; @@ -241,6 +241,8 @@ static void ppc_heathrow_init (ram_addr_t ram_size, escc_mem = escc_init(0x80013000, pic[0x0f], pic[0x10], serial_hds[0], serial_hds[1], ESCC_CLOCK, 4); + memory_region_init_alias(escc_bar, "escc-bar", + escc_mem, 0, memory_region_size(escc_mem)); for(i = 0; i < nb_nics; i++) pci_nic_init_nofail(&nd_table[i], "ne2k_pci", NULL); @@ -269,7 +271,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size, pmac_format_nvram_partition(nvr, 0x2000); macio_init(pci_bus, PCI_DEVICE_ID_APPLE_343S1201, 1, pic_mem, - dbdma_mem, cuda_mem, nvr, 2, ide_mem, escc_mem); + dbdma_mem, cuda_mem, nvr, 2, ide_mem, escc_bar); if (usb_enabled) { usb_ohci_init_pci(pci_bus, -1); -- 1.7.5.3