qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] mac99: Bring memory layout closer to real hardware
@ 2014-03-15  0:17 BALATON Zoltan
  2014-03-20 10:16 ` [Qemu-devel] [Qemu-ppc] " BALATON Zoltan
  0 siblings, 1 reply; 3+ messages in thread
From: BALATON Zoltan @ 2014-03-15  0:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, Alexander Graf

Try to better match the memory map of a PowerMac3,1 model by moving
the pci-cfg mappings to where they are on a real machine. Also add the
VGA card after the macio to let the latter be mapped from 0x80000000 to
match hardware. (On real hardware the graphics card is on a different
bus but we don't seem to model that yet.)

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---

This patch is intended to bring memory layout closer to what's seen in
these dumps:

http://nandra.segv.jp/NetBSD/G4.dump-device-tree.txt
http://raveland.org/ports/eeprom.txt
http://mail-index.netbsd.org/port-macppc/2007/10/24/0000.html
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=604134

It makes MorphOS a little happier and not print alerts when creating
its memory map but not happy enough to not crash later.

If this is merged the corresponding addresses need to be changed in
OpenBIOS arch/ppc/qemu/init.c also! I can send a patch for that if
needed.

 hw/pci-host/uninorth.c | 10 +++++-----
 hw/ppc/mac_newworld.c  | 10 ++++++----
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
index e72fe2a..6e88b6a 100644
--- a/hw/pci-host/uninorth.c
+++ b/hw/pci-host/uninorth.c
@@ -230,7 +230,7 @@ PCIBus *pci_pmac_init(qemu_irq *pic,
     d = UNI_NORTH_PCI_HOST_BRIDGE(dev);
     memory_region_init(&d->pci_mmio, OBJECT(d), "pci-mmio", 0x100000000ULL);
     memory_region_init_alias(&d->pci_hole, OBJECT(d), "pci-hole", &d->pci_mmio,
-                             0x80000000ULL, 0x70000000ULL);
+                             0x80000000ULL, 0x10000000ULL);
     memory_region_add_subregion(address_space_mem, 0x80000000ULL,
                                 &d->pci_hole);
 
@@ -245,8 +245,8 @@ PCIBus *pci_pmac_init(qemu_irq *pic,
     pci_create_simple(h->bus, PCI_DEVFN(11, 0), "uni-north");
 #endif
 
-    sysbus_mmio_map(s, 0, 0xf2800000);
-    sysbus_mmio_map(s, 1, 0xf2c00000);
+    sysbus_mmio_map(s, 0, 0xf3000000);
+    sysbus_mmio_map(s, 1, 0xf3400000);
 
     /* DEC 21154 bridge */
 #if 0
@@ -259,8 +259,8 @@ PCIBus *pci_pmac_init(qemu_irq *pic,
     dev = qdev_create(NULL, TYPE_UNI_NORTH_AGP_HOST_BRIDGE);
     qdev_init_nofail(dev);
     s = SYS_BUS_DEVICE(dev);
-    sysbus_mmio_map(s, 0, 0xf0800000);
-    sysbus_mmio_map(s, 1, 0xf0c00000);
+    sysbus_mmio_map(s, 0, 0xf1000000);
+    sysbus_mmio_map(s, 1, 0xf1400000);
 
     /* Uninorth internal bus */
 #if 0
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 5e79575..9d4e570 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -154,7 +154,9 @@ static void ppc_core99_init(QEMUMachineInitArgs *args)
     qemu_irq *pic, **openpic_irqs;
     MemoryRegion *isa = g_new(MemoryRegion, 1);
     MemoryRegion *unin_memory = g_new(MemoryRegion, 1);
+#if 0
     MemoryRegion *unin2_memory = g_new(MemoryRegion, 1);
+#endif
     int linux_boot, i, j, k;
     MemoryRegion *ram = g_new(MemoryRegion, 1), *bios = g_new(MemoryRegion, 1);
     hwaddr kernel_base, initrd_base, cmdline_base = 0;
@@ -296,10 +298,10 @@ static void ppc_core99_init(QEMUMachineInitArgs *args)
     /* UniN init: XXX should be a real device */
     memory_region_init_io(unin_memory, NULL, &unin_ops, token, "unin", 0x1000);
     memory_region_add_subregion(get_system_memory(), 0xf8000000, unin_memory);
-
+#if 0
     memory_region_init_io(unin2_memory, NULL, &unin_ops, token, "unin", 0x1000);
     memory_region_add_subregion(get_system_memory(), 0xf3000000, unin2_memory);
-
+#endif
     openpic_irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *));
     openpic_irqs[0] =
         g_malloc0(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB);
@@ -371,8 +373,6 @@ static void ppc_core99_init(QEMUMachineInitArgs *args)
         machine_arch = ARCH_MAC99;
     }
     /* init basic PC hardware */
-    pci_vga_init(pci_bus);
-
     escc_mem = escc_init(0, pic[0x25], pic[0x24],
                          serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);
     memory_region_init_alias(escc_bar, NULL, "escc-bar",
@@ -418,6 +418,8 @@ static void ppc_core99_init(QEMUMachineInitArgs *args)
         }
     }
 
+    pci_vga_init(pci_bus);
+
     if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8)
         graphic_depth = 15;
 
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] mac99: Bring memory layout closer to real hardware
  2014-03-15  0:17 [Qemu-devel] [PATCH] mac99: Bring memory layout closer to real hardware BALATON Zoltan
@ 2014-03-20 10:16 ` BALATON Zoltan
  2014-04-11 11:39   ` Alexander Graf
  0 siblings, 1 reply; 3+ messages in thread
From: BALATON Zoltan @ 2014-03-20 10:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, Andreas Färber

On Sat, 15 Mar 2014, BALATON Zoltan wrote:
> Try to better match the memory map of a PowerMac3,1 model by moving
> the pci-cfg mappings to where they are on a real machine. Also add the
> VGA card after the macio to let the latter be mapped from 0x80000000 to
> match hardware. (On real hardware the graphics card is on a different
> bus but we don't seem to model that yet.)
>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
>
> This patch is intended to bring memory layout closer to what's seen in
> these dumps:
>
> http://nandra.segv.jp/NetBSD/G4.dump-device-tree.txt
> http://raveland.org/ports/eeprom.txt
> http://mail-index.netbsd.org/port-macppc/2007/10/24/0000.html
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=604134
>
> It makes MorphOS a little happier and not print alerts when creating
> its memory map but not happy enough to not crash later.

I'm not so sure about this patch either by now. I've come across some logs 
that show that these MorphOS alerts can happen on real hardware too and 
are probably not related to the crash but it needs more debugging and 
experimenting. If anyone has any ideas how to converge QEMU's model to 
what's seen in the dumps above please let me know.

Regards,
BALATON Zoltan

> If this is merged the corresponding addresses need to be changed in
> OpenBIOS arch/ppc/qemu/init.c also! I can send a patch for that if
> needed.
>
> hw/pci-host/uninorth.c | 10 +++++-----
> hw/ppc/mac_newworld.c  | 10 ++++++----
> 2 files changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
> index e72fe2a..6e88b6a 100644
> --- a/hw/pci-host/uninorth.c
> +++ b/hw/pci-host/uninorth.c
> @@ -230,7 +230,7 @@ PCIBus *pci_pmac_init(qemu_irq *pic,
>     d = UNI_NORTH_PCI_HOST_BRIDGE(dev);
>     memory_region_init(&d->pci_mmio, OBJECT(d), "pci-mmio", 0x100000000ULL);
>     memory_region_init_alias(&d->pci_hole, OBJECT(d), "pci-hole", &d->pci_mmio,
> -                             0x80000000ULL, 0x70000000ULL);
> +                             0x80000000ULL, 0x10000000ULL);
>     memory_region_add_subregion(address_space_mem, 0x80000000ULL,
>                                 &d->pci_hole);
>
> @@ -245,8 +245,8 @@ PCIBus *pci_pmac_init(qemu_irq *pic,
>     pci_create_simple(h->bus, PCI_DEVFN(11, 0), "uni-north");
> #endif
>
> -    sysbus_mmio_map(s, 0, 0xf2800000);
> -    sysbus_mmio_map(s, 1, 0xf2c00000);
> +    sysbus_mmio_map(s, 0, 0xf3000000);
> +    sysbus_mmio_map(s, 1, 0xf3400000);
>
>     /* DEC 21154 bridge */
> #if 0
> @@ -259,8 +259,8 @@ PCIBus *pci_pmac_init(qemu_irq *pic,
>     dev = qdev_create(NULL, TYPE_UNI_NORTH_AGP_HOST_BRIDGE);
>     qdev_init_nofail(dev);
>     s = SYS_BUS_DEVICE(dev);
> -    sysbus_mmio_map(s, 0, 0xf0800000);
> -    sysbus_mmio_map(s, 1, 0xf0c00000);
> +    sysbus_mmio_map(s, 0, 0xf1000000);
> +    sysbus_mmio_map(s, 1, 0xf1400000);
>
>     /* Uninorth internal bus */
> #if 0
> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
> index 5e79575..9d4e570 100644
> --- a/hw/ppc/mac_newworld.c
> +++ b/hw/ppc/mac_newworld.c
> @@ -154,7 +154,9 @@ static void ppc_core99_init(QEMUMachineInitArgs *args)
>     qemu_irq *pic, **openpic_irqs;
>     MemoryRegion *isa = g_new(MemoryRegion, 1);
>     MemoryRegion *unin_memory = g_new(MemoryRegion, 1);
> +#if 0
>     MemoryRegion *unin2_memory = g_new(MemoryRegion, 1);
> +#endif
>     int linux_boot, i, j, k;
>     MemoryRegion *ram = g_new(MemoryRegion, 1), *bios = g_new(MemoryRegion, 1);
>     hwaddr kernel_base, initrd_base, cmdline_base = 0;
> @@ -296,10 +298,10 @@ static void ppc_core99_init(QEMUMachineInitArgs *args)
>     /* UniN init: XXX should be a real device */
>     memory_region_init_io(unin_memory, NULL, &unin_ops, token, "unin", 0x1000);
>     memory_region_add_subregion(get_system_memory(), 0xf8000000, unin_memory);
> -
> +#if 0
>     memory_region_init_io(unin2_memory, NULL, &unin_ops, token, "unin", 0x1000);
>     memory_region_add_subregion(get_system_memory(), 0xf3000000, unin2_memory);
> -
> +#endif
>     openpic_irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *));
>     openpic_irqs[0] =
>         g_malloc0(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB);
> @@ -371,8 +373,6 @@ static void ppc_core99_init(QEMUMachineInitArgs *args)
>         machine_arch = ARCH_MAC99;
>     }
>     /* init basic PC hardware */
> -    pci_vga_init(pci_bus);
> -
>     escc_mem = escc_init(0, pic[0x25], pic[0x24],
>                          serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);
>     memory_region_init_alias(escc_bar, NULL, "escc-bar",
> @@ -418,6 +418,8 @@ static void ppc_core99_init(QEMUMachineInitArgs *args)
>         }
>     }
>
> +    pci_vga_init(pci_bus);
> +
>     if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8)
>         graphic_depth = 15;
>
> -- 
> 1.8.1.5
>
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] mac99: Bring memory layout closer to real hardware
  2014-03-20 10:16 ` [Qemu-devel] [Qemu-ppc] " BALATON Zoltan
