Skip to contentSkip to conversation

Misc ppc/mac machines clean up

PATCH In review BALATON Zoltan 7 participants 64 messages Jan 4, 2023 – Nov 6, 2023 PowerPC

lore
Share & tools
lore
#4 lore raw

PATCH v7 2/7 mac_{old,new}world: Use local variable instead of qdev_get_machine()

In reply to BALATON Zoltan

We already have machine in a local variable so no need to use qdev_get_machine(), also remove now unneded line break.

---
 hw/ppc/mac_newworld.c | 3 +--
 hw/ppc/mac_oldworld.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
hw/ppc/mac_newworld.c +1 -2
index 601ea518f8..460c14b5e3 100644
@@ -466,8 +466,7 @@ static void ppc_core99_init(MachineState *machine)
     fw_cfg = FW_CFG(dev);
     qdev_prop_set_uint32(dev, "data_width", 1);
     qdev_prop_set_bit(dev, "dma_enabled", false);
-    object_property_add_child(OBJECT(qdev_get_machine()), TYPE_FW_CFG,
-                              OBJECT(fw_cfg));
+    object_property_add_child(OBJECT(machine), TYPE_FW_CFG, OBJECT(fw_cfg));
     s = SYS_BUS_DEVICE(dev);
     sysbus_realize_and_unref(s, &error_fatal);
     sysbus_mmio_map(s, 0, CFG_ADDR);
hw/ppc/mac_oldworld.c +1 -2
index 558c639202..5a7b25a4a8 100644
@@ -303,8 +303,7 @@ static void ppc_heathrow_init(MachineState *machine)
     fw_cfg = FW_CFG(dev);
     qdev_prop_set_uint32(dev, "data_width", 1);
     qdev_prop_set_bit(dev, "dma_enabled", false);
-    object_property_add_child(OBJECT(qdev_get_machine()), TYPE_FW_CFG,
-                              OBJECT(fw_cfg));
+    object_property_add_child(OBJECT(machine), TYPE_FW_CFG, OBJECT(fw_cfg));
     s = SYS_BUS_DEVICE(dev);
     sysbus_realize_and_unref(s, &error_fatal);
     sysbus_mmio_map(s, 0, CFG_ADDR);
Signature · 1 line
2.30.6
#0 lore raw

v7 cover Misc ppc/mac machines clean up

This is the remainder of the series that were postponed to after the freeze the last time I've tried to submit them with some new patches I did meanwhile.

BALATON Zoltan (7):
input/adb: Only include header where needed mac_{old,new}world: Use local variable instead of qdev_get_machine() mac_{old,new}world: Pass MacOS VGA NDRV in card ROM instead of fw_cfg
mac_newworld: Add machine types for different mac99 configs
mac_newworld: Deprecate mac99 with G5 CPU
mac_newworld: Deprecate mac99 "via" option
mac_newworld: Document deprecation

 docs/about/deprecated.rst    |   7 ++
 docs/system/ppc/powermac.rst |  12 ++--
 hw/misc/macio/cuda.c         |   2 -
 hw/misc/macio/pmu.c          |   3 -
 hw/misc/mos6522.c            |   1 -
 hw/ppc/mac_newworld.c        | 130 +++++++++++++++++++++++++++++++----
 hw/ppc/mac_oldworld.c        |  21 ++----
 include/hw/misc/mac_via.h    |   1 +
 include/hw/misc/macio/cuda.h |   1 +
 include/hw/misc/macio/pmu.h  |   1 +
 include/hw/misc/mos6522.h    |   3 +-
 11 files changed, 142 insertions(+), 40 deletions(-)
Signature · 1 line
2.30.6
#28 lore raw

PATCH v7 6/7 mac_newworld: Deprecate mac99 "via" option

Setting emulated machine type with a property called "via" is confusing users so deprecate the "via" option in favour of newly added explicit machine types. The default via=cuda option is not a valid config (no real Mac has this combination of hardware) so no machine type could be defined for that therefore it is kept for backwards compatibility with older QEMU versions for now but other options resembling real machines are deprecated.

---
 hw/ppc/mac_newworld.c | 9 +++++++++
 1 file changed, 9 insertions(+)
hw/ppc/mac_newworld.c +9 -0
index f07c37328b..adf185bd3a 100644
@@ -169,6 +169,15 @@ static void ppc_core99_init(MachineState *machine)
         if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) {
             warn_report("mac99 with G5 CPU is deprecated, "
                         "use powermac7_3 instead");
+        } else {
+            if (core99_machine->via_config == CORE99_VIA_CONFIG_PMU) {
+                warn_report("mac99,via=pmu is deprecated, "
+                            "use powermac3_1 instead");
+            }
+            if (core99_machine->via_config == CORE99_VIA_CONFIG_PMU_ADB) {
+                warn_report("mac99,via=pmu-adb is deprecated, "
+                            "use powerbook3_2 instead");
+            }
         }
     }
     /* allocate RAM */
Signature · 1 line
2.30.6
#1 lore raw

PATCH v7 1/7 input/adb: Only include header where needed

In reply to BALATON Zoltan

The header hw/input/adb.h is included by some files that don't need it. Clean it up and include only where necessary.

---
 hw/misc/macio/cuda.c         | 2 --
 hw/misc/macio/pmu.c          | 3 ---
 hw/misc/mos6522.c            | 1 -
 include/hw/misc/mac_via.h    | 1 +
 include/hw/misc/macio/cuda.h | 1 +
 include/hw/misc/macio/pmu.h  | 1 +
 include/hw/misc/mos6522.h    | 3 +--
 7 files changed, 4 insertions(+), 8 deletions(-)
hw/misc/macio/cuda.c +0 -2
index 853e88bfed..7208b90e12 100644
@@ -27,8 +27,6 @@
 #include "hw/irq.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
-#include "hw/input/adb.h"
-#include "hw/misc/mos6522.h"
 #include "hw/misc/macio/cuda.h"
 #include "qapi/error.h"
 #include "qemu/timer.h"
hw/misc/macio/pmu.c +0 -3
index 97ef8c771b..8575bc1264 100644
@@ -31,10 +31,7 @@
 #include "qemu/osdep.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
-#include "hw/input/adb.h"
 #include "hw/irq.h"
-#include "hw/misc/mos6522.h"
-#include "hw/misc/macio/gpio.h"
 #include "hw/misc/macio/pmu.h"
 #include "qapi/error.h"
 #include "qemu/timer.h"
hw/misc/mos6522.c +0 -1
index 0ed631186c..d6ba47bde9 100644
@@ -25,7 +25,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/input/adb.h"
 #include "hw/irq.h"
 #include "hw/misc/mos6522.h"
 #include "hw/qdev-properties.h"
include/hw/misc/mac_via.h +1 -0
index 5fe7a7f592..422da43bf9 100644
@@ -12,6 +12,7 @@
 #include "exec/memory.h"
 #include "hw/sysbus.h"
 #include "hw/misc/mos6522.h"
+#include "hw/input/adb.h"
 #include "qom/object.h"
 
 
include/hw/misc/macio/cuda.h +1 -0
index a71deec968..8a6678c749 100644
@@ -26,6 +26,7 @@
 #ifndef CUDA_H
 #define CUDA_H
 
+#include "hw/input/adb.h"
 #include "hw/misc/mos6522.h"
 #include "qom/object.h"
 
include/hw/misc/macio/pmu.h +1 -0
index 00fcdd23f5..ba76afb52a 100644
@@ -10,6 +10,7 @@
 #ifndef PMU_H
 #define PMU_H
 
+#include "hw/input/adb.h"
 #include "hw/misc/mos6522.h"
 #include "hw/misc/macio/gpio.h"
 #include "qom/object.h"
include/hw/misc/mos6522.h +1 -2
index 05872fffc9..fba45668ab 100644
@@ -27,9 +27,8 @@
 #ifndef MOS6522_H
 #define MOS6522_H
 
-#include "exec/memory.h"
+#include "exec/hwaddr.h"
 #include "hw/sysbus.h"
-#include "hw/input/adb.h"
 #include "qom/object.h"
 
 #define MOS6522_NUM_REGS 16
Signature · 1 line
2.30.6
#58 lore raw

PATCH v7 7/7 mac_newworld: Document deprecation

In reply to BALATON Zoltan

Also update PowerMac family docs with some more recent info.

---
 docs/about/deprecated.rst    |  7 +++++++
 docs/system/ppc/powermac.rst | 12 ++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)
docs/about/deprecated.rst +7 -0
index 93affe3669..07661af7fe 100644
@@ -248,6 +248,13 @@ These old machine types are quite neglected nowadays and thus might have
 various pitfalls with regards to live migration. Use a newer machine type
 instead.
 
+``mac99`` variants other than the default qemu-system-ppc version (since 7.2)
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+The ``mac99`` machine emulates different hardware depending on using
+qemu-system-ppc64 or ``via`` property. To avoid confusion new machine
+types has been added for these variants which are now preferred over
+``mac99``.
 
 Backend options
 ---------------
docs/system/ppc/powermac.rst +8 -4
index 04334ba210..d4a47a6881 100644
@@ -4,8 +4,12 @@ PowerMac family boards (``g3beige``, ``mac99``)
 Use the executable ``qemu-system-ppc`` to simulate a complete PowerMac
 PowerPC system.
 
-- ``g3beige``              Heathrow based PowerMAC
-- ``mac99``                Mac99 based PowerMAC
+- ``g3beige``           Heathrow based old world Power Macintosh G3
+- ``mac99``             Core99 based generic PowerMac
+- ``powermac3_1``       Power Mac G4 AGP (Sawtooth)
+- ``powerbook3_2``      PowerBook G4 Titanium (Mercury)
+- ``powermac7_3``       Power Mac G5 (Niagara) (only in ``qemu-system-ppc64``)
+
 
 Supported devices
 -----------------
@@ -15,9 +19,9 @@ QEMU emulates the following PowerMac peripherals:
  *  UniNorth or Grackle PCI Bridge
  *  PCI VGA compatible card with VESA Bochs Extensions
  *  2 PMAC IDE interfaces with hard disk and CD-ROM support
- *  NE2000 PCI adapters
+ *  Sungem PCI network adapter
  *  Non Volatile RAM
- *  VIA-CUDA with ADB keyboard and mouse.
+ *  VIA-CUDA or VIA-PMU99 with or without ADB or USB keyboard and mouse.
 
 
 Missing devices
Signature · 1 line
2.30.6
#8 lore raw

PATCH v7 3/7 mac_{old,new}world: Pass MacOS VGA NDRV in card ROM instead of fw_cfg

In reply to BALATON Zoltan

OpenBIOS cannot run FCode ROMs yet but it can detect NDRV in VGA card ROM and add it to the device tree for MacOS. Pass the NDRV this way instead of via fw_cfg. This solves the problem with OpenBIOS also adding the NDRV to ati-vga which it does not work with. This does not need any changes to OpenBIOS as this NDRV ROM handling is already there but this patch also allows simplifying OpenBIOS later to remove the fw_cfg ndrv handling from the vga FCode and also drop the vga-ndrv? option which is not needed any more as users can disable the ndrv with -device VGA,romfile="" (or override it with their own NDRV or ROM). Once FCode support is implemented in OpenBIOS, the proper FCode ROM can be set the same way so this paves the way to remove some hacks.

---
 hw/ppc/mac_newworld.c | 18 ++++++------------
 hw/ppc/mac_oldworld.c | 18 ++++++------------
 2 files changed, 12 insertions(+), 24 deletions(-)
hw/ppc/mac_newworld.c +6 -12
index 460c14b5e3..60c9c27986 100644
@@ -510,18 +510,6 @@ static void ppc_core99_init(MachineState *machine)
     fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ);
     fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_NVRAM_ADDR, nvram_addr);
 
-    /* MacOS NDRV VGA driver */
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, NDRV_VGA_FILENAME);
-    if (filename) {
-        gchar *ndrv_file;
-        gsize ndrv_size;
-
-        if (g_file_get_contents(filename, &ndrv_file, &ndrv_size, NULL)) {
-            fw_cfg_add_file(fw_cfg, "ndrv/qemu_vga.ndrv", ndrv_file, ndrv_size);
-        }
-        g_free(filename);
-    }
-
     qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
 }
 
@@ -565,6 +553,11 @@ static int core99_kvm_type(MachineState *machine, const char *arg)
     return 2;
 }
 
+static GlobalProperty props[] = {
+    /* MacOS NDRV VGA driver */
+    { "VGA", "romfile", NDRV_VGA_FILENAME },
+};
+
 static void core99_machine_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
@@ -585,6 +578,7 @@ static void core99_machine_class_init(ObjectClass *oc, void *data)
 #endif
     mc->default_ram_id = "ppc_core99.ram";
     mc->ignore_boot_device_suffixes = true;
+    compat_props_add(mc->compat_props, props, G_N_ELEMENTS(props));
     fwc->get_dev_path = core99_fw_dev_path;
 }
 
hw/ppc/mac_oldworld.c +6 -12
index 5a7b25a4a8..6a1b1ad47a 100644
@@ -344,18 +344,6 @@ static void ppc_heathrow_init(MachineState *machine)
     fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_CLOCKFREQ, CLOCKFREQ);
     fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ);
 
-    /* MacOS NDRV VGA driver */
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, NDRV_VGA_FILENAME);
-    if (filename) {
-        gchar *ndrv_file;
-        gsize ndrv_size;
-
-        if (g_file_get_contents(filename, &ndrv_file, &ndrv_size, NULL)) {
-            fw_cfg_add_file(fw_cfg, "ndrv/qemu_vga.ndrv", ndrv_file, ndrv_size);
-        }
-        g_free(filename);
-    }
-
     qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
 }
 
@@ -400,6 +388,11 @@ static int heathrow_kvm_type(MachineState *machine, const char *arg)
     return 2;
 }
 
+static GlobalProperty props[] = {
+    /* MacOS NDRV VGA driver */
+    { "VGA", "romfile", NDRV_VGA_FILENAME },
+};
+
 static void heathrow_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
@@ -420,6 +413,7 @@ static void heathrow_class_init(ObjectClass *oc, void *data)
     mc->default_display = "std";
     mc->ignore_boot_device_suffixes = true;
     mc->default_ram_id = "ppc_heathrow.ram";
+    compat_props_add(mc->compat_props, props, G_N_ELEMENTS(props));
     fwc->get_dev_path = heathrow_fw_dev_path;
 }
 
Signature · 1 line
2.30.6
#25 lore raw

PATCH v7 5/7 mac_newworld: Deprecate mac99 with G5 CPU

In reply to BALATON Zoltan

Besides resolving the confusing behaviour mentioned in previous commit this might also allow unifying qemu-system-ppc and qemu-system-ppc64 in the future.

---
 hw/ppc/mac_newworld.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/ppc/mac_newworld.c +6 -0
index 3f5d1ec097..f07c37328b 100644
@@ -165,6 +165,12 @@ static void ppc_core99_init(MachineState *machine)
         qemu_register_reset(ppc_core99_reset, cpu);
     }
 
+    if (object_property_find(OBJECT(machine), "via")) {
+        if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) {
+            warn_report("mac99 with G5 CPU is deprecated, "
+                        "use powermac7_3 instead");
+        }
+    }
     /* allocate RAM */
     if (machine->ram_size > 2 * GiB) {
         error_report("RAM size more than 2 GiB is not supported");
Signature · 1 line
2.30.6
#17 lore raw

PATCH v7 4/7 mac_newworld: Add machine types for different mac99 configs

In reply to BALATON Zoltan

The mac99 machine emulates different machines depending on machine properties or even if it is run as qemu-system-ppc64 or qemu-system-ppc. This is very confusing for users and many hours were lost trying to explain it or finding out why commands users came up with are not working as expected. (E.g. Windows users might think qemu-system-ppc64 is just the 64 bit version of qemu-system-ppc and then fail to boot a 32 bit OS with -M mac99 trying to follow an example that had qemu-system-ppc.) To avoid such confusion, add explicit machine types for the different configs which will work the same with both qemu-system-ppc and qemu-system-ppc64 and also make the command line clearer for new users.

---
 hw/ppc/mac_newworld.c | 94 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)
hw/ppc/mac_newworld.c +94 -0
index 60c9c27986..3f5d1ec097 100644
@@ -642,9 +642,103 @@ static const TypeInfo core99_machine_info = {
     },
 };
 
+static void powermac3_1_machine_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    core99_machine_class_init(oc, data);
+    mc->desc = "Apple Power Mac G4 AGP (Sawtooth)";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("7400_v2.9");
+}
+
+static void powermac3_1_instance_init(Object *obj)
+{
+    Core99MachineState *cms = CORE99_MACHINE(obj);
+
+    cms->via_config = CORE99_VIA_CONFIG_PMU;
+    return;
+}
+
+static const TypeInfo powermac3_1_machine_info = {
+    .name          = MACHINE_TYPE_NAME("powermac3_1"),
+    .parent        = TYPE_MACHINE,
+    .class_init    = powermac3_1_machine_class_init,
+    .instance_init = powermac3_1_instance_init,
+    .instance_size = sizeof(Core99MachineState),
+    .interfaces = (InterfaceInfo[]) {
+        { TYPE_FW_PATH_PROVIDER },
+        { }
+    },
+};
+
+static void powerbook3_2_machine_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    core99_machine_class_init(oc, data);
+    mc->desc = "Apple PowerBook G4 Titanium (Mercury)";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("7400_v2.9");
+}
+
+static void powerbook3_2_instance_init(Object *obj)
+{
+    Core99MachineState *cms = CORE99_MACHINE(obj);
+
+    cms->via_config = CORE99_VIA_CONFIG_PMU_ADB;
+    return;
+}
+
+static const TypeInfo powerbook3_2_machine_info = {
+    .name          = MACHINE_TYPE_NAME("powerbook3_2"),
+    .parent        = TYPE_MACHINE,
+    .class_init    = powerbook3_2_machine_class_init,
+    .instance_init = powerbook3_2_instance_init,
+    .instance_size = sizeof(Core99MachineState),
+    .interfaces = (InterfaceInfo[]) {
+        { TYPE_FW_PATH_PROVIDER },
+        { }
+    },
+};
+
+#ifdef TARGET_PPC64
+static void powermac7_3_machine_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    core99_machine_class_init(oc, data);
+    mc->desc = "Apple Power Mac G5 (Niagara)";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("970fx_v3.1");
+}
+
+static void powermac7_3_instance_init(Object *obj)
+{
+    Core99MachineState *cms = CORE99_MACHINE(obj);
+
+    cms->via_config = CORE99_VIA_CONFIG_PMU;
+    return;
+}
+
+static const TypeInfo powermac7_3_machine_info = {
+    .name          = MACHINE_TYPE_NAME("powermac7_3"),
+    .parent        = TYPE_MACHINE,
+    .class_init    = powermac7_3_machine_class_init,
+    .instance_init = powermac7_3_instance_init,
+    .instance_size = sizeof(Core99MachineState),
+    .interfaces = (InterfaceInfo[]) {
+        { TYPE_FW_PATH_PROVIDER },
+        { }
+    },
+};
+#endif
+
 static void mac_machine_register_types(void)
 {
     type_register_static(&core99_machine_info);
+    type_register_static(&powermac3_1_machine_info);
+    type_register_static(&powerbook3_2_machine_info);
+#ifdef TARGET_PPC64
+    type_register_static(&powermac7_3_machine_info);
+#endif
 }
 
 type_init(mac_machine_register_types)
Signature · 1 line
2.30.6
Reviewed-by on v7 2/7
#5 lore raw

Re: [PATCH v7 2/7] mac_{old, new}world: Use local variable instead of qdev_get_machine()

In reply to BALATON Zoltan
Quoted 2 lines · BALATON Zoltan

We already have machine in a local variable so no need to use qdev_get_machine(), also remove now unneded line break.

Typo "unneeded".

Quoted 5 lines
---
  hw/ppc/mac_newworld.c | 3 +--
  hw/ppc/mac_oldworld.c | 3 +--
  2 files changed, 2 insertions(+), 4 deletions(-)
#26 lore raw

Re: [PATCH v7 5/7] mac_newworld: Deprecate mac99 with G5 CPU

In reply to BALATON Zoltan
Quoted 14 lines · BALATON Zoltan

Besides resolving the confusing behaviour mentioned in previous commit this might also allow unifying qemu-system-ppc and qemu-system-ppc64 in the future.

---
  hw/ppc/mac_newworld.c | 6 ++++++
  1 file changed, 6 insertions(+)
hw/ppc/mac_newworld.c +0 -0
index 3f5d1ec097..f07c37328b 100644

hw/ppc/mac_newworld.c static void ppc_core99_init(MachineState *machine) · line 171

Quoted 7 lines
hw/ppc/mac_newworld.c +4 -0
@@ -165,6 +165,12 @@ static void ppc_core99_init(MachineState *machine)
          qemu_register_reset(ppc_core99_reset, cpu);
      }
 
