From: Avi Kivity <avi@redhat.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] ppc_oldworld, ppc_newworld: fix escc BAR related crash
Date: Wed, 24 Aug 2011 21:40:20 +0300 [thread overview]
Message-ID: <1314211220-22010-1-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <CAAu8pHtUTvw+HxO79mGy-MbKYMJZSFP3R2D1fH6AptZso8MvPg@mail.gmail.com>
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 <avi@redhat.com>
---
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
next prev parent reply other threads:[~2011-08-24 18:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-23 17:55 [Qemu-devel] PPC* and Sparc32 crash Blue Swirl
2011-08-23 17:59 ` Peter Maydell
2011-08-23 19:19 ` Edgar E. Iglesias
2011-08-24 17:49 ` Blue Swirl
2011-08-24 18:14 ` Edgar E. Iglesias
2011-08-24 18:16 ` Edgar E. Iglesias
2011-08-24 18:39 ` Edgar E. Iglesias
2011-08-24 19:09 ` [Qemu-devel] [PATCH] gt64xxx: fix crash in gt64120_pci_mapping() Avi Kivity
2011-08-24 19:17 ` Edgar E. Iglesias
2011-08-24 17:54 ` [Qemu-devel] PPC* and Sparc32 crash Blue Swirl
2011-08-24 18:05 ` Peter Maydell
2011-08-24 9:41 ` Avi Kivity
2011-08-24 17:48 ` Blue Swirl
2011-08-24 18:20 ` Avi Kivity
2011-08-24 18:40 ` Avi Kivity [this message]
2011-08-24 18:43 ` Avi Kivity
2011-08-24 19:43 ` Blue Swirl
2011-08-24 19:59 ` Avi Kivity
2011-08-24 20:02 ` Blue Swirl
2011-08-25 4:43 ` Avi Kivity
2011-08-25 17:33 ` Blue Swirl
2011-08-25 19:31 ` Avi Kivity
2011-08-25 20:17 ` Blue Swirl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1314211220-22010-1-git-send-email-avi@redhat.com \
--to=avi@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).