@ 2014-04-11 11:39   ` Alexander Graf
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Graf @ 2014-04-11 11:39 UTC (permalink / raw)
  To: BALATON Zoltan, qemu-devel; +Cc: qemu-ppc, Andreas Färber


On 20.03.14 11:16, BALATON Zoltan wrote:
> On Sat, 15 Mar 2014, BALATON Zoltan wrote:
>> Try to better match the memory map of a PowerMac3,1 model by moving
>> the pci-cfg mappings to where they are on a real machine. Also add the
>> VGA card after the macio to let the latter be mapped from 0x80000000 to
>> match hardware. (On real hardware the graphics card is on a different
>> bus but we don't seem to model that yet.)
>>
>> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
>> ---
>>
>> This patch is intended to bring memory layout closer to what's seen in
>> these dumps:
>>
>> http://nandra.segv.jp/NetBSD/G4.dump-device-tree.txt
>> http://raveland.org/ports/eeprom.txt
>> http://mail-index.netbsd.org/port-macppc/2007/10/24/0000.html
>> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=604134
>>
>> It makes MorphOS a little happier and not print alerts when creating
>> its memory map but not happy enough to not crash later.
>
> I'm not so sure about this patch either by now. I've come across some 
> logs that show that these MorphOS alerts can happen on real hardware 
> too and are probably not related to the crash but it needs more 
> debugging and experimenting. If anyone has any ideas how to converge 
> QEMU's model to what's seen in the dumps above please let me know.

Yeah, I'd rather hold back on this until we fix a real bug.

The problem with the mac99 target in QEMU is that it doesn't match any 
real machine out there. It's essentially a hack good enough to get a 
good amount of Linux and Mac OS X working, but I'm sure if you don't 
look at the device tree for device creation you'll blow up :).

The "real" fix would be to create a new machine model that models 
*exactly* a real system from scratch.


Alex

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-11 11:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-15  0:17 [Qemu-devel] [PATCH] mac99: Bring memory layout closer to real hardware BALATON Zoltan
2014-03-20 10:16 ` [Qemu-devel] [Qemu-ppc] " BALATON Zoltan
2014-04-11 11:39   ` Alexander Graf

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).