+    if (object_property_find(OBJECT(machine), "via")) {
+        if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) {
+            warn_report("mac99 with G5 CPU is deprecated, "
+                        "use powermac7_3 instead");

"mac99 machine with G5 CPU is deprecated, prefer the powermac7_3 machine instead"?

Quoted 5 lines
hw/ppc/mac_newworld.c +2 -0
+        }
+    }
      /* allocate RAM */
      if (machine->ram_size > 2 * GiB) {
          error_report("RAM size more than 2 GiB is not supported");
#59 lore raw

Re: [PATCH v7 7/7] mac_newworld: Document deprecation

In reply to BALATON Zoltan
Quoted 13 lines · BALATON Zoltan

Also update PowerMac family docs with some more recent info.

---
  docs/about/deprecated.rst    |  7 +++++++
  docs/system/ppc/powermac.rst | 12 ++++++++----
  2 files changed, 15 insertions(+), 4 deletions(-)
docs/about/deprecated.rst +0 -0
index 93affe3669..07661af7fe 100644

docs/about/deprecated.rst These old machine types are quite neglected nowadays and thus might have · line 257

Quoted 10 lines
docs/about/deprecated.rst +7 -0
@@ -248,6 +248,13 @@ These old machine types are quite neglected nowadays and thus might have
  various pitfalls with regards to live migration. Use a newer machine type
  instead.
 
+``mac99`` variants other than the default qemu-system-ppc version (since 7.2)
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+The ``mac99`` machine emulates different hardware depending on using
+qemu-system-ppc64 or ``via`` property. To avoid confusion new machine
+types has been added for these variants which are now preferred over
+``mac99``.

^ this part is OK,

but below is part of patch 4/7 "Add different mac99 machine types".

Quoted 31 lines
docs/system/ppc/powermac.rst +8 -4
index 04334ba210..d4a47a6881 100644
@@ -4,8 +4,12 @@ PowerMac family boards (``g3beige``, ``mac99``)
  Use the executable ``qemu-system-ppc`` to simulate a complete PowerMac
  PowerPC system.
 
-- ``g3beige``              Heathrow based PowerMAC
-- ``mac99``                Mac99 based PowerMAC
+- ``g3beige``           Heathrow based old world Power Macintosh G3
+- ``mac99``             Core99 based generic PowerMac
+- ``powermac3_1``       Power Mac G4 AGP (Sawtooth)
+- ``powerbook3_2``      PowerBook G4 Titanium (Mercury)
+- ``powermac7_3``       Power Mac G5 (Niagara) (only in ``qemu-system-ppc64``)
+
 
  Supported devices
  -----------------
@@ -15,9 +19,9 @@ QEMU emulates the following PowerMac peripherals:
   *  UniNorth or Grackle PCI Bridge
   *  PCI VGA compatible card with VESA Bochs Extensions
   *  2 PMAC IDE interfaces with hard disk and CD-ROM support
- *  NE2000 PCI adapters
+ *  Sungem PCI network adapter
   *  Non Volatile RAM
- *  VIA-CUDA with ADB keyboard and mouse.
+ *  VIA-CUDA or VIA-PMU99 with or without ADB or USB keyboard and mouse.
 
 
  Missing devices
#27 lore raw

Re: [PATCH v7 5/7] mac_newworld: Deprecate mac99 with G5 CPU

In reply to Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 9 lines · BALATON Zoltan

Besides resolving the confusing behaviour mentioned in previous commit this might also allow unifying qemu-system-ppc and qemu-system-ppc64 in the future.

---
  hw/ppc/mac_newworld.c | 6 ++++++
  1 file changed, 6 insertions(+)
Quoted 13 lines

hw/ppc/mac_newworld.c static void ppc_core99_init(MachineState *machine) · line 170

Quoted 11 lines
hw/ppc/mac_newworld.c +3 -0
index 3f5d1ec097..f07c37328b 100644
@@ -165,6 +165,12 @@ static void ppc_core99_init(MachineState *machine)
          qemu_register_reset(ppc_core99_reset, cpu);
      }
  +    if (object_property_find(OBJECT(machine), "via")) {
+        if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) {
+            warn_report("mac99 with G5 CPU is deprecated, "
+                        "use powermac7_3 instead");

"mac99 machine with G5 CPU is deprecated, prefer the powermac7_3 machine instead"?

I don't mind what the text is but this seems unnecessarily long where my version conveys the message in a more concise way. But if others prefer something else I'm OK to change it as you like. I expect these last patches may need to be repartitioned so I'm waiting for review to see what's preferred.

Regards,
BALATON Zoltan

Quoted 8 lines
Quoted 5 lines
hw/ppc/mac_newworld.c +2 -0
+        }
+    }
      /* allocate RAM */
      if (machine->ram_size > 2 * GiB) {
          error_report("RAM size more than 2 GiB is not supported");
#60 lore raw

Re: [PATCH v7 7/7] mac_newworld: Document deprecation

In reply to Philippe Mathieu-Daudé
Quoted 28 lines · Philippe Mathieu-Daudé
Quoted 19 lines · BALATON Zoltan

Also update PowerMac family docs with some more recent info.

---
  docs/about/deprecated.rst    |  7 +++++++
  docs/system/ppc/powermac.rst | 12 ++++++++----
  2 files changed, 15 insertions(+), 4 deletions(-)
docs/about/deprecated.rst +0 -0
index 93affe3669..07661af7fe 100644
@@ -248,6 +248,13 @@ These old machine types are quite neglected nowadays 

and thus might have
various pitfalls with regards to live migration. Use a newer machine type instead.
+``mac99`` variants other than the default qemu-system-ppc version (since
7.2) +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

docs/about/deprecated.rst These old machine types are quite neglected nowadays and thus might have · line 257

Quoted 5 lines
docs/about/deprecated.rst +5 -0
+
+The ``mac99`` machine emulates different hardware depending on using
+qemu-system-ppc64 or ``via`` property. To avoid confusion new machine
+types has been added for these variants which are now preferred over
+``mac99``.

^ this part is OK,

Quoted 1 line

but below is part of patch 4/7 "Add different mac99 machine types".

Not really, as that patch does not add these. It's already the current state which this patch just documents so this is just updating docs. If anything then the above part about deprecating mac99 may be squashed with patch 5 and 6 to make a single deprecation patch but I'll see what the maintainer prefers because whatever I come up with is usually not what he likes so to avoid wasted effort I'd rather wait for clear instructions before making more changes.

Regards,
BALATON Zoltan

Quoted 31 lines
Quoted 28 lines
docs/system/ppc/powermac.rst +8 -3
index 04334ba210..d4a47a6881 100644
@@ -4,8 +4,12 @@ PowerMac family boards (``g3beige``, ``mac99``)
  Use the executable ``qemu-system-ppc`` to simulate a complete PowerMac
  PowerPC system.
  -- ``g3beige``              Heathrow based PowerMAC
-- ``mac99``                Mac99 based PowerMAC
+- ``g3beige``           Heathrow based old world Power Macintosh G3
+- ``mac99``             Core99 based generic PowerMac
+- ``powermac3_1``       Power Mac G4 AGP (Sawtooth)
+- ``powerbook3_2``      PowerBook G4 Titanium (Mercury)
+- ``powermac7_3``       Power Mac G5 (Niagara) (only in 
 ``qemu-system-ppc64``)
+
    Supported devices
  -----------------
@@ -15,9 +19,9 @@ QEMU emulates the following PowerMac peripherals:
   *  UniNorth or Grackle PCI Bridge
   *  PCI VGA compatible card with VESA Bochs Extensions
   *  2 PMAC IDE interfaces with hard disk and CD-ROM support
- *  NE2000 PCI adapters
+ *  Sungem PCI network adapter
   *  Non Volatile RAM
- *  VIA-CUDA with ADB keyboard and mouse.
+ *  VIA-CUDA or VIA-PMU99 with or without ADB or USB keyboard and mouse.
      Missing devices
Reviewed-by on v7 1/7
#2 lore raw

Re: [PATCH v7 1/7] input/adb: Only include header where needed

In reply to BALATON Zoltan
Quoted 4 lines · BALATON Zoltan

The header hw/input/adb.h is included by some files that don't need it. Clean it up and include only where necessary.

Quoted 9 lines
---
  hw/misc/macio/cuda.c         | 2 --
  hw/misc/macio/pmu.c          | 3 ---
  hw/misc/mos6522.c            | 1 -
  include/hw/misc/mac_via.h    | 1 +
  include/hw/misc/macio/cuda.h | 1 +
  include/hw/misc/macio/pmu.h  | 1 +
  include/hw/misc/mos6522.h    | 3 +--
  7 files changed, 4 insertions(+), 8 deletions(-)
#29 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

In reply to BALATON Zoltan
Quoted 8 lines · BALATON Zoltan

Setting emulated machine type with a property called "via" is confusing users so deprecate the "via" option in favour of newly added explicit machine types. The default via=cuda option is not a valid config (no real Mac has this combination of hardware) so no machine type could be defined for that therefore it is kept for backwards compatibility with older QEMU versions for now but other options resembling real machines are deprecated.

Quoted 4 lines
---
  hw/ppc/mac_newworld.c | 9 +++++++++
  1 file changed, 9 insertions(+)

Don't we need to document in the 'System emulator machines' section of docs/about/deprecated.rst? (maybe within a "machine options" subsection)

#30 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 8 lines · BALATON Zoltan

Setting emulated machine type with a property called "via" is confusing users so deprecate the "via" option in favour of newly added explicit machine types. The default via=cuda option is not a valid config (no real Mac has this combination of hardware) so no machine type could be defined for that therefore it is kept for backwards compatibility with older QEMU versions for now but other options resembling real machines are deprecated.

Quoted 8 lines
Quoted 4 lines
---
  hw/ppc/mac_newworld.c | 9 +++++++++
  1 file changed, 9 insertions(+)

Don't we need to document in the 'System emulator machines' section of docs/about/deprecated.rst? (maybe within a "machine options" subsection)

That's in patch 7 for now which contains all the docs updates in one patch, I can reorganise these once we decide what should each patch contain. Options could be to make all deprecations a single patch or divide it by machines or options like one patch for ppc64 mac99 another for via option os whatever Matk is ready to accept at the end.

Regards,
BALATON Zoltan

Reviewed-by on v7 2/7
#6 lore raw

Re: [PATCH v7 2/7] mac_{old,new}world: Use local variable instead of qdev_get_machine()

In reply to BALATON Zoltan

Am 4. Januar 2023 21:59:37 UTC schrieb BALATON Zoltan <[email protected]>:

Quoted 28 lines

We already have machine in a local variable so no need to use qdev_get_machine(), also remove now unneded line break.

---
hw/ppc/mac_newworld.c | 3 +--
hw/ppc/mac_oldworld.c | 3 +--

2 files changed, 2 insertions(+), 4 deletions(-)
hw/ppc/mac_newworld.c +1 -2
index 601ea518f8..460c14b5e3 100644
@@ -466,8 +466,7 @@ static void ppc_core99_init(MachineState *machine)
    fw_cfg = FW_CFG(dev);
    qdev_prop_set_uint32(dev, "data_width", 1);
    qdev_prop_set_bit(dev, "dma_enabled", false);
-    object_property_add_child(OBJECT(qdev_get_machine()), TYPE_FW_CFG,
-                              OBJECT(fw_cfg));
+    object_property_add_child(OBJECT(machine), TYPE_FW_CFG, OBJECT(fw_cfg));
    s = SYS_BUS_DEVICE(dev);
    sysbus_realize_and_unref(s, &error_fatal);
    sysbus_mmio_map(s, 0, CFG_ADDR);
hw/ppc/mac_oldworld.c +0 -0
index 558c639202..5a7b25a4a8 100644

hw/ppc/mac_oldworld.c static void ppc_heathrow_init(MachineState *machine) · line 309

Quoted 9 lines
hw/ppc/mac_oldworld.c +1 -2
@@ -303,8 +303,7 @@ static void ppc_heathrow_init(MachineState *machine)
    fw_cfg = FW_CFG(dev);
    qdev_prop_set_uint32(dev, "data_width", 1);
    qdev_prop_set_bit(dev, "dma_enabled", false);
-    object_property_add_child(OBJECT(qdev_get_machine()), TYPE_FW_CFG,
-                              OBJECT(fw_cfg));
+    object_property_add_child(OBJECT(machine), TYPE_FW_CFG, OBJECT(fw_cfg));
    s = SYS_BUS_DEVICE(dev);
    sysbus_realize_and_unref(s, &error_fatal);
    sysbus_mmio_map(s, 0, CFG_ADDR);
Reviewed-by on v7 1/7
#3 lore raw

Re: [PATCH v7 1/7] input/adb: Only include header where needed

In reply to BALATON Zoltan
Quoted 95 lines · BALATON Zoltan

The header hw/input/adb.h is included by some files that don't need it. Clean it up and include only where necessary.

---
  hw/misc/macio/cuda.c         | 2 --
  hw/misc/macio/pmu.c          | 3 ---
  hw/misc/mos6522.c            | 1 -
  include/hw/misc/mac_via.h    | 1 +
  include/hw/misc/macio/cuda.h | 1 +
  include/hw/misc/macio/pmu.h  | 1 +
  include/hw/misc/mos6522.h    | 3 +--
  7 files changed, 4 insertions(+), 8 deletions(-)
hw/misc/macio/cuda.c +0 -2
index 853e88bfed..7208b90e12 100644
@@ -27,8 +27,6 @@
  #include "hw/irq.h"
  #include "hw/qdev-properties.h"
  #include "migration/vmstate.h"
-#include "hw/input/adb.h"
-#include "hw/misc/mos6522.h"
  #include "hw/misc/macio/cuda.h"
  #include "qapi/error.h"
  #include "qemu/timer.h"
hw/misc/macio/pmu.c +0 -3
index 97ef8c771b..8575bc1264 100644
@@ -31,10 +31,7 @@
  #include "qemu/osdep.h"
  #include "hw/qdev-properties.h"
  #include "migration/vmstate.h"
-#include "hw/input/adb.h"
  #include "hw/irq.h"
-#include "hw/misc/mos6522.h"
-#include "hw/misc/macio/gpio.h"
  #include "hw/misc/macio/pmu.h"
  #include "qapi/error.h"
  #include "qemu/timer.h"
hw/misc/mos6522.c +0 -1
index 0ed631186c..d6ba47bde9 100644
@@ -25,7 +25,6 @@
   */
 
  #include "qemu/osdep.h"
-#include "hw/input/adb.h"
  #include "hw/irq.h"
  #include "hw/misc/mos6522.h"
  #include "hw/qdev-properties.h"
include/hw/misc/mac_via.h +1 -0
index 5fe7a7f592..422da43bf9 100644
@@ -12,6 +12,7 @@
  #include "exec/memory.h"
  #include "hw/sysbus.h"
  #include "hw/misc/mos6522.h"
+#include "hw/input/adb.h"
  #include "qom/object.h"
 
 
include/hw/misc/macio/cuda.h +1 -0
index a71deec968..8a6678c749 100644
@@ -26,6 +26,7 @@
  #ifndef CUDA_H
  #define CUDA_H
 
+#include "hw/input/adb.h"
  #include "hw/misc/mos6522.h"
  #include "qom/object.h"
 
include/hw/misc/macio/pmu.h +1 -0
index 00fcdd23f5..ba76afb52a 100644
@@ -10,6 +10,7 @@
  #ifndef PMU_H
  #define PMU_H
 
+#include "hw/input/adb.h"
  #include "hw/misc/mos6522.h"
  #include "hw/misc/macio/gpio.h"
  #include "qom/object.h"
include/hw/misc/mos6522.h +0 -0
index 05872fffc9..fba45668ab 100644

include/hw/misc/mos6522.h line 34

Quoted 10 lines
include/hw/misc/mos6522.h +1 -2
@@ -27,9 +27,8 @@
  #ifndef MOS6522_H
  #define MOS6522_H
 
-#include "exec/memory.h"
+#include "exec/hwaddr.h"
  #include "hw/sysbus.h"
-#include "hw/input/adb.h"
  #include "qom/object.h"
 
  #define MOS6522_NUM_REGS 16

ATB,

Mark.

Reviewed-by on v7 2/7
#7 lore raw

Re: [PATCH v7 2/7] mac_{old, new}world: Use local variable instead of qdev_get_machine()

In reply to BALATON Zoltan
Quoted 28 lines · BALATON Zoltan

We already have machine in a local variable so no need to use qdev_get_machine(), also remove now unneded line break.

---
  hw/ppc/mac_newworld.c | 3 +--
  hw/ppc/mac_oldworld.c | 3 +--
  2 files changed, 2 insertions(+), 4 deletions(-)
hw/ppc/mac_newworld.c +1 -2
index 601ea518f8..460c14b5e3 100644
@@ -466,8 +466,7 @@ static void ppc_core99_init(MachineState *machine)
      fw_cfg = FW_CFG(dev);
      qdev_prop_set_uint32(dev, "data_width", 1);
      qdev_prop_set_bit(dev, "dma_enabled", false);
-    object_property_add_child(OBJECT(qdev_get_machine()), TYPE_FW_CFG,
-                              OBJECT(fw_cfg));
+    object_property_add_child(OBJECT(machine), TYPE_FW_CFG, OBJECT(fw_cfg));
      s = SYS_BUS_DEVICE(dev);
      sysbus_realize_and_unref(s, &error_fatal);
      sysbus_mmio_map(s, 0, CFG_ADDR);
hw/ppc/mac_oldworld.c +0 -0
index 558c639202..5a7b25a4a8 100644

hw/ppc/mac_oldworld.c static void ppc_heathrow_init(MachineState *machine) · line 309

Quoted 9 lines
hw/ppc/mac_oldworld.c +1 -2
@@ -303,8 +303,7 @@ static void ppc_heathrow_init(MachineState *machine)
      fw_cfg = FW_CFG(dev);
      qdev_prop_set_uint32(dev, "data_width", 1);
      qdev_prop_set_bit(dev, "dma_enabled", false);
-    object_property_add_child(OBJECT(qdev_get_machine()), TYPE_FW_CFG,
-                              OBJECT(fw_cfg));
+    object_property_add_child(OBJECT(machine), TYPE_FW_CFG, OBJECT(fw_cfg));
      s = SYS_BUS_DEVICE(dev);
      sysbus_realize_and_unref(s, &error_fatal);
      sysbus_mmio_map(s, 0, CFG_ADDR);

ATB,

Mark.

#9 lore raw

Re: [PATCH v7 3/7] mac_{old,new}world: Pass MacOS VGA NDRV in card ROM instead of fw_cfg

In reply to BALATON Zoltan
Quoted 98 lines · BALATON Zoltan

OpenBIOS cannot run FCode ROMs yet but it can detect NDRV in VGA card ROM and add it to the device tree for MacOS. Pass the NDRV this way instead of via fw_cfg. This solves the problem with OpenBIOS also adding the NDRV to ati-vga which it does not work with. This does not need any changes to OpenBIOS as this NDRV ROM handling is already there but this patch also allows simplifying OpenBIOS later to remove the fw_cfg ndrv handling from the vga FCode and also drop the vga-ndrv? option which is not needed any more as users can disable the ndrv with -device VGA,romfile="" (or override it with their own NDRV or ROM). Once FCode support is implemented in OpenBIOS, the proper FCode ROM can be set the same way so this paves the way to remove some hacks.

---
  hw/ppc/mac_newworld.c | 18 ++++++------------
  hw/ppc/mac_oldworld.c | 18 ++++++------------
  2 files changed, 12 insertions(+), 24 deletions(-)
hw/ppc/mac_newworld.c +6 -12
index 460c14b5e3..60c9c27986 100644
@@ -510,18 +510,6 @@ static void ppc_core99_init(MachineState *machine)
      fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ);
      fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_NVRAM_ADDR, nvram_addr);
 
-    /* MacOS NDRV VGA driver */
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, NDRV_VGA_FILENAME);
-    if (filename) {
-        gchar *ndrv_file;
-        gsize ndrv_size;
-
-        if (g_file_get_contents(filename, &ndrv_file, &ndrv_size, NULL)) {
-            fw_cfg_add_file(fw_cfg, "ndrv/qemu_vga.ndrv", ndrv_file, ndrv_size);
-        }
-        g_free(filename);
-    }
-
      qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
  }
 
@@ -565,6 +553,11 @@ static int core99_kvm_type(MachineState *machine, const char *arg)
      return 2;
  }
 
+static GlobalProperty props[] = {
+    /* MacOS NDRV VGA driver */
+    { "VGA", "romfile", NDRV_VGA_FILENAME },
+};
+
  static void core99_machine_class_init(ObjectClass *oc, void *data)
  {
      MachineClass *mc = MACHINE_CLASS(oc);
@@ -585,6 +578,7 @@ static void core99_machine_class_init(ObjectClass *oc, void *data)
  #endif
      mc->default_ram_id = "ppc_core99.ram";
      mc->ignore_boot_device_suffixes = true;
+    compat_props_add(mc->compat_props, props, G_N_ELEMENTS(props));
      fwc->get_dev_path = core99_fw_dev_path;
  }
 
hw/ppc/mac_oldworld.c +5 -12
index 5a7b25a4a8..6a1b1ad47a 100644
@@ -344,18 +344,6 @@ static void ppc_heathrow_init(MachineState *machine)
      fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_CLOCKFREQ, CLOCKFREQ);
      fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ);
 
-    /* MacOS NDRV VGA driver */
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, NDRV_VGA_FILENAME);
-    if (filename) {
-        gchar *ndrv_file;
-        gsize ndrv_size;
-
-        if (g_file_get_contents(filename, &ndrv_file, &ndrv_size, NULL)) {
-            fw_cfg_add_file(fw_cfg, "ndrv/qemu_vga.ndrv", ndrv_file, ndrv_size);
-        }
-        g_free(filename);
-    }
-
      qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
  }
 
@@ -400,6 +388,11 @@ static int heathrow_kvm_type(MachineState *machine, const char *arg)
      return 2;
  }
 
+static GlobalProperty props[] = {
+    /* MacOS NDRV VGA driver */
+    { "VGA", "romfile", NDRV_VGA_FILENAME },
+};
+
  static void heathrow_class_init(ObjectClass *oc, void *data)
  {
      MachineClass *mc = MACHINE_CLASS(oc);

hw/ppc/mac_oldworld.c static void heathrow_class_init(ObjectClass *oc, void *data) · line 418

Quoted 6 lines
hw/ppc/mac_oldworld.c +1 -0
@@ -420,6 +413,7 @@ static void heathrow_class_init(ObjectClass *oc, void *data)
      mc->default_display = "std";
      mc->ignore_boot_device_suffixes = true;
      mc->default_ram_id = "ppc_heathrow.ram";
+    compat_props_add(mc->compat_props, props, G_N_ELEMENTS(props));
      fwc->get_dev_path = heathrow_fw_dev_path;
  }

The qemu_vga.ndrv is deliberately kept separate from the PCI option ROM because it is a binary generated by a separate project: otherwise you'd end up creating a dependency between OpenBIOS and QemuMacDrivers, which is almost impossible to achieve since qemu_vga.ndrv can only (currently) be built in an emulated MacOS 9 guest.

The best way to do this would be to extract the PCI config words from your ATI OpenBIOS patches and the alter drivers/vga.fs so that it only generates the driver,AAPL,MacOS,PowerPC property if the device id and vendor id match that of the QEMU VGA device.

ATB,

Mark.

#18 lore raw

Re: [PATCH v7 4/7] mac_newworld: Add machine types for different mac99 configs

In reply to BALATON Zoltan
Quoted 12 lines · BALATON Zoltan

The mac99 machine emulates different machines depending on machine properties or even if it is run as qemu-system-ppc64 or qemu-system-ppc. This is very confusing for users and many hours were lost trying to explain it or finding out why commands users came up with are not working as expected. (E.g. Windows users might think qemu-system-ppc64 is just the 64 bit version of qemu-system-ppc and then fail to boot a 32 bit OS with -M mac99 trying to follow an example that had qemu-system-ppc.) To avoid such confusion, add explicit machine types for the different configs which will work the same with both qemu-system-ppc and qemu-system-ppc64 and also make the command line clearer for new users.

Quoted 1 line

Some thoughts on this: the first is that not everyone agrees that for qemu-system-X that X represents the target. There were previous discussion where some KVM people assumed X represented the host, i.e. ppc64 was the binary that ran all PPC guests but with hardware acceleration for ppc64 guests on ppc64 hosts. This was a while ago, so it may be worth starting a thread on qemu-devel to see what the current consensus is.

Secondly it's not clear to me why you've chosen names like "powermac_3_1" instead of "g4agp"? Does powermac_3_1 uniquely identify the G4 AGP Sawtooth model? For QEMU it is always best to emulate real machines, and whilst I understand you want to separate out the two versions of the mac99 machine, having "powermac_X_Y" seems less clear to me.

Finally can you post links to the device trees that you are using for each of the new machine types so that we have a clear reference point for future changes to the QEMU Mac machines? Even better include the links in the comments for each machine so that the information is easily visible for developers.

Quoted 102 lines
---
  hw/ppc/mac_newworld.c | 94 +++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 94 insertions(+)
hw/ppc/mac_newworld.c +89 -0
index 60c9c27986..3f5d1ec097 100644
@@ -642,9 +642,103 @@ static const TypeInfo core99_machine_info = {
      },
  };
 
+static void powermac3_1_machine_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    core99_machine_class_init(oc, data);
+    mc->desc = "Apple Power Mac G4 AGP (Sawtooth)";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("7400_v2.9");
+}
+
+static void powermac3_1_instance_init(Object *obj)
+{
+    Core99MachineState *cms = CORE99_MACHINE(obj);
+
+    cms->via_config = CORE99_VIA_CONFIG_PMU;
+    return;
+}
+
+static const TypeInfo powermac3_1_machine_info = {
+    .name          = MACHINE_TYPE_NAME("powermac3_1"),
+    .parent        = TYPE_MACHINE,
+    .class_init    = powermac3_1_machine_class_init,
+    .instance_init = powermac3_1_instance_init,
+    .instance_size = sizeof(Core99MachineState),
+    .interfaces = (InterfaceInfo[]) {
+        { TYPE_FW_PATH_PROVIDER },
+        { }
+    },
+};
+
+static void powerbook3_2_machine_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    core99_machine_class_init(oc, data);
+    mc->desc = "Apple PowerBook G4 Titanium (Mercury)";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("7400_v2.9");
+}
+
+static void powerbook3_2_instance_init(Object *obj)
+{
+    Core99MachineState *cms = CORE99_MACHINE(obj);
+
+    cms->via_config = CORE99_VIA_CONFIG_PMU_ADB;
+    return;
+}
+
+static const TypeInfo powerbook3_2_machine_info = {
+    .name          = MACHINE_TYPE_NAME("powerbook3_2"),
+    .parent        = TYPE_MACHINE,
+    .class_init    = powerbook3_2_machine_class_init,
+    .instance_init = powerbook3_2_instance_init,
+    .instance_size = sizeof(Core99MachineState),
+    .interfaces = (InterfaceInfo[]) {
+        { TYPE_FW_PATH_PROVIDER },
+        { }
+    },
+};
+
+#ifdef TARGET_PPC64
+static void powermac7_3_machine_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    core99_machine_class_init(oc, data);
+    mc->desc = "Apple Power Mac G5 (Niagara)";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("970fx_v3.1");
+}
+
+static void powermac7_3_instance_init(Object *obj)
+{
+    Core99MachineState *cms = CORE99_MACHINE(obj);
+
+    cms->via_config = CORE99_VIA_CONFIG_PMU;
+    return;
+}
+
+static const TypeInfo powermac7_3_machine_info = {
+    .name          = MACHINE_TYPE_NAME("powermac7_3"),
+    .parent        = TYPE_MACHINE,
+    .class_init    = powermac7_3_machine_class_init,
+    .instance_init = powermac7_3_instance_init,
+    .instance_size = sizeof(Core99MachineState),
+    .interfaces = (InterfaceInfo[]) {
+        { TYPE_FW_PATH_PROVIDER },
+        { }
+    },
+};
+#endif
+
  static void mac_machine_register_types(void)

hw/ppc/mac_newworld.c static const TypeInfo core99_machine_info = { · line 744

Quoted 10 lines
hw/ppc/mac_newworld.c +5 -0
  {
      type_register_static(&core99_machine_info);
+    type_register_static(&powermac3_1_machine_info);
+    type_register_static(&powerbook3_2_machine_info);
+#ifdef TARGET_PPC64
+    type_register_static(&powermac7_3_machine_info);
+#endif
  }
 
  type_init(mac_machine_register_types)

ATB,

Mark.

#31 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

In reply to BALATON Zoltan
Quoted 9 lines · BALATON Zoltan

Setting emulated machine type with a property called "via" is confusing users so deprecate the "via" option in favour of newly added explicit machine types. The default via=cuda option is not a valid config (no real Mac has this combination of hardware) so no machine type could be defined for that therefore it is kept for backwards compatibility with older QEMU versions for now but other options resembling real machines are deprecated.

I believe that people do use -M mac99,via=cuda to run some rare versions of MacOS in QEMU (I think possibly OS X DP and Workgroup Server?), so we would want to keep this option somewhere.

Quoted 14 lines
---
  hw/ppc/mac_newworld.c | 9 +++++++++
  1 file changed, 9 insertions(+)
hw/ppc/mac_newworld.c +2 -0
index f07c37328b..adf185bd3a 100644
@@ -169,6 +169,15 @@ static void ppc_core99_init(MachineState *machine)
          if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) {
              warn_report("mac99 with G5 CPU is deprecated, "
                          "use powermac7_3 instead");
+        } else {
+            if (core99_machine->via_config == CORE99_VIA_CONFIG_PMU) {

hw/ppc/mac_newworld.c static void ppc_core99_init(MachineState *machine) · line 183

Quoted 10 lines
hw/ppc/mac_newworld.c +7 -0
+                warn_report("mac99,via=pmu is deprecated, "
+                            "use powermac3_1 instead");
+            }
+            if (core99_machine->via_config == CORE99_VIA_CONFIG_PMU_ADB) {
+                warn_report("mac99,via=pmu-adb is deprecated, "
+                            "use powerbook3_2 instead");
+            }
          }
      }
      /* allocate RAM */

ATB,

Mark.

#32 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

Quoted 10 lines · Mark Cave-Ayland
Quoted 8 lines · BALATON Zoltan

Setting emulated machine type with a property called "via" is confusing users so deprecate the "via" option in favour of newly added explicit machine types. The default via=cuda option is not a valid config (no real Mac has this combination of hardware) so no machine type could be defined for that therefore it is kept for backwards compatibility with older QEMU versions for now but other options resembling real machines are deprecated.

Quoted 3 lines
Quoted 1 line

I believe that people do use -M mac99,via=cuda to run some rare versions of MacOS in QEMU (I think possibly OS X DP and Workgroup Server?), so we would want to keep this option somewhere.

The idea is that after previous patches we now have machine types for all other via option values (that also match real Mac machines) other than via=cude but that is the default for mac99 so after the reprecation period when the via option is removed mac99 (which is the same as mac99,via=cuda) can remain for this use case (and for backward compatibility) until the other machines are fixed to not need this any more. So all via options are still available but as different machine types.

Regards,
BALATON Zoltan

Quoted 31 lines
Quoted 14 lines
---
  hw/ppc/mac_newworld.c | 9 +++++++++
  1 file changed, 9 insertions(+)
hw/ppc/mac_newworld.c +2 -0
index f07c37328b..adf185bd3a 100644
@@ -169,6 +169,15 @@ static void ppc_core99_init(MachineState *machine)
          if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) {
              warn_report("mac99 with G5 CPU is deprecated, "
                          "use powermac7_3 instead");
+        } else {
+            if (core99_machine->via_config == CORE99_VIA_CONFIG_PMU) {

hw/ppc/mac_newworld.c static void ppc_core99_init(MachineState *machine) · line 183

Quoted 10 lines
hw/ppc/mac_newworld.c +7 -0
+                warn_report("mac99,via=pmu is deprecated, "
+                            "use powermac3_1 instead");
+            }
+            if (core99_machine->via_config == CORE99_VIA_CONFIG_PMU_ADB) {
+                warn_report("mac99,via=pmu-adb is deprecated, "
+                            "use powerbook3_2 instead");
+            }
          }
      }
      /* allocate RAM */

ATB,

Mark.

#19 lore raw

Re: [PATCH v7 4/7] mac_newworld: Add machine types for different mac99 configs

In reply to Mark Cave-Ayland
Quoted 13 lines · Mark Cave-Ayland
Quoted 12 lines · BALATON Zoltan

The mac99 machine emulates different machines depending on machine properties or even if it is run as qemu-system-ppc64 or qemu-system-ppc. This is very confusing for users and many hours were lost trying to explain it or finding out why commands users came up with are not working as expected. (E.g. Windows users might think qemu-system-ppc64 is just the 64 bit version of qemu-system-ppc and then fail to boot a 32 bit OS with -M mac99 trying to follow an example that had qemu-system-ppc.) To avoid such confusion, add explicit machine types for the different configs which will work the same with both qemu-system-ppc and qemu-system-ppc64 and also make the command line clearer for new users.

Quoted 3 lines
Quoted 1 line

Some thoughts on this: the first is that not everyone agrees that for qemu-system-X that X represents the target. There were previous discussion where some KVM people assumed X represented the host, i.e. ppc64 was the binary that ran all PPC guests but with hardware acceleration for ppc64 guests on ppc64 hosts. This was a while ago, so it may be worth starting a thread on qemu-devel to see what the current consensus is.

I don't see how this is relevant to this series, Also likely not the case any more as qemu-system-ppc and qemu-system-ppc64 share most of the code since a while with ppc64 including the config of ppc and adding more machines.

Quoted 1 line

Secondly it's not clear to me why you've chosen names like "powermac_3_1" instead of "g4agp"? Does powermac_3_1 uniquely identify the G4 AGP Sawtooth model? For QEMU it is always best to emulate real machines, and whilst I understand you want to separate out the two versions of the mac99 machine, having "powermac_X_Y" seems less clear to me.

These machine model identifiers are used by Apple to uniquely identify (all of) their machines since new-world Macs (even modern iPads and Macs have them) so for Mac people this should be clearer than the informal names that could get a bit long and confusing as there may be slight differences within a family. In any case, qemu-system-ppc -M mac99 is not corresponding to any real Mac so I'd like the options which do emulate real Macs to be called in a name that show which Mac is that. For the PPC Macs there's some info here for example:

https://en.wikipedia.org/wiki/Power_Mac_G4

And everymac.com also has info on all Macs. There were actually more than one G4 PowerMac with AGP but the other one was informally called gigabit ethernet. So the model ID is a shorter and better way to clearly identify which hardware is it (and it's also referenced in the device-tree of these Macs).

Quoted 1 line

Finally can you post links to the device trees that you are using for each of the new machine types so that we have a clear reference point for future changes to the QEMU Mac machines? Even better include the links in the comments for each machine so that the information is easily visible for developers.

I still have those I've posted over the past 8 years when I made changes to OpenBIOS to make the device-tree closer to real machine. I've downloaded it back then, don't know where to find it now but searching for e.g. "PowerMac3,1" "device-tree" should get some results.

Regards,
BALATON Zoltan

Quoted 117 lines
Quoted 100 lines
---
  hw/ppc/mac_newworld.c | 94 +++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 94 insertions(+)
hw/ppc/mac_newworld.c +88 -0
index 60c9c27986..3f5d1ec097 100644
@@ -642,9 +642,103 @@ static const TypeInfo core99_machine_info = {
      },
  };
  +static void powermac3_1_machine_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    core99_machine_class_init(oc, data);
+    mc->desc = "Apple Power Mac G4 AGP (Sawtooth)";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("7400_v2.9");
+}
+
+static void powermac3_1_instance_init(Object *obj)
+{
+    Core99MachineState *cms = CORE99_MACHINE(obj);
+
+    cms->via_config = CORE99_VIA_CONFIG_PMU;
+    return;
+}
+
+static const TypeInfo powermac3_1_machine_info = {
+    .name          = MACHINE_TYPE_NAME("powermac3_1"),
+    .parent        = TYPE_MACHINE,
+    .class_init    = powermac3_1_machine_class_init,
+    .instance_init = powermac3_1_instance_init,
+    .instance_size = sizeof(Core99MachineState),
+    .interfaces = (InterfaceInfo[]) {
+        { TYPE_FW_PATH_PROVIDER },
+        { }
+    },
+};
+
+static void powerbook3_2_machine_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    core99_machine_class_init(oc, data);
+    mc->desc = "Apple PowerBook G4 Titanium (Mercury)";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("7400_v2.9");
+}
+
+static void powerbook3_2_instance_init(Object *obj)
+{
+    Core99MachineState *cms = CORE99_MACHINE(obj);
+
+    cms->via_config = CORE99_VIA_CONFIG_PMU_ADB;
+    return;
+}
+
+static const TypeInfo powerbook3_2_machine_info = {
+    .name          = MACHINE_TYPE_NAME("powerbook3_2"),
+    .parent        = TYPE_MACHINE,
+    .class_init    = powerbook3_2_machine_class_init,
+    .instance_init = powerbook3_2_instance_init,
+    .instance_size = sizeof(Core99MachineState),
+    .interfaces = (InterfaceInfo[]) {
+        { TYPE_FW_PATH_PROVIDER },
+        { }
+    },
+};
+
+#ifdef TARGET_PPC64
+static void powermac7_3_machine_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    core99_machine_class_init(oc, data);
+    mc->desc = "Apple Power Mac G5 (Niagara)";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("970fx_v3.1");
+}
+
+static void powermac7_3_instance_init(Object *obj)
+{
+    Core99MachineState *cms = CORE99_MACHINE(obj);
+
+    cms->via_config = CORE99_VIA_CONFIG_PMU;
+    return;
+}
+
+static const TypeInfo powermac7_3_machine_info = {
+    .name          = MACHINE_TYPE_NAME("powermac7_3"),
+    .parent        = TYPE_MACHINE,
+    .class_init    = powermac7_3_machine_class_init,
+    .instance_init = powermac7_3_instance_init,
+    .instance_size = sizeof(Core99MachineState),
+    .interfaces = (InterfaceInfo[]) {
+        { TYPE_FW_PATH_PROVIDER },
+        { }
+    },
+};
+#endif
+

hw/ppc/mac_newworld.c static const TypeInfo core99_machine_info = { · line 742

Quoted 10 lines
hw/ppc/mac_newworld.c +5 -0
  static void mac_machine_register_types(void)
  {
      type_register_static(&core99_machine_info);
+    type_register_static(&powermac3_1_machine_info);
+    type_register_static(&powerbook3_2_machine_info);
+#ifdef TARGET_PPC64
+    type_register_static(&powermac7_3_machine_info);
+#endif
  }
    type_init(mac_machine_register_types)

ATB,

Mark.

#10 lore raw

Re: [PATCH v7 3/7] mac_{old,new}world: Pass MacOS VGA NDRV in card ROM instead of fw_cfg

In reply to Mark Cave-Ayland
Quoted 98 lines · Mark Cave-Ayland
Quoted 97 lines · BALATON Zoltan

OpenBIOS cannot run FCode ROMs yet but it can detect NDRV in VGA card ROM and add it to the device tree for MacOS. Pass the NDRV this way instead of via fw_cfg. This solves the problem with OpenBIOS also adding the NDRV to ati-vga which it does not work with. This does not need any changes to OpenBIOS as this NDRV ROM handling is already there but this patch also allows simplifying OpenBIOS later to remove the fw_cfg ndrv handling from the vga FCode and also drop the vga-ndrv? option which is not needed any more as users can disable the ndrv with -device VGA,romfile="" (or override it with their own NDRV or ROM). Once FCode support is implemented in OpenBIOS, the proper FCode ROM can be set the same way so this paves the way to remove some hacks.

---
  hw/ppc/mac_newworld.c | 18 ++++++------------
  hw/ppc/mac_oldworld.c | 18 ++++++------------
  2 files changed, 12 insertions(+), 24 deletions(-)
hw/ppc/mac_newworld.c +0 -11
index 460c14b5e3..60c9c27986 100644
@@ -510,18 +510,6 @@ static void ppc_core99_init(MachineState *machine)
      fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ);
      fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_NVRAM_ADDR, nvram_addr);
  -    /* MacOS NDRV VGA driver */
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, NDRV_VGA_FILENAME);
-    if (filename) {
-        gchar *ndrv_file;
-        gsize ndrv_size;
-
-        if (g_file_get_contents(filename, &ndrv_file, &ndrv_size, NULL)) {
-            fw_cfg_add_file(fw_cfg, "ndrv/qemu_vga.ndrv", ndrv_file, 
 ndrv_size);
-        }
-        g_free(filename);
-    }
-
      qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
  }
  @@ -565,6 +553,11 @@ static int core99_kvm_type(MachineState *machine, 

const char *arg)

      return 2;

}
+static GlobalProperty props[] = {

hw/ppc/mac_newworld.c +5 -0
+    /* MacOS NDRV VGA driver */
+    { "VGA", "romfile", NDRV_VGA_FILENAME },
+};
+
  static void core99_machine_class_init(ObjectClass *oc, void *data)
  {
      MachineClass *mc = MACHINE_CLASS(oc);
@@ -585,6 +578,7 @@ static void core99_machine_class_init(ObjectClass *oc, 
 void *data)
  #endif
      mc->default_ram_id = "ppc_core99.ram";
      mc->ignore_boot_device_suffixes = true;
+    compat_props_add(mc->compat_props, props, G_N_ELEMENTS(props));
      fwc->get_dev_path = core99_fw_dev_path;
  }

diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 5a7b25a4a8..6a1b1ad47a 100644

hw/ppc/mac_oldworld.c +0 -11
@@ -344,18 +344,6 @@ static void ppc_heathrow_init(MachineState *machine)
      fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_CLOCKFREQ, CLOCKFREQ);
      fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ);
  -    /* MacOS NDRV VGA driver */
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, NDRV_VGA_FILENAME);
-    if (filename) {
-        gchar *ndrv_file;
-        gsize ndrv_size;
-
-        if (g_file_get_contents(filename, &ndrv_file, &ndrv_size, NULL)) {
-            fw_cfg_add_file(fw_cfg, "ndrv/qemu_vga.ndrv", ndrv_file, 
 ndrv_size);
-        }
-        g_free(filename);
-    }
-
      qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
  }
  @@ -400,6 +388,11 @@ static int heathrow_kvm_type(MachineState *machine, 

const char *arg)

      return 2;

}
+static GlobalProperty props[] = {

hw/ppc/mac_oldworld.c +4 -0
+    /* MacOS NDRV VGA driver */
+    { "VGA", "romfile", NDRV_VGA_FILENAME },
+};
+
  static void heathrow_class_init(ObjectClass *oc, void *data)
  {
      MachineClass *mc = MACHINE_CLASS(oc);
@@ -420,6 +413,7 @@ static void heathrow_class_init(ObjectClass *oc, void 
 *data)
Quoted 8 lines

hw/ppc/mac_oldworld.c static void heathrow_class_init(ObjectClass *oc, void *data) · line 418

Quoted 6 lines
hw/ppc/mac_oldworld.c +1 -0
      mc->default_display = "std";
      mc->ignore_boot_device_suffixes = true;
      mc->default_ram_id = "ppc_heathrow.ram";
+    compat_props_add(mc->compat_props, props, G_N_ELEMENTS(props));
      fwc->get_dev_path = heathrow_fw_dev_path;
  }

The qemu_vga.ndrv is deliberately kept separate from the PCI option ROM because it is a binary generated by a separate project: otherwise you'd end up creating a dependency between OpenBIOS and QemuMacDrivers, which is almost impossible to achieve since qemu_vga.ndrv can only (currently) be built in an emulated MacOS 9 guest.

I don't get this. The dependency is already there as qemu_vga.ndrv ships with QEMU such as all the vgabios-*.bin and SeaBIOS binaries which are also built from different projects. The qemu_vga.ndrv would also still be part of an FCode ROM together with vga.fs if OpenBIOS could run that so this patch solely changes the way of passing the ROM binary to OpenBIOS from fw_cfg to the card ROM which is closer to how it should be and can direcly be replaced with the FCode ROM later after OpenBIOS will be advanced to that point.

Quoted 1 line

The best way to do this would be to extract the PCI config words from your ATI OpenBIOS patches and the alter drivers/vga.fs so that it only generates the driver,AAPL,MacOS,PowerPC property if the device id and vendor id match that of the QEMU VGA device.

This is further down the road and does not block this patch. The config access words should be provided by OpenBIOS not vga.fs. If we want to do it like on the real machine then vga.fs and qemu_vga,ndrv should be together the FCode ROM that the card has and OpenBIOS would run that. This is also how the ATI and NVIDIA ROMs do it which contain some Forth to init the card and add the embedded ndrv to the device tree for MacOS. But that's independent of this patch and needs OpenBIOS changes, while this patch does not need any change in OpenBIOS just moves to that direction to be able to attach a proper FCode ROM sometimes later and simpify fw_cfg handling in OpenBIOS. For now adding the ndrv in the ROM is enough for OpenBIOS as it has additional code to handle it already.

So this patch neither adds new dependency to QEMU nor repends on any change in OpenBIOS. It just gets rid of passing files via fw_cfg.

Regards,
BALATON Zoltan

#33 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

In reply to BALATON Zoltan
Quoted 19 lines · BALATON Zoltan
Quoted 10 lines · Mark Cave-Ayland
Quoted 8 lines · BALATON Zoltan

Setting emulated machine type with a property called "via" is confusing users so deprecate the "via" option in favour of newly added explicit machine types. The default via=cuda option is not a valid config (no real Mac has this combination of hardware) so no machine type could be defined for that therefore it is kept for backwards compatibility with older QEMU versions for now but other options resembling real machines are deprecated.

Quoted 3 lines
Quoted 1 line

I believe that people do use -M mac99,via=cuda to run some rare versions

of

Quoted 1 line

MacOS in QEMU (I think possibly OS X DP and Workgroup Server?), so we

would

Quoted 1 line

want to keep this option somewhere.

Quoted 9 lines

The idea is that after previous patches we now have machine types for all other via option values (that also match real Mac machines) other than via=cude but that is the default for mac99 so after the reprecation period when the via option is removed mac99 (which is the same as mac99,via=cuda) can remain for this use case (and for backward compatibility) until the other machines are fixed to not need this any more. So all via options are still available but as different machine types.

My 2 cents about naming:
It seems less important how the machines are named when their name is not covering their definition. F.i. the powermac3,1 never had adb, could not be equipped with a G3 cpu, did not run at 900Mhz. The closest possible qemu-options based definition of a powermac3,1 (via=pmu) will not run Mac OS 9.0.4 ;-) due to the 2 USB devices problem. To run that via=cuda is already needed.

Quoted 35 lines
Quoted 5 lines
Quoted 5 lines
---
  hw/ppc/mac_newworld.c | 9 +++++++++
  1 file changed, 9 insertions(+)
Quoted 14 lines
Quoted 5 lines
hw/ppc/mac_newworld.c +0 -0
index f07c37328b..adf185bd3a 100644

hw/ppc/mac_newworld.c static void ppc_core99_init(MachineState *machine) · line 177

Quoted 9 lines
hw/ppc/mac_newworld.c +6 -0
@@ -169,6 +169,15 @@ static void ppc_core99_init(MachineState *machine)
          if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) {
              warn_report("mac99 with G5 CPU is deprecated, "
                          "use powermac7_3 instead");
+        } else {
+            if (core99_machine->via_config == CORE99_VIA_CONFIG_PMU) {
+                warn_report("mac99,via=pmu is deprecated, "
+                            "use powermac3_1 instead");
+            }
+            if (core99_machine->via_config ==

CORE99_VIA_CONFIG_PMU_ADB) {

Quoted 13 lines

hw/ppc/mac_newworld.c static void ppc_core99_init(MachineState *machine) · line 183

Quoted 6 lines
hw/ppc/mac_newworld.c +3 -0
+                warn_report("mac99,via=pmu-adb is deprecated, "
+                            "use powerbook3_2 instead");
+            }
          }
      }
      /* allocate RAM */

ATB,

Mark.

#34 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

Quoted 29 lines · Howard Spoelstra
Quoted 19 lines · BALATON Zoltan
Quoted 10 lines · Mark Cave-Ayland
Quoted 8 lines · BALATON Zoltan

Setting emulated machine type with a property called "via" is confusing users so deprecate the "via" option in favour of newly added explicit machine types. The default via=cuda option is not a valid config (no real Mac has this combination of hardware) so no machine type could be defined for that therefore it is kept for backwards compatibility with older QEMU versions for now but other options resembling real machines are deprecated.

Quoted 3 lines
Quoted 1 line

I believe that people do use -M mac99,via=cuda to run some rare versions

of

Quoted 1 line

MacOS in QEMU (I think possibly OS X DP and Workgroup Server?), so we

would

Quoted 1 line

want to keep this option somewhere.

Quoted 8 lines

The idea is that after previous patches we now have machine types for all other via option values (that also match real Mac machines) other than via=cude but that is the default for mac99 so after the reprecation period when the via option is removed mac99 (which is the same as mac99,via=cuda) can remain for this use case (and for backward compatibility) until the other machines are fixed to not need this any more. So all via options are still available but as different machine types.

Quoted 7 lines

My 2 cents about naming:
It seems less important how the machines are named when their name is not covering their definition. F.i. the powermac3,1 never had adb, could not be equipped with a G3 cpu, did not run at 900Mhz. The closest possible qemu-options based definition of a powermac3,1 (via=pmu) will not run Mac OS 9.0.4 ;-) due to the 2 USB devices problem. To run that via=cuda is already needed.

What does that mean? Should we aim to emulate real Macs or are we happy with the Franken-Mac we have now? The names also show what we intend to emulate even though the emulation may not be complete or have bugs (this is also true for other machines in QEMU where a lot of them are not fully emulated, only well enough to boot guest OSes).

Looks like everybody has forgotten the previous discussion and not read the docs and deprecation patches where this is explained so I summarise the proposed change here again:

- qemu-system-ppc -M mac99 is unchanged and works like before it just warns for the via option and when using it in qemu-system-ppc64 suggesting using new machines instead so these could evetually be removed next year. mac99,via=cuda is just mac99 so you can continue to use that, mac99 is not deprecated and don't want to remove it.

- qemu-system-ppc64 -M mac99 -> powermac7_3

- qemu-system-ppc -M mac99,via=pmu -> powermac3,1

- qemu-system-ppc64 -M mac99,via=pmu-adb -> powerbook3_2

The last one is one of the rare Macs that had adb and pmu, all others with pmu usually have USB. The PowerMac1,2 (G4 PCI) had CUDA but not with mac99 hardware but more similar to g3beige and no ADB ports according to https://en.wikipedia.org/wiki/Power_Mac_G4#1st_generation:_Graphite
https://en.wikipedia.org/wiki/Power_Macintosh_G3_(Blue_and_White)#Hardware

The PowerMac7,3 seems to be matching the PCI device listing in the comment at the beginning of mac_newworld.c and also this article:
https://www.informit.com/articles/article.aspx?p=606582

What is the 2 USB devices problem? Is it the one we've debugged before and found that it's noted in a comment marked with ??? in hw/usb/hcd-ohci.c? That could be fixed if there was somebody interested enough to provide a patch.

But this series does not remove the mac99 and does not even deprecate it. What it deprecates are the via option to select different machine types and the automatic detection of ppc64 to emulate something different which are hard to understand for users and caused several misunderstandings. It's much more clear to have a separate machine type for each machine we emulate even when they aren't yet complete but at least we know which way to go and can compare to real hardware and fix the missing parts later. Also introducing powermac7_3 to split the ppc64 mac99 would allow to remove qemu-system-ppc if we wanted and only have one executable for all machines but even without this it's clearer to have separate machnies for G5 and G4 macs than mac99 silently behaving differently.

Regards,
BALATON Zoltan

#35 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

Quoted 39 lines · BALATON Zoltan
Quoted 1 line · Howard Spoelstra

On Wed, Jan 11, 2023 at 1:15 AM BALATON Zoltan <[email protected]>

Quoted 12 lines · wrote:
Quoted 12 lines · Mark Cave-Ayland
Quoted 10 lines · BALATON Zoltan
Quoted 9 lines

Setting emulated machine type with a property called "via" is confusing users so deprecate the "via" option in favour of newly added explicit machine types. The default via=cuda option is not a valid config (no real Mac has this combination of hardware) so no machine type could be defined for that therefore it is kept for backwards compatibility with older QEMU versions for now but other options resembling real machines are deprecated.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

I believe that people do use -M mac99,via=cuda to run some rare

versions

Quoted 6 lines
Quoted 6 lines

of

Quoted 1 line

MacOS in QEMU (I think possibly OS X DP and Workgroup Server?), so we

would

Quoted 1 line

want to keep this option somewhere.

The idea is that after previous patches we now have machine types for

all

Quoted 2 lines
Quoted 2 lines

other via option values (that also match real Mac machines) other than via=cude but that is the default for mac99 so after the reprecation

period

Quoted 1 line
Quoted 1 line

when the via option is removed mac99 (which is the same as

mac99,via=cuda)

Quoted 2 lines
Quoted 2 lines

can remain for this use case (and for backward compatibility) until the other machines are fixed to not need this any more. So all via options

are

Quoted 5 lines
Quoted 2 lines

still available but as different machine types.

My 2 cents about naming:
It seems less important how the machines are named when their name is not covering their definition. F.i. the powermac3,1 never had adb, could not

Quoted 9 lines

be

Quoted 4 lines

equipped with a G3 cpu, did not run at 900Mhz. The closest possible qemu-options based definition of a powermac3,1 (via=pmu) will not run Mac OS 9.0.4 ;-) due to the 2 USB devices problem. To run that via=cuda is already needed.

What does that mean? Should we aim to emulate real Macs or are we happy with the Franken-Mac we have now?

The names also show what we intend to

Quoted 10 lines

emulate even though the emulation may not be complete or have bugs (this is also true for other machines in QEMU where a lot of them are not fully emulated, only well enough to boot guest OSes).

Looks like everybody has forgotten the previous discussion and not read the docs and deprecation patches where this is explained so I summarise the proposed change here again:

No, I haven't forgotten that discussion. FWIW (as I cannot contribute): I personally do not oppose a name change, the new names seem more descriptive. I tested your patches and they behave as they should. The functionality does not change. However, my simple point was what's in a name when the underlying machine does not reflect what the name implies.

It is not my place to comment on a possible development agenda. I can only tell you what I'd like and point out issues.

Quoted 18 lines

- qemu-system-ppc -M mac99 is unchanged and works like before it just warns for the via option and when using it in qemu-system-ppc64 suggesting using new machines instead so these could evetually be removed next year. mac99,via=cuda is just mac99 so you can continue to use that, mac99 is not deprecated and don't want to remove it.

- qemu-system-ppc64 -M mac99 -> powermac7_3

- qemu-system-ppc -M mac99,via=pmu -> powermac3,1

- qemu-system-ppc64 -M mac99,via=pmu-adb -> powerbook3_2

The last one is one of the rare Macs that had adb and pmu, all others with pmu usually have USB. The PowerMac1,2 (G4 PCI) had CUDA but not with mac99 hardware but more similar to g3beige and no ADB ports according to
https://en.wikipedia.org/wiki/Power_Mac_G4#1st_generation:_Graphite
https://en.wikipedia.org/wiki/Power_Macintosh_G3_(Blue_and_White)#Hardware

Quoted 9 lines

The PowerMac7,3 seems to be matching the PCI device listing in the comment at the beginning of mac_newworld.c and also this article:
https://www.informit.com/articles/article.aspx?p=606582

What is the 2 USB devices problem? Is it the one we've debugged before and found that it's noted in a comment marked with ??? in hw/usb/hcd-ohci.c? That could be fixed if there was somebody interested enough to provide a patch.

It is not about passing through USB devices and active packets per endpoint. The powermac3,1 has two 2 USB 1.1 ports. However, when booting Mac OS 9.0.4 with via=pmu it will support only one (the kbd). When started with via=cuda -usb -device usb-kbd -device usb-mouse it will support the first-mentioned usb-kbd. When kbd and mouse arguments are reversed it supports the other device ;-)

Quoted 16 lines

But this series does not remove the mac99 and does not even deprecate it. What it deprecates are the via option to select different machine types and the automatic detection of ppc64 to emulate something different which are hard to understand for users and caused several misunderstandings. It's much more clear to have a separate machine type for each machine we emulate even when they aren't yet complete but at least we know which way to go and can compare to real hardware and fix the missing parts later. Also introducing powermac7_3 to split the ppc64 mac99 would allow to remove qemu-system-ppc if we wanted and only have one executable for all machines but even without this it's clearer to have separate machnies for G5 and G4 macs than mac99 silently behaving differently.

Regards,
BALATON Zoltan

#36 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

Quoted 11 lines · Howard Spoelstra
Quoted 10 lines · BALATON Zoltan

The names also show what we intend to
emulate even though the emulation may not be complete or have bugs (this is also true for other machines in QEMU where a lot of them are not fully emulated, only well enough to boot guest OSes).

Looks like everybody has forgotten the previous discussion and not read the docs and deprecation patches where this is explained so I summarise the proposed change here again:

Quoted 5 lines

No, I haven't forgotten that discussion. FWIW (as I cannot contribute): I personally do not oppose a name change, the new names seem more descriptive. I tested your patches and they behave as they should. The functionality does not change. However, my simple point was what's in a name when the underlying machine does not reflect what the name implies.

In case of powermac3_1 (currently mac99,via=pmu) it does resemble the PowerMac3,1 G4 AGP machine. It's also what the device tree says and the emulated hardware corresponds to that machine, apart from some missing pieces (like I2C) and known bugs in some (like USB) it aims to emulate that machine but it's currently hidden in the obscure via option of mac99 which ny default is some non-existent Mac like machine with cuda. It's much easier for users not having inside knowledge of QEMU to get a machine type which clearly says what it emulates. If we ever want to run firmware ROM from the real machine we also want to make sure we emulate a real machine. I've done some steps in that direction before and submitted RFC patches that could get to an OF prompt with some debugger tweaking and could eventually made to work but it needs Mark's screamer series to get finished and some rewrite of the macio emulation to add I2C cleanly so it's stalled currently but maybe one day we'll get there.

For powermac7,3 it is what qemu-system-ppc64 -M mac99 currently aims to emulate evidenced by the comment at the beginning and that it adds U3 chipset instead of Uninorth but currently only Linux boots on this machine. It may need some more fixes to get other OSes running starting with the device tree. I think the way for that is to move device tree creation to QEMU similar to what other PPC machines do. I have plans for that but it's blocked by not being able to contribute to OpenBIOS as most of my patches are disliked by Mark but I'll keep trying.

The powerboot3,2 is one hardware I could find info on having PMU and ADB and it's the same era as the PowerMac3,1 so has similar hardware but not sure why this combination is even there. What guest needs this that cannot run with either mac99 or powermac3,1?

Quoted 31 lines

It is not my place to comment on a possible development agenda. I can only tell you what I'd like and point out issues.

Quoted 18 lines

- qemu-system-ppc -M mac99 is unchanged and works like before it just warns for the via option and when using it in qemu-system-ppc64 suggesting using new machines instead so these could evetually be removed next year. mac99,via=cuda is just mac99 so you can continue to use that, mac99 is not deprecated and don't want to remove it.

- qemu-system-ppc64 -M mac99 -> powermac7_3

- qemu-system-ppc -M mac99,via=pmu -> powermac3,1

- qemu-system-ppc64 -M mac99,via=pmu-adb -> powerbook3_2

The last one is one of the rare Macs that had adb and pmu, all others with pmu usually have USB. The PowerMac1,2 (G4 PCI) had CUDA but not with mac99 hardware but more similar to g3beige and no ADB ports according to
https://en.wikipedia.org/wiki/Power_Mac_G4#1st_generation:_Graphite
https://en.wikipedia.org/wiki/Power_Macintosh_G3_(Blue_and_White)#Hardware

Quoted 9 lines

The PowerMac7,3 seems to be matching the PCI device listing in the comment at the beginning of mac_newworld.c and also this article:
https://www.informit.com/articles/article.aspx?p=606582

What is the 2 USB devices problem? Is it the one we've debugged before and found that it's noted in a comment marked with ??? in hw/usb/hcd-ohci.c? That could be fixed if there was somebody interested enough to provide a patch.

Quoted 6 lines

It is not about passing through USB devices and active packets per endpoint. The powermac3,1 has two 2 USB 1.1 ports. However, when booting Mac OS 9.0.4 with via=pmu it will support only one (the kbd). When started with via=cuda -usb -device usb-kbd -device usb-mouse it will support the first-mentioned usb-kbd. When kbd and mouse arguments are reversed it supports the other device ;-)

Is this something that happens on real hardware as well or is it some bug in emulation somewhere? If the drivers on this OS keep active packets on different endpoints then it's the same issue we've discovered with USB pass through of audio devices that also need this feature. If it's something else it may be fixable but we need to understand first what causes the issue.

Regards,
BALATON Zoltan

#20 lore raw

Re: [PATCH v7 4/7] mac_newworld: Add machine types for different mac99 configs

In reply to BALATON Zoltan
Quoted 14 lines · BALATON Zoltan
Quoted 13 lines · Mark Cave-Ayland
Quoted 12 lines · BALATON Zoltan

The mac99 machine emulates different machines depending on machine properties or even if it is run as qemu-system-ppc64 or qemu-system-ppc. This is very confusing for users and many hours were lost trying to explain it or finding out why commands users came up with are not working as expected. (E.g. Windows users might think qemu-system-ppc64 is just the 64 bit version of qemu-system-ppc and then fail to boot a 32 bit OS with -M mac99 trying to follow an example that had qemu-system-ppc.) To avoid such confusion, add explicit machine types for the different configs which will work the same with both qemu-system-ppc and qemu-system-ppc64 and also make the command line clearer for new users.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Some thoughts on this: the first is that not everyone agrees that for qemu-system-X that X represents the target. There were previous discussion where some KVM people assumed X represented the host, i.e. ppc64 was the binary that ran all PPC guests but with hardware acceleration for ppc64 guests on ppc64 hosts. This was a while ago, so it may be worth starting a thread on qemu-devel to see what the current consensus is.

I don't see how this is relevant to this series, Also likely not the case any more as qemu-system-ppc and qemu-system-ppc64 share most of the code since a while with ppc64 including the config of ppc and adding more machines.

Well the patch defines the powermac 7.3 machine just for TARGET_PPC64, no? So you're making the assumption qemu-system-ppc64 represents a 64-bit target rather than a 64-bit host.

Quoted 7 lines
Quoted 1 line

Secondly it's not clear to me why you've chosen names like "powermac_3_1" instead of "g4agp"? Does powermac_3_1 uniquely identify the G4 AGP Sawtooth model? For QEMU it is always best to emulate real machines, and whilst I understand you want to separate out the two versions of the mac99 machine, having "powermac_X_Y" seems less clear to me.

These machine model identifiers are used by Apple to uniquely identify (all of) their machines since new-world Macs (even modern iPads and Macs have them) so for Mac people this should be clearer than the informal names that could get a bit long and confusing as there may be slight differences within a family. In any case, qemu-system-ppc -M mac99 is not corresponding to any real Mac so I'd like the options which do emulate real Macs to be called in a name that show which Mac is that. For the PPC Macs there's some info here for example:

https://en.wikipedia.org/wiki/Power_Mac_G4

And everymac.com also has info on all Macs. There were actually more than one G4 PowerMac with AGP but the other one was informally called gigabit ethernet. So the model ID is a shorter and better way to clearly identify which hardware is it (and it's also referenced in the device-tree of these Macs).

Are you planning to work on different types of G4 Mac where this could be confusing? Even to me "PowerMac 3.1" doesn't really tell me what model of Mac is being emulated, whereas "g4agp" (much in the same way as g3beige) is much more friendlier to people interested in using QEMU for Mac emulation.

Quoted 3 lines
Quoted 1 line

Finally can you post links to the device trees that you are using for each of the new machine types so that we have a clear reference point for future changes to the QEMU Mac machines? Even better include the links in the comments for each machine so that the information is easily visible for developers.

I still have those I've posted over the past 8 years when I made changes to OpenBIOS to make the device-tree closer to real machine. I've downloaded it back then, don't know where to find it now but searching for e.g. "PowerMac3,1" "device-tree" should get some results.

Nothing shows up for me, I'm afraid (remember that Google searches are unique to each user). If you want argue for changing the QEMU machines, then we should agree on the reference device model for future changes.

ATB,

Mark.

#11 lore raw

Re: [PATCH v7 3/7] mac_{old,new}world: Pass MacOS VGA NDRV in card ROM instead of fw_cfg

In reply to BALATON Zoltan
Quoted 103 lines · BALATON Zoltan
Quoted 93 lines · Mark Cave-Ayland
Quoted 92 lines · BALATON Zoltan

OpenBIOS cannot run FCode ROMs yet but it can detect NDRV in VGA card ROM and add it to the device tree for MacOS. Pass the NDRV this way instead of via fw_cfg. This solves the problem with OpenBIOS also adding the NDRV to ati-vga which it does not work with. This does not need any changes to OpenBIOS as this NDRV ROM handling is already there but this patch also allows simplifying OpenBIOS later to remove the fw_cfg ndrv handling from the vga FCode and also drop the vga-ndrv? option which is not needed any more as users can disable the ndrv with -device VGA,romfile="" (or override it with their own NDRV or ROM). Once FCode support is implemented in OpenBIOS, the proper FCode ROM can be set the same way so this paves the way to remove some hacks.

---
  hw/ppc/mac_newworld.c | 18 ++++++------------
  hw/ppc/mac_oldworld.c | 18 ++++++------------

  2 files changed, 12 insertions(+), 24 deletions(-)
hw/ppc/mac_newworld.c +0 -0
index 460c14b5e3..60c9c27986 100644
@@ -510,18 +510,6 @@ static void ppc_core99_init(MachineState *machine)
       fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ);
       fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_NVRAM_ADDR, nvram_addr);

  -    /* MacOS NDRV VGA driver */
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, NDRV_VGA_FILENAME); -    if (filename) {
-        gchar *ndrv_file;
-        gsize ndrv_size;

hw/ppc/mac_newworld.c +0 -7
-
-        if (g_file_get_contents(filename, &ndrv_file, &ndrv_size, NULL)) {
-            fw_cfg_add_file(fw_cfg, "ndrv/qemu_vga.ndrv", ndrv_file, ndrv_size);
-        }
-        g_free(filename);
-    }
-

      qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
  }
  @@ -565,6 +553,11 @@ static int core99_kvm_type(MachineState *machine, const char *arg) return 2;
  }
  +static GlobalProperty props[] = {
+    /* MacOS NDRV VGA driver */
+    { "VGA", "romfile", NDRV_VGA_FILENAME },

hw/ppc/mac_newworld.c +2 -0
+};
+

  static void core99_machine_class_init(ObjectClass *oc, void *data) {
      MachineClass *mc = MACHINE_CLASS(oc);

hw/ppc/mac_newworld.c +1 -0
@@ -585,6 +578,7 @@ static void core99_machine_class_init(ObjectClass *oc, void 
 *data)
   #endif
       mc->default_ram_id = "ppc_core99.ram";
       mc->ignore_boot_device_suffixes = true;
+    compat_props_add(mc->compat_props, props, G_N_ELEMENTS(props));
       fwc->get_dev_path = core99_fw_dev_path;
   }

  diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 5a7b25a4a8..6a1b1ad47a 100644

hw/ppc/mac_oldworld.c +0 -0
@@ -344,18 +344,6 @@ static void ppc_heathrow_init(MachineState *machine)
       fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_CLOCKFREQ, CLOCKFREQ);
       fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ);

  -    /* MacOS NDRV VGA driver */
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, NDRV_VGA_FILENAME); -    if (filename) {
-        gchar *ndrv_file;
-        gsize ndrv_size;

hw/ppc/mac_oldworld.c +0 -7
-
-        if (g_file_get_contents(filename, &ndrv_file, &ndrv_size, NULL)) {
-            fw_cfg_add_file(fw_cfg, "ndrv/qemu_vga.ndrv", ndrv_file, ndrv_size);
-        }
-        g_free(filename);
-    }
-

      qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
  }
  @@ -400,6 +388,11 @@ static int heathrow_kvm_type(MachineState *machine, const char *arg) return 2;
  }
  +static GlobalProperty props[] = {
+    /* MacOS NDRV VGA driver */
+    { "VGA", "romfile", NDRV_VGA_FILENAME },

hw/ppc/mac_oldworld.c +2 -0
+};
+

  static void heathrow_class_init(ObjectClass *oc, void *data) {
      MachineClass *mc = MACHINE_CLASS(oc);

hw/ppc/mac_oldworld.c +0 -0
@@ -420,6 +413,7 @@ static void heathrow_class_init(ObjectClass *oc, void *data)
Quoted 8 lines

hw/ppc/mac_oldworld.c static void heathrow_class_init(ObjectClass *oc, void *data) · line 418

Quoted 6 lines
hw/ppc/mac_oldworld.c +1 -0
       mc->default_display = "std";
       mc->ignore_boot_device_suffixes = true;
       mc->default_ram_id = "ppc_heathrow.ram";
+    compat_props_add(mc->compat_props, props, G_N_ELEMENTS(props));
       fwc->get_dev_path = heathrow_fw_dev_path;
   }

The qemu_vga.ndrv is deliberately kept separate from the PCI option ROM because it is a binary generated by a separate project: otherwise you'd end up creating a dependency between OpenBIOS and QemuMacDrivers, which is almost impossible to achieve since qemu_vga.ndrv can only (currently) be built in an emulated MacOS 9 guest.

Quoted 1 line

I don't get this. The dependency is already there as qemu_vga.ndrv ships with QEMU such as all the vgabios-*.bin and SeaBIOS binaries which are also built from different projects. The qemu_vga.ndrv would also still be part of an FCode ROM together with vga.fs if OpenBIOS could run that so this patch solely changes the way of passing the ROM binary to OpenBIOS from fw_cfg to the card ROM which is closer to how it should be and can direcly be replaced with the FCode ROM later after OpenBIOS will be advanced to that point.

Even if OpenBIOS were able to execute PCI option ROMs, the problem is that OpenBIOS cannot generate the qemu_vga.ndrv binary from source and therefore cannot generate the complete ROM by itself. Hence why the existing mechanism exists to inject qemu_vga.ndrv via fw_cfg() so the OpenBIOS ROM is self-contained.

Quoted 3 lines
Quoted 1 line

The best way to do this would be to extract the PCI config words from your ATI OpenBIOS patches and the alter drivers/vga.fs so that it only generates the driver,AAPL,MacOS,PowerPC property if the device id and vendor id match that of the QEMU VGA device.

This is further down the road and does not block this patch. The config access words should be provided by OpenBIOS not vga.fs. If we want to do it like on the real machine then vga.fs and qemu_vga,ndrv should be together the FCode ROM that the card has and OpenBIOS would run that. This is also how the ATI and NVIDIA ROMs do it which contain some Forth to init the card and add the embedded ndrv to the device tree for MacOS. But that's independent of this patch and needs OpenBIOS changes, while this patch does not need any change in OpenBIOS just moves to that direction to be able to attach a proper FCode ROM sometimes later and simpify fw_cfg handling in OpenBIOS. For now adding the ndrv in the ROM is enough for OpenBIOS as it has additional code to handle it already.

The problem you are ultimately trying to solve though is that OpenBIOS is loading the NDRV for all VGA PCI devices, so why not just fix drivers/vga.fs so that the NDRV is loaded only for the QEMU VGA device?

Quoted 1 line

So this patch neither adds new dependency to QEMU nor repends on any change in OpenBIOS. It just gets rid of passing files via fw_cfg.

Unfortunately that still doesn't solve the problem of building a self-contained OpenBIOS ROM, so this patch isn't the right way forward.

ATB,

Mark.

#37 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

In reply to BALATON Zoltan
Quoted 54 lines · BALATON Zoltan
Quoted 29 lines · Howard Spoelstra
Quoted 19 lines · BALATON Zoltan
Quoted 10 lines · Mark Cave-Ayland
Quoted 8 lines · BALATON Zoltan

Setting emulated machine type with a property called "via" is confusing users so deprecate the "via" option in favour of newly added explicit machine types. The default via=cuda option is not a valid config (no real Mac has this combination of hardware) so no machine type could be defined for that therefore it is kept for backwards compatibility with older QEMU versions for now but other options resembling real machines are deprecated.

Quoted 3 lines
Quoted 1 line

I believe that people do use -M mac99,via=cuda to run some rare versions

of

Quoted 1 line

MacOS in QEMU (I think possibly OS X DP and Workgroup Server?), so we

would

Quoted 1 line

want to keep this option somewhere.

Quoted 8 lines

The idea is that after previous patches we now have machine types for all other via option values (that also match real Mac machines) other than via=cude but that is the default for mac99 so after the reprecation period when the via option is removed mac99 (which is the same as mac99,via=cuda) can remain for this use case (and for backward compatibility) until the other machines are fixed to not need this any more. So all via options are still available but as different machine types.

Quoted 7 lines

My 2 cents about naming:
It seems less important how the machines are named when their name is not covering their definition. F.i. the powermac3,1 never had adb, could not be equipped with a G3 cpu, did not run at 900Mhz. The closest possible qemu-options based definition of a powermac3,1 (via=pmu) will not run Mac OS 9.0.4 ;-) due to the 2 USB devices problem. To run that via=cuda is already needed.

What does that mean? Should we aim to emulate real Macs or are we happy with the Franken-Mac we have now? The names also show what we intend to emulate even though the emulation may not be complete or have bugs (this is also true for other machines in QEMU where a lot of them are not fully emulated, only well enough to boot guest OSes).

Looks like everybody has forgotten the previous discussion and not read the docs and deprecation patches where this is explained so I summarise the proposed change here again:

- qemu-system-ppc -M mac99 is unchanged and works like before it just warns for the
via option and when using it in qemu-system-ppc64 suggesting using new machines instead so these could evetually be removed next year. mac99,via=cuda is just mac99 so you can continue to use that, mac99 is not deprecated and don't want to remove it.

- qemu-system-ppc64 -M mac99 -> powermac7_3

- qemu-system-ppc -M mac99,via=pmu -> powermac3,1

- qemu-system-ppc64 -M mac99,via=pmu-adb -> powerbook3_2

The last one is one of the rare Macs that had adb and pmu, all others with pmu usually have USB. The PowerMac1,2 (G4 PCI) had CUDA but not with mac99 hardware but more similar to g3beige and no ADB ports according to https://en.wikipedia.org/wiki/Power_Mac_G4#1st_generation:_Graphite
https://en.wikipedia.org/wiki/Power_Macintosh_G3_(Blue_and_White)#Hardware

Quoted 6 lines

The PowerMac7,3 seems to be matching the PCI device listing in the comment at the beginning of mac_newworld.c and also this article:
https://www.informit.com/articles/article.aspx?p=606582

What is the 2 USB devices problem? Is it the one we've debugged before and found that it's noted in a comment marked with ??? in hw/usb/hcd-ohci.c? That could be fixed if there was somebody interested enough to provide a patch.

But this series does not remove the mac99 and does not even deprecate it. What it deprecates are the via option to select different machine types and the automatic detection of ppc64 to emulate something different which are hard to understand for users and caused several misunderstandings. It's much more clear to have a separate machine type for each machine we emulate even when they aren't yet complete but at least we know which way to go and can compare to real hardware and fix the missing parts later. Also introducing powermac7_3 to split the ppc64 mac99 would allow to remove qemu-system-ppc if we wanted and only have one executable for all machines but even without this it's clearer to have separate machnies for G5 and G4 macs than mac99 silently behaving differently.

Ultimately the issue you are trying to solve is this, which is that -M mac99 is different for qemu-system-ppc and qemu-system-ppc64. Perhaps the best way to start is to create a new "g5niagara" machine type (including OpenBIOS) and make it a clone of mac_newworld.c, and then issue a warning on qemu-system-ppc64 for -M mac99.

The reason for suggesting this is that the number of users of qemu-system-ppc64 -M mac99 will be much smaller than those using qemu-system-ppc, which means there will be a lot less breakage for users. In the meantime we don't need to make a final decision re: machine names, yet it still gives you the freedom to work on -M mac99 for 32-bit Macs and move it closer towards the G4 AGP model.

ATB,

Mark.

#21 lore raw

Re: [PATCH v7 4/7] mac_newworld: Add machine types for different mac99 configs

In reply to Mark Cave-Ayland
Quoted 15 lines · Mark Cave-Ayland
Quoted 14 lines · BALATON Zoltan
Quoted 13 lines · Mark Cave-Ayland
Quoted 12 lines · BALATON Zoltan

The mac99 machine emulates different machines depending on machine properties or even if it is run as qemu-system-ppc64 or qemu-system-ppc. This is very confusing for users and many hours were lost trying to explain it or finding out why commands users came up with are not working as expected. (E.g. Windows users might think qemu-system-ppc64 is just the 64 bit version of qemu-system-ppc and then fail to boot a 32 bit OS with -M mac99 trying to follow an example that had qemu-system-ppc.) To avoid such confusion, add explicit machine types for the different configs which will work the same with both qemu-system-ppc and qemu-system-ppc64 and also make the command line clearer for new users.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Some thoughts on this: the first is that not everyone agrees that for qemu-system-X that X represents the target. There were previous discussion where some KVM people assumed X represented the host, i.e. ppc64 was the binary that ran all PPC guests but with hardware acceleration for ppc64 guests on ppc64 hosts. This was a while ago, so it may be worth starting a thread on qemu-devel to see what the current consensus is.

I don't see how this is relevant to this series, Also likely not the case any more as qemu-system-ppc and qemu-system-ppc64 share most of the code since a while with ppc64 including the config of ppc and adding more machines.

Well the patch defines the powermac 7.3 machine just for TARGET_PPC64, no? So you're making the assumption qemu-system-ppc64 represents a 64-bit target rather than a 64-bit host.

I'm not making that assumption, it's already there:

$ qemu-system-ppc -machine help
Supported machines are:
40p                  IBM RS/6000 7020 (40p)
bamboo               bamboo
g3beige              Heathrow based PowerMAC (default)
mac99                Mac99 based PowerMAC
mpc8544ds            mpc8544ds
none                 empty machine
pegasos2             Genesi/bPlan Pegasos II
ppce500              generic paravirt e500 platform
ref405ep             ref405ep
sam460ex             aCube Sam460ex
virtex-ml507         Xilinx Virtex ML507 reference design
$ qemu-system-ppc64 -machine help
Supported machines are:
40p                  IBM RS/6000 7020 (40p)
bamboo               bamboo
g3beige              Heathrow based PowerMAC
mac99                Mac99 based PowerMAC
mpc8544ds            mpc8544ds
none                 empty machine
pegasos2             Genesi/bPlan Pegasos II
powernv10            IBM PowerNV (Non-Virtualized) POWER10
powernv8             IBM PowerNV (Non-Virtualized) POWER8
powernv              IBM PowerNV (Non-Virtualized) POWER9 (alias of  powernv9)
powernv9             IBM PowerNV (Non-Virtualized) POWER9
ppce500              generic paravirt e500 platform
pseries-2.1          pSeries Logical Partition (PAPR compliant)
[lots of different pseries versions omitted here]
pseries              pSeries Logical Partition (PAPR compliant) (alias of pseries-8.0)
pseries-8.0          pSeries Logical Partition (PAPR compliant) (default)
ref405ep             ref405ep
sam460ex             aCube Sam460ex
virtex-ml507         Xilinx Virtex ML507 reference design

It makes no sense to define it for qemu-system-ppc as that version does not have G5 and 64 bit CPUs compiled in. Cf. qemu-system-ppc -cpu help and qemu-system-ppc64 -cpu help or target/ppc/cpu-models.c so I don't know what you're talking about.

Quoted 9 lines
Quoted 7 lines
Quoted 1 line

Secondly it's not clear to me why you've chosen names like "powermac_3_1" instead of "g4agp"? Does powermac_3_1 uniquely identify the G4 AGP Sawtooth model? For QEMU it is always best to emulate real machines, and whilst I understand you want to separate out the two versions of the mac99 machine, having "powermac_X_Y" seems less clear to me.

These machine model identifiers are used by Apple to uniquely identify (all of) their machines since new-world Macs (even modern iPads and Macs have them) so for Mac people this should be clearer than the informal names that could get a bit long and confusing as there may be slight differences within a family. In any case, qemu-system-ppc -M mac99 is not corresponding to any real Mac so I'd like the options which do emulate real Macs to be called in a name that show which Mac is that. For the PPC Macs there's some info here for example:

https://en.wikipedia.org/wiki/Power_Mac_G4

And everymac.com also has info on all Macs. There were actually more than one G4 PowerMac with AGP but the other one was informally called gigabit ethernet. So the model ID is a shorter and better way to clearly identify which hardware is it (and it's also referenced in the device-tree of these Macs).

Are you planning to work on different types of G4 Mac where this could be confusing? Even to me "PowerMac 3.1" doesn't really tell me what model of Mac is being emulated, whereas "g4agp" (much in the same way as g3beige) is much more friendlier to people interested in using QEMU for Mac emulation.

This is similar problem as some people like to call Mac OS X versions by number and some by big cats names. Personally I prefer version numbers because it's easy to tell which is newer or older that way without remembering a nomenclature or having to look it up every time. It would be good if others interested in this also shared their preference because if it's only us two with different views then it's hard to make a decision. I still think machine ID is better also because then these machines would be grouped in the -machine help output like the others but as long as we don't have other machines that start with a g or other Macs that have some other name it might work so I could change the naming if that's all needed for this to get in.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Finally can you post links to the device trees that you are using for each of the new machine types so that we have a clear reference point for future changes to the QEMU Mac machines? Even better include the links in the comments for each machine so that the information is easily visible for developers.

I still have those I've posted over the past 8 years when I made changes to OpenBIOS to make the device-tree closer to real machine. I've downloaded it back then, don't know where to find it now but searching for e.g. "PowerMac3,1" "device-tree" should get some results.

Nothing shows up for me, I'm afraid (remember that Google searches are unique to each user). If you want argue for changing the QEMU machines, then we should agree on the reference device model for future changes.

Sigh, maybe search your list archives instead of Googls. Also it's "PowerMac3,1" where I've converted the comma to underscre for qemu command line parsing so became powermac3_1 not powermac_3_1. Try searching with quotes to reduce the number of false results.

- mac99 (via=cuda) does not exist so no real device tree for this needed

- powermac3_1 (currently mac99,via=pmu) I've sent links years ago e.g.:
https://mail.coreboot.org/pipermail/openbios/2016-February/009145.html
but you still keep asking

- powermac7_3 (ppc64 mac99) The expected hardware is listed in a comment in mac_newworld.c also it adds a 970fx CPU and according to https://en.wikipedia.org/wiki/Power_Mac_G5 PowerMac7,3 was the first version with 970fx so I think that was the target for whoever started it back then. These G5 Macs are probably still around so you should be able to ask someone to get a device tree dump, I've only seen Linux hardware listings:
https://gist.github.com/tomari/3689297 https://forum.ubuntu-fr.org/viewtopic.php?id=2026003 (last post)

-powerbook3_2 (mac99,via=pmi-adb) this is rare as Macs with PMU usually have USB and not ADB; only the first PowerBooks had an ADB trackpad (but no outside ports AFAIK). All other Macs with ADB had CUDA so I'm not even sure we need this option but if we want it then the first PowerBooks are candidates, I've picked the lowest number for 1st gen Titanium PowerBook from here:
https://en.wikipedia.org/wiki/PowerBook_G4
and e.g. these links confirm it had ADB:
https://forums.freebsd.org/threads/12-powerbook-g4-867mhz-xorg-doesnt-work.37815/
http://macos9lives.com/smforum/index.php/topic,4781.msg41380.html?PHPSESSID=75b23dcb4c042b51c6dddd311cff2341#msg41380

It would be tough to come up with a name for the powerbook3_2 though as these were called Early 2001 Titanium PowerBook G4 or code name Mercury but even Mac fanatics probably couldn't tell that was a powerbook if you call it g4mercury so I'm open to votes on naming but hard to be convinced there's anything simpler and more straightforward than using machine id which is usually also listed everywhere for these.

Regards,
BALATON Zoltan

#38 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

In reply to Mark Cave-Ayland
Quoted 53 lines · Mark Cave-Ayland
Quoted 52 lines · BALATON Zoltan
Quoted 27 lines · Howard Spoelstra
Quoted 18 lines · BALATON Zoltan
Quoted 9 lines · Mark Cave-Ayland
Quoted 8 lines · BALATON Zoltan

Setting emulated machine type with a property called "via" is confusing users so deprecate the "via" option in favour of newly added explicit machine types. The default via=cuda option is not a valid config (no real Mac has this combination of hardware) so no machine type could be defined for that therefore it is kept for backwards compatibility with older QEMU versions for now but other options resembling real machines are deprecated.

Quoted 3 lines
Quoted 1 line

I believe that people do use -M mac99,via=cuda to run some rare versions

of

Quoted 1 line

MacOS in QEMU (I think possibly OS X DP and Workgroup Server?), so we

would

Quoted 1 line

want to keep this option somewhere.

Quoted 8 lines

The idea is that after previous patches we now have machine types for all other via option values (that also match real Mac machines) other than via=cude but that is the default for mac99 so after the reprecation period when the via option is removed mac99 (which is the same as mac99,via=cuda) can remain for this use case (and for backward compatibility) until the other machines are fixed to not need this any more. So all via options are still available but as different machine types.

Quoted 7 lines

My 2 cents about naming:
It seems less important how the machines are named when their name is not covering their definition. F.i. the powermac3,1 never had adb, could not be equipped with a G3 cpu, did not run at 900Mhz. The closest possible qemu-options based definition of a powermac3,1 (via=pmu) will not run Mac OS 9.0.4 ;-) due to the 2 USB devices problem. To run that via=cuda is already needed.

What does that mean? Should we aim to emulate real Macs or are we happy with the Franken-Mac we have now? The names also show what we intend to emulate even though the emulation may not be complete or have bugs (this is also true for other machines in QEMU where a lot of them are not fully emulated, only well enough to boot guest OSes).

Looks like everybody has forgotten the previous discussion and not read the docs and deprecation patches where this is explained so I summarise the proposed change here again:

- qemu-system-ppc -M mac99 is unchanged and works like before it just warns
for the via option and when using it in qemu-system-ppc64 suggesting using new machines instead so these could evetually be removed next year. mac99,via=cuda is just mac99 so you can continue to use that, mac99 is not deprecated and don't want to remove it.

- qemu-system-ppc64 -M mac99 -> powermac7_3

- qemu-system-ppc -M mac99,via=pmu -> powermac3,1

- qemu-system-ppc64 -M mac99,via=pmu-adb -> powerbook3_2

The last one is one of the rare Macs that had adb and pmu, all others with pmu usually have USB. The PowerMac1,2 (G4 PCI) had CUDA but not with mac99 hardware but more similar to g3beige and no ADB ports according to https://en.wikipedia.org/wiki/Power_Mac_G4#1st_generation:_Graphite
https://en.wikipedia.org/wiki/Power_Macintosh_G3_(Blue_and_White)#Hardware

Quoted 8 lines
Quoted 6 lines

The PowerMac7,3 seems to be matching the PCI device listing in the comment at the beginning of mac_newworld.c and also this article:
https://www.informit.com/articles/article.aspx?p=606582

What is the 2 USB devices problem? Is it the one we've debugged before and found that it's noted in a comment marked with ??? in hw/usb/hcd-ohci.c? That could be fixed if there was somebody interested enough to provide a patch.

But this series does not remove the mac99 and does not even deprecate it. What it deprecates are the via option to select different machine types and the automatic detection of ppc64 to emulate something different which are hard to understand for users and caused several misunderstandings. It's much more clear to have a separate machine type for each machine we emulate even when they aren't yet complete but at least we know which way to go and can compare to real hardware and fix the missing parts later. Also introducing powermac7_3 to split the ppc64 mac99 would allow to remove qemu-system-ppc if we wanted and only have one executable for all machines but even without this it's clearer to have separate machnies for G5 and G4 macs than mac99 silently behaving differently.

Ultimately the issue you are trying to solve is this, which is that -M mac99 is different for qemu-system-ppc and qemu-system-ppc64. Perhaps the best way to start is to create a new "g5niagara" machine type (including OpenBIOS) and make it a clone of mac_newworld.c, and then issue a warning on qemu-system-ppc64 for -M mac99.

I don't get what you mean. Patch 4 introduces a new machine type called powermac7_3 (or g5niagara if you want) which is a clone of mac99 and then issues the warning to deprecate qemu-system-ppc64 -M mac99 in patch 5. Did you actually test these patches at all?

Quoted 1 line

The reason for suggesting this is that the number of users of qemu-system-ppc64 -M mac99 will be much smaller than those using qemu-system-ppc, which means there will be a lot less breakage for users. In

Except those who mean to use ppc mac99 but think that they should use qemu-system-ppc64 on 64 bit Windows which is probably the highest number of users currently. I've cc'd you on the last instance of this but can dig up some more from last year and look at the emaculation.com forum or ask Howard how many times that happens. So after these patches users can still use qemu-system-ppc -M mac99 as before without a warning but will get warned for qemu-system-ppc64 -M mac99 to use powernac7_3 instead.

Quoted 1 line

the meantime we don't need to make a final decision re: machine names, yet it still gives you the freedom to work on -M mac99 for 32-bit Macs and move it closer towards the G4 AGP model.

That's a different issue you're mixing in here. One issue is mac99 emulating different machines with ppc and pcc64, this is solved as above. Another issue is that ppc mac99 is not a real mac, to get the hardware to match the device tree OpenBIOS tells the guest it is you have to use mac99,via=pmu which no user can guess. I want to rename this to simply powermac3_1 and get rid of the via option eventually and make these separate machines which is much more clear to the user. The implementation remains the same, but we're free to change that later once the naming is resolved. So I think we should decide on naming now and start deprecating old names (which are ppc64 mac99 and macc99 with via option so we only leave mac99 as before and all other variants will become -machine options). What part of this is not clear to you. I feel like despite trying to explain it for the third time we're still not on the same page.

Regards,
BALATON Zoltan

#12 lore raw

Re: [PATCH v7 3/7] mac_{old,new}world: Pass MacOS VGA NDRV in card ROM instead of fw_cfg

In reply to Mark Cave-Ayland
Quoted 109 lines · Mark Cave-Ayland
Quoted 108 lines · BALATON Zoltan
Quoted 106 lines · Mark Cave-Ayland
Quoted 96 lines · BALATON Zoltan

OpenBIOS cannot run FCode ROMs yet but it can detect NDRV in VGA card ROM and add it to the device tree for MacOS. Pass the NDRV this way instead of via fw_cfg. This solves the problem with OpenBIOS also adding the NDRV to ati-vga which it does not work with. This does not need any changes to OpenBIOS as this NDRV ROM handling is already there but this patch also allows simplifying OpenBIOS later to remove the fw_cfg ndrv handling from the vga FCode and also drop the vga-ndrv? option which is not needed any more as users can disable the ndrv with -device VGA,romfile="" (or override it with their own NDRV or ROM). Once FCode support is implemented in OpenBIOS, the proper FCode ROM can be set the same way so this paves the way to remove some hacks.

---
  hw/ppc/mac_newworld.c | 18 ++++++------------
  hw/ppc/mac_oldworld.c | 18 ++++++------------

  2 files changed, 12 insertions(+), 24 deletions(-)
hw/ppc/mac_newworld.c +0 -0
index 460c14b5e3..60c9c27986 100644
@@ -510,18 +510,6 @@ static void ppc_core99_init(MachineState *machine)
       fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ);
       fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_NVRAM_ADDR, nvram_addr);

  -    /* MacOS NDRV VGA driver */
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, NDRV_VGA_FILENAME);
-    if (filename) {
-        gchar *ndrv_file;
-        gsize ndrv_size;
-
-        if (g_file_get_contents(filename, &ndrv_file, &ndrv_size, NULL))
{
-            fw_cfg_add_file(fw_cfg, "ndrv/qemu_vga.ndrv", ndrv_file, ndrv_size);
-        }
-        g_free(filename);
-    }
-
      qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
  }
  @@ -565,6 +553,11 @@ static int core99_kvm_type(MachineState *machine, const char *arg) return 2;
  }
  +static GlobalProperty props[] = {
+    /* MacOS NDRV VGA driver */
+    { "VGA", "romfile", NDRV_VGA_FILENAME },

hw/ppc/mac_newworld.c +2 -0
+};
+

  static void core99_machine_class_init(ObjectClass *oc, void *data) {
      MachineClass *mc = MACHINE_CLASS(oc);

hw/ppc/mac_newworld.c +1 -0
@@ -585,6 +578,7 @@ static void core99_machine_class_init(ObjectClass 
 *oc, void *data)
   #endif
       mc->default_ram_id = "ppc_core99.ram";
       mc->ignore_boot_device_suffixes = true;
+    compat_props_add(mc->compat_props, props, G_N_ELEMENTS(props));
       fwc->get_dev_path = core99_fw_dev_path;
   }

  diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 5a7b25a4a8..6a1b1ad47a 100644

hw/ppc/mac_oldworld.c +0 -0
@@ -344,18 +344,6 @@ static void ppc_heathrow_init(MachineState *machine)
       fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_CLOCKFREQ, CLOCKFREQ);
       fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ);

  -    /* MacOS NDRV VGA driver */
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, NDRV_VGA_FILENAME);
-    if (filename) {
-        gchar *ndrv_file;
-        gsize ndrv_size;
-
-        if (g_file_get_contents(filename, &ndrv_file, &ndrv_size, NULL))
{
-            fw_cfg_add_file(fw_cfg, "ndrv/qemu_vga.ndrv", ndrv_file, ndrv_size);
-        }
-        g_free(filename);
-    }
-
      qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
  }
  @@ -400,6 +388,11 @@ static int heathrow_kvm_type(MachineState *machine, const char *arg) return 2;
  }
  +static GlobalProperty props[] = {
+    /* MacOS NDRV VGA driver */
+    { "VGA", "romfile", NDRV_VGA_FILENAME },

hw/ppc/mac_oldworld.c +2 -0
+};
+

  static void heathrow_class_init(ObjectClass *oc, void *data) {
      MachineClass *mc = MACHINE_CLASS(oc);

hw/ppc/mac_oldworld.c static void heathrow_class_init(ObjectClass *oc, void · line 419

Quoted 7 lines
hw/ppc/mac_oldworld.c +1 -0
@@ -420,6 +413,7 @@ static void heathrow_class_init(ObjectClass *oc, void 
 *data)
       mc->default_display = "std";
       mc->ignore_boot_device_suffixes = true;
       mc->default_ram_id = "ppc_heathrow.ram";
+    compat_props_add(mc->compat_props, props, G_N_ELEMENTS(props));
       fwc->get_dev_path = heathrow_fw_dev_path;
   }

The qemu_vga.ndrv is deliberately kept separate from the PCI option ROM because it is a binary generated by a separate project: otherwise you'd end up creating a dependency between OpenBIOS and QemuMacDrivers, which is almost impossible to achieve since qemu_vga.ndrv can only (currently) be built in an emulated MacOS 9 guest.

Quoted 3 lines
Quoted 1 line

I don't get this. The dependency is already there as qemu_vga.ndrv ships with QEMU such as all the vgabios-*.bin and SeaBIOS binaries which are also built from different projects. The qemu_vga.ndrv would also still be part of an FCode ROM together with vga.fs if OpenBIOS could run that so this patch solely changes the way of passing the ROM binary to OpenBIOS from fw_cfg to the card ROM which is closer to how it should be and can direcly be replaced with the FCode ROM later after OpenBIOS will be advanced to that point.

Even if OpenBIOS were able to execute PCI option ROMs, the problem is that OpenBIOS cannot generate the qemu_vga.ndrv binary from source and therefore cannot generate the complete ROM by itself. Hence why the existing mechanism exists to inject qemu_vga.ndrv via fw_cfg() so the OpenBIOS ROM is self-contained.

And how does this change by this patch? The ndrv is built separately and included in QEMU currently. This does not change at all. The only thing that changes is that QEMU does not add it to fw_cfg but to the ROM where OpenBIOS adds it to the device tree but it can do it much simpler removing some code to handle downloading the file as it already reads the ROM. The option ROM is not self contained now and it will not be after this patch it's just a different way to solve the same issue simpler. What you don't like about it?

Quoted 9 lines
Quoted 3 lines
Quoted 1 line

The best way to do this would be to extract the PCI config words from your ATI OpenBIOS patches and the alter drivers/vga.fs so that it only generates the driver,AAPL,MacOS,PowerPC property if the device id and vendor id match that of the QEMU VGA device.

This is further down the road and does not block this patch. The config access words should be provided by OpenBIOS not vga.fs. If we want to do it like on the real machine then vga.fs and qemu_vga,ndrv should be together the FCode ROM that the card has and OpenBIOS would run that. This is also how the ATI and NVIDIA ROMs do it which contain some Forth to init the card and add the embedded ndrv to the device tree for MacOS. But that's independent of this patch and needs OpenBIOS changes, while this patch does not need any change in OpenBIOS just moves to that direction to be able to attach a proper FCode ROM sometimes later and simpify fw_cfg handling in OpenBIOS. For now adding the ndrv in the ROM is enough for OpenBIOS as it has additional code to handle it already.

The problem you are ultimately trying to solve though is that OpenBIOS is loading the NDRV for all VGA PCI devices, so why not just fix drivers/vga.fs so that the NDRV is loaded only for the QEMU VGA device?

Quoted 1 line

So this patch neither adds new dependency to QEMU nor repends on any change in OpenBIOS. It just gets rid of passing files via fw_cfg.

Unfortunately that still doesn't solve the problem of building a self-contained OpenBIOS ROM, so this patch isn't the right way forward.

It does take a step to make it possible to eventually add a self contained ROM and remove the vga.fs from OpenBIOS but it's not doing that fully. It just simplifies QEMU and OpenBIOS vga.fs for now and making the ROM also contain the FCode will be a further step but we can't get there if you don't allow to make smaller steps or don't merge my patches for OpenBIOS which would allow it to run FCode ROMs. If you're waiting for all this to be finished I'll give up and it will never be finished. If you allow to progress in smaller steps then maybe we'll get there.

Regards,
BALATON Zoltan

#22 lore raw

Re: [PATCH v7 4/7] mac_newworld: Add machine types for different mac99 configs

In reply to BALATON Zoltan
Quoted 1 line · BALATON Zoltan

It would be tough to come up with a name for the powerbook3_2 though as these were called Early 2001 Titanium PowerBook G4 or code name Mercury but even Mac fanatics probably couldn't tell that was a powerbook if you call it g4mercury so I'm open to votes on naming but hard to be convinced there's anything simpler and more straightforward than using machine id which is usually also listed everywhere for these.

g4tibook1stgen?

("TiBook" being an affectionate abbreviation for "Titanium PowerBook")

Cheers,
Josh

#23 lore raw

Re: [PATCH v7 4/7] mac_newworld: Add machine types for different mac99 configs

In reply to BALATON Zoltan
Quoted 62 lines · BALATON Zoltan
Quoted 15 lines · Mark Cave-Ayland
Quoted 14 lines · BALATON Zoltan
Quoted 13 lines · Mark Cave-Ayland
Quoted 12 lines · BALATON Zoltan

The mac99 machine emulates different machines depending on machine properties or even if it is run as qemu-system-ppc64 or qemu-system-ppc. This is very confusing for users and many hours were lost trying to explain it or finding out why commands users came up with are not working as expected. (E.g. Windows users might think qemu-system-ppc64 is just the 64 bit version of qemu-system-ppc and then fail to boot a 32 bit OS with -M mac99 trying to follow an example that had qemu-system-ppc.) To avoid such confusion, add explicit machine types for the different configs which will work the same with both qemu-system-ppc and qemu-system-ppc64 and also make the command line clearer for new users.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Some thoughts on this: the first is that not everyone agrees that for qemu-system-X that X represents the target. There were previous discussion where some KVM people assumed X represented the host, i.e. ppc64 was the binary that ran all PPC guests but with hardware acceleration for ppc64 guests on ppc64 hosts. This was a while ago, so it may be worth starting a thread on qemu-devel to see what the current consensus is.

I don't see how this is relevant to this series, Also likely not the case any more as qemu-system-ppc and qemu-system-ppc64 share most of the code since a while with ppc64 including the config of ppc and adding more machines.

Well the patch defines the powermac 7.3 machine just for TARGET_PPC64, no? So you're making the assumption qemu-system-ppc64 represents a 64-bit target rather than a 64-bit host.

I'm not making that assumption, it's already there:

$ qemu-system-ppc -machine help
Supported machines are:
40p                  IBM RS/6000 7020 (40p)
bamboo               bamboo
g3beige              Heathrow based PowerMAC (default)
mac99                Mac99 based PowerMAC
mpc8544ds            mpc8544ds
none                 empty machine
pegasos2             Genesi/bPlan Pegasos II
ppce500              generic paravirt e500 platform
ref405ep             ref405ep
sam460ex             aCube Sam460ex
virtex-ml507         Xilinx Virtex ML507 reference design
$ qemu-system-ppc64 -machine help
Supported machines are:
40p                  IBM RS/6000 7020 (40p)
bamboo               bamboo
g3beige              Heathrow based PowerMAC
mac99                Mac99 based PowerMAC
mpc8544ds            mpc8544ds
none                 empty machine
pegasos2             Genesi/bPlan Pegasos II
powernv10            IBM PowerNV (Non-Virtualized) POWER10
powernv8             IBM PowerNV (Non-Virtualized) POWER8
powernv              IBM PowerNV (Non-Virtualized) POWER9 (alias of  powernv9)
powernv9             IBM PowerNV (Non-Virtualized) POWER9
ppce500              generic paravirt e500 platform
pseries-2.1          pSeries Logical Partition (PAPR compliant)
[lots of different pseries versions omitted here]
pseries              pSeries Logical Partition (PAPR compliant) (alias of pseries-8.0)
pseries-8.0          pSeries Logical Partition (PAPR compliant) (default)
ref405ep             ref405ep
sam460ex             aCube Sam460ex
virtex-ml507         Xilinx Virtex ML507 reference design
Quoted 1 line

It makes no sense to define it for qemu-system-ppc as that version does not have G5 and 64 bit CPUs compiled in. Cf. qemu-system-ppc -cpu help and qemu-system-ppc64 -cpu help or target/ppc/cpu-models.c so I don't know what you're talking about.

I did a quick ask around online, and the general consensus was that it references the target (see https://lists.gnu.org/archive/html/qemu-devel/2022-05/msg00757.html for one of the more recent discussions about this as why this isn't always clear). However as you point out the 64-bit CPU isn't available for qemu-system-ppc so you're right that won't be an issue here.

Quoted 11 lines
Quoted 9 lines
Quoted 7 lines
Quoted 1 line

Secondly it's not clear to me why you've chosen names like "powermac_3_1" instead of "g4agp"? Does powermac_3_1 uniquely identify the G4 AGP Sawtooth model? For QEMU it is always best to emulate real machines, and whilst I understand you want to separate out the two versions of the mac99 machine, having "powermac_X_Y" seems less clear to me.

These machine model identifiers are used by Apple to uniquely identify (all of) their machines since new-world Macs (even modern iPads and Macs have them) so for Mac people this should be clearer than the informal names that could get a bit long and confusing as there may be slight differences within a family. In any case, qemu-system-ppc -M mac99 is not corresponding to any real Mac so I'd like the options which do emulate real Macs to be called in a name that show which Mac is that. For the PPC Macs there's some info here for example:

https://en.wikipedia.org/wiki/Power_Mac_G4

And everymac.com also has info on all Macs. There were actually more than one G4 PowerMac with AGP but the other one was informally called gigabit ethernet. So the model ID is a shorter and better way to clearly identify which hardware is it (and it's also referenced in the device-tree of these Macs).

Are you planning to work on different types of G4 Mac where this could be confusing? Even to me "PowerMac 3.1" doesn't really tell me what model of Mac is being emulated, whereas "g4agp" (much in the same way as g3beige) is much more friendlier to people interested in using QEMU for Mac emulation.

This is similar problem as some people like to call Mac OS X versions by number and some by big cats names. Personally I prefer version numbers because it's easy to tell which is newer or older that way without remembering a nomenclature or having to look it up every time. It would be good if others interested in this also shared their preference because if it's only us two with different views then it's hard to make a decision. I still think machine ID is better also because then these machines would be grouped in the -machine help output like the others but as long as we don't have other machines that start with a g or other Macs that have some other name it might work so I could change the naming if that's all needed for this to get in.

I'd lean towards the g* naming, because not only is it more obvious to less technical Mac users what is being emulated, it matches the existing precedent set by g3beige.

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Finally can you post links to the device trees that you are using for each of the new machine types so that we have a clear reference point for future changes to the QEMU Mac machines? Even better include the links in the comments for each machine so that the information is easily visible for developers.

I still have those I've posted over the past 8 years when I made changes to OpenBIOS to make the device-tree closer to real machine. I've downloaded it back then, don't know where to find it now but searching for e.g. "PowerMac3,1" "device-tree" should get some results.

Nothing shows up for me, I'm afraid (remember that Google searches are unique to each user). If you want argue for changing the QEMU machines, then we should agree on the reference device model for future changes.

Quoted 7 lines

Sigh, maybe search your list archives instead of Googls. Also it's "PowerMac3,1" where I've converted the comma to underscre for qemu command line parsing so became powermac3_1 not powermac_3_1. Try searching with quotes to reduce the number of false results.

- mac99 (via=cuda) does not exist so no real device tree for this needed

- powermac3_1 (currently mac99,via=pmu) I've sent links years ago e.g.:
https://mail.coreboot.org/pipermail/openbios/2016-February/009145.html
but you still keep asking

Right, because old documentation like this is slowly disappearing from the internet. We should consider a patch to add those public links into the source files so there is a (hopefully) long-term reference to them.

Quoted 12 lines

- powermac7_3 (ppc64 mac99) The expected hardware is listed in a comment in
mac_newworld.c also it adds a 970fx CPU and according to https://en.wikipedia.org/wiki/Power_Mac_G5 PowerMac7,3 was the first version with 970fx so I think that was the target for whoever started it back then. These G5 Macs are probably still around so you should be able to ask someone to get a device tree dump, I've only seen Linux hardware listings:
https://gist.github.com/tomari/3689297 https://forum.ubuntu-fr.org/viewtopic.php?id=2026003 (last post)

-powerbook3_2 (mac99,via=pmi-adb) this is rare as Macs with PMU usually have USB and
not ADB; only the first PowerBooks had an ADB trackpad (but no outside ports AFAIK). All other Macs with ADB had CUDA so I'm not even sure we need this option but if we want it then the first PowerBooks are candidates, I've picked the lowest number for 1st gen Titanium PowerBook from here:
https://en.wikipedia.org/wiki/PowerBook_G4
and e.g. these links confirm it had ADB:
https://forums.freebsd.org/threads/12-powerbook-g4-867mhz-xorg-doesnt-work.37815/
http://macos9lives.com/smforum/index.php/topic,4781.msg41380.html?PHPSESSID=75b23dcb4c042b51c6dddd311cff2341#msg41380

Quoted 1 line

It would be tough to come up with a name for the powerbook3_2 though as these were called Early 2001 Titanium PowerBook G4 or code name Mercury but even Mac fanatics probably couldn't tell that was a powerbook if you call it g4mercury so I'm open to votes on naming but hard to be convinced there's anything simpler and more straightforward than using machine id which is usually also listed everywhere for these.

The question really is which OSs use -M mac99,via=cuda and -M mac99,via=pmu-adb, and what real machines were intended to boot them. Howard, perhaps you have better knowledge of this?

ATB,

Mark.

#39 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

In reply to BALATON Zoltan
Quoted 42 lines · BALATON Zoltan
Quoted 41 lines · Mark Cave-Ayland
Quoted 40 lines · BALATON Zoltan
Quoted 27 lines · Howard Spoelstra
Quoted 18 lines · BALATON Zoltan
Quoted 9 lines · Mark Cave-Ayland
Quoted 8 lines · BALATON Zoltan

Setting emulated machine type with a property called "via" is confusing users so deprecate the "via" option in favour of newly added explicit machine types. The default via=cuda option is not a valid config (no real Mac has this combination of hardware) so no machine type could be defined for that therefore it is kept for backwards compatibility with older QEMU versions for now but other options resembling real machines are deprecated.

Quoted 3 lines
Quoted 1 line

I believe that people do use -M mac99,via=cuda to run some rare versions

of

Quoted 1 line

MacOS in QEMU (I think possibly OS X DP and Workgroup Server?), so we

would

Quoted 1 line

want to keep this option somewhere.

Quoted 8 lines

The idea is that after previous patches we now have machine types for all other via option values (that also match real Mac machines) other than via=cude but that is the default for mac99 so after the reprecation period when the via option is removed mac99 (which is the same as mac99,via=cuda) can remain for this use case (and for backward compatibility) until the other machines are fixed to not need this any more. So all via options are still available but as different machine types.

Quoted 7 lines

My 2 cents about naming:
It seems less important how the machines are named when their name is not covering their definition. F.i. the powermac3,1 never had adb, could not be equipped with a G3 cpu, did not run at 900Mhz. The closest possible qemu-options based definition of a powermac3,1 (via=pmu) will not run Mac OS 9.0.4 ;-) due to the 2 USB devices problem. To run that via=cuda is already needed.

What does that mean? Should we aim to emulate real Macs or are we happy with the Franken-Mac we have now? The names also show what we intend to emulate even though the emulation may not be complete or have bugs (this is also true for other machines in QEMU where a lot of them are not fully emulated, only well enough to boot guest OSes).

Looks like everybody has forgotten the previous discussion and not read the docs and deprecation patches where this is explained so I summarise the proposed change here again:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

- qemu-system-ppc -M mac99 is unchanged and works like before it just warns for
the via option and when using it in qemu-system-ppc64 suggesting using new machines instead so these could evetually be removed next year. mac99,via=cuda is just mac99 so you can continue to use that, mac99 is not deprecated and don't want to remove it.

- qemu-system-ppc64 -M mac99 -> powermac7_3

- qemu-system-ppc -M mac99,via=pmu -> powermac3,1

- qemu-system-ppc64 -M mac99,via=pmu-adb -> powerbook3_2

FWIW this information would be useful in the cover letter once we decide the way forward. Also as a reviewer, it is hard to keep track of all the changes if the series are constantly changing and with no changelog on the cover letter, which is why it takes me a while to review them.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

The last one is one of the rare Macs that had adb and pmu, all others with pmu usually have USB. The PowerMac1,2 (G4 PCI) had CUDA but not with mac99 hardware but more similar to g3beige and no ADB ports according to https://en.wikipedia.org/wiki/Power_Mac_G4#1st_generation:_Graphite
https://en.wikipedia.org/wiki/Power_Macintosh_G3_(Blue_and_White)#Hardware

The PowerMac7,3 seems to be matching the PCI device listing in the comment at the beginning of mac_newworld.c and also this article:
https://www.informit.com/articles/article.aspx?p=606582

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

What is the 2 USB devices problem? Is it the one we've debugged before and found that it's noted in a comment marked with ??? in hw/usb/hcd-ohci.c? That could be fixed if there was somebody interested enough to provide a patch.

But this series does not remove the mac99 and does not even deprecate it. What it deprecates are the via option to select different machine types and the automatic detection of ppc64 to emulate something different which are hard to understand for users and caused several misunderstandings. It's much more clear to have a separate machine type for each machine we emulate even when they aren't yet complete but at least we know which way to go and can compare to real hardware and fix the missing parts later. Also introducing powermac7_3 to split the ppc64 mac99 would allow to remove qemu-system-ppc if we wanted and only have one executable for all machines but even without this it's clearer to have separate machnies for G5 and G4 macs than mac99 silently behaving differently.

Ultimately the issue you are trying to solve is this, which is that -M mac99 is different for qemu-system-ppc and qemu-system-ppc64. Perhaps the best way to start is to create a new "g5niagara" machine type (including OpenBIOS) and make it a clone of mac_newworld.c, and then issue a warning on qemu-system-ppc64 for -M mac99.

I don't get what you mean. Patch 4 introduces a new machine type called powermac7_3 (or g5niagara if you want) which is a clone of mac99 and then issues the warning to deprecate qemu-system-ppc64 -M mac99 in patch 5. Did you actually test these patches at all?

More specifically, what I'm suggesting as well as creating a new machine name is that we clone mac_newworld.c into a separate file for the 64-bit Mac machine, declare it as compiled for PPC64 only, and put the deprecation there. By creating a separate file and separate machine type for OpenBIOS, it gives you the freedom to make changes to mac99 to move it towards a G4 AGP without having to worry about affecting any existing 64-bit users.

Quoted 3 lines
Quoted 1 line

The reason for suggesting this is that the number of users of qemu-system-ppc64 -M mac99 will be much smaller than those using qemu-system-ppc, which means there will be a lot less breakage for users. In

Except those who mean to use ppc mac99 but think that they should use qemu-system-ppc64 on 64 bit Windows which is probably the highest number of users currently. I've cc'd you on the last instance of this but can dig up some more from last year and look at the emaculation.com forum or ask Howard how many times that happens. So after these patches users can still use qemu-system-ppc -M mac99 as before without a warning but will get warned for qemu-system-ppc64 -M mac99 to use powernac7_3 instead.

We're saying the same thing here, no?

Quoted 3 lines
Quoted 1 line

the meantime we don't need to make a final decision re: machine names, yet it still gives you the freedom to work on -M mac99 for 32-bit Macs and move it closer towards the G4 AGP model.

That's a different issue you're mixing in here. One issue is mac99 emulating different machines with ppc and pcc64, this is solved as above. Another issue is that ppc mac99 is not a real mac, to get the hardware to match the device tree OpenBIOS tells the guest it is you have to use mac99,via=pmu which no user can guess. I want to rename this to simply powermac3_1 and get rid of the via option eventually and make these separate machines which is much more clear to the user. The implementation remains the same, but we're free to change that later once the naming is resolved. So I think we should decide on naming now and start deprecating old names (which are ppc64 mac99 and macc99 with via option so we only leave mac99 as before and all other variants will become -machine options). What part of this is not clear to you. I feel like despite trying to explain it for the third time we're still not on the same page.

The default was set to mac99,via=cuda since that was the original implementation and via=pmu broke booting some images (unfortunately I can't remember the detail right now). Ultimately my aim was to fix the remaining bugs and switch the mac99 default to via=pmu, but due to various changes in the past couple of years my available time to work on QEMU is considerably reduced.

What I see you are effectively asking for is a new machine which is currently equivalent to -M mac99,via=pmu that you wish to diverge towards a real G4 AGP machine, right?

ATB,

Mark.

#13 lore raw

Re: [PATCH v7 3/7] mac_{old,new}world: Pass MacOS VGA NDRV in card ROM instead of fw_cfg

In reply to BALATON Zoltan
Quoted 7 lines · BALATON Zoltan
Quoted 5 lines

The problem you are ultimately trying to solve though is that OpenBIOS is loading the NDRV for all VGA PCI devices, so why not just fix drivers/vga.fs so that the NDRV is loaded only for the QEMU VGA device?

Quoted 1 line

So this patch neither adds new dependency to QEMU nor repends on any change in OpenBIOS. It just gets rid of passing files via fw_cfg.

Unfortunately that still doesn't solve the problem of building a self-contained OpenBIOS ROM, so this patch isn't the right way forward.

It does take a step to make it possible to eventually add a self contained ROM and remove the vga.fs from OpenBIOS but it's not doing that fully. It just simplifies QEMU and OpenBIOS vga.fs for now and making the ROM also contain the FCode will be a further step but we can't get there if you don't allow to make smaller steps or don't merge my patches for OpenBIOS which would allow it to run FCode ROMs. If you're waiting for all this to be finished I'll give up and it will never be finished. If you allow to progress in smaller steps then maybe we'll get there.

You can already add a self-contained rom using the romfile= property, so that's not preventing you from doing anything though? Even once OpenBIOS can read PCI option ROMs, the option ROM will still need to contain OpenBIOS's vga.fs as a payload, and it will still need to be able to inject qemu_vga.ndrv because OpenBIOS cannot have an external dependency upon QemuMacDrivers.

ATB,

Mark.

#40 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

In reply to Mark Cave-Ayland
Quoted 212 lines · Mark Cave-Ayland
Quoted 4 lines · BALATON Zoltan
Quoted 3 lines · Mark Cave-Ayland
Quoted 2 lines · BALATON Zoltan
Quoted 1 line · Howard Spoelstra

On Wed, Jan 11, 2023 at 1:15 AM BALATON Zoltan <[email protected]>

Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines · Mark Cave-Ayland
Quoted 3 lines · BALATON Zoltan
Quoted 2 lines

Setting emulated machine type with a property called "via" is confusing users so deprecate the "via" option in favour of newly

added

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 7 lines

explicit machine types. The default via=cuda option is not a valid config (no real Mac has this combination of hardware) so no machine type could be defined for that therefore it is kept for backwards compatibility with older QEMU versions for now but other options resembling real machines are deprecated.

I believe that people do use -M mac99,via=cuda to run some rare

versions

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

of

Quoted 1 line

MacOS in QEMU (I think possibly OS X DP and Workgroup Server?), so

we

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

would

Quoted 1 line

want to keep this option somewhere.

The idea is that after previous patches we now have machine types

for all

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

other via option values (that also match real Mac machines) other

than

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

via=cude but that is the default for mac99 so after the reprecation

period

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

when the via option is removed mac99 (which is the same as

mac99,via=cuda)

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

can remain for this use case (and for backward compatibility) until

the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

other machines are fixed to not need this any more. So all via

options are

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

still available but as different machine types.

My 2 cents about naming:
It seems less important how the machines are named when their name is

not

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

covering their definition. F.i. the powermac3,1 never had adb, could

not be

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

equipped with a G3 cpu, did not run at 900Mhz. The closest possible qemu-options based definition of a powermac3,1 (via=pmu) will not run

Mac

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

OS 9.0.4 ;-) due to the 2 USB devices problem. To run that via=cuda is already needed.

What does that mean? Should we aim to emulate real Macs or are we

happy with the

Quoted 1 line
Quoted 1 line
Quoted 1 line

Franken-Mac we have now? The names also show what we intend to emulate

even though

Quoted 1 line
Quoted 1 line
Quoted 1 line

the emulation may not be complete or have bugs (this is also true for

other

Quoted 1 line
Quoted 1 line
Quoted 1 line

machines in QEMU where a lot of them are not fully emulated, only well

enough to

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

boot guest OSes).

Looks like everybody has forgotten the previous discussion and not

read the docs

Quoted 1 line
Quoted 1 line
Quoted 1 line

and deprecation patches where this is explained so I summarise the

proposed change

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

here again:

- qemu-system-ppc -M mac99 is unchanged and works like before it just

warns for

Quoted 1 line
Quoted 1 line
Quoted 1 line

the via option and when using it in qemu-system-ppc64 suggesting using

new

Quoted 1 line
Quoted 1 line
Quoted 1 line

machines instead so these could evetually be removed next year.

mac99,via=cuda is

Quoted 1 line
Quoted 1 line
Quoted 1 line

just mac99 so you can continue to use that, mac99 is not deprecated

and don't want

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

to remove it.

- qemu-system-ppc64 -M mac99 -> powermac7_3

- qemu-system-ppc -M mac99,via=pmu -> powermac3,1

- qemu-system-ppc64 -M mac99,via=pmu-adb -> powerbook3_2

FWIW this information would be useful in the cover letter once we decide the way
forward. Also as a reviewer, it is hard to keep track of all the changes if the
series are constantly changing and with no changelog on the cover letter, which is
why it takes me a while to review them.

Quoted 1 line
Quoted 1 line
Quoted 1 line

The last one is one of the rare Macs that had adb and pmu, all others

with pmu

Quoted 1 line
Quoted 1 line
Quoted 1 line

usually have USB. The PowerMac1,2 (G4 PCI) had CUDA but not with mac99

hardware

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

but more similar to g3beige and no ADB ports according to
https://en.wikipedia.org/wiki/Power_Mac_G4#1st_generation:_Graphite

https://en.wikipedia.org/wiki/Power_Macintosh_G3_(Blue_and_White)#Hardware

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

The PowerMac7,3 seems to be matching the PCI device listing in the

comment at the

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

beginning of mac_newworld.c and also this article:
https://www.informit.com/articles/article.aspx?p=606582

What is the 2 USB devices problem? Is it the one we've debugged before

and found

Quoted 1 line
Quoted 1 line
Quoted 1 line

that it's noted in a comment marked with ??? in hw/usb/hcd-ohci.c?

That could be

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

fixed if there was somebody interested enough to provide a patch.

But this series does not remove the mac99 and does not even deprecate

it. What it

Quoted 1 line
Quoted 1 line
Quoted 1 line

deprecates are the via option to select different machine types and

the automatic

Quoted 1 line
Quoted 1 line
Quoted 1 line

detection of ppc64 to emulate something different which are hard to

understand for

Quoted 1 line
Quoted 1 line
Quoted 1 line

users and caused several misunderstandings. It's much more clear to

have a

Quoted 1 line
Quoted 1 line
Quoted 1 line

separate machine type for each machine we emulate even when they

aren't yet

Quoted 1 line
Quoted 1 line
Quoted 1 line

complete but at least we know which way to go and can compare to real

hardware and

Quoted 1 line
Quoted 1 line
Quoted 1 line

fix the missing parts later. Also introducing powermac7_3 to split the

ppc64 mac99

Quoted 1 line
Quoted 1 line
Quoted 1 line

would allow to remove qemu-system-ppc if we wanted and only have one

executable

Quoted 1 line
Quoted 1 line
Quoted 1 line

for all machines but even without this it's clearer to have separate

machnies for

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

G5 and G4 macs than mac99 silently behaving differently.

Ultimately the issue you are trying to solve is this, which is that -M

mac99 is

Quoted 1 line
Quoted 1 line

different for qemu-system-ppc and qemu-system-ppc64. Perhaps the best

way to start

Quoted 1 line
Quoted 1 line

is to create a new "g5niagara" machine type (including OpenBIOS) and

make it a

Quoted 1 line
Quoted 1 line

clone of mac_newworld.c, and then issue a warning on qemu-system-ppc64

for -M mac99.

Quoted 2 lines

I don't get what you mean. Patch 4 introduces a new machine type called

powermac7_3

Quoted 1 line

(or g5niagara if you want) which is a clone of mac99 and then issues the

warning to

Quoted 1 line

deprecate qemu-system-ppc64 -M mac99 in patch 5. Did you actually test

these patches

Quoted 1 line

at all?

More specifically, what I'm suggesting as well as creating a new machine name is that
we clone mac_newworld.c into a separate file for the 64-bit Mac machine, declare it
as compiled for PPC64 only, and put the deprecation there. By creating a separate
file and separate machine type for OpenBIOS, it gives you the freedom to make changes
to mac99 to move it towards a G4 AGP without having to worry about affecting any
existing 64-bit users.

Quoted 1 line
Quoted 1 line

The reason for suggesting this is that the number of users of

qemu-system-ppc64 -M

Quoted 1 line
Quoted 1 line

mac99 will be much smaller than those using qemu-system-ppc, which

means there will

Quoted 4 lines
Quoted 1 line

be a lot less breakage for users. In

Except those who mean to use ppc mac99 but think that they should use qemu-system-ppc64 on 64 bit Windows which is probably the highest number

of users

Quoted 1 line

currently. I've cc'd you on the last instance of this but can dig up

some more from

Quoted 1 line

last year and look at the emaculation.com forum or ask Howard how many

times that

Quoted 1 line

happens. So after these patches users can still use qemu-system-ppc -M

mac99 as

Quoted 1 line

before without a warning but will get warned for qemu-system-ppc64 -M

mac99 to use

Quoted 1 line

powernac7_3 instead.

We're saying the same thing here, no?

Quoted 1 line
Quoted 1 line

the meantime we don't need to make a final decision re: machine names,

yet it still

Quoted 1 line
Quoted 1 line

gives you the freedom to work on -M mac99 for 32-bit Macs and move it

closer

Quoted 3 lines
Quoted 1 line

towards the G4 AGP model.

That's a different issue you're mixing in here. One issue is mac99

emulating

Quoted 1 line

different machines with ppc and pcc64, this is solved as above. Another

issue is that

Quoted 1 line

ppc mac99 is not a real mac, to get the hardware to match the device

tree OpenBIOS

Quoted 1 line

tells the guest it is you have to use mac99,via=pmu which no user can

guess. I want

Quoted 1 line

to rename this to simply powermac3_1 and get rid of the via option

eventually and

Quoted 1 line

make these separate machines which is much more clear to the user. The

implementation

Quoted 1 line

remains the same, but we're free to change that later once the naming is

resolved. So

Quoted 1 line

I think we should decide on naming now and start deprecating old names

(which are

Quoted 1 line

ppc64 mac99 and macc99 with via option so we only leave mac99 as before

and all other

Quoted 1 line

variants will become -machine options). What part of this is not clear

to you. I feel

Quoted 1 line

like despite trying to explain it for the third time we're still not on

the same page.

Quoted 11 lines

The default was set to mac99,via=cuda since that was the original implementation and
via=pmu broke booting some images (unfortunately I can't remember the detail right
now). Ultimately my aim was to fix the remaining bugs and switch the mac99 default to
via=pmu, but due to various changes in the past couple of years my available time to
work on QEMU is considerably reduced.

From a Mac OS guest perspective, via=cuda is needed for Mac OS 9.0.4 due to the 2 usb devices (mouse/kbd) issue. And for 10.0/10.1 (my guess would be that these suffer the same usb issue)
The real powermac3,1 AGP has no adb.

via=cuda supports Mac OS 9.0.4 up to OS X 10.4. via=pmu is strictly only needed for Mac OS X 10.5 guest (for which the speed reported was hacked to 900Mhz to fool the installer), but should support all Mac OS/OS X that are now supported.

via=pmu-adb seems only needed to trick mac os server installations that would later run on the g3beige.

To my knowledge 32 bit Linux guests all require via=pmu See here: https://wiki.qemu.org/Documentation/Platforms/PowerPC

Best,
Howard

Quoted 11 lines

What I see you are effectively asking for is a new machine which is currently
equivalent to -M mac99,via=pmu that you wish to diverge towards a real G4 AGP
machine, right?

ATB,

Mark.

#14 lore raw

Re: [PATCH v7 3/7] mac_{old,new}world: Pass MacOS VGA NDRV in card ROM instead of fw_cfg

In reply to Mark Cave-Ayland
Quoted 10 lines · Mark Cave-Ayland
Quoted 7 lines · BALATON Zoltan
Quoted 5 lines

The problem you are ultimately trying to solve though is that OpenBIOS is loading the NDRV for all VGA PCI devices, so why not just fix drivers/vga.fs so that the NDRV is loaded only for the QEMU VGA device?

Quoted 1 line

So this patch neither adds new dependency to QEMU nor repends on any change in OpenBIOS. It just gets rid of passing files via fw_cfg.

Unfortunately that still doesn't solve the problem of building a self-contained OpenBIOS ROM, so this patch isn't the right way forward.

It does take a step to make it possible to eventually add a self contained ROM and remove the vga.fs from OpenBIOS but it's not doing that fully. It just simplifies QEMU and OpenBIOS vga.fs for now and making the ROM also contain the FCode will be a further step but we can't get there if you don't allow to make smaller steps or don't merge my patches for OpenBIOS which would allow it to run FCode ROMs. If you're waiting for all this to be finished I'll give up and it will never be finished. If you allow to progress in smaller steps then maybe we'll get there.

You can already add a self-contained rom using the romfile= property, so that's not preventing you from doing anything though? Even once OpenBIOS can

Except that OpenBIOS will break the device tree by adding the qemu_vga.ndrv to the video card node so the card rom I pass via romfile will see it's already there and won't install its owm. Then MacOS will try to use the wrong driver and it does not work and I spend a lot of time to find out I also need -prom env vga-ndrv?=false to avoid this problem which I always forget and somebody trying this for the first time won't even know.

What's more, all this complication is not needed. With this patch everything works as before for std VGA as it will have the qemu_vga.ndrv as its romfile but ati-vga won't so OpenBIOS only installs it for std VGA without adding anything to OpenBIOS to handle this. Adding a romfile to ati-vga will work without further hassle and the romfile option can also be used to replace or disable the qemu_vga.ndrv for std VGA as -device VGA,romdile="" (or add your FCode in development here). Due to the way standard VGA works adding -device VGA,romfile= to the command line won't add a second VGA device just set the option for the default one (actually it omits the default and adds the specified one but the point is this just works).

Then we not only not need to add anythig to OpenBIOS but we can drop the vga-ndrv? option (which does not exist on real machines anyway) and also all the code in vga.fs to get the driver from fw_cfg so simplifying it leaving only the code which will eventually need to be part of the FCode ROM. Once this patch is accepted it fixes the above problem and allows to simplify OpenBIOS later and when we're there you just have to replace qemu_vga.ndrv with the version that prepends the FCode from vga.fs before it so I don't see what's your problem with this patch. Can you give a reason why it can't be accepted?

Quoted 1 line

read PCI option ROMs, the option ROM will still need to contain OpenBIOS's vga.fs as a payload, and it will still need to be able to inject qemu_vga.ndrv because OpenBIOS cannot have an external dependency upon QemuMacDrivers.

The way real card ROMs work is that they embed the driver binary and have some FCode that adds that to the device tree. It should be the same for QEMU emulated cards so if you say that you want only vga.fs as the card ROM which then downloads the qemu_vga.ndrv from QEMU that makes no sense at all. Currently the qemu_vga.ndrv is build from QemuMacDrivers and added as a binary to QEMU. You can add it as a binary the same way to OpenBIOS then build the FCOde ROM from vga.fs and qemu_vga.ndrv bin that results in the FCode ROM that will replace qemu_vga.ndrv binaty in QEMU. You just say this is not possible because you're OK with adding the qemu_vga,ndrv binary to QEMU but doing the same with OpenBIOS cannot be done?

Regards,
BALATON Zoltan

#24 lore raw

Re: [PATCH v7 4/7] mac_newworld: Add machine types for different mac99 configs

In reply to Mark Cave-Ayland
Quoted 11 lines · Mark Cave-Ayland
Quoted 10 lines · BALATON Zoltan
Quoted 9 lines · Mark Cave-Ayland
Quoted 8 lines · BALATON Zoltan
Quoted 2 lines · Mark Cave-Ayland

On 04/01/2023 21:59, BALATON Zoltan wrote:
Secondly it's not clear to me why you've chosen names like "powermac_3_1" instead of "g4agp"? Does powermac_3_1 uniquely identify the G4 AGP Sawtooth model? For QEMU it is always best to emulate real machines, and whilst I understand you want to separate out the two versions of the mac99 machine, having "powermac_X_Y" seems less clear to me.

These machine model identifiers are used by Apple to uniquely identify (all of) their machines since new-world Macs (even modern iPads and Macs have them) so for Mac people this should be clearer than the informal names that could get a bit long and confusing as there may be slight differences within a family. In any case, qemu-system-ppc -M mac99 is not corresponding to any real Mac so I'd like the options which do emulate real Macs to be called in a name that show which Mac is that. For the PPC Macs there's some info here for example:

https://en.wikipedia.org/wiki/Power_Mac_G4

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

And everymac.com also has info on all Macs. There were actually more than one G4 PowerMac with AGP but the other one was informally called gigabit ethernet. So the model ID is a shorter and better way to clearly identify which hardware is it (and it's also referenced in the device-tree of these Macs).

Are you planning to work on different types of G4 Mac where this could be confusing? Even to me "PowerMac 3.1" doesn't really tell me what model of Mac is being emulated, whereas "g4agp" (much in the same way as g3beige) is much more friendlier to people interested in using QEMU for Mac emulation.

This is similar problem as some people like to call Mac OS X versions by number and some by big cats names. Personally I prefer version numbers because it's easy to tell which is newer or older that way without remembering a nomenclature or having to look it up every time. It would be good if others interested in this also shared their preference because if it's only us two with different views then it's hard to make a decision. I still think machine ID is better also because then these machines would be grouped in the -machine help output like the others but as long as we don't have other machines that start with a g or other Macs that have some other name it might work so I could change the naming if that's all needed for this to get in.

I'd lean towards the g* naming, because not only is it more obvious to less technical Mac users what is being emulated, it matches the existing precedent set by g3beige.

The g3beige is not a good example as model ids were introduced with new world Macs and the beige G3 is one of the last old world ones which had a numeric ID so we can't give that a name by model ID. All later Macs though have a model ID which is a short and clear way to idenfify a model. Found a list here:

https://www.macupgrades.co.uk/store/mac_model_id/

and it even carries on for modern Macs:

https://support.apple.com/en-us/HT201634

and it's listed in System Profiler next to the model name:

https://support.apple.com/en-gb/HT201581

so it should be pretty obvious and familiar to Mac users. So I think anything else would be more confusing but I don't care that much as long as we can have a separate name for each machine we emulate. I'll take whatever names you come up with if that's what it takes for this patch to get merged. Please tell me what names you want and I'll change it if nobody else votes fot the names I've proposed.

Regards,
BALATON Zoltan

#55 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

In reply to Mark Cave-Ayland
Quoted 10 lines · Mark Cave-Ayland
Quoted 9 lines · BALATON Zoltan
Quoted 8 lines · Mark Cave-Ayland
Quoted 7 lines · BALATON Zoltan
Quoted 3 lines · Howard Spoelstra
Quoted 2 lines · BALATON Zoltan
Quoted 1 line · Mark Cave-Ayland

On 04/01/2023 21:59, BALATON Zoltan wrote:

- qemu-system-ppc -M mac99 is unchanged and works like before it just
warns for the via option and when using it in qemu-system-ppc64 suggesting using new machines instead so these could evetually be removed next year. mac99,via=cuda is just mac99 so you can continue to use that, mac99 is not deprecated and don't want to remove it.

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

- qemu-system-ppc64 -M mac99 -> powermac7_3

- qemu-system-ppc -M mac99,via=pmu -> powermac3,1

- qemu-system-ppc64 -M mac99,via=pmu-adb -> powerbook3_2

FWIW this information would be useful in the cover letter once we decide the way forward. Also as a reviewer, it is hard to keep track of all the changes if the series are constantly changing and with no changelog on the cover letter, which is why it takes me a while to review them.

As a maintainer you could help reducing the size of the series and patches under review by queuing the patches that are already reviewed then hopefully there are only a few left to discuss. One reason for changing the series was to omit patches you've dismissed right away and move the ones reviewed or those you were less resistant about to the front so you could easily merge them and reduce the size of the remaining series that I'll have to roll and respin later. So queueing those you're already OK with could help making this clearer.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

The last one is one of the rare Macs that had adb and pmu, all others with pmu usually have USB. The PowerMac1,2 (G4 PCI) had CUDA but not with mac99 hardware but more similar to g3beige and no ADB ports according to https://en.wikipedia.org/wiki/Power_Mac_G4#1st_generation:_Graphite
https://en.wikipedia.org/wiki/Power_Macintosh_G3_(Blue_and_White)#Hardware

The PowerMac7,3 seems to be matching the PCI device listing in the comment at the beginning of mac_newworld.c and also this article:
https://www.informit.com/articles/article.aspx?p=606582

What is the 2 USB devices problem? Is it the one we've debugged before and found that it's noted in a comment marked with ??? in hw/usb/hcd-ohci.c? That could be fixed if there was somebody interested enough to provide a patch.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

But this series does not remove the mac99 and does not even deprecate it. What it deprecates are the via option to select different machine types and the automatic detection of ppc64 to emulate something different which are hard to understand for users and caused several misunderstandings. It's much more clear to have a separate machine type for each machine we emulate even when they aren't yet complete but at least we know which way to go and can compare to real hardware and fix the missing parts later. Also introducing powermac7_3 to split the ppc64 mac99 would allow to remove qemu-system-ppc if we wanted and only have one executable for all machines but even without this it's clearer to have separate machnies for G5 and G4 macs than mac99 silently behaving differently.

Ultimately the issue you are trying to solve is this, which is that -M mac99 is different for qemu-system-ppc and qemu-system-ppc64. Perhaps the best way to start is to create a new "g5niagara" machine type (including OpenBIOS) and make it a clone of mac_newworld.c, and then issue a warning on qemu-system-ppc64 for -M mac99.

I don't get what you mean. Patch 4 introduces a new machine type called powermac7_3 (or g5niagara if you want) which is a clone of mac99 and then issues the warning to deprecate qemu-system-ppc64 -M mac99 in patch 5. Did you actually test these patches at all?

More specifically, what I'm suggesting as well as creating a new machine name is that we clone mac_newworld.c into a separate file for the 64-bit Mac machine, declare it as compiled for PPC64 only, and put the deprecation there. By creating a separate file and separate machine type for OpenBIOS, it gives you the freedom to make changes to mac99 to move it towards a G4 AGP without having to worry about affecting any existing 64-bit users.

This would create a lot of duplicated code and increase the nunber of machines to maintain so I don't think this is a good idea at this point. I also don't want to change any of these machines now. The mac99.via=pmu is sufficiently close to PowerMac3,1 already. All I want is to have separate machine names for the machines we emulate. This is to

1. resolve the confusion this causes to usesrs
2. allow deprecating old ways of specifying these so we can eventually get rid of those
3. and this will also allow later to split the implementation if we need to or add new machines from scratch that will fit in the new naming

So what you propose is not needed now and don't see why you think it would be needed just to resolve the names now.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

The reason for suggesting this is that the number of users of qemu-system-ppc64 -M mac99 will be much smaller than those using qemu-system-ppc, which means there will be a lot less breakage for users. In

Except those who mean to use ppc mac99 but think that they should use qemu-system-ppc64 on 64 bit Windows which is probably the highest number of users currently. I've cc'd you on the last instance of this but can dig up some more from last year and look at the emaculation.com forum or ask Howard how many times that happens. So after these patches users can still use qemu-system-ppc -M mac99 as before without a warning but will get warned for qemu-system-ppc64 -M mac99 to use powernac7_3 instead.

We're saying the same thing here, no?

I don't know. If we were saying the same why are you not happy with the patch? I probably don't get what your concern is. To me it looks like you just resist any change without a clear reason and try to come up with excuses why not to merge these patches. My point was that this patch should not break any command lines for anybody, it will just issue warnings for the via option and ppc64 mac99 telling users to use new -machine options instead. They can keep using ppc mac99 without a warning and it can be either kept as it is for backwards compatibility or deprecated later once the other machines are better. If your concern was that it might break something for somebody then it's not likely as this does not change the machines' implementation just adds explicit names for those which are currently only accessible by options and defaults.

Spliting the ppc and ppc64 mac99 as you say would increase the chance of it breaking in the future because you'll then need to make every change in two places and if you forget it's easier to break. So this patch leaves the implementation shared but adds separate names so they can be split as at a later point without addecting users but no need to do that change now. Just separating the name is enough and it has less chance to break anything.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

the meantime we don't need to make a final decision re: machine names, yet it still gives you the freedom to work on -M mac99 for 32-bit Macs and move it closer towards the G4 AGP model.

That's a different issue you're mixing in here. One issue is mac99 emulating different machines with ppc and pcc64, this is solved as above. Another issue is that ppc mac99 is not a real mac, to get the hardware to match the device tree OpenBIOS tells the guest it is you have to use mac99,via=pmu which no user can guess. I want to rename this to simply powermac3_1 and get rid of the via option eventually and make these separate machines which is much more clear to the user. The implementation remains the same, but we're free to change that later once the naming is resolved. So I think we should decide on naming now and start deprecating old names (which are ppc64 mac99 and macc99 with via option so we only leave mac99 as before and all other variants will become -machine options). What part of this is not clear to you. I feel like despite trying to explain it for the third time we're still not on the same page.

The default was set to mac99,via=cuda since that was the original implementation and via=pmu broke booting some images (unfortunately I can't remember the detail right now). Ultimately my aim was to fix the remaining bugs and switch the mac99 default to via=pmu, but due to various changes in the past couple of years my available time to work on QEMU is considerably reduced.

What I see you are effectively asking for is a new machine which is currently equivalent to -M mac99,via=pmu that you wish to diverge towards a real G4 AGP machine, right?

No I don't want it to diverge just to be available as a machine option instead of a cryptic option that nobody can find out without being told. If you now do qemu-system-ppc64 -machine help you'll see:

$ qemu-system-ppc64 -machine help
Supported machines are:
40p                  IBM RS/6000 7020 (40p)
bamboo               bamboo
g3beige              Heathrow based PowerMAC
mac99                Mac99 based PowerMAC
mpc8544ds            mpc8544ds
none                 empty machine
pegasos2             Genesi/bPlan Pegasos II
powernv10            IBM PowerNV (Non-Virtualized) POWER10
powernv8             IBM PowerNV (Non-Virtualized) POWER8
[...]

How do you know how to emulate a G5 Mac and a G4 Mac? You don't without reading docs (which nobody does) or asking (which nobody does either). Instead they try mac99 and find it does not work and abandon it. After this patch you'll get:

$ qemu-system-ppc64 -machine help
Supported machines are:
40p                  IBM RS/6000 7020 (40p)
bamboo               bamboo
g3beige              Heathrow based PowerMAC
mac99                Mac99 based PowerMAC
mpc8544ds            mpc8544ds
none                 empty machine
pegasos2             Genesi/bPlan Pegasos II
powerbook3_2         Apple PowerBook G4 Titanium (Mercury)
powermac3_1          Apple Power Mac G4 AGP (Sawtooth)
powermac7_3          Apple Power Mac G5 (Niagara)
powernv10            IBM PowerNV (Non-Virtualized) POWER10
powernv8             IBM PowerNV (Non-Virtualized) POWER8

and specifying the -machine option will give you the right machine right away. I really don't know what is so hard to get about this that I have to ecplain it all over again for 3 months now since I've first submitted these.

Regards,
BALATON Zoltan

#41 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

In reply to Howard Spoelstra
Quoted 4 lines · Howard Spoelstra

From a Mac OS guest perspective, via=cuda is needed for Mac OS 9.0.4 due to the 2 usb devices (mouse/kbd) issue. And for 10.0/10.1 (my guess would be that these suffer the same usb issue)
The real powermac3,1 AGP has no adb.

And do these OSes run on real PowerMac3,1? If so then we likely have a bug in USB emulation so maybe that could be fixed? In any case my patch does not change mac99 and this should continue to work.

Quoted 4 lines

via=cuda supports Mac OS 9.0.4 up to OS X 10.4. via=pmu is strictly only needed for Mac OS X 10.5 guest (for which the speed reported was hacked to 900Mhz to fool the installer), but should support all Mac OS/OS X that are now supported.

Since via=pmu is what should be a real machine does it run OS X >=10.2 already?

Quoted 5 lines

via=pmu-adb seems only needed to trick mac os server installations that would later run on the g3beige.

To my knowledge 32 bit Linux guests all require via=pmu See here: https://wiki.qemu.org/Documentation/Platforms/PowerPC

That doc might need some updating. It seems to be from before pegasos2 was added. Maybe we would be better off linking from this page to others that are more actively maintained such as: https://www.emaculation.com/doku.php/qemu and http://zero.eik.bme.hu/~balaton/qemu/amiga/

or even better updating the main docs in

https://www.qemu.org/docs/master/system/ppc/powermac.html

or somehow link these sources together.

Regards,
BALATON Zoltan

#42 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

Quoted 13 lines · BALATON Zoltan
Quoted 1 line · Howard Spoelstra

From a Mac OS guest perspective, via=cuda is needed for Mac OS 9.0.4 due

to

Quoted 3 lines

the 2 usb devices (mouse/kbd) issue. And for 10.0/10.1 (my guess would be that these suffer the same usb issue)
The real powermac3,1 AGP has no adb.

And do these OSes run on real PowerMac3,1? If so then we likely have a bug in USB emulation so maybe that could be fixed? In any case my patch does not change mac99 and this should continue to work.

Quoted 2 lines

via=cuda supports Mac OS 9.0.4 up to OS X 10.4. via=pmu is strictly only needed for Mac OS X 10.5 guest (for which the speed reported was hacked

Quoted 8 lines

to

Quoted 1 line

900Mhz to fool the installer), but should support all Mac OS/OS X that

are

Quoted 1 line

now supported.

Since via=pmu is what should be a real machine does it run OS X >=10.2 already?

A real powermac3,1 (G4 400Mhz/AGP) runs 8.6 up to10.4.11

qemu-system-ppc status:
8.6 will not boot from CD or HD.
9.0.4* with via=pmu only supports mouse, not kbd. Needs via=cuda due to 2 usb device problem
9.1 and 9.2 with via=pmu
10.0 and 10.1 with via=pmu: no mouse and kdb. Needs via=cuda. (so also with an usb problem)
10.2 with via=pmu (but has serious graphics speed problem, also with via=cuda)
10.3 and 10.4 with via=pmu
10.5 only with via=pmu (but needs the 900Mhz speed hack).

*9.0.4 will only run with Mac OS Rom version 5.2.1 and above.

It seems via=pmu provides usb mouse first, usb kbd second. With Mac OS 9.0.4 the second device will not work. With 10.0 / 10.1 both usb mouse and kbd do not work.

Real hardware provides two USB buses: USB 0 and USB 1. In Qemu by default I only see one bus: USB 0 into which both mouse and kdb are plugged. On the real G4 the mouse and kbd are each plugged into another bus, so I see the kbd on e.g. USB 0 and the mouse on e.g. USB 1.

With -M mac99,via=cuda one USB bus is always created. It has id "usb-bus" We can add a second USB bus with e.g. -device pci-ohci,id=usb1 (this is the Apple USB controller).

Then add mouse and kbd to different buses with:
-device usb-mouse,bus=usb-bus.0 (attaches to first and default bus)
-device usb-kbd,bus=usb1.0 (attaches to second bus).

This then mimics what I see on real hardware. Should qemu-system-ppc by default provide the same?

Quoted 6 lines
Quoted 5 lines

via=pmu-adb seems only needed to trick mac os server installations that would later run on the g3beige.

To my knowledge 32 bit Linux guests all require via=pmu See here: https://wiki.qemu.org/Documentation/Platforms/PowerPC

Quoted 8 lines

That doc might need some updating. It seems to be from before pegasos2 was added. Maybe we would be better off linking from this page to others that are more actively maintained such as:
https://www.emaculation.com/doku.php/qemu
and
http://zero.eik.bme.hu/~balaton/qemu/amiga/

I "maintain" that page with only general information. I can link to the specific sites you mention.

Quoted 5 lines

or even better updating the main docs in

https://www.qemu.org/docs/master/system/ppc/powermac.html

That would have to be taken up by someone else.

Best,
Howard

#43 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

Quoted 37 lines · Howard Spoelstra
Quoted 13 lines · BALATON Zoltan
Quoted 1 line · Howard Spoelstra

From a Mac OS guest perspective, via=cuda is needed for Mac OS 9.0.4 due

to

Quoted 3 lines

the 2 usb devices (mouse/kbd) issue. And for 10.0/10.1 (my guess would be that these suffer the same usb issue)
The real powermac3,1 AGP has no adb.

And do these OSes run on real PowerMac3,1? If so then we likely have a bug in USB emulation so maybe that could be fixed? In any case my patch does not change mac99 and this should continue to work.

Quoted 2 lines

via=cuda supports Mac OS 9.0.4 up to OS X 10.4. via=pmu is strictly only needed for Mac OS X 10.5 guest (for which the speed reported was hacked

Quoted 8 lines

to

Quoted 1 line

900Mhz to fool the installer), but should support all Mac OS/OS X that

are

Quoted 1 line

now supported.

Since via=pmu is what should be a real machine does it run OS X >=10.2 already?

A real powermac3,1 (G4 400Mhz/AGP) runs 8.6 up to10.4.11

qemu-system-ppc status:
8.6 will not boot from CD or HD.
9.0.4* with via=pmu only supports mouse, not kbd. Needs via=cuda due to 2 usb device problem
9.1 and 9.2 with via=pmu
10.0 and 10.1 with via=pmu: no mouse and kdb. Needs via=cuda. (so also with an usb problem)
10.2 with via=pmu (but has serious graphics speed problem, also with via=cuda)
10.3 and 10.4 with via=pmu
10.5 only with via=pmu (but needs the 900Mhz speed hack).

Quoted 1 line

*9.0.4 will only run with Mac OS Rom version 5.2.1 and above.

I thought MacOS 8 needed old world ROM but looks like it can also load it from disk on new world machines. Then what version of the ROM it has? It seems there was some change at ROM 5.2.1 then which solves the problem with usb and older versions may have done something differently and expect it to work unlike it's emulated now.

So it seems versions before 10.2 have a problem (except 9,1 and 9.2 which may have a newer usb driver maybe? also 9.0.4 with ROM 5.2.1 and I assume later 9.x versions have at least this or newer Toolbox ROM) I think it's esasier to debug with OS X because it's easier to get logs and the drivers may also be open source so easier to check what's happening so let's just forget about MacOS9 for now and try to find out what changed between 10.1 and 10.2 in usb handling.

Quoted 3 lines

It seems via=pmu provides usb mouse first, usb kbd second. With Mac OS 9.0.4 the second device will not work. With 10.0 / 10.1 both usb mouse and kbd do not work.

These are added here:

https://gitlab.com/qemu-project/qemu/-/blob/master/hw/ppc/mac_newworld.c#L435

you could change the order but it does not matter if both needs to work. If it makes the first one work then maybe the older USB drivers only handle one port per bus? But then the problem in OS X may be different.

Quoted 13 lines

Real hardware provides two USB buses: USB 0 and USB 1. In Qemu by default I only see one bus: USB 0 into which both mouse and kdb are plugged. On the real G4 the mouse and kbd are each plugged into another bus, so I see the kbd on e.g. USB 0 and the mouse on e.g. USB 1.

With -M mac99,via=cuda one USB bus is always created. It has id "usb-bus" We can add a second USB bus with e.g. -device pci-ohci,id=usb1 (this is the Apple USB controller).

Then add mouse and kbd to different buses with:

(quoted diff) +0 -2
-device usb-mouse,bus=usb-bus.0    (attaches to first and default bus)
-device usb-kbd,bus=usb1.0 (attaches to second bus).
Quoted 2 lines

This then mimics what I see on real hardware. Should qemu-system-ppc by default provide the same?

Does this solve the problem you have? (You talk about via=cude above but I think it should be via=pmu. Is that a typo?) If this helps mac_newworld.c could add another usb bus or do somerthing different to match real hardware but you have to convince Mark about that first... Also Mac keyboards have a hub where the mouse is usially connected. Does modeling that setup with QEMU help?

Other idea you could try is to boot 10.1 and 10.2 and compare the ioteg outputs for the USB devices to see if there are some differences or get the USB driver versions and try to find out what changed in them.

Quoted 5 lines
Quoted 4 lines

or even better updating the main docs in

https://www.qemu.org/docs/master/system/ppc/powermac.html

That would have to be taken up by someone else.

That page is generated from this file in QEMU source:

https://gitlab.com/qemu-project/qemu/-/blob/master/docs/system/ppc/powermac.rst

you can submit a patch to that like I did:

https://lists.nongnu.org/archive/html/qemu-ppc/2023-01/msg00006.html

Regards,
BALATON Zoltan

#44 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

Quoted 46 lines · BALATON Zoltan
Quoted 1 line · Howard Spoelstra

On Tue, Jan 24, 2023 at 2:49 AM BALATON Zoltan <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines · Howard Spoelstra
Quoted 1 line

From a Mac OS guest perspective, via=cuda is needed for Mac OS 9.0.4

due

Quoted 2 lines
Quoted 2 lines

to

Quoted 1 line

the 2 usb devices (mouse/kbd) issue. And for 10.0/10.1 (my guess would

be

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

that these suffer the same usb issue)
The real powermac3,1 AGP has no adb.

And do these OSes run on real PowerMac3,1? If so then we likely have a

bug

Quoted 4 lines
Quoted 4 lines

in USB emulation so maybe that could be fixed? In any case my patch does not change mac99 and this should continue to work.

Quoted 1 line

via=cuda supports Mac OS 9.0.4 up to OS X 10.4. via=pmu is strictly

only

Quoted 10 lines
Quoted 9 lines
Quoted 1 line

needed for Mac OS X 10.5 guest (for which the speed reported was hacked

to

Quoted 1 line

900Mhz to fool the installer), but should support all Mac OS/OS X that

are

Quoted 1 line

now supported.

Since via=pmu is what should be a real machine does it run OS X >=10.2 already?

Quoted 8 lines

A real powermac3,1 (G4 400Mhz/AGP) runs 8.6 up to10.4.11

qemu-system-ppc status:
8.6 will not boot from CD or HD.
9.0.4* with via=pmu only supports mouse, not kbd. Needs via=cuda due to 2 usb device problem
9.1 and 9.2 with via=pmu
10.0 and 10.1 with via=pmu: no mouse and kdb. Needs via=cuda. (so also

with

Quoted 7 lines

an usb problem)
10.2 with via=pmu (but has serious graphics speed problem, also with via=cuda)
10.3 and 10.4 with via=pmu
10.5 only with via=pmu (but needs the 900Mhz speed hack).

*9.0.4 will only run with Mac OS Rom version 5.2.1 and above.

Quoted 7 lines

I thought MacOS 8 needed old world ROM but looks like it can also load it from disk on new world machines. Then what version of the ROM it has? It seems there was some change at ROM 5.2.1 then which solves the problem with usb and older versions may have done something differently and expect it to work unlike it's emulated now.

The rom on the 8.6 Cd is version ....

The disk utility on the CD cannot initialise a hard disk (something we had with some 9.0.4 versions too)

Quoted 31 lines

So it seems versions before 10.2 have a problem (except 9,1 and 9.2 which may have a newer usb driver maybe? also 9.0.4 with ROM 5.2.1 and I assume later 9.x versions have at least this or newer Toolbox ROM) I think it's esasier to debug with OS X because it's easier to get logs and the drivers may also be open source so easier to check what's happening so let's just forget about MacOS9 for now and try to find out what changed between 10.1 and 10.2 in usb handling.

Quoted 3 lines

It seems via=pmu provides usb mouse first, usb kbd second. With Mac OS 9.0.4 the second device will not work. With 10.0 / 10.1 both usb mouse and kbd do not work.

These are added here:

https://gitlab.com/qemu-project/qemu/-/blob/master/hw/ppc/mac_newworld.c#L435

you could change the order but it does not matter if both needs to work. If it makes the first one work then maybe the older USB drivers only handle one port per bus? But then the problem in OS X may be different.

Quoted 1 line

Real hardware provides two USB buses: USB 0 and USB 1. In Qemu by

default I

Quoted 8 lines

only see one bus: USB 0 into which both mouse and kdb are plugged. On the real G4 the mouse and kbd are each plugged into another bus, so I see the kbd on e.g. USB 0 and the mouse on e.g. USB 1.

With -M mac99,via=cuda one USB bus is always created. It has id "usb-bus" We can add a second USB bus with e.g. -device pci-ohci,id=usb1 (this is the Apple USB controller).

Quoted 8 lines
Quoted 6 lines

Then add mouse and kbd to different buses with:

(quoted diff) +0 -2
-device usb-mouse,bus=usb-bus.0    (attaches to first and default bus)
-device usb-kbd,bus=usb1.0 (attaches to second bus).

This then mimics what I see on real hardware. Should qemu-system-ppc by default provide the same?

Does this solve the problem you have?

No.

Quoted 2 lines

(You talk about via=cude above but I
think it should be via=pmu. Is that a typo?)

No, even with via-cuda the first usb bus is created:
dev: pci-ohci, id ""

        masterbus = ""
        num-ports = 3 (0x3)
        firstport = 0 (0x0)
        addr = 0d.0
        romfile = ""
        romsize = 4294967295 (0xffffffff)
        rombar = 1 (0x1)
        multifunction = false
        x-pcie-lnksta-dllla = true
        x-pcie-extcap-init = true
        failover_pair_id = ""
        acpi-index = 0 (0x0)
        class USB controller, addr 00:0d.0, pci id 106b:003f (sub 1af4:1100)
        bar 0: mem at 0x80080000 [0x800800ff]
        bus: usb-bus.0
          type usb-bus

I now think in some cases the mouse falls back to adb when usb does not work. Hence the wiggling/clicking that is needed to get 9.0.4 to get to the desktop.
Can we disable usb-bus creation for via=cuda?

If this helps mac_newworld.c

Quoted 5 lines

could add another usb bus or do somerthing different to match real hardware but you have to convince Mark about that first... Also Mac keyboards have a hub where the mouse is usially connected. Does modeling that setup with QEMU help?

Quoted 8 lines

No, same issues with that.

Other idea you could try is to boot 10.1 and 10.2 and compare the ioreg outputs for the USB devices to see if there are some differences or get the USB driver versions and try to find out what changed in them.

I attempted to take a look, but without mouse/kbd it is difficult to get to ioreg ;-)

Quoted 18 lines
Quoted 5 lines
Quoted 4 lines

or even better updating the main docs in

https://www.qemu.org/docs/master/system/ppc/powermac.html

That would have to be taken up by someone else.

That page is generated from this file in QEMU source:

https://gitlab.com/qemu-project/qemu/-/blob/master/docs/system/ppc/powermac.rst

you can submit a patch to that like I did:

https://lists.nongnu.org/archive/html/qemu-ppc/2023-01/msg00006.html

Regards,
BALATON Zoltan

#45 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

Quoted 10 lines · Howard Spoelstra
Quoted 7 lines · BALATON Zoltan

I thought MacOS 8 needed old world ROM but looks like it can also load it from disk on new world machines. Then what version of the ROM it has? It seems there was some change at ROM 5.2.1 then which solves the problem with usb and older versions may have done something differently and expect it to work unlike it's emulated now.

The rom on the 8.6 Cd is version ....

The disk utility on the CD cannot initialise a hard disk (something we had with some 9.0.4 versions too)

This sentence seems to be unfinished, also the disk utility problem is maybe unrelated so just ignore that for now and focus on usb first.

Quoted 35 lines
Quoted 35 lines

So it seems versions before 10.2 have a problem (except 9,1 and 9.2 which may have a newer usb driver maybe? also 9.0.4 with ROM 5.2.1 and I assume later 9.x versions have at least this or newer Toolbox ROM) I think it's esasier to debug with OS X because it's easier to get logs and the drivers may also be open source so easier to check what's happening so let's just forget about MacOS9 for now and try to find out what changed between 10.1 and 10.2 in usb handling.

Quoted 3 lines

It seems via=pmu provides usb mouse first, usb kbd second. With Mac OS 9.0.4 the second device will not work. With 10.0 / 10.1 both usb mouse and kbd do not work.

These are added here:

https://gitlab.com/qemu-project/qemu/-/blob/master/hw/ppc/mac_newworld.c#L435

you could change the order but it does not matter if both needs to work. If it makes the first one work then maybe the older USB drivers only handle one port per bus? But then the problem in OS X may be different.

Quoted 1 line

Real hardware provides two USB buses: USB 0 and USB 1. In Qemu by

default I

Quoted 12 lines

only see one bus: USB 0 into which both mouse and kdb are plugged. On the real G4 the mouse and kbd are each plugged into another bus, so I see the kbd on e.g. USB 0 and the mouse on e.g. USB 1.

With -M mac99,via=cuda one USB bus is always created. It has id "usb-bus" We can add a second USB bus with e.g. -device pci-ohci,id=usb1 (this is the Apple USB controller).

Then add mouse and kbd to different buses with:

(quoted diff) +0 -2
-device usb-mouse,bus=usb-bus.0    (attaches to first and default bus)
-device usb-kbd,bus=usb1.0 (attaches to second bus).
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

This then mimics what I see on real hardware. Should qemu-system-ppc by default provide the same?

Does this solve the problem you have?

No.

OK so then we should not do that by default either unless we find it's needed for some reason.

Quoted 23 lines
Quoted 2 lines

(You talk about via=cude above but I
think it should be via=pmu. Is that a typo?)

No, even with via-cuda the first usb bus is created:
dev: pci-ohci, id ""

       masterbus = ""
       num-ports = 3 (0x3)
       firstport = 0 (0x0)
       addr = 0d.0
       romfile = ""
       romsize = 4294967295 (0xffffffff)
       rombar = 1 (0x1)
       multifunction = false
       x-pcie-lnksta-dllla = true
       x-pcie-extcap-init = true
       failover_pair_id = ""
       acpi-index = 0 (0x0)
       class USB controller, addr 00:0d.0, pci id 106b:003f (sub 1af4:1100)
       bar 0: mem at 0x80080000 [0x800800ff]
       bus: usb-bus.0
         type usb-bus
Quoted 4 lines

I now think in some cases the mouse falls back to adb when usb does not work. Hence the wiggling/clicking that is needed to get 9.0.4 to get to the desktop.
Can we disable usb-bus creation for via=cuda?

Yes, try:

qemu-system-ppc -M mac99,usb=no

(I had to look at the code to find that out).

Quoted 7 lines

If this helps mac_newworld.c

Quoted 6 lines

could add another usb bus or do somerthing different to match real hardware but you have to convince Mark about that first... Also Mac keyboards have a hub where the mouse is usially connected. Does modeling that setup with QEMU help?

No, same issues with that.

Then it's probably not about how these ports are arranged but something about modeiling the hardware maybe (i.e. QEMU does something differently than real hardware and this confuses the driver).

Quoted 7 lines
Quoted 5 lines

Other idea you could try is to boot 10.1 and 10.2 and compare the ioreg outputs for the USB devices to see if there are some differences or get the USB driver versions and try to find out what changed in them.

I attempted to take a look, but without mouse/kbd it is difficult to get to ioreg ;-)

You can set up tap or vmnet network, boot it with cuda, enable ssh then you can access it from there after booting usb config. (It may even work with user network somehow, I think there's an option to forward a port from the guest to host then you could access ssh that way without having to set up bridged networking but you'll need to find that option as I don't remember what it was but I think I've seen it somewhere. Maybe in qemu-system-ppc -help or some docs on QEMU networking somewhere.)

Regards,
BALATON Zoltan

#56 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

In reply to Howard Spoelstra
Quoted 4 lines · Howard Spoelstra

My 2 cents about naming:
It seems less important how the machines are named when their name is not covering their definition. F.i. the powermac3,1 never had adb, could not be equipped with a G3 cpu, did not run at 900Mhz.

True it never had ADB and makes not much sense to run it with a G3 (although you probably could, just nobody wanted to; but the other way around, i.e. according to https://en.wikipedia.org/wiki/Power_Mac_G4 the first PCI only G4 PowerMac1,2 had a motherboard from a G3 Mac just with a G4 CPU). But the G4 AGP could have a 900 MHz or faster CPU via a CPU upgrade:

https://lowendmac.com/newsrev/07/0330.html#b
https://lowendmac.com/newsrev/mnr07/1029.html
https://lowendmac.com/ppc/power-mac-g4-upgrade-guide.html

These links are from this page:

https://lowendmac.com/1999/power-mac-g4-sawtooth/

also may be of interest:

https://lowendmac.com/1998/beige-power-mac-g3-1998/
https://lowendmac.com/1997/beige-power-mac-g3-1997/

Regards,
BALATON Zoltan

#57 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

In reply to BALATON Zoltan
Quoted 22 lines · BALATON Zoltan

Setting emulated machine type with a property called "via" is confusing users so deprecate the "via" option in favour of newly added explicit machine types. The default via=cuda option is not a valid config (no real Mac has this combination of hardware) so no machine type could be defined for that therefore it is kept for backwards compatibility with older QEMU versions for now but other options resembling real machines are deprecated.

---
hw/ppc/mac_newworld.c | 9 +++++++++

1 file changed, 9 insertions(+)
hw/ppc/mac_newworld.c +0 -0
index f07c37328b..adf185bd3a 100644

hw/ppc/mac_newworld.c static void ppc_core99_init(MachineState *machine) · line 175

Quoted 7 lines
hw/ppc/mac_newworld.c +4 -0
@@ -169,6 +169,15 @@ static void ppc_core99_init(MachineState *machine)
        if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) {
            warn_report("mac99 with G5 CPU is deprecated, "
                        "use powermac7_3 instead");
+        } else {
+            if (core99_machine->via_config == CORE99_VIA_CONFIG_PMU) {
+                warn_report("mac99,via=pmu is deprecated, "
+                            "use powermac3_1 instead");

so use ‘-m mac99,via=powermac3_1’ or ‘-m powermac3_1’ or ‘-m mac99,powerpmac3_1’

I have no clue which one I’m supposed to use. It would be better to tell the user which of these three possibilities they should really use. From the other patches in the series, I’m guessing it’s the middle one, but even after looking at the code, I’m unsure.

hw/ppc/mac_newworld.c static void ppc_core99_init(MachineState *machine) · line 179

Quoted 4 lines
hw/ppc/mac_newworld.c +4 -0
+            }
+            if (core99_machine->via_config == CORE99_VIA_CONFIG_PMU_ADB) {
+                warn_report("mac99,via=pmu-adb is deprecated, "
+                            "use powerbook3_2 instead");

Same basic comment here.

I’m thinking adding '-m’ or ‘machine type’ before powerbook… in both of these would resolve it..

Warner

Quoted 8 lines
hw/ppc/mac_newworld.c +1 -1
+            }
        }
    }
    /* allocate RAM */
--

2.30.6

#46 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

In reply to BALATON Zoltan
Quoted 122 lines · BALATON Zoltan
Quoted 1 line · Howard Spoelstra

On Tue, Jan 24, 2023 at 3:15 PM BALATON Zoltan <[email protected]>

Quoted 1 line · wrote:
Quoted 1 line

I thought MacOS 8 needed old world ROM but looks like it can also load

it

Quoted 2 lines
Quoted 2 lines

from disk on new world machines. Then what version of the ROM it has? It seems there was some change at ROM 5.2.1 then which solves the

problem

Quoted 5 lines
Quoted 4 lines

with usb and older versions may have done something differently and expect it to work unlike it's emulated now.

The rom on the 8.6 Cd is version ....

The disk utility on the CD cannot initialise a hard disk (something we

had

Quoted 1 line

with some 9.0.4 versions too)

This sentence seems to be unfinished, also the disk utility problem is maybe unrelated so just ignore that for now and focus on usb first.

Quoted 1 line
Quoted 1 line

So it seems versions before 10.2 have a problem (except 9,1 and 9.2

which

Quoted 1 line
Quoted 1 line

may have a newer usb driver maybe? also 9.0.4 with ROM 5.2.1 and I

assume

Quoted 2 lines
Quoted 2 lines

later 9.x versions have at least this or newer Toolbox ROM) I think it's esasier to debug with OS X because it's easier to get logs and the

drivers

Quoted 1 line
Quoted 1 line

may also be open source so easier to check what's happening so let's

just

Quoted 1 line
Quoted 1 line

forget about MacOS9 for now and try to find out what changed between

10.1

Quoted 10 lines
Quoted 10 lines

and 10.2 in usb handling.

Quoted 3 lines

It seems via=pmu provides usb mouse first, usb kbd second. With Mac OS 9.0.4 the second device will not work. With 10.0 / 10.1 both usb mouse and kbd do not work.

These are added here:

https://gitlab.com/qemu-project/qemu/-/blob/master/hw/ppc/mac_newworld.c#L435

Quoted 9 lines
Quoted 9 lines

you could change the order but it does not matter if both needs to work. If it makes the first one work then maybe the older USB drivers only handle one port per bus? But then the problem in OS X may be different.

Quoted 1 line

Real hardware provides two USB buses: USB 0 and USB 1. In Qemu by

default I

Quoted 2 lines

only see one bus: USB 0 into which both mouse and kdb are plugged. On the real G4 the mouse and kbd are each plugged into another bus, so

I

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

see the kbd on e.g. USB 0 and the mouse on e.g. USB 1.

With -M mac99,via=cuda one USB bus is always created. It has id

"usb-bus"

Quoted 1 line
Quoted 1 line
Quoted 1 line

We can add a second USB bus with e.g. -device pci-ohci,id=usb1 (this

is

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

the Apple USB controller).

Then add mouse and kbd to different buses with:

(quoted diff) +0 -2
-device usb-mouse,bus=usb-bus.0    (attaches to first and default bus)
-device usb-kbd,bus=usb1.0 (attaches to second bus).
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

This then mimics what I see on real hardware. Should qemu-system-ppc by default provide the same?

Does this solve the problem you have?

No.

OK so then we should not do that by default either unless we find it's needed for some reason.

Quoted 6 lines
Quoted 2 lines

(You talk about via=cude above but I
think it should be via=pmu. Is that a typo?)

No, even with via-cuda the first usb bus is created:
dev: pci-ohci, id ""

Quoted 13 lines
       masterbus = ""
       num-ports = 3 (0x3)
       firstport = 0 (0x0)
       addr = 0d.0
       romfile = ""
       romsize = 4294967295 (0xffffffff)
       rombar = 1 (0x1)
       multifunction = false
       x-pcie-lnksta-dllla = true
       x-pcie-extcap-init = true
       failover_pair_id = ""
       acpi-index = 0 (0x0)
       class USB controller, addr 00:0d.0, pci id 106b:003f (sub

1af4:1100)

Quoted 6 lines
       bar 0: mem at 0x80080000 [0x800800ff]
       bus: usb-bus.0
         type usb-bus

I now think in some cases the mouse falls back to adb when usb does not work. Hence the wiggling/clicking that is needed to get 9.0.4 to get to

the

Quoted 2 lines

desktop.
Can we disable usb-bus creation for via=cuda?

Yes, try:

qemu-system-ppc -M mac99,usb=no

(I had to look at the code to find that out).

Quoted 7 lines

If this helps mac_newworld.c

Quoted 6 lines

could add another usb bus or do somerthing different to match real hardware but you have to convince Mark about that first... Also Mac keyboards have a hub where the mouse is usially connected. Does modeling that setup with QEMU help?

No, same issues with that.

Then it's probably not about how these ports are arranged but something about modeiling the hardware maybe (i.e. QEMU does something differently than real hardware and this confuses the driver).

Quoted 9 lines
Quoted 6 lines
Quoted 5 lines

Other idea you could try is to boot 10.1 and 10.2 and compare the ioreg outputs for the USB devices to see if there are some differences or get the USB driver versions and try to find out what changed in them.

I attempted to take a look, but without mouse/kbd it is difficult to get

to

Quoted 1 line

ioreg ;-)

I tested all Mac OS/OSX available to me with mouse and kbd alternately connected to usb-bus1 or usb-bus2.

./qemu-system-ppc \
-M mac99,usb=off \
-L pc-bios \
-boot c \
-prom-env "auto-boot?=true" \
-display gtk -monitor stdio \
-drive file=/home/hsp/Mac-disks/9.0.4.img,format=raw,media=disk \
-device pci-ohci,id=usb-bus1 \
-device pci-ohci,id=usb-bus2 \
-device usb-mouse,bus=usb-bus1.0,pcap=9.0.4_p1_mouse-2usb.pcap \
-device usb-kbd,bus=usb-bus2.0,pcap=9.0.4_p2_kbd-2usb.pcap \
-device sungem,netdev=network01 -netdev user,id=network01 \
-trace "usb_ohci*"

These are the results:

Mac OS:
#9.0.4 bus1 kbd: works up to usb_ohci_port_reset port #0 in trace, pcap shows normal operation and recognition as HID device .
#9.0.4 bus2 mouse. Reverts to adb mouse. No recognition as HID device. #9.0.4 bus1 mouse: usb_ohci_port_reset port #0 (twice). No further traffic in trace. Reverts to adb mouse. No recognition as HID device. #9.0.4 bus2 kbd then no longer works (due to reset?)

I attempted to replace the 9.0.4 disk based USB drivers with the drivers from 9.1, which did not work.

#9.1/9.2: mouse and kbd work on both buses. Profiler shows 2 buses with one device each.

Mac OS X
#10.0 bus1 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to adb mouse. No recognition as HID device.
#10.0 bus2 kbd: usb_ohci_stop pci-ohci: USB Suspended. Up to that point kbd pcap shows normal interrupt operation and recognition as HID device #10.0 bus1 kbd: usb_ohci_stop pci-ohci: USB Suspended. Up to that point kbd pcap shows normal interrupt operation and recognition as HID device #10.0 bus2 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to adb mouse. pcap shows no recognition as HID device.
#10.0 in both cases apple system profiler shows 2 usb buses but no devices.

#10.1 bus1 mouse: pcap shows normal interrupt operation and recognition as HID device, trace shows continuous traffic
#10.1 bus2 kbd: works. pcap shows normal interrupt operation and recognition as HID device, trace shows continuous traffic #10.1 bus1 kbd: works. pcap shows normal interrupt operation and recognition as HID device, trace shows continuous traffic #10.1 bus2 mouse: pcap shows normal interrupt operation and recognition as HID device, trace shows continuous traffic
#10.1 Mouse does not move on desktop, but trace shows packets flow.

#10.2/10.3/10.4/10.5 mouse and kbd work on both buses. Profiler shows 2 buses with one device each.

10.0 and 9.0.4 seem to suffer the same issue (mouse not communicating as a HID device, but 10.1 seems to have another issue.

Attempts to run Mac OS X ioreg show that it fails in that it cannot read the full registry.
This was already noticed here:
https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg05260.html

-Ioreg from a real G4 running 10.4 and output from the PCI DDK name registry tool from a real G4 running 9.0.4 and from Qemu running 9.0.4, 9.1 and 9.2 are available here:
https://surfdrive.surf.nl/files/index.php/s/1wcC3GGaagqKVpj/download

Best,
Howard

#47 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

Quoted 55 lines · Howard Spoelstra

I tested all Mac OS/OSX available to me with mouse and kbd alternately connected to usb-bus1 or usb-bus2.

./qemu-system-ppc \

(quoted diff) +0 -12
-M mac99,usb=off \
-L pc-bios \
-boot c \
-prom-env "auto-boot?=true" \
-display gtk -monitor stdio \
-drive file=/home/hsp/Mac-disks/9.0.4.img,format=raw,media=disk \
-device pci-ohci,id=usb-bus1 \
-device pci-ohci,id=usb-bus2 \
-device usb-mouse,bus=usb-bus1.0,pcap=9.0.4_p1_mouse-2usb.pcap \
-device usb-kbd,bus=usb-bus2.0,pcap=9.0.4_p2_kbd-2usb.pcap \
-device sungem,netdev=network01 -netdev user,id=network01 \
-trace "usb_ohci*"

These are the results:

Mac OS:
#9.0.4 bus1 kbd: works up to usb_ohci_port_reset port #0 in trace, pcap shows normal operation and recognition as HID device .
#9.0.4 bus2 mouse. Reverts to adb mouse. No recognition as HID device. #9.0.4 bus1 mouse: usb_ohci_port_reset port #0 (twice). No further traffic in trace. Reverts to adb mouse. No recognition as HID device. #9.0.4 bus2 kbd then no longer works (due to reset?)

I attempted to replace the 9.0.4 disk based USB drivers with the drivers from 9.1, which did not work.

#9.1/9.2: mouse and kbd work on both buses. Profiler shows 2 buses with one device each.

Mac OS X
#10.0 bus1 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to adb mouse. No recognition as HID device.
#10.0 bus2 kbd: usb_ohci_stop pci-ohci: USB Suspended. Up to that point kbd pcap shows normal interrupt operation and recognition as HID device #10.0 bus1 kbd: usb_ohci_stop pci-ohci: USB Suspended. Up to that point kbd pcap shows normal interrupt operation and recognition as HID device #10.0 bus2 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to adb mouse. pcap shows no recognition as HID device.
#10.0 in both cases apple system profiler shows 2 usb buses but no devices.

#10.1 bus1 mouse: pcap shows normal interrupt operation and recognition as HID device, trace shows continuous traffic
#10.1 bus2 kbd: works. pcap shows normal interrupt operation and recognition as HID device, trace shows continuous traffic #10.1 bus1 kbd: works. pcap shows normal interrupt operation and recognition as HID device, trace shows continuous traffic #10.1 bus2 mouse: pcap shows normal interrupt operation and recognition as HID device, trace shows continuous traffic
#10.1 Mouse does not move on desktop, but trace shows packets flow.

Quoted 2 lines

#10.2/10.3/10.4/10.5 mouse and kbd work on both buses. Profiler shows 2 buses with one device each.

Maybe we need a bit more details from around the point the traces start to differ between the versions and about 10-20 lines before it srops and 10-20 lines after (around) that point with versions that work for comparison. It seems the versions that don't work get some error and the OHCI device stops or it's something around reset as the suspend is also called from there. But we need to locate more where is it in the driver to be able to tell what's happening. Maybe also add -trace enable="usb_ohci*" -trace enable="usb_port*" and try to correlate what the driver is doing by that. The OS X driver sources are available at

https://github.com/apple-oss-distributions/IOHIDFamily

the versions correslonding to OS releases are at

https://opensource.apple.com/releases/

10.1.x had 8.3 and 10.2 had version 33 of this driver but new in 10.2 was

https://github.com/apple-oss-distributions/IOUSBFamily/tree/IOUSBFamily-190.4.1

so it seems there was some bigger change in USB handling between those versions. Darwin sources may have more detailed info but I don't know where to find those.

Quoted 7 lines

10.0 and 9.0.4 seem to suffer the same issue (mouse not communicating as a HID device, but 10.1 seems to have another issue.

Attempts to run Mac OS X ioreg show that it fails in that it cannot read the full registry.
This was already noticed here:
https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg05260.html

If this is related to the NVRAM format as speculated in later that thread:

https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg05315.html

Then that format is also documented in the sources:

https://github.com/apple-oss-distributions/AppleCore99NVRAM

and there are other emulators that implement it:

https://github.com/dingusdev/dingusppc/blob/master/devices/common/ofnvram.cpp

so this should be easy to fix. Ask Mark to do that in QEMU and OpenBIOS or let somebody do it without making a fuss about it. (If we could boot these OSes with a firmware ROM from the real machine we could verify if it's a problem with NVRAM format or something else. Maybe I should try OS X on g3beige but it currently stops in Toolbox ROM before display is up or accessing CD so not sure if OS X could boor. If it does not need Toolbox just OpenFirmware maybe it could work but I haven't tried yet. What's a good version of OS X to run on a real G3 beige?)

Quoted 4 lines

-Ioreg from a real G4 running 10.4 and output from the PCI DDK name registry tool from a real G4 running 9.0.4 and from Qemu running 9.0.4, 9.1 and 9.2 are available here:
https://surfdrive.surf.nl/files/index.php/s/1wcC3GGaagqKVpj/download

This ioreg output is truncated. Use ioreg -w 0 -l to get a full output.

Regards,
BALATON Zoltan

#48 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

In reply to Howard Spoelstra
Quoted 10 lines · Howard Spoelstra

Mac OS X
#10.0 bus1 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to adb mouse. No recognition as HID device.
#10.0 bus2 kbd: usb_ohci_stop pci-ohci: USB Suspended. Up to that point kbd pcap shows normal interrupt operation and recognition as HID device #10.0 bus1 kbd: usb_ohci_stop pci-ohci: USB Suspended. Up to that point kbd pcap shows normal interrupt operation and recognition as HID device #10.0 bus2 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to adb mouse. pcap shows no recognition as HID device.
#10.0 in both cases apple system profiler shows 2 usb buses but no devices.

These are all the logs I get booting a 10.0 install iso with mac99,via=pmu

Quoted 7 lines
Quoted 7 lines

=============================================================
OpenBIOS 1.1 [May 25 2022 20:04] Configuration device id QEMU version 1 machine id 1
CPUs: 1
Memory: 256M
UUID: 00000000-0000-0000-0000-000000000000 CPU type PowerPC,G4

milliseconds isn't unique.

Quoted 3 lines
Quoted 3 lines

switching to new context:
call-method slw_update_keymap failed with error ffffffdf call-method slw_update_keymap failed with error ffffffdf

usb_ohci_reset pci-ohci
usb_ohci_stop pci-ohci: USB Suspended usb_ohci_set_ctl pci-ohci: new state 0x0 usb_ohci_stop pci-ohci: USB Suspended usb_ohci_port_detach port #0 usb_ohci_port_attach port #0 usb_ohci_port_detach port #1 usb_ohci_port_attach port #1
dbdma_unassigned_flush: use of unassigned channel 0
dbdma_unassigned_flush: use of unassigned channel 0 usb_ohci_mem_write_bad_offset 0x30 usb_ohci_set_ctl pci-ohci: new state 0x80 usb_ohci_start pci-ohci: USB Operational usb_ohci_hub_power_up powered up all ports usb_ohci_hub_power_up powered up all ports usb_ohci_set_ctl pci-ohci: new state 0xc0 usb_ohci_stop pci-ohci: USB Suspended usb_ohci_hub_power_up powered up all ports usb_ohci_hub_power_up powered up all ports usb_ohci_port_reset port #0

It's probably OK until it restarts but the seems to be stopped. Anybody wants to have a look? Maybe start with finding what the states mean.

Regards,
BALATON Zoltan

#49 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

Quoted 49 lines · BALATON Zoltan
Quoted 4 lines · Howard Spoelstra

Mac OS X
#10.0 bus1 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to adb mouse. No recognition as HID device.
#10.0 bus2 kbd: usb_ohci_stop pci-ohci: USB Suspended. Up to that point

kbd

Quoted 2 lines

pcap shows normal interrupt operation and recognition as HID device #10.0 bus1 kbd: usb_ohci_stop pci-ohci: USB Suspended. Up to that point

kbd

Quoted 4 lines

pcap shows normal interrupt operation and recognition as HID device #10.0 bus2 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to adb mouse. pcap shows no recognition as HID device.
#10.0 in both cases apple system profiler shows 2 usb buses but no

devices.

These are all the logs I get booting a 10.0 install iso with mac99,via=pmu

Quoted 7 lines
Quoted 7 lines

=============================================================
OpenBIOS 1.1 [May 25 2022 20:04] Configuration device id QEMU version 1 machine id 1
CPUs: 1
Memory: 256M
UUID: 00000000-0000-0000-0000-000000000000 CPU type PowerPC,G4

milliseconds isn't unique.

Quoted 3 lines
Quoted 3 lines

switching to new context:
call-method slw_update_keymap failed with error ffffffdf call-method slw_update_keymap failed with error ffffffdf

usb_ohci_reset pci-ohci
usb_ohci_stop pci-ohci: USB Suspended usb_ohci_set_ctl pci-ohci: new state 0x0 usb_ohci_stop pci-ohci: USB Suspended usb_ohci_port_detach port #0 usb_ohci_port_attach port #0 usb_ohci_port_detach port #1 usb_ohci_port_attach port #1
dbdma_unassigned_flush: use of unassigned channel 0
dbdma_unassigned_flush: use of unassigned channel 0 usb_ohci_mem_write_bad_offset 0x30 usb_ohci_set_ctl pci-ohci: new state 0x80 usb_ohci_start pci-ohci: USB Operational usb_ohci_hub_power_up powered up all ports usb_ohci_hub_power_up powered up all ports usb_ohci_set_ctl pci-ohci: new state 0xc0 usb_ohci_stop pci-ohci: USB Suspended usb_ohci_hub_power_up powered up all ports usb_ohci_hub_power_up powered up all ports usb_ohci_port_reset port #0

Quoted 4 lines

It's probably OK until it restarts but the seems to be stopped. Anybody wants to have a look? Maybe start with finding what the states mean.

I get the same with two usb-ohci controllers (so 6 ports) running Mac OS 9.0.4:

usb_ohci_set_ctl pci-ohci: new state 0x80
usb_ohci_start pci-ohci: USB Operational
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_port_reset port #0
usb_ohci_port_reset port #0

So both usb mouse and kbd do not work.

the pcap file for the mouse stalls here:
12 0.007048 0.1.0 host USB 64 SET CONFIGURATION Response

However, when I use the usb probe tool from the USB DDK, to probe the buses I see the host emit a get descriptor

13 115.761725 host 0.0.0 USB 64 GET DESCRIPTOR Request DEVICE 14 115.761803 0.0.0 host USB 72 GET DESCRIPTOR Response DEVICE 15 115.773719 host 0.0.0 USB 64 SET ADDRESS Request
etc. and this time the mouse is recognised as HID device, the host starts
polling it and mouse and kbd start to work.

Best,
Howard

#50 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

Quoted 68 lines · Howard Spoelstra
Quoted 49 lines · BALATON Zoltan
Quoted 4 lines · Howard Spoelstra

Mac OS X
#10.0 bus1 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to adb mouse. No recognition as HID device.
#10.0 bus2 kbd: usb_ohci_stop pci-ohci: USB Suspended. Up to that point

kbd

Quoted 2 lines

pcap shows normal interrupt operation and recognition as HID device #10.0 bus1 kbd: usb_ohci_stop pci-ohci: USB Suspended. Up to that point

kbd

Quoted 4 lines

pcap shows normal interrupt operation and recognition as HID device #10.0 bus2 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to adb mouse. pcap shows no recognition as HID device.
#10.0 in both cases apple system profiler shows 2 usb buses but no

devices.

These are all the logs I get booting a 10.0 install iso with mac99,via=pmu

Quoted 7 lines
Quoted 7 lines

=============================================================
OpenBIOS 1.1 [May 25 2022 20:04] Configuration device id QEMU version 1 machine id 1
CPUs: 1
Memory: 256M
UUID: 00000000-0000-0000-0000-000000000000 CPU type PowerPC,G4

milliseconds isn't unique.

Quoted 3 lines
Quoted 3 lines

switching to new context:
call-method slw_update_keymap failed with error ffffffdf call-method slw_update_keymap failed with error ffffffdf

usb_ohci_reset pci-ohci
usb_ohci_stop pci-ohci: USB Suspended usb_ohci_set_ctl pci-ohci: new state 0x0 usb_ohci_stop pci-ohci: USB Suspended usb_ohci_port_detach port #0 usb_ohci_port_attach port #0 usb_ohci_port_detach port #1 usb_ohci_port_attach port #1
dbdma_unassigned_flush: use of unassigned channel 0
dbdma_unassigned_flush: use of unassigned channel 0 usb_ohci_mem_write_bad_offset 0x30 usb_ohci_set_ctl pci-ohci: new state 0x80 usb_ohci_start pci-ohci: USB Operational usb_ohci_hub_power_up powered up all ports usb_ohci_hub_power_up powered up all ports usb_ohci_set_ctl pci-ohci: new state 0xc0 usb_ohci_stop pci-ohci: USB Suspended usb_ohci_hub_power_up powered up all ports usb_ohci_hub_power_up powered up all ports usb_ohci_port_reset port #0

Quoted 4 lines

It's probably OK until it restarts but the seems to be stopped. Anybody wants to have a look? Maybe start with finding what the states mean.

I get the same with two usb-ohci controllers (so 6 ports) running Mac OS 9.0.4:

usb_ohci_set_ctl pci-ohci: new state 0x80
usb_ohci_start pci-ohci: USB Operational
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_port_reset port #0
usb_ohci_port_reset port #0

Quoted 4 lines

So both usb mouse and kbd do not work.

the pcap file for the mouse stalls here:
12 0.007048 0.1.0 host USB 64 SET CONFIGURATION Response

Maybe the driver gets something from the emulated HID device that it cannot handle and stops during init? Can you reproduce the same with OS X 10.0 and try to correlate the events you see in pcap and trace with the driver source or find out how to enable and read the messages in the driver (unless these are stripped from the binary in Mac OS X but maybe there's something in the guest logs; ave you checked those?) In QEMU the usb-kbd and mouse are implemented in hw/usb/dev-hid.c but this file does not have any debuging or traces. You might try to add some printfs for testing.

Quoted 8 lines

However, when I use the usb probe tool from the USB DDK, to probe the buses I see the host emit a get descriptor

13 115.761725 host 0.0.0 USB 64 GET DESCRIPTOR Request DEVICE 14 115.761803 0.0.0 host USB 72 GET DESCRIPTOR Response DEVICE 15 115.773719 host 0.0.0 USB 64 SET ADDRESS Request
etc. and this time the mouse is recognised as HID device, the host starts polling it and mouse and kbd start to work.

It could be possible that the driver did not get to this point but once something else get's past that it recognises the device but I have no idea how this works and not even sure which OS you had this result with. Is this still 9.0.4? That's hard to debug because we don't know what its driver is doing.

Is there a Darwin, OpenDarwin or whatever was that called during the years iso that boots on this machine (also on the real one)? That should be fully open source and probably have the same drivers as Mac OS X so reproducing with that could give some more info or maybe its driver is more verbose about errors and has debugging. So you could try to find an early Darwin version that's about the same time as early OS X versions or look at the IOHIDFamily and try to find what part of it is running when you see the logs (as this driver is quite complex it may not be easy).

Regards,
BALATON Zoltan

#51 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

Quoted 85 lines · BALATON Zoltan
Quoted 68 lines · Howard Spoelstra
Quoted 49 lines · BALATON Zoltan
Quoted 4 lines · Howard Spoelstra

Mac OS X
#10.0 bus1 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to adb mouse. No recognition as HID device.
#10.0 bus2 kbd: usb_ohci_stop pci-ohci: USB Suspended. Up to that point

kbd

Quoted 2 lines

pcap shows normal interrupt operation and recognition as HID device #10.0 bus1 kbd: usb_ohci_stop pci-ohci: USB Suspended. Up to that point

kbd

Quoted 4 lines

pcap shows normal interrupt operation and recognition as HID device #10.0 bus2 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to adb mouse. pcap shows no recognition as HID device.
#10.0 in both cases apple system profiler shows 2 usb buses but no

devices.

These are all the logs I get booting a 10.0 install iso with mac99,via=pmu

Quoted 7 lines
Quoted 7 lines

=============================================================
OpenBIOS 1.1 [May 25 2022 20:04] Configuration device id QEMU version 1 machine id 1
CPUs: 1
Memory: 256M
UUID: 00000000-0000-0000-0000-000000000000 CPU type PowerPC,G4

milliseconds isn't unique.

Quoted 3 lines
Quoted 3 lines

switching to new context:
call-method slw_update_keymap failed with error ffffffdf call-method slw_update_keymap failed with error ffffffdf

usb_ohci_reset pci-ohci
usb_ohci_stop pci-ohci: USB Suspended usb_ohci_set_ctl pci-ohci: new state 0x0 usb_ohci_stop pci-ohci: USB Suspended usb_ohci_port_detach port #0 usb_ohci_port_attach port #0 usb_ohci_port_detach port #1 usb_ohci_port_attach port #1
dbdma_unassigned_flush: use of unassigned channel 0
dbdma_unassigned_flush: use of unassigned channel 0 usb_ohci_mem_write_bad_offset 0x30 usb_ohci_set_ctl pci-ohci: new state 0x80 usb_ohci_start pci-ohci: USB Operational usb_ohci_hub_power_up powered up all ports usb_ohci_hub_power_up powered up all ports usb_ohci_set_ctl pci-ohci: new state 0xc0 usb_ohci_stop pci-ohci: USB Suspended usb_ohci_hub_power_up powered up all ports usb_ohci_hub_power_up powered up all ports usb_ohci_port_reset port #0

Quoted 4 lines

It's probably OK until it restarts but the seems to be stopped. Anybody wants to have a look? Maybe start with finding what the states mean.

I get the same with two usb-ohci controllers (so 6 ports) running Mac OS 9.0.4:

usb_ohci_set_ctl pci-ohci: new state 0x80
usb_ohci_start pci-ohci: USB Operational
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_port_reset port #0
usb_ohci_port_reset port #0

Quoted 4 lines

So both usb mouse and kbd do not work.

the pcap file for the mouse stalls here:
12 0.007048 0.1.0 host USB 64 SET CONFIGURATION Response

Maybe the driver gets something from the emulated HID device that it cannot handle and stops during init? Can you reproduce the same with OS X 10.0 and try to correlate the events you see in pcap and trace with the driver source or find out how to enable and read the messages in the driver (unless these are stripped from the binary in Mac OS X but maybe there's something in the guest logs; ave you checked those?) In QEMU the usb-kbd and mouse are implemented in hw/usb/dev-hid.c but this file does not have any debuging or traces. You might try to add some printfs for testing.

Quoted 8 lines

However, when I use the usb probe tool from the USB DDK, to probe the buses I see the host emit a get descriptor

13 115.761725 host 0.0.0 USB 64 GET DESCRIPTOR Request DEVICE 14 115.761803 0.0.0 host USB 72 GET DESCRIPTOR Response DEVICE 15 115.773719 host 0.0.0 USB 64 SET ADDRESS Request
etc. and this time the mouse is recognised as HID device, the host starts polling it and mouse and kbd start to work.

Quoted 3 lines

It could be possible that the driver did not get to this point but once something else get's past that it recognises the device but I have no idea how this works and not even sure which OS you had this result with. Is this still 9.0.4? That's hard to debug because we don't know what its driver is doing.

Is there a Darwin, OpenDarwin or whatever was that called during the years iso that boots on this machine (also on the real one)? That should be fully open source and probably have the same drivers as Mac OS X so reproducing with that could give some more info or maybe its driver is more verbose about errors and has debugging. So you could try to find an early Darwin version that's about the same time as early OS X versions or look at the IOHIDFamily and try to find what part of it is running when you see the logs (as this driver is quite complex it may not be easy).

The oldest Darwin CD I could find is 6.2 which boots and works so it's not old enough for us.

The simplest driver is in the oldest 10.0 version so maybe we should try to look at that:

https://github.com/apple-oss-distributions/IOHIDFamily/tree/IOHIDFamily-6

and the low level part is in the xnu kernel:

https://github.com/apple-oss-distributions/xnu/tree/xnu-123.5/iokit/Families/IOHIDSystem

I don't quite know how it works and where it starts running but a large part of it looks like it handles key mapping. While booting I see an error from OpenBIOS saying:

Quoted 1 line
Quoted 1 line

call-method slw_update_keymap failed with error ffffffdf

Could this be related to the problem? What is this error about? This PearPC bug has some info on where it may come from:

https://github.com/sebastianbiallas/pearpc/issues/4

but I don't know if any of this is relevant.

Regards,
BALATON Zoltan

#52 lore raw

Re: [PATCH v7 6/7] mac_newworld: Deprecate mac99 "via" option

Quoted 145 lines · BALATON Zoltan
Quoted 2 lines · BALATON Zoltan
Quoted 1 line · Howard Spoelstra

On Thu, Jan 26, 2023 at 9:57 PM BALATON Zoltan <[email protected]>

Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines · Howard Spoelstra
Quoted 2 lines

Mac OS X
#10.0 bus1 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to

adb

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

mouse. No recognition as HID device.
#10.0 bus2 kbd: usb_ohci_stop pci-ohci: USB Suspended. Up to that

point

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

kbd

Quoted 2 lines

pcap shows normal interrupt operation and recognition as HID device #10.0 bus1 kbd: usb_ohci_stop pci-ohci: USB Suspended. Up to that

point

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

kbd

Quoted 2 lines

pcap shows normal interrupt operation and recognition as HID device #10.0 bus2 mouse: usb_ohci_stop pci-ohci: USB Suspended. Reverts to

adb

Quoted 57 lines
Quoted 57 lines
Quoted 39 lines
Quoted 2 lines

mouse. pcap shows no recognition as HID device.
#10.0 in both cases apple system profiler shows 2 usb buses but no

devices.

These are all the logs I get booting a 10.0 install iso with mac99,via=pmu

Quoted 7 lines
Quoted 7 lines

=============================================================
OpenBIOS 1.1 [May 25 2022 20:04] Configuration device id QEMU version 1 machine id 1
CPUs: 1
Memory: 256M
UUID: 00000000-0000-0000-0000-000000000000 CPU type PowerPC,G4

milliseconds isn't unique.

Quoted 3 lines
Quoted 3 lines

switching to new context:
call-method slw_update_keymap failed with error ffffffdf call-method slw_update_keymap failed with error ffffffdf

usb_ohci_reset pci-ohci
usb_ohci_stop pci-ohci: USB Suspended usb_ohci_set_ctl pci-ohci: new state 0x0 usb_ohci_stop pci-ohci: USB Suspended usb_ohci_port_detach port #0 usb_ohci_port_attach port #0 usb_ohci_port_detach port #1 usb_ohci_port_attach port #1
dbdma_unassigned_flush: use of unassigned channel 0
dbdma_unassigned_flush: use of unassigned channel 0 usb_ohci_mem_write_bad_offset 0x30 usb_ohci_set_ctl pci-ohci: new state 0x80 usb_ohci_start pci-ohci: USB Operational usb_ohci_hub_power_up powered up all ports usb_ohci_hub_power_up powered up all ports usb_ohci_set_ctl pci-ohci: new state 0xc0 usb_ohci_stop pci-ohci: USB Suspended usb_ohci_hub_power_up powered up all ports usb_ohci_hub_power_up powered up all ports usb_ohci_port_reset port #0

Quoted 4 lines

It's probably OK until it restarts but the seems to be stopped. Anybody wants to have a look? Maybe start with finding what the states mean.

I get the same with two usb-ohci controllers (so 6 ports) running Mac OS 9.0.4:

usb_ohci_set_ctl pci-ohci: new state 0x80
usb_ohci_start pci-ohci: USB Operational
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_hub_power_up powered up all ports
usb_ohci_port_reset port #0
usb_ohci_port_reset port #0

Quoted 6 lines
Quoted 4 lines

So both usb mouse and kbd do not work.

the pcap file for the mouse stalls here:
12 0.007048 0.1.0 host USB 64 SET CONFIGURATION Response

Maybe the driver gets something from the emulated HID device that it

cannot

Quoted 1 line

handle and stops during init? Can you reproduce the same with OS X 10.0

and

Quoted 1 line

try to correlate the events you see in pcap and trace with the driver

source

Quoted 1 line

or find out how to enable and read the messages in the driver (unless

these

Quoted 1 line

are stripped from the binary in Mac OS X but maybe there's something in

the

Quoted 2 lines

guest logs; ave you checked those?) In QEMU the usb-kbd and mouse are implemented in hw/usb/dev-hid.c but this file does not have any debuging

or

Quoted 3 lines

traces. You might try to add some printfs for testing.

Quoted 1 line

However, when I use the usb probe tool from the USB DDK, to probe the

buses

Quoted 6 lines
Quoted 6 lines

I see the host emit a get descriptor

13 115.761725 host 0.0.0 USB 64 GET DESCRIPTOR Request DEVICE 14 115.761803 0.0.0 host USB 72 GET DESCRIPTOR Response DEVICE 15 115.773719 host 0.0.0 USB 64 SET ADDRESS Request etc. and this time the mouse is recognised as HID device, the host

starts

Quoted 4 lines
Quoted 1 line

polling it and mouse and kbd start to work.

It could be possible that the driver did not get to this point but once something else get's past that it recognises the device but I have no

idea

Quoted 1 line

how this works and not even sure which OS you had this result with. Is

this

Quoted 1 line

still 9.0.4? That's hard to debug because we don't know what its driver

is

Quoted 3 lines

doing.

Is there a Darwin, OpenDarwin or whatever was that called during the

years

Quoted 1 line

iso that boots on this machine (also on the real one)? That should be

fully

Quoted 1 line

open source and probably have the same drivers as Mac OS X so

reproducing

Quoted 1 line

with that could give some more info or maybe its driver is more verbose

about

Quoted 1 line

errors and has debugging. So you could try to find an early Darwin

version

Quoted 1 line

that's about the same time as early OS X versions or look at the

IOHIDFamily

Quoted 1 line

and try to find what part of it is running when you see the logs (as

this

Quoted 1 line

driver is quite complex it may not be easy).

The oldest Darwin CD I could find is 6.2 which boots and works so it's not old enough for us.

The simplest driver is in the oldest 10.0 version so maybe we should try to look at that:

https://github.com/apple-oss-distributions/IOHIDFamily/tree/IOHIDFamily-6

and the low level part is in the xnu kernel:

https://github.com/apple-oss-distributions/xnu/tree/xnu-123.5/iokit/Families/IOHIDSystem

Quoted 10 lines

I don't quite know how it works and where it starts running but a large part of it looks like it handles key mapping. While booting I see an error from OpenBIOS saying:

Quoted 1 line
Quoted 1 line

call-method slw_update_keymap failed with error ffffffdf

Could this be related to the problem? What is this error about? This PearPC bug has some info on where it may come from:

This seem to come from here:
https://web.archive.org/web/20150922180615/http://www.opensource.apple.com/source/BootX/BootX-45/bootx.tproj/ci.subproj/sl_words.c

Quoted 7 lines

https://github.com/sebastianbiallas/pearpc/issues/4

but I don't know if any of this is relevant.

Regards,
BALATON Zoltan

#15 lore raw

Re: [PATCH v7 3/7] mac_{old,new}world: Pass MacOS VGA NDRV in card ROM instead of fw_cfg

In reply to BALATON Zoltan
Quoted 10 lines · BALATON Zoltan
Quoted 9 lines · Mark Cave-Ayland
Quoted 7 lines · BALATON Zoltan
Quoted 5 lines

The problem you are ultimately trying to solve though is that OpenBIOS is loading the NDRV for all VGA PCI devices, so why not just fix drivers/vga.fs so that the NDRV is loaded only for the QEMU VGA device?

Quoted 1 line

So this patch neither adds new dependency to QEMU nor repends on any change in OpenBIOS. It just gets rid of passing files via fw_cfg.

Unfortunately that still doesn't solve the problem of building a self-contained OpenBIOS ROM, so this patch isn't the right way forward.

It does take a step to make it possible to eventually add a self contained ROM and remove the vga.fs from OpenBIOS but it's not doing that fully. It just simplifies QEMU and OpenBIOS vga.fs for now and making the ROM also contain the FCode will be a further step but we can't get there if you don't allow to make smaller steps or don't merge my patches for OpenBIOS which would allow it to run FCode ROMs. If you're waiting for all this to be finished I'll give up and it will never be finished. If you allow to progress in smaller steps then maybe we'll get there.

Quoted 7 lines
Quoted 1 line

You can already add a self-contained rom using the romfile= property, so that's not preventing you from doing anything though? Even once OpenBIOS can

Except that OpenBIOS will break the device tree by adding the qemu_vga.ndrv to the video card node so the card rom I pass via romfile will see it's already there and won't install its owm. Then MacOS will try to use the wrong driver and it does not work and I spend a lot of time to find out I also need -prom env vga-ndrv?=false to avoid this problem which I always forget and somebody trying this for the first time won't even know.

What's more, all this complication is not needed. With this patch everything works as before for std VGA as it will have the qemu_vga.ndrv as its romfile but ati-vga won't so OpenBIOS only installs it for std VGA without adding anything to OpenBIOS to handle this. Adding a romfile to ati-vga will work without further hassle and the romfile option can also be used to replace or disable the qemu_vga.ndrv for std VGA as -device VGA,romdile="" (or add your FCode in development here). Due to the way standard VGA works adding -device VGA,romfile= to the command line won't add a second VGA device just set the option for the default one (actually it omits the default and adds the specified one but the point is this just works).

Then we not only not need to add anythig to OpenBIOS but we can drop the vga-ndrv? option (which does not exist on real machines anyway) and also all the code in vga.fs to get the driver from fw_cfg so simplifying it leaving only the code which will eventually need to be part of the FCode ROM. Once this patch is accepted it fixes the above problem and allows to simplify OpenBIOS later and when we're there you just have to replace qemu_vga.ndrv with the version that prepends the FCode from vga.fs before it so I don't see what's your problem with this patch. Can you give a reason why it can't be accepted?

It doesn't work this way though: once the FCode ROM is working it also generates the QEMU,VGA device tree node, which means that -device VGA,romfile="" will not only disable qemu_vga.ndrv, but also leave a device node missing the properties required for the guest to correctly identify the VGA adapter.

As I already mentioned, this is the wrong approach and what is needed is to fix vga.fs in OpenBIOS so that the NDRV is only loaded for the QEMU,VGA device.

Quoted 3 lines
Quoted 1 line

read PCI option ROMs, the option ROM will still need to contain OpenBIOS's vga.fs as a payload, and it will still need to be able to inject qemu_vga.ndrv because OpenBIOS cannot have an external dependency upon QemuMacDrivers.

The way real card ROMs work is that they embed the driver binary and have some FCode that adds that to the device tree. It should be the same for QEMU emulated cards so if you say that you want only vga.fs as the card ROM which then downloads the qemu_vga.ndrv from QEMU that makes no sense at all. Currently the qemu_vga.ndrv is build from QemuMacDrivers and added as a binary to QEMU. You can add it as a binary the same way to OpenBIOS then build the FCOde ROM from vga.fs and qemu_vga.ndrv bin that results in the FCode ROM that will replace qemu_vga.ndrv binaty in QEMU. You just say this is not possible because you're OK with adding the qemu_vga,ndrv binary to QEMU but doing the same with OpenBIOS cannot be done?

What you're suggesting doesn't make any sense, as all you're doing is moving the binary from QEMU where there is already precedent for distributing binary ROMs to OpenBIOS where it becomes a build dependency that cannot be built outside of a very specific guest environment.

I should also add that it wasn't me who designed and implemented the existing scheme for keeping the qemu_vga.ndrv binary in QEMU, it was Ben - and his approach still seems to be the best solution in my opinion.

ATB,

Mark.

#61 lore raw
In reply to BALATON Zoltan
Quoted 13 lines · BALATON Zoltan

This is the remainder of the series that were postponed to after the freeze the last time I've tried to submit them with some new patches I did meanwhile.

BALATON Zoltan (7):
input/adb: Only include header where needed mac_{old,new}world: Use local variable instead of qdev_get_machine() mac_{old,new}world: Pass MacOS VGA NDRV in card ROM instead of fw_cfg
mac_newworld: Add machine types for different mac99 configs
mac_newworld: Deprecate mac99 with G5 CPU
mac_newworld: Deprecate mac99 "via" option
mac_newworld: Document deprecation

Quoted 12 lines
  docs/about/deprecated.rst    |   7 ++
  docs/system/ppc/powermac.rst |  12 ++--
  hw/misc/macio/cuda.c         |   2 -
  hw/misc/macio/pmu.c          |   3 -
  hw/misc/mos6522.c            |   1 -
  hw/ppc/mac_newworld.c        | 130 +++++++++++++++++++++++++++++++----
  hw/ppc/mac_oldworld.c        |  21 ++----
  include/hw/misc/mac_via.h    |   1 +
  include/hw/misc/macio/cuda.h |   1 +
  include/hw/misc/macio/pmu.h  |   1 +
  include/hw/misc/mos6522.h    |   3 +-
  11 files changed, 142 insertions(+), 40 deletions(-)

I've applied patches 1 and 2 to my qemu-macppc branch. Patch 3 isn't the right solution to the problem, and the discussion as to how the New World machines should be organised in future for patches 4 to 7 still hasn't been clarified.

ATB,

Mark.

#62 lore raw
Quoted 27 lines · Mark Cave-Ayland
Quoted 13 lines · BALATON Zoltan

This is the remainder of the series that were postponed to after the freeze the last time I've tried to submit them with some new patches I did meanwhile.

BALATON Zoltan (7):
input/adb: Only include header where needed mac_{old,new}world: Use local variable instead of qdev_get_machine() mac_{old,new}world: Pass MacOS VGA NDRV in card ROM instead of fw_cfg
mac_newworld: Add machine types for different mac99 configs
mac_newworld: Deprecate mac99 with G5 CPU
mac_newworld: Deprecate mac99 "via" option
mac_newworld: Document deprecation

Quoted 12 lines
  docs/about/deprecated.rst    |   7 ++
  docs/system/ppc/powermac.rst |  12 ++--
  hw/misc/macio/cuda.c         |   2 -
  hw/misc/macio/pmu.c          |   3 -
  hw/misc/mos6522.c            |   1 -
  hw/ppc/mac_newworld.c        | 130 +++++++++++++++++++++++++++++++----
  hw/ppc/mac_oldworld.c        |  21 ++----
  include/hw/misc/mac_via.h    |   1 +
  include/hw/misc/macio/cuda.h |   1 +
  include/hw/misc/macio/pmu.h  |   1 +
  include/hw/misc/mos6522.h    |   3 +-
  11 files changed, 142 insertions(+), 40 deletions(-)
Quoted 1 line

I've applied patches 1 and 2 to my qemu-macppc branch. Patch 3 isn't the right solution to the problem, and the discussion as to how the New World machines should be organised in future for patches 4 to 7 still hasn't been clarified.

Thanks, let's come back to patch 3 in the other thread. As for 4-7 the discussion seems to have ended and the result was that nobody really cares besides you and me. So make a suggestion for names instead of the machine id based ones I came up with and I'll change it to use those names. Whatever we call these is still better than what we have currently so as long as I can get PowerMac3,1 and PowerMac7,2 with a simple -machine option without getting them confused in qemu-system-ppc64 I'd go for that.

Regards,
BALATON Zoltan

#16 lore raw

Re: [PATCH v7 3/7] mac_{old,new}world: Pass MacOS VGA NDRV in card ROM instead of fw_cfg

In reply to Mark Cave-Ayland
Quoted 13 lines · Mark Cave-Ayland
Quoted 12 lines · BALATON Zoltan
Quoted 10 lines · Mark Cave-Ayland
Quoted 7 lines · BALATON Zoltan
Quoted 5 lines

The problem you are ultimately trying to solve though is that OpenBIOS is loading the NDRV for all VGA PCI devices, so why not just fix drivers/vga.fs so that the NDRV is loaded only for the QEMU VGA device?

Quoted 1 line

So this patch neither adds new dependency to QEMU nor repends on any change in OpenBIOS. It just gets rid of passing files via fw_cfg.

Unfortunately that still doesn't solve the problem of building a self-contained OpenBIOS ROM, so this patch isn't the right way forward.

It does take a step to make it possible to eventually add a self contained ROM and remove the vga.fs from OpenBIOS but it's not doing that fully. It just simplifies QEMU and OpenBIOS vga.fs for now and making the ROM also contain the FCode will be a further step but we can't get there if you don't allow to make smaller steps or don't merge my patches for OpenBIOS which would allow it to run FCode ROMs. If you're waiting for all this to be finished I'll give up and it will never be finished. If you allow to progress in smaller steps then maybe we'll get there.

You can already add a self-contained rom using the romfile= property, so that's not preventing you from doing anything though? Even once OpenBIOS can

Quoted 7 lines
Quoted 5 lines

Except that OpenBIOS will break the device tree by adding the qemu_vga.ndrv to the video card node so the card rom I pass via romfile will see it's already there and won't install its owm. Then MacOS will try to use the wrong driver and it does not work and I spend a lot of time to find out I also need -prom env vga-ndrv?=false to avoid this problem which I always forget and somebody trying this for the first time won't even know.

What's more, all this complication is not needed. With this patch everything works as before for std VGA as it will have the qemu_vga.ndrv as its romfile but ati-vga won't so OpenBIOS only installs it for std VGA without adding anything to OpenBIOS to handle this. Adding a romfile to ati-vga will work without further hassle and the romfile option can also be used to replace or disable the qemu_vga.ndrv for std VGA as -device VGA,romdile="" (or add your FCode in development here). Due to the way standard VGA works adding -device VGA,romfile= to the command line won't add a second VGA device just set the option for the default one (actually it omits the default and adds the specified one but the point is this just works).

Then we not only not need to add anythig to OpenBIOS but we can drop the vga-ndrv? option (which does not exist on real machines anyway) and also all the code in vga.fs to get the driver from fw_cfg so simplifying it leaving only the code which will eventually need to be part of the FCode ROM. Once this patch is accepted it fixes the above problem and allows to simplify OpenBIOS later and when we're there you just have to replace qemu_vga.ndrv with the version that prepends the FCode from vga.fs before it so I don't see what's your problem with this patch. Can you give a reason why it can't be accepted?

It doesn't work this way though: once the FCode ROM is working it also generates the QEMU,VGA device tree node, which means that -device VGA,romfile="" will not only disable qemu_vga.ndrv, but also leave a device node missing the properties required for the guest to correctly identify the VGA adapter.

Under what circumstances does it make sense to not have the ndrv in the device tree when using vga.fs or a ROM built from that later?

Quoted 1 line

As I already mentioned, this is the wrong approach and what is needed is to fix vga.fs in OpenBIOS so that the NDRV is only loaded for the QEMU,VGA device.

Then please do that as it's your code and I don't want to find out how to change the forth in vga.fs to do this.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

read PCI option ROMs, the option ROM will still need to contain OpenBIOS's vga.fs as a payload, and it will still need to be able to inject qemu_vga.ndrv because OpenBIOS cannot have an external dependency upon QemuMacDrivers.

The way real card ROMs work is that they embed the driver binary and have some FCode that adds that to the device tree. It should be the same for QEMU emulated cards so if you say that you want only vga.fs as the card ROM which then downloads the qemu_vga.ndrv from QEMU that makes no sense at all. Currently the qemu_vga.ndrv is build from QemuMacDrivers and added as a binary to QEMU. You can add it as a binary the same way to OpenBIOS then build the FCOde ROM from vga.fs and qemu_vga.ndrv bin that results in the FCode ROM that will replace qemu_vga.ndrv binaty in QEMU. You just say this is not possible because you're OK with adding the qemu_vga,ndrv binary to QEMU but doing the same with OpenBIOS cannot be done?

What you're suggesting doesn't make any sense, as all you're doing is moving the binary from QEMU where there is already precedent for distributing binary ROMs to OpenBIOS where it becomes a build dependency that cannot be built outside of a very specific guest environment.

I should also add that it wasn't me who designed and implemented the existing scheme for keeping the qemu_vga.ndrv binary in QEMU, it was Ben - and his approach still seems to be the best solution in my opinion.

Since I can't convince you I'll leave this for now but it would help if you could come up with an alternative patch at least solving the problem of adding the ndrv to vga devices it does not work with. I like the romfile="" option also because this is needed for other firmwares with ati-vga that have BIOS emulator that can't run the default vgabios from QEMU because it contains i386 opcodes that those firmwares' x86 emulators don't know about. So I'm already listing that option for ati-vga for sam460ex and pegasos2 in user docs and if the same worked for mac99,via=pmu that would be simpler for users (and for me always forgetting about the option to prevent ndrv loading as I don't use it very often).

Regards,
BALATON Zoltan

#63 lore raw
In reply to BALATON Zoltan
Quoted 28 lines · BALATON Zoltan
Quoted 27 lines · Mark Cave-Ayland
Quoted 25 lines · BALATON Zoltan

This is the remainder of the series that were postponed to after the freeze the last time I've tried to submit them with some new patches I did meanwhile.

BALATON Zoltan (7):
input/adb: Only include header where needed mac_{old,new}world: Use local variable instead of qdev_get_machine() mac_{old,new}world: Pass MacOS VGA NDRV in card ROM instead of fw_cfg
mac_newworld: Add machine types for different mac99 configs
mac_newworld: Deprecate mac99 with G5 CPU
mac_newworld: Deprecate mac99 "via" option
mac_newworld: Document deprecation

  docs/about/deprecated.rst    |   7 ++
  docs/system/ppc/powermac.rst |  12 ++--
  hw/misc/macio/cuda.c         |   2 -
  hw/misc/macio/pmu.c          |   3 -
  hw/misc/mos6522.c            |   1 -
  hw/ppc/mac_newworld.c        | 130 +++++++++++++++++++++++++++++++----
  hw/ppc/mac_oldworld.c        |  21 ++----
  include/hw/misc/mac_via.h    |   1 +
  include/hw/misc/macio/cuda.h |   1 +
  include/hw/misc/macio/pmu.h  |   1 +
  include/hw/misc/mos6522.h    |   3 +-
  11 files changed, 142 insertions(+), 40 deletions(-)
Quoted 3 lines
Quoted 1 line

I've applied patches 1 and 2 to my qemu-macppc branch. Patch 3 isn't the right solution to the problem, and the discussion as to how the New World machines should be organised in future for patches 4 to 7 still hasn't been clarified.

Thanks, let's come back to patch 3 in the other thread. As for 4-7 the discussion seems to have ended and the result was that nobody really cares besides you and me. So make a suggestion for names instead of the machine id based ones I came up with and I'll change it to use those names. Whatever we call these is still better than what we have currently so as long as I can get PowerMac3,1 and PowerMac7,2 with a simple -machine option without getting them confused in qemu-system-ppc64 I'd go for that.

Thank you for taking care of these, now only the last patches are not yet merged. We can postpone the NDRV patch for later but I'd appreciate if you could make an alternative fix in OpenBIOS. I'd still want to resolve the mac99 machine though and add new machine names and start deprecation now. I'm waiting for your suggestion on names for these machines and preferred partitioning of the changes in patches so I can change and resubmit these. I'd like this to not miss the freeze which may seem far ahead but at the speed these are reviewed and merged I wanted to get over it as soon as possible. (Othersise this would be the second time these miss a freeze.)

Regards,
BALATON Zoltan

#53 lore raw

Error detecting linker while compiling qemu-system-ppc on macOS

In reply to Howard Spoelstra

Hi all,

I'm getting a error while compiling on macOS (Intel). It seems linker detection is passed an unknown argument "--version", whereas "-v" works OK? See log below.

Thanks for looking into this,
Howard

Build started at 2023-11-06T07:29:19.181487
Main binary: /Users/hsp/src/qemu-ppc/build/pyvenv/bin/python3.11 Build Options: -Db_pie=false -Ddocs=disabled -Dplugins=true '--native-file config-meson.cross'
Python system: Darwin
The Meson build system
Version: 0.63.3
Source dir: /Users/hsp/src/qemu-ppc
Build dir: /Users/hsp/src/qemu-ppc/build
Build type: native build
Project name: qemu
Project version: 8.1.50
-----
Detecting compiler via: cc -m64 -mcx16 --version
compiler returned <Popen: returncode: 0 args: ['cc', '-m64', '-mcx16', '--version']>
compiler stdout:
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

compiler stderr:

Running command: cc -m64 -mcx16 -E -dM -
-----
Detecting linker via: cc -m64 -mcx16 -Wl,--version
linker returned <Popen: returncode: 1 args: ['cc', '-m64', '-mcx16', '-Wl,--version']>
linker stdout:

linker stderr:
ld: unknown options: --version
clang: error: linker command failed with exit code 1 (use -v to see invocation)

-----
Detecting Apple linker via: cc -m64 -mcx16 -Wl,-v
linker stdout:

linker stderr:
@(#)PROGRAM:ld PROJECT:dyld-1015.7
BUILD 18:48:43 Aug 22 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
will use ld-classic for: armv6 armv7 armv7s arm64_32 i386 armv6m armv7k armv7m armv7em
LTO support using: LLVM version 15.0.0 (static support for 29, runtime is
29)
TAPI support using: Apple TAPI version 15.0.0 (tapi-1500.0.12.3) Library search paths:
/usr/local/lib
Framework search paths:
ld: Undefined symbols:
_main, referenced from:
<initial-undefines>
clang: error: linker command failed with exit code 1 (use -v to see invocation)

../meson.build:1:0: ERROR: Unable to detect linker for compiler cc -m64 -mcx16 -Wl,--version
stdout:
stderr: ld: unknown options: --version
clang: error: linker command failed with exit code 1 (use -v to see invocation)

#54 lore raw

Re: Error detecting linker while compiling qemu-system-ppc on macOS

Hello,

Quoted 5 lines · Howard Spoelstra

Hi all,

I'm getting a error while compiling on macOS (Intel). It seems linker detection is passed an unknown argument "--version", whereas "-v" works OK? See log below.

See also https://lists.nongnu.org/archive/html/qemu-devel/2023-10/msg10375.html
and the tickets listed in there. It should work with meson 1.2.x according to Rene's ticket to Meson and you can install that from homebrew but it seems it's not picked up. Why is it using /Users/hsp/src/qemu-ppc/build/pyvenv/bin/python3.11 ? How many pythons do you8 have on macOS? What does which python tell you and does it work better when you add --python=/path/to/python/that/homebrew/meson/uses ?

Regards,
BALATON Zoltan

Quoted 70 lines

Thanks for looking into this,
Howard

Build started at 2023-11-06T07:29:19.181487
Main binary: /Users/hsp/src/qemu-ppc/build/pyvenv/bin/python3.11 Build Options: -Db_pie=false -Ddocs=disabled -Dplugins=true '--native-file config-meson.cross'
Python system: Darwin
The Meson build system
Version: 0.63.3
Source dir: /Users/hsp/src/qemu-ppc
Build dir: /Users/hsp/src/qemu-ppc/build
Build type: native build
Project name: qemu
Project version: 8.1.50
-----
Detecting compiler via: cc -m64 -mcx16 --version
compiler returned <Popen: returncode: 0 args: ['cc', '-m64', '-mcx16', '--version']>
compiler stdout:
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

compiler stderr:

Running command: cc -m64 -mcx16 -E -dM -
-----
Detecting linker via: cc -m64 -mcx16 -Wl,--version
linker returned <Popen: returncode: 1 args: ['cc', '-m64', '-mcx16', '-Wl,--version']>
linker stdout:

linker stderr:
ld: unknown options: --version
clang: error: linker command failed with exit code 1 (use -v to see invocation)

-----
Detecting Apple linker via: cc -m64 -mcx16 -Wl,-v
linker stdout:

linker stderr:
@(#)PROGRAM:ld PROJECT:dyld-1015.7
BUILD 18:48:43 Aug 22 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
will use ld-classic for: armv6 armv7 armv7s arm64_32 i386 armv6m armv7k armv7m armv7em
LTO support using: LLVM version 15.0.0 (static support for 29, runtime is
29)
TAPI support using: Apple TAPI version 15.0.0 (tapi-1500.0.12.3) Library search paths:
/usr/local/lib
Framework search paths:
ld: Undefined symbols:
_main, referenced from:
<initial-undefines>
clang: error: linker command failed with exit code 1 (use -v to see invocation)

../meson.build:1:0: ERROR: Unable to detect linker for compiler cc -m64 -mcx16 -Wl,--version
stdout:
stderr: ld: unknown options: --version
clang: error: linker command failed with exit code 1 (use -v to see invocation)