Skip to contentSkip to conversation

system: Absorb globals-target.c within common globals.c

PATCH Superseded Philippe Mathieu-Daudé 5 participants 38 messages Feb 14 – Feb 16 Arm/Amlogic Meson SoC support

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover system: Absorb globals-target.c within common globals.c

Slightly rework how the graphic dimension variables for the M68k / PPC / SPARC targets are initialized, removing the need for the target-specific globals-target.c file.

Philippe Mathieu-Daudé (8):
hw/display/macfb: Constify macfb_sense_table[] array hw/display/macfb: Constify macfb_mode_table[] array hw/m68k/q800: Use MacFbMode fields in q800_machine_init() hw/m68k/q800: Set MACFB_DISPLAY_APPLE_21_COLOR within MacFrameBuffer hw/m68k: Set graphic display dimensions generically hw/sparc: Set graphic display dimensions generically hw/ppc: Set graphic display dimensions generically system/globals: Build as common code

 include/hw/display/macfb.h |  2 +-
 include/hw/ppc/ppc.h       |  2 ++
 hw/display/macfb.c         | 18 +++++++++++-------
 hw/m68k/q800.c             | 17 ++++++-----------
 hw/ppc/mac_newworld.c      | 10 ++++++----
 hw/ppc/mac_oldworld.c      | 10 ++++++----
 hw/ppc/ppc.c               |  8 ++++++++
 hw/ppc/prep.c              |  4 ++++
 hw/ppc/spapr.c             |  4 ++++
 hw/sparc/sun4m.c           |  9 +++++++++
 hw/sparc64/sun4u.c         | 10 ++++++++++
 system/globals-target.c    | 24 ------------------------
 system/globals.c           |  3 +++
 system/meson.build         |  4 ----
 14 files changed, 70 insertions(+), 55 deletions(-)
 delete mode 100644 system/globals-target.c
Signature · 1 line
2.52.0
#1 lore raw

PATCH 1/8 hw/display/macfb: Constify macfb_sense_table[] array

macfb_sense_table[] is only read, never updated, so can be const.

Update the single call site, macfb_sense_read().

---
 hw/display/macfb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/display/macfb.c +2 -2
index 388f8de5070..57ad8ad5587 100644
@@ -82,7 +82,7 @@ typedef struct MacFbSense {
     uint8_t ext_sense;
 } MacFbSense;
 
-static MacFbSense macfb_sense_table[] = {
+static const MacFbSense macfb_sense_table[] = {
     { MACFB_DISPLAY_APPLE_21_COLOR, 0x0, 0 },
     { MACFB_DISPLAY_APPLE_PORTRAIT, 0x1, 0 },
     { MACFB_DISPLAY_APPLE_12_RGB, 0x2, 0 },
@@ -342,7 +342,7 @@ static void macfb_invalidate_display(void *opaque)
 
 static uint32_t macfb_sense_read(MacfbState *s)
 {
-    MacFbSense *macfb_sense;
+    const MacFbSense *macfb_sense;
     uint8_t sense;
 
     assert(s->type < ARRAY_SIZE(macfb_sense_table));
Signature · 1 line
2.52.0
Reviewed-by on v1 1/8
#3 lore raw

Re: [PATCH 1/8] hw/display/macfb: Constify macfb_sense_table[] array

In reply to Philippe Mathieu-Daudé
Quoted 23 lines · Philippe Mathieu-Daudé

macfb_sense_table[] is only read, never updated, so can be const.

Update the single call site, macfb_sense_read().

---
  hw/display/macfb.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/display/macfb.c +1 -1
index 388f8de5070..57ad8ad5587 100644
@@ -82,7 +82,7 @@ typedef struct MacFbSense {
      uint8_t ext_sense;
  } MacFbSense;
 
-static MacFbSense macfb_sense_table[] = {
+static const MacFbSense macfb_sense_table[] = {
      { MACFB_DISPLAY_APPLE_21_COLOR, 0x0, 0 },
      { MACFB_DISPLAY_APPLE_PORTRAIT, 0x1, 0 },
      { MACFB_DISPLAY_APPLE_12_RGB, 0x2, 0 },

hw/display/macfb.c static void macfb_invalidate_display(void *opaque) · line 348

Quoted 8 lines
hw/display/macfb.c +1 -1
@@ -342,7 +342,7 @@ static void macfb_invalidate_display(void *opaque)
 
  static uint32_t macfb_sense_read(MacfbState *s)
  {
-    MacFbSense *macfb_sense;
+    const MacFbSense *macfb_sense;
      uint8_t sense;
 
      assert(s->type < ARRAY_SIZE(macfb_sense_table));

ATB,

Mark.

#4 lore raw

PATCH 2/8 hw/display/macfb: Constify macfb_mode_table[] array

In reply to Philippe Mathieu-Daudé

macfb_mode_table[] is only read, never updated, so can be const.

Update the call sites accordingly.
Make the MacfbState::mode pointer to const.

---
 include/hw/display/macfb.h |  2 +-
 hw/display/macfb.c         | 10 +++++-----
 hw/m68k/q800.c             |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)
include/hw/display/macfb.h +1 -1
index 495dead44b5..cb7aac7a4dd 100644
@@ -66,7 +66,7 @@ typedef struct MacfbState {
     uint8_t type;
 
     uint32_t regs[MACFB_NUM_REGS];
-    MacFbMode *mode;
+    const MacFbMode *mode;
 
     QEMUTimer *vbl_timer;
     qemu_irq irq;
hw/display/macfb.c +5 -5
index 57ad8ad5587..8ef174dc6df 100644
@@ -100,7 +100,7 @@ static const MacFbSense macfb_sense_table[] = {
     { MACFB_DISPLAY_SVGA, 0x7, 0x5 },
 };
 
-static MacFbMode macfb_mode_table[] = {
+static const MacFbMode macfb_mode_table[] = {
     { MACFB_DISPLAY_VGA, 1, 0x100, 0x71e, 640, 480, 0x400, 0x1000 },
     { MACFB_DISPLAY_VGA, 2, 0x100, 0x70e, 640, 480, 0x400, 0x1000 },
     { MACFB_DISPLAY_VGA, 4, 0x100, 0x706, 640, 480, 0x400, 0x1000 },
@@ -397,7 +397,7 @@ static void macfb_update_mode(MacfbState *s)
 
 static void macfb_mode_write(MacfbState *s)
 {
-    MacFbMode *macfb_mode;
+    const MacFbMode *macfb_mode;
     int i;
 
     for (i = 0; i < ARRAY_SIZE(macfb_mode_table); i++) {
@@ -418,11 +418,11 @@ static void macfb_mode_write(MacfbState *s)
     }
 }
 
-static MacFbMode *macfb_find_mode(MacfbDisplayType display_type,
+static const MacFbMode *macfb_find_mode(MacfbDisplayType display_type,
                                   uint16_t width, uint16_t height,
                                   uint8_t depth)
 {
-    MacFbMode *macfb_mode;
+    const MacFbMode *macfb_mode;
     int i;
 
     for (i = 0; i < ARRAY_SIZE(macfb_mode_table); i++) {
@@ -440,7 +440,7 @@ static MacFbMode *macfb_find_mode(MacfbDisplayType display_type,
 static gchar *macfb_mode_list(void)
 {
     GString *list = g_string_new("");
-    MacFbMode *macfb_mode;
+    const MacFbMode *macfb_mode;
     int i;
 
     for (i = 0; i < ARRAY_SIZE(macfb_mode_table); i++) {
hw/m68k/q800.c +1 -1
index 25ddddb5d9f..4767eb4298f 100644
@@ -255,7 +255,7 @@ static void q800_machine_init(MachineState *machine)
     int32_t initrd_size;
     uint8_t *prom;
     int i, checksum;
-    MacFbMode *macfb_mode;
+    const MacFbMode *macfb_mode;
     ram_addr_t ram_size = machine->ram_size;
     const char *kernel_filename = machine->kernel_filename;
     const char *initrd_filename = machine->initrd_filename;
Signature · 1 line
2.52.0
Reviewed-by on v1 2/8
#5 lore raw

Re: [PATCH 2/8] hw/display/macfb: Constify macfb_mode_table[] array

Quoted 5 lines · Philippe Mathieu-Daudé

macfb_mode_table[] is only read, never updated, so can be const.

Update the call sites accordingly.
Make the MacfbState::mode pointer to const.

Quoted 7 lines
---
  include/hw/display/macfb.h |  2 +-
  hw/display/macfb.c         | 10 +++++-----
  hw/m68k/q800.c             |  2 +-
  3 files changed, 7 insertions(+), 7 deletions(-)
Reviewed-by on v1 2/8
#6 lore raw

Re: [PATCH 2/8] hw/display/macfb: Constify macfb_mode_table[] array

In reply to Philippe Mathieu-Daudé
Quoted 75 lines · Philippe Mathieu-Daudé

macfb_mode_table[] is only read, never updated, so can be const.

Update the call sites accordingly.
Make the MacfbState::mode pointer to const.

---
  include/hw/display/macfb.h |  2 +-
  hw/display/macfb.c         | 10 +++++-----
  hw/m68k/q800.c             |  2 +-
  3 files changed, 7 insertions(+), 7 deletions(-)
include/hw/display/macfb.h +1 -1
index 495dead44b5..cb7aac7a4dd 100644
@@ -66,7 +66,7 @@ typedef struct MacfbState {
      uint8_t type;
 
      uint32_t regs[MACFB_NUM_REGS];
-    MacFbMode *mode;
+    const MacFbMode *mode;
 
      QEMUTimer *vbl_timer;
      qemu_irq irq;
hw/display/macfb.c +5 -5
index 57ad8ad5587..8ef174dc6df 100644
@@ -100,7 +100,7 @@ static const MacFbSense macfb_sense_table[] = {
      { MACFB_DISPLAY_SVGA, 0x7, 0x5 },
  };
 
-static MacFbMode macfb_mode_table[] = {
+static const MacFbMode macfb_mode_table[] = {
      { MACFB_DISPLAY_VGA, 1, 0x100, 0x71e, 640, 480, 0x400, 0x1000 },
      { MACFB_DISPLAY_VGA, 2, 0x100, 0x70e, 640, 480, 0x400, 0x1000 },
      { MACFB_DISPLAY_VGA, 4, 0x100, 0x706, 640, 480, 0x400, 0x1000 },
@@ -397,7 +397,7 @@ static void macfb_update_mode(MacfbState *s)
 
  static void macfb_mode_write(MacfbState *s)
  {
-    MacFbMode *macfb_mode;
+    const MacFbMode *macfb_mode;
      int i;
 
      for (i = 0; i < ARRAY_SIZE(macfb_mode_table); i++) {
@@ -418,11 +418,11 @@ static void macfb_mode_write(MacfbState *s)
      }
  }
 
-static MacFbMode *macfb_find_mode(MacfbDisplayType display_type,
+static const MacFbMode *macfb_find_mode(MacfbDisplayType display_type,
                                    uint16_t width, uint16_t height,
                                    uint8_t depth)
  {
-    MacFbMode *macfb_mode;
+    const MacFbMode *macfb_mode;
      int i;
 
      for (i = 0; i < ARRAY_SIZE(macfb_mode_table); i++) {
@@ -440,7 +440,7 @@ static MacFbMode *macfb_find_mode(MacfbDisplayType display_type,
  static gchar *macfb_mode_list(void)
  {
      GString *list = g_string_new("");
-    MacFbMode *macfb_mode;
+    const MacFbMode *macfb_mode;
      int i;
 
      for (i = 0; i < ARRAY_SIZE(macfb_mode_table); i++) {
hw/m68k/q800.c +0 -0
index 25ddddb5d9f..4767eb4298f 100644

hw/m68k/q800.c static void q800_machine_init(MachineState *machine) · line 261

Quoted 8 lines
hw/m68k/q800.c +1 -1
@@ -255,7 +255,7 @@ static void q800_machine_init(MachineState *machine)
      int32_t initrd_size;
      uint8_t *prom;
      int i, checksum;
-    MacFbMode *macfb_mode;
+    const MacFbMode *macfb_mode;
      ram_addr_t ram_size = machine->ram_size;
      const char *kernel_filename = machine->kernel_filename;
      const char *initrd_filename = machine->initrd_filename;

ATB,

Mark.

#7 lore raw

PATCH 3/8 hw/m68k/q800: Use MacFbMode fields in q800_machine_init()

In reply to Philippe Mathieu-Daudé

Once the Mac Frame Buffer device is realized on the NuBus, its MacFbMode might be different of the global graphic_depth and graphic_width globals. Prefer the device MacFbMode fields to initialize the BootInfo structure.

---
 hw/m68k/q800.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/m68k/q800.c +2 -2
index 4767eb4298f..b55c03a90bf 100644
@@ -605,9 +605,9 @@ static void q800_machine_init(MachineState *machine)
         BOOTINFO2(param_ptr, BI_MEMCHUNK, 0, ram_size);
         BOOTINFO1(param_ptr, BI_MAC_VADDR,
                   VIDEO_BASE + macfb_mode->offset);
-        BOOTINFO1(param_ptr, BI_MAC_VDEPTH, graphic_depth);
+        BOOTINFO1(param_ptr, BI_MAC_VDEPTH, macfb_mode->depth);
         BOOTINFO1(param_ptr, BI_MAC_VDIM,
-                  (graphic_height << 16) | graphic_width);
+                  (graphic_height << 16) | macfb_mode->width);
         BOOTINFO1(param_ptr, BI_MAC_VROW, macfb_mode->stride);
         BOOTINFO1(param_ptr, BI_MAC_SCCBASE, SCC_BASE);
 
Signature · 1 line
2.52.0
Reviewed-by on v1 3/8
#8 lore raw

Re: [PATCH 3/8] hw/m68k/q800: Use MacFbMode fields in q800_machine_init()

Quoted 10 lines · Philippe Mathieu-Daudé

Once the Mac Frame Buffer device is realized on the NuBus, its MacFbMode might be different of the global graphic_depth and graphic_width globals. Prefer the device MacFbMode fields to initialize the BootInfo structure.

---
  hw/m68k/q800.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
#9 lore raw

Re: [PATCH 3/8] hw/m68k/q800: Use MacFbMode fields in q800_machine_init()

In reply to Philippe Mathieu-Daudé
Quoted 15 lines · Philippe Mathieu-Daudé

Once the Mac Frame Buffer device is realized on the NuBus, its MacFbMode might be different of the global graphic_depth and graphic_width globals. Prefer the device MacFbMode fields to initialize the BootInfo structure.

---
hw/m68k/q800.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
hw/m68k/q800.c +0 -0
index 4767eb4298f..b55c03a90bf 100644

hw/m68k/q800.c static void q800_machine_init(MachineState *machine) · line 612

Quoted 10 lines
hw/m68k/q800.c +2 -2
@@ -605,9 +605,9 @@ static void q800_machine_init(MachineState *machine)
        BOOTINFO2(param_ptr, BI_MEMCHUNK, 0, ram_size);
        BOOTINFO1(param_ptr, BI_MAC_VADDR,
                  VIDEO_BASE + macfb_mode->offset);
-        BOOTINFO1(param_ptr, BI_MAC_VDEPTH, graphic_depth);
+        BOOTINFO1(param_ptr, BI_MAC_VDEPTH, macfb_mode->depth);
        BOOTINFO1(param_ptr, BI_MAC_VDIM,
-                  (graphic_height << 16) | graphic_width);
+                  (graphic_height << 16) | macfb_mode->width);
        BOOTINFO1(param_ptr, BI_MAC_VROW, macfb_mode->stride);
        BOOTINFO1(param_ptr, BI_MAC_SCCBASE, SCC_BASE);

I know nothing about this but the idea is to let the user override graphics resolution via the command line. Would this break that?

Regards,
BALATON Zoltan

Reviewed-by on v1 3/8
#10 lore raw

Re: [PATCH 3/8] hw/m68k/q800: Use MacFbMode fields in q800_machine_init()

In reply to Philippe Mathieu-Daudé
Quoted 15 lines · Philippe Mathieu-Daudé

Once the Mac Frame Buffer device is realized on the NuBus, its MacFbMode might be different of the global graphic_depth and graphic_width globals. Prefer the device MacFbMode fields to initialize the BootInfo structure.

---
  hw/m68k/q800.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/m68k/q800.c +0 -0
index 4767eb4298f..b55c03a90bf 100644

hw/m68k/q800.c static void q800_machine_init(MachineState *machine) · line 612

Quoted 10 lines
hw/m68k/q800.c +2 -2
@@ -605,9 +605,9 @@ static void q800_machine_init(MachineState *machine)
          BOOTINFO2(param_ptr, BI_MEMCHUNK, 0, ram_size);
          BOOTINFO1(param_ptr, BI_MAC_VADDR,
                    VIDEO_BASE + macfb_mode->offset);
-        BOOTINFO1(param_ptr, BI_MAC_VDEPTH, graphic_depth);
+        BOOTINFO1(param_ptr, BI_MAC_VDEPTH, macfb_mode->depth);
          BOOTINFO1(param_ptr, BI_MAC_VDIM,
-                  (graphic_height << 16) | graphic_width);
+                  (graphic_height << 16) | macfb_mode->width);
          BOOTINFO1(param_ptr, BI_MAC_VROW, macfb_mode->stride);
          BOOTINFO1(param_ptr, BI_MAC_SCCBASE, SCC_BASE);

ATB,

Mark.

#11 lore raw

PATCH 4/8 hw/m68k/q800: Set MACFB_DISPLAY_APPLE_21_COLOR within MacFrameBuffer

In reply to Philippe Mathieu-Daudé

The MACFB_DISPLAY_APPLE_21_COLOR mode is not specific to the Q800 machine. Check and set it once in the MacFB DeviceRealize handler.

---
 hw/display/macfb.c | 4 ++++
 hw/m68k/q800.c     | 5 -----
 2 files changed, 4 insertions(+), 5 deletions(-)
hw/display/macfb.c +4 -0
index 8ef174dc6df..b8115c2be13 100644
@@ -645,6 +645,10 @@ static bool macfb_common_realize(DeviceState *dev, MacfbState *s, Error **errp)
 {
     DisplaySurface *surface;
 
+    if (s->width == 1152 && s->height == 870) {
+        s->type = MACFB_DISPLAY_APPLE_21_COLOR;
+    }
+
     s->mode = macfb_find_mode(s->type, s->width, s->height, s->depth);
     if (!s->mode) {
         gchar *list;
hw/m68k/q800.c +0 -5
index b55c03a90bf..ba32da2fa45 100644
@@ -563,11 +563,6 @@ static void q800_machine_init(MachineState *machine)
     qdev_prop_set_uint32(dev, "width", graphic_width);
     qdev_prop_set_uint32(dev, "height", graphic_height);
     qdev_prop_set_uint8(dev, "depth", graphic_depth);
-    if (graphic_width == 1152 && graphic_height == 870) {
-        qdev_prop_set_uint8(dev, "display", MACFB_DISPLAY_APPLE_21_COLOR);
-    } else {
-        qdev_prop_set_uint8(dev, "display", MACFB_DISPLAY_VGA);
-    }
     qdev_realize(dev, BUS(nubus), &error_fatal);
 
     macfb_mode = (NUBUS_MACFB(dev)->macfb).mode;
Signature · 1 line
2.52.0
Reviewed-by on v1 4/8
#12 lore raw

Re: [PATCH 4/8] hw/m68k/q800: Set MACFB_DISPLAY_APPLE_21_COLOR within MacFrameBuffer

Quoted 9 lines · Philippe Mathieu-Daudé

The MACFB_DISPLAY_APPLE_21_COLOR mode is not specific to the Q800 machine. Check and set it once in the MacFB DeviceRealize handler.

---
  hw/display/macfb.c | 4 ++++
  hw/m68k/q800.c     | 5 -----
  2 files changed, 4 insertions(+), 5 deletions(-)
Reviewed-by on v1 4/8
#13 lore raw

Re: [PATCH 4/8] hw/m68k/q800: Set MACFB_DISPLAY_APPLE_21_COLOR within MacFrameBuffer

In reply to Philippe Mathieu-Daudé
Quoted 29 lines · Philippe Mathieu-Daudé

The MACFB_DISPLAY_APPLE_21_COLOR mode is not specific to the Q800 machine. Check and set it once in the MacFB DeviceRealize handler.

---
  hw/display/macfb.c | 4 ++++
  hw/m68k/q800.c     | 5 -----
  2 files changed, 4 insertions(+), 5 deletions(-)
hw/display/macfb.c +4 -0
index 8ef174dc6df..b8115c2be13 100644
@@ -645,6 +645,10 @@ static bool macfb_common_realize(DeviceState *dev, MacfbState *s, Error **errp)
  {
      DisplaySurface *surface;
 
+    if (s->width == 1152 && s->height == 870) {
+        s->type = MACFB_DISPLAY_APPLE_21_COLOR;
+    }
+
      s->mode = macfb_find_mode(s->type, s->width, s->height, s->depth);
      if (!s->mode) {
          gchar *list;
hw/m68k/q800.c +0 -0
index b55c03a90bf..ba32da2fa45 100644

hw/m68k/q800.c static void q800_machine_init(MachineState *machine) · line 569

Quoted 7 lines
hw/m68k/q800.c +0 -4
@@ -563,11 +563,6 @@ static void q800_machine_init(MachineState *machine)
      qdev_prop_set_uint32(dev, "width", graphic_width);
      qdev_prop_set_uint32(dev, "height", graphic_height);
      qdev_prop_set_uint8(dev, "depth", graphic_depth);
-    if (graphic_width == 1152 && graphic_height == 870) {
-        qdev_prop_set_uint8(dev, "display", MACFB_DISPLAY_APPLE_21_COLOR);
-    } else {
-        qdev_prop_set_uint8(dev, "display", MACFB_DISPLAY_VGA);

I was going to ask about what happened to MACFB_DISPLAY_VGA, but it seems to be the default for the macfb device so no problem there.

hw/m68k/q800.c static void q800_machine_init(MachineState *machine) · line 568

Quoted 4 lines
hw/m68k/q800.c +0 -1
-    }
      qdev_realize(dev, BUS(nubus), &error_fatal);
 
      macfb_mode = (NUBUS_MACFB(dev)->macfb).mode;

I'm not sure if 1152x870 is available on all macfb devices (as opposed to just that used on the Quadra), but still for now:

ATB,

Mark.

#14 lore raw

PATCH 5/8 hw/m68k: Set graphic display dimensions generically

In reply to Philippe Mathieu-Daudé

If a dimension is not set, have the machine init code (q800_machine_init) set the default value.

---
 hw/m68k/q800.c          | 6 +++---
 system/globals-target.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
hw/m68k/q800.c +3 -3
index ba32da2fa45..ded531394e6 100644
@@ -560,9 +560,9 @@ static void q800_machine_init(MachineState *machine)
                             TYPE_NUBUS_MACFB);
     dev = DEVICE(&m->macfb);
     qdev_prop_set_uint32(dev, "slot", 9);
-    qdev_prop_set_uint32(dev, "width", graphic_width);
-    qdev_prop_set_uint32(dev, "height", graphic_height);
-    qdev_prop_set_uint8(dev, "depth", graphic_depth);
+    qdev_prop_set_uint32(dev, "width", graphic_width ?: 800);
+    qdev_prop_set_uint32(dev, "height", graphic_height ?: 600);
+    qdev_prop_set_uint8(dev, "depth", graphic_depth ?: 8);
     qdev_realize(dev, BUS(nubus), &error_fatal);
 
     macfb_mode = (NUBUS_MACFB(dev)->macfb).mode;
system/globals-target.c +3 -3
index 989720591e7..e3f7d846ac0 100644
@@ -14,9 +14,9 @@ int graphic_width = 1024;
 int graphic_height = 768;
 int graphic_depth = 8;
 #elif defined(TARGET_M68K)
-int graphic_width = 800;
-int graphic_height = 600;
-int graphic_depth = 8;
+int graphic_width;
+int graphic_height;
+int graphic_depth;
 #else
 int graphic_width = 800;
 int graphic_height = 600;
Signature · 1 line
2.52.0
Reviewed-by on v1 5/8
#15 lore raw

Re: [PATCH 5/8] hw/m68k: Set graphic display dimensions generically

Quoted 9 lines · Philippe Mathieu-Daudé

If a dimension is not set, have the machine init code (q800_machine_init) set the default value.

---
  hw/m68k/q800.c          | 6 +++---
  system/globals-target.c | 6 +++---
  2 files changed, 6 insertions(+), 6 deletions(-)
Reviewed-by on v1 5/8
#16 lore raw

Re: [PATCH 5/8] hw/m68k: Set graphic display dimensions generically

In reply to Philippe Mathieu-Daudé
Quoted 33 lines · Philippe Mathieu-Daudé

If a dimension is not set, have the machine init code (q800_machine_init) set the default value.

---
  hw/m68k/q800.c          | 6 +++---
  system/globals-target.c | 6 +++---
  2 files changed, 6 insertions(+), 6 deletions(-)
hw/m68k/q800.c +3 -3
index ba32da2fa45..ded531394e6 100644
@@ -560,9 +560,9 @@ static void q800_machine_init(MachineState *machine)
                              TYPE_NUBUS_MACFB);
      dev = DEVICE(&m->macfb);
      qdev_prop_set_uint32(dev, "slot", 9);
-    qdev_prop_set_uint32(dev, "width", graphic_width);
-    qdev_prop_set_uint32(dev, "height", graphic_height);
-    qdev_prop_set_uint8(dev, "depth", graphic_depth);
+    qdev_prop_set_uint32(dev, "width", graphic_width ?: 800);
+    qdev_prop_set_uint32(dev, "height", graphic_height ?: 600);
+    qdev_prop_set_uint8(dev, "depth", graphic_depth ?: 8);
      qdev_realize(dev, BUS(nubus), &error_fatal);
 
      macfb_mode = (NUBUS_MACFB(dev)->macfb).mode;
system/globals-target.c +0 -0
index 989720591e7..e3f7d846ac0 100644
@@ -14,9 +14,9 @@ int graphic_width = 1024;
  int graphic_height = 768;
  int graphic_depth = 8;

system/globals-target.c int graphic_width = 1024; · line 22

Quoted 10 lines
system/globals-target.c +3 -3
  #elif defined(TARGET_M68K)
-int graphic_width = 800;
-int graphic_height = 600;
-int graphic_depth = 8;
+int graphic_width;
+int graphic_height;
+int graphic_depth;
  #else
  int graphic_width = 800;
  int graphic_height = 600;

ATB,

Mark.

#17 lore raw

PATCH 6/8 hw/sparc: Set graphic display dimensions generically

In reply to Philippe Mathieu-Daudé

If a dimension is not set, have the machine init code set the default value.

---
 hw/sparc/sun4m.c        |  9 +++++++++
 hw/sparc64/sun4u.c      | 10 ++++++++++
 system/globals-target.c |  6 +-----
 3 files changed, 20 insertions(+), 5 deletions(-)
hw/sparc/sun4m.c +9 -0
index 0c0d658d301..a17bdb36927 100644
@@ -892,6 +892,15 @@ static void sun4m_hw_init(MachineState *machine)
                      hwdef->esp_base, slavio_irq[18],
                      hwdef->le_base, slavio_irq[16], &hostid);
 
+    if (!graphic_width) {
+        graphic_width = 1024;
+    }
+    if (!graphic_height) {
+        graphic_height = 768;
+    }
+    if (!graphic_depth) {
+        graphic_depth = 8;
+    }
     if (graphic_depth != 8 && graphic_depth != 24) {
         error_report("Unsupported depth: %d", graphic_depth);
         exit (1);
hw/sparc64/sun4u.c +10 -0
index 5d7787fc1a5..b8bda1eb816 100644
@@ -666,6 +666,16 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
                                 sysbus_mmio_get_region(s, 0));
     nvram = NVRAM(dev);
  
+    if (!graphic_width) {
+        graphic_width = 1024;
+    }
+    if (!graphic_height) {
+        graphic_height = 768;
+    }
+    if (!graphic_depth) {
+        graphic_depth = 8;
+    }
+
     initrd_size = 0;
     initrd_addr = 0;
     kernel_size = sun4u_load_kernel(machine->kernel_filename,
system/globals-target.c +1 -5
index e3f7d846ac0..17a27a06218 100644
@@ -9,11 +9,7 @@
 #include "qemu/osdep.h"
 #include "system/system.h"
 
-#ifdef TARGET_SPARC
-int graphic_width = 1024;
-int graphic_height = 768;
-int graphic_depth = 8;
-#elif defined(TARGET_M68K)
+#if defined(TARGET_SPARC) || defined(TARGET_M68K)
 int graphic_width;
 int graphic_height;
 int graphic_depth;
Signature · 1 line
2.52.0
Reviewed-by on v1 6/8
#18 lore raw

Re: [PATCH 6/8] hw/sparc: Set graphic display dimensions generically

Quoted 10 lines · Philippe Mathieu-Daudé

If a dimension is not set, have the machine init code set the default value.

---
  hw/sparc/sun4m.c        |  9 +++++++++
  hw/sparc64/sun4u.c      | 10 ++++++++++
  system/globals-target.c |  6 +-----
  3 files changed, 20 insertions(+), 5 deletions(-)
Reviewed-by on v1 6/8
#19 lore raw

Re: [PATCH 6/8] hw/sparc: Set graphic display dimensions generically

In reply to Philippe Mathieu-Daudé
Quoted 58 lines · Philippe Mathieu-Daudé

If a dimension is not set, have the machine init code set the default value.

---
  hw/sparc/sun4m.c        |  9 +++++++++
  hw/sparc64/sun4u.c      | 10 ++++++++++
  system/globals-target.c |  6 +-----
  3 files changed, 20 insertions(+), 5 deletions(-)
hw/sparc/sun4m.c +9 -0
index 0c0d658d301..a17bdb36927 100644
@@ -892,6 +892,15 @@ static void sun4m_hw_init(MachineState *machine)
                       hwdef->esp_base, slavio_irq[18],
                       hwdef->le_base, slavio_irq[16], &hostid);
 
+    if (!graphic_width) {
+        graphic_width = 1024;
+    }
+    if (!graphic_height) {
+        graphic_height = 768;
+    }
+    if (!graphic_depth) {
+        graphic_depth = 8;
+    }
      if (graphic_depth != 8 && graphic_depth != 24) {
          error_report("Unsupported depth: %d", graphic_depth);
          exit (1);
hw/sparc64/sun4u.c +10 -0
index 5d7787fc1a5..b8bda1eb816 100644
@@ -666,6 +666,16 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
                                  sysbus_mmio_get_region(s, 0));
      nvram = NVRAM(dev);
 
+    if (!graphic_width) {
+        graphic_width = 1024;
+    }
+    if (!graphic_height) {
+        graphic_height = 768;
+    }
+    if (!graphic_depth) {
+        graphic_depth = 8;
+    }
+
      initrd_size = 0;
      initrd_addr = 0;
      kernel_size = sun4u_load_kernel(machine->kernel_filename,
system/globals-target.c +0 -0
index e3f7d846ac0..17a27a06218 100644
@@ -9,11 +9,7 @@
  #include "qemu/osdep.h"
  #include "system/system.h"

system/globals-target.c line 15

Quoted 10 lines
system/globals-target.c +1 -5
 
-#ifdef TARGET_SPARC
-int graphic_width = 1024;
-int graphic_height = 768;
-int graphic_depth = 8;
-#elif defined(TARGET_M68K)
+#if defined(TARGET_SPARC) || defined(TARGET_M68K)
  int graphic_width;
  int graphic_height;
  int graphic_depth;

ATB,

Mark.

#20 lore raw

PATCH 7/8 hw/ppc: Set graphic display dimensions generically

In reply to Philippe Mathieu-Daudé

If a dimension is not set, have the machine init code set the default value by calling the ppc_graphic_dimensions() helper, common to all PowerPC machines. Declare local variables to avoid using the global ones.

---
 include/hw/ppc/ppc.h    |  2 ++
 hw/ppc/mac_newworld.c   | 10 ++++++----
 hw/ppc/mac_oldworld.c   | 10 ++++++----
 hw/ppc/ppc.c            |  8 ++++++++
 hw/ppc/prep.c           |  4 ++++
 hw/ppc/spapr.c          |  4 ++++
 system/globals-target.c |  6 ------
 7 files changed, 30 insertions(+), 14 deletions(-)
include/hw/ppc/ppc.h +2 -0
index cb51d704c6d..14cc09ab22b 100644
@@ -102,6 +102,8 @@ enum {
     ARCH_MAC99_U3,
 };
 
+void ppc_graphic_dimensions(int *width, int *height, int *depth);
+
 #define FW_CFG_PPC_WIDTH        (FW_CFG_ARCH_LOCAL + 0x00)
 #define FW_CFG_PPC_HEIGHT       (FW_CFG_ARCH_LOCAL + 0x01)
 #define FW_CFG_PPC_DEPTH        (FW_CFG_ARCH_LOCAL + 0x02)
hw/ppc/mac_newworld.c +6 -4
index 7275563a155..daf0029c01a 100644
@@ -156,6 +156,7 @@ static void ppc_core99_init(MachineState *machine)
     DeviceState *uninorth_internal_dev = NULL, *uninorth_agp_dev = NULL;
     hwaddr nvram_addr = 0xFFF04000;
     uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
+    int graphic_width, graphic_height, graphic_depth;
 
     /* init CPUs */
     for (i = 0; i < machine->smp.cpus; i++) {
@@ -432,10 +433,6 @@ static void ppc_core99_init(MachineState *machine)
 
     pci_vga_init(pci_bus);
 
-    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
-        graphic_depth = 15;
-    }
-
     pci_init_nic_devices(pci_bus, mc->default_nic);
 
     /* The NewWorld NVRAM is not located in the MacIO device */
@@ -480,6 +477,11 @@ static void ppc_core99_init(MachineState *machine)
     fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
     fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device);
 
+    ppc_graphic_dimensions(&graphic_width, &graphic_height, &graphic_depth);
+    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
+        graphic_depth = 15;
+    }
+
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
hw/ppc/mac_oldworld.c +6 -4
index e679d338985..ea1f778877c 100644
@@ -108,6 +108,7 @@ static void ppc_heathrow_init(MachineState *machine)
     DriveInfo *dinfo, *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
     void *fw_cfg;
     uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
+    int graphic_width, graphic_height, graphic_depth;
 
     /* init CPUs */
     for (i = 0; i < machine->smp.cpus; i++) {
@@ -288,10 +289,6 @@ static void ppc_heathrow_init(MachineState *machine)
         pci_create_simple(pci_bus, -1, "pci-ohci");
     }
 
-    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
-        graphic_depth = 15;
-    }
-
     /* No PCI init: the BIOS will do it */
 
     dev = qdev_new(TYPE_FW_CFG_MEM);
@@ -321,6 +318,11 @@ static void ppc_heathrow_init(MachineState *machine)
     fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
     fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device);
 
+    ppc_graphic_dimensions(&graphic_width, &graphic_height, &graphic_depth);
+    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
+        graphic_depth = 15;
+    }
+
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
hw/ppc/ppc.c +8 -0
index a512d4fa647..d7b4466d701 100644
@@ -29,6 +29,7 @@
 #include "qemu/timer.h"
 #include "exec/cpu-interrupt.h"
 #include "system/cpus.h"
+#include "system/system.h"
 #include "qemu/log.h"
 #include "qemu/main-loop.h"
 #include "qemu/error-report.h"
@@ -1557,3 +1558,10 @@ void ppc_irq_reset(PowerPCCPU *cpu)
         kvmppc_set_interrupt(cpu, PPC_INTERRUPT_EXT, 0);
     }
 }
+
+void ppc_graphic_dimensions(int *width, int *height, int *depth)
+{
+    *width = graphic_width ?: 800;
+    *height = graphic_height ?: 600;
+    *depth = graphic_depth ?: 32;
+}
hw/ppc/prep.c +4 -0
index c4efd1d3908..7077b047b25 100644
@@ -43,6 +43,7 @@
 #include "exec/target_page.h"
 #include "system/kvm.h"
 #include "system/reset.h"
+#include "system/system.h"
 #include "trace.h"
 #include "elf.h"
 #include "qemu/units.h"
@@ -250,6 +251,7 @@ static void ibm_40p_init(MachineState *machine)
     uint32_t kernel_base = 0, initrd_base = 0;
     long kernel_size = 0, initrd_size = 0;
     char boot_device;
+    int graphic_width, graphic_height, graphic_depth;
 
     if (kvm_enabled()) {
         error_report("machine %s does not support the KVM accelerator",
@@ -412,6 +414,8 @@ static void ibm_40p_init(MachineState *machine)
     fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size);
     fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_PREP);
 
+    ppc_graphic_dimensions(&graphic_width, &graphic_height, &graphic_depth);
+
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
hw/ppc/spapr.c +4 -0
index 274f38785f2..c50c7da34d5 100644
@@ -1143,6 +1143,7 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset)
 {
     MachineState *machine = MACHINE(spapr);
     int chosen;
+    int graphic_width, graphic_height, graphic_depth;
 
     _FDT(chosen = fdt_add_subnode(fdt, 0, "chosen"));
 
@@ -1177,6 +1178,9 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset)
         if (machine->boot_config.has_menu && machine->boot_config.menu) {
             _FDT((fdt_setprop_cell(fdt, chosen, "qemu,boot-menu", true)));
         }
+
+        ppc_graphic_dimensions(&graphic_width, &graphic_height, &graphic_depth);
+
         _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-width", graphic_width));
         _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-height", graphic_height));
         _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-depth", graphic_depth));
system/globals-target.c +0 -6
index 17a27a06218..ffa6c308b59 100644
@@ -9,12 +9,6 @@
 #include "qemu/osdep.h"
 #include "system/system.h"
 
-#if defined(TARGET_SPARC) || defined(TARGET_M68K)
 int graphic_width;
 int graphic_height;
 int graphic_depth;
-#else
-int graphic_width = 800;
-int graphic_height = 600;
-int graphic_depth = 32;
-#endif
Signature · 1 line
2.52.0
Reviewed-by on v1 7/8
#21 lore raw

Re: [PATCH 7/8] hw/ppc: Set graphic display dimensions generically

Quoted 6 lines · Philippe Mathieu-Daudé

If a dimension is not set, have the machine init code set the default value by calling the ppc_graphic_dimensions() helper, common to all PowerPC machines. Declare local variables to avoid using the global ones.

Quoted 10 lines
---
  include/hw/ppc/ppc.h    |  2 ++
  hw/ppc/mac_newworld.c   | 10 ++++++----
  hw/ppc/mac_oldworld.c   | 10 ++++++----
  hw/ppc/ppc.c            |  8 ++++++++
  hw/ppc/prep.c           |  4 ++++
  hw/ppc/spapr.c          |  4 ++++
  system/globals-target.c |  6 ------
  7 files changed, 30 insertions(+), 14 deletions(-)
#22 lore raw

Re: [PATCH 7/8] hw/ppc: Set graphic display dimensions generically

In reply to Philippe Mathieu-Daudé
Quoted 112 lines · Philippe Mathieu-Daudé

If a dimension is not set, have the machine init code set the default value by calling the ppc_graphic_dimensions() helper, common to all PowerPC machines. Declare local variables to avoid using the global ones.

---

include/hw/ppc/ppc.h    |  2 ++
hw/ppc/mac_newworld.c   | 10 ++++++----
hw/ppc/mac_oldworld.c   | 10 ++++++----
hw/ppc/ppc.c            |  8 ++++++++
hw/ppc/prep.c           |  4 ++++
hw/ppc/spapr.c          |  4 ++++
system/globals-target.c |  6 ------
7 files changed, 30 insertions(+), 14 deletions(-)
include/hw/ppc/ppc.h +2 -0
index cb51d704c6d..14cc09ab22b 100644
@@ -102,6 +102,8 @@ enum {
    ARCH_MAC99_U3,
 };
 
+void ppc_graphic_dimensions(int *width, int *height, int *depth);
+
 #define FW_CFG_PPC_WIDTH        (FW_CFG_ARCH_LOCAL + 0x00)
 #define FW_CFG_PPC_HEIGHT       (FW_CFG_ARCH_LOCAL + 0x01)
 #define FW_CFG_PPC_DEPTH        (FW_CFG_ARCH_LOCAL + 0x02)
hw/ppc/mac_newworld.c +6 -4
index 7275563a155..daf0029c01a 100644
@@ -156,6 +156,7 @@ static void ppc_core99_init(MachineState *machine)
    DeviceState *uninorth_internal_dev = NULL, *uninorth_agp_dev = NULL;
    hwaddr nvram_addr = 0xFFF04000;
    uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
+    int graphic_width, graphic_height, graphic_depth;
 
    /* init CPUs */
    for (i = 0; i < machine->smp.cpus; i++) {
@@ -432,10 +433,6 @@ static void ppc_core99_init(MachineState *machine)
 
    pci_vga_init(pci_bus);
 
-    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
-        graphic_depth = 15;
-    }
-
    pci_init_nic_devices(pci_bus, mc->default_nic);
 
    /* The NewWorld NVRAM is not located in the MacIO device */
@@ -480,6 +477,11 @@ static void ppc_core99_init(MachineState *machine)
    fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
    fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device);
 
+    ppc_graphic_dimensions(&graphic_width, &graphic_height, &graphic_depth);
+    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
+        graphic_depth = 15;
+    }
+
    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
hw/ppc/mac_oldworld.c +6 -4
index e679d338985..ea1f778877c 100644
@@ -108,6 +108,7 @@ static void ppc_heathrow_init(MachineState *machine)
    DriveInfo *dinfo, *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
    void *fw_cfg;
    uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
+    int graphic_width, graphic_height, graphic_depth;
 
    /* init CPUs */
    for (i = 0; i < machine->smp.cpus; i++) {
@@ -288,10 +289,6 @@ static void ppc_heathrow_init(MachineState *machine)
        pci_create_simple(pci_bus, -1, "pci-ohci");
    }
 
-    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
-        graphic_depth = 15;
-    }
-
    /* No PCI init: the BIOS will do it */
 
    dev = qdev_new(TYPE_FW_CFG_MEM);
@@ -321,6 +318,11 @@ static void ppc_heathrow_init(MachineState *machine)
    fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
    fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device);
 
+    ppc_graphic_dimensions(&graphic_width, &graphic_height, &graphic_depth);
+    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
+        graphic_depth = 15;
+    }
+
    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
hw/ppc/ppc.c +1 -0
index a512d4fa647..d7b4466d701 100644
@@ -29,6 +29,7 @@
 #include "qemu/timer.h"
 #include "exec/cpu-interrupt.h"
 #include "system/cpus.h"
+#include "system/system.h"
 #include "qemu/log.h"
 #include "qemu/main-loop.h"
 #include "qemu/error-report.h"

hw/ppc/ppc.c void ppc_irq_reset(PowerPCCPU *cpu) · line 1567

Quoted 10 lines
hw/ppc/ppc.c +7 -0
@@ -1557,3 +1558,10 @@ void ppc_irq_reset(PowerPCCPU *cpu)
        kvmppc_set_interrupt(cpu, PPC_INTERRUPT_EXT, 0);
    }
 }
+
+void ppc_graphic_dimensions(int *width, int *height, int *depth)
+{
+    *width = graphic_width ?: 800;
+    *height = graphic_height ?: 600;
+    *depth = graphic_depth ?: 32;
+}

I think there's no reason to have this common to all ppc machines. If we change this we could also make it per machine like for other targets. There's nothing common in these machines that dictate these defaults. It seems it used to be an arbitrary default in QEMU that some machines later deviated from. So might as well just keep it as global for now after you removed the SPARC and M68K special cases. If the ppc machines are the last users of these global defaults you can just move them to hw/ppc/ppc.{h,c} for now and let ppc people clean this up eventually.

Regards,
BALATON Zoltan

Quoted 69 lines
hw/ppc/prep.c +4 -0
index c4efd1d3908..7077b047b25 100644
@@ -43,6 +43,7 @@
 #include "exec/target_page.h"
 #include "system/kvm.h"
 #include "system/reset.h"
+#include "system/system.h"
 #include "trace.h"
 #include "elf.h"
 #include "qemu/units.h"
@@ -250,6 +251,7 @@ static void ibm_40p_init(MachineState *machine)
    uint32_t kernel_base = 0, initrd_base = 0;
    long kernel_size = 0, initrd_size = 0;
    char boot_device;
+    int graphic_width, graphic_height, graphic_depth;
 
    if (kvm_enabled()) {
        error_report("machine %s does not support the KVM accelerator",
@@ -412,6 +414,8 @@ static void ibm_40p_init(MachineState *machine)
    fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size);
    fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_PREP);
 
+    ppc_graphic_dimensions(&graphic_width, &graphic_height, &graphic_depth);
+
    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
hw/ppc/spapr.c +4 -0
index 274f38785f2..c50c7da34d5 100644
@@ -1143,6 +1143,7 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset)
 {
    MachineState *machine = MACHINE(spapr);
    int chosen;
+    int graphic_width, graphic_height, graphic_depth;
 
    _FDT(chosen = fdt_add_subnode(fdt, 0, "chosen"));
 
@@ -1177,6 +1178,9 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset)
        if (machine->boot_config.has_menu && machine->boot_config.menu) {
            _FDT((fdt_setprop_cell(fdt, chosen, "qemu,boot-menu", true)));
        }
+
+        ppc_graphic_dimensions(&graphic_width, &graphic_height, &graphic_depth);
+
        _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-width", graphic_width));
        _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-height", graphic_height));
        _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-depth", graphic_depth));
system/globals-target.c +0 -6
index 17a27a06218..ffa6c308b59 100644
@@ -9,12 +9,6 @@
 #include "qemu/osdep.h"
 #include "system/system.h"
 
-#if defined(TARGET_SPARC) || defined(TARGET_M68K)
 int graphic_width;
 int graphic_height;
 int graphic_depth;
-#else
-int graphic_width = 800;
-int graphic_height = 600;
-int graphic_depth = 32;
-#endif
#23 lore raw

Re: [PATCH 7/8] hw/ppc: Set graphic display dimensions generically

Hi Zoltan,

Quoted 123 lines · BALATON Zoltan
Quoted 122 lines · Philippe Mathieu-Daudé

If a dimension is not set, have the machine init code set the default value by calling the ppc_graphic_dimensions() helper, common to all PowerPC machines. Declare local variables to avoid using the global ones.

---
include/hw/ppc/ppc.h    |  2 ++
hw/ppc/mac_newworld.c   | 10 ++++++----
hw/ppc/mac_oldworld.c   | 10 ++++++----
hw/ppc/ppc.c            |  8 ++++++++
hw/ppc/prep.c           |  4 ++++
hw/ppc/spapr.c          |  4 ++++
system/globals-target.c |  6 ------

7 files changed, 30 insertions(+), 14 deletions(-)
include/hw/ppc/ppc.h +2 -0
index cb51d704c6d..14cc09ab22b 100644
@@ -102,6 +102,8 @@ enum {
     ARCH_MAC99_U3,
 };
 
+void ppc_graphic_dimensions(int *width, int *height, int *depth);
+
 #define FW_CFG_PPC_WIDTH        (FW_CFG_ARCH_LOCAL + 0x00)
 #define FW_CFG_PPC_HEIGHT       (FW_CFG_ARCH_LOCAL + 0x01)
 #define FW_CFG_PPC_DEPTH        (FW_CFG_ARCH_LOCAL + 0x02)
hw/ppc/mac_newworld.c +1 -4
index 7275563a155..daf0029c01a 100644
@@ -156,6 +156,7 @@ static void ppc_core99_init(MachineState *machine)
     DeviceState *uninorth_internal_dev = NULL, *uninorth_agp_dev = NULL;
     hwaddr nvram_addr = 0xFFF04000;
     uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
+    int graphic_width, graphic_height, graphic_depth;
 
     /* init CPUs */
     for (i = 0; i < machine->smp.cpus; i++) {
@@ -432,10 +433,6 @@ static void ppc_core99_init(MachineState *machine)
 
     pci_vga_init(pci_bus);
 
-    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth ! 
 = 8) {
-        graphic_depth = 15;
-    }
-
     pci_init_nic_devices(pci_bus, mc->default_nic);
 

    /* The NewWorld NVRAM is not located in the MacIO device */

hw/ppc/mac_newworld.c +5 -0
@@ -480,6 +477,11 @@ static void ppc_core99_init(MachineState *machine)
     fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
     fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device);
 
+    ppc_graphic_dimensions(&graphic_width, &graphic_height, 
 &graphic_depth);
+    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth ! 
 = 8) {
+        graphic_depth = 15;
+    }
+
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);

    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);

hw/ppc/mac_oldworld.c +1 -4
index e679d338985..ea1f778877c 100644
@@ -108,6 +108,7 @@ static void ppc_heathrow_init(MachineState *machine)
     DriveInfo *dinfo, *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
     void *fw_cfg;
     uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
+    int graphic_width, graphic_height, graphic_depth;
 
     /* init CPUs */
     for (i = 0; i < machine->smp.cpus; i++) {
@@ -288,10 +289,6 @@ static void ppc_heathrow_init(MachineState *machine)
         pci_create_simple(pci_bus, -1, "pci-ohci");
     }
 
-    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth ! 
 = 8) {
-        graphic_depth = 15;
-    }
-
     /* No PCI init: the BIOS will do it */
 

    dev = qdev_new(TYPE_FW_CFG_MEM);

hw/ppc/mac_oldworld.c +5 -0
@@ -321,6 +318,11 @@ static void ppc_heathrow_init(MachineState *machine)
     fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
     fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device);
 
+    ppc_graphic_dimensions(&graphic_width, &graphic_height, 
 &graphic_depth);
+    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth ! 
 = 8) {
+        graphic_depth = 15;
+    }
+
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);

    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);

hw/ppc/ppc.c +2 -0
index a512d4fa647..d7b4466d701 100644
@@ -29,6 +29,7 @@
 #include "qemu/timer.h"
 #include "exec/cpu-interrupt.h"
 #include "system/cpus.h"
+#include "system/system.h"
 #include "qemu/log.h"
 #include "qemu/main-loop.h"
 #include "qemu/error-report.h"
@@ -1557,3 +1558,10 @@ void ppc_irq_reset(PowerPCCPU *cpu)
         kvmppc_set_interrupt(cpu, PPC_INTERRUPT_EXT, 0);
     }
 }
+
Quoted 8 lines

hw/ppc/ppc.c void ppc_irq_reset(PowerPCCPU *cpu) · line 1567

Quoted 6 lines
hw/ppc/ppc.c +6 -0
+void ppc_graphic_dimensions(int *width, int *height, int *depth)
+{
+    *width = graphic_width ?: 800;
+    *height = graphic_height ?: 600;
+    *depth = graphic_depth ?: 32;
+}

I think there's no reason to have this common to all ppc machines. If we change this we could also make it per machine like for other targets. There's nothing common in these machines that dictate these defaults. It seems it used to be an arbitrary default in QEMU that some machines later deviated from. So might as well just keep it as global for now after you removed the SPARC and M68K special cases. If the ppc machines are the last users of these global defaults you can just move them to hw/ppc/ppc.{h,c} for now and let ppc people clean this up eventually.

What you are asking is to use 800x600x32 as the default for all non-SPARC / non-M68K targets, so PPC don't have to change? But then SPARC and M68k won't be able to use the '-g' CLI (which Paolo asked me not to remove, thus this series). What is worrying you exactly? Can you provide a patch showing how you'd prefer it to be done?

Thanks,

Phil.

#24 lore raw

Re: [PATCH 7/8] hw/ppc: Set graphic display dimensions generically

Quoted 133 lines · Philippe Mathieu-Daudé
Quoted 123 lines · BALATON Zoltan
Quoted 122 lines · Philippe Mathieu-Daudé

If a dimension is not set, have the machine init code set the default value by calling the ppc_graphic_dimensions() helper, common to all PowerPC machines. Declare local variables to avoid using the global ones.

---
include/hw/ppc/ppc.h    |  2 ++
hw/ppc/mac_newworld.c   | 10 ++++++----
hw/ppc/mac_oldworld.c   | 10 ++++++----
hw/ppc/ppc.c            |  8 ++++++++
hw/ppc/prep.c           |  4 ++++
hw/ppc/spapr.c          |  4 ++++
system/globals-target.c |  6 ------

7 files changed, 30 insertions(+), 14 deletions(-)
include/hw/ppc/ppc.h +2 -0
index cb51d704c6d..14cc09ab22b 100644
@@ -102,6 +102,8 @@ enum {
     ARCH_MAC99_U3,
 };
 
+void ppc_graphic_dimensions(int *width, int *height, int *depth);
+
 #define FW_CFG_PPC_WIDTH        (FW_CFG_ARCH_LOCAL + 0x00)
 #define FW_CFG_PPC_HEIGHT       (FW_CFG_ARCH_LOCAL + 0x01)
 #define FW_CFG_PPC_DEPTH        (FW_CFG_ARCH_LOCAL + 0x02)
hw/ppc/mac_newworld.c +1 -4
index 7275563a155..daf0029c01a 100644
@@ -156,6 +156,7 @@ static void ppc_core99_init(MachineState *machine)
     DeviceState *uninorth_internal_dev = NULL, *uninorth_agp_dev = NULL;
     hwaddr nvram_addr = 0xFFF04000;
     uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
+    int graphic_width, graphic_height, graphic_depth;
 
     /* init CPUs */
     for (i = 0; i < machine->smp.cpus; i++) {
@@ -432,10 +433,6 @@ static void ppc_core99_init(MachineState *machine)
 
     pci_vga_init(pci_bus);
 
-    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth ! = 
 8) {
-        graphic_depth = 15;
-    }
-
     pci_init_nic_devices(pci_bus, mc->default_nic);
 

    /* The NewWorld NVRAM is not located in the MacIO device */

hw/ppc/mac_newworld.c +5 -0
@@ -480,6 +477,11 @@ static void ppc_core99_init(MachineState *machine)
     fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
     fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device);
 
+    ppc_graphic_dimensions(&graphic_width, &graphic_height, 
 &graphic_depth);
+    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth ! = 
 8) {
+        graphic_depth = 15;
+    }
+
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);

    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);

hw/ppc/mac_oldworld.c +1 -4
index e679d338985..ea1f778877c 100644
@@ -108,6 +108,7 @@ static void ppc_heathrow_init(MachineState *machine)
     DriveInfo *dinfo, *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
     void *fw_cfg;
     uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
+    int graphic_width, graphic_height, graphic_depth;
 
     /* init CPUs */
     for (i = 0; i < machine->smp.cpus; i++) {
@@ -288,10 +289,6 @@ static void ppc_heathrow_init(MachineState *machine)
         pci_create_simple(pci_bus, -1, "pci-ohci");
     }
 
-    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth ! = 
 8) {
-        graphic_depth = 15;
-    }
-
     /* No PCI init: the BIOS will do it */
 

    dev = qdev_new(TYPE_FW_CFG_MEM);

hw/ppc/mac_oldworld.c +5 -0
@@ -321,6 +318,11 @@ static void ppc_heathrow_init(MachineState *machine)
     fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
     fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device);
 
+    ppc_graphic_dimensions(&graphic_width, &graphic_height, 
 &graphic_depth);
+    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth ! = 
 8) {
+        graphic_depth = 15;
+    }
+
     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);

    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);

hw/ppc/ppc.c +2 -0
index a512d4fa647..d7b4466d701 100644
@@ -29,6 +29,7 @@
 #include "qemu/timer.h"
 #include "exec/cpu-interrupt.h"
 #include "system/cpus.h"
+#include "system/system.h"
 #include "qemu/log.h"
 #include "qemu/main-loop.h"
 #include "qemu/error-report.h"
@@ -1557,3 +1558,10 @@ void ppc_irq_reset(PowerPCCPU *cpu)
         kvmppc_set_interrupt(cpu, PPC_INTERRUPT_EXT, 0);
     }
 }
+
Quoted 8 lines

hw/ppc/ppc.c void ppc_irq_reset(PowerPCCPU *cpu) · line 1567

Quoted 6 lines
hw/ppc/ppc.c +6 -0
+void ppc_graphic_dimensions(int *width, int *height, int *depth)
+{
+    *width = graphic_width ?: 800;
+    *height = graphic_height ?: 600;
+    *depth = graphic_depth ?: 32;
+}

I think there's no reason to have this common to all ppc machines. If we change this we could also make it per machine like for other targets. There's nothing common in these machines that dictate these defaults. It seems it used to be an arbitrary default in QEMU that some machines later deviated from. So might as well just keep it as global for now after you removed the SPARC and M68K special cases. If the ppc machines are the last users of these global defaults you can just move them to hw/ppc/ppc.{h,c} for now and let ppc people clean this up eventually.

Quoted 2 lines

What you are asking is to use 800x600x32 as the default for all non-SPARC / non-M68K targets, so PPC don't have to change? But then

This is what the original code did. But now I get that you need a way to tell if these were set so changed the default to 0 so the sparc and m68k can set their own defaults if the user did not provide values.

Quoted 2 lines

SPARC and M68k won't be able to use the '-g' CLI (which Paolo asked me not to remove, thus this series). What is worrying you exactly?

Too much churn and introducing interdependency between ppc machines that should be removed later. The ppc_graphic_dimensions does not make sense as these are different machines with potentially different default resolutions (and most of these should be able to use EDID that we since have in QEMU).

Quoted 1 line

Can you provide a patch showing how you'd prefer it to be done?

Maybe turning these into properties could work. I could look at adding such properties but don't know how to change the -g option. But considering these are all machines that Mark maintains maybe he should do something about it. The easiest were if he agreed to drop -g option but he never agrees removing anything so then he should provide patches to clean this up the way he prefers. I could try to make patches but I'm afraid those would become wasted effort so may I only do it when there's an approved way that will be accepted.

Regards,
BALATON Zoltan

#25 lore raw

Re: [PATCH 7/8] hw/ppc: Set graphic display dimensions generically

Quoted 1 line · BALATON Zoltan

Maybe turning these into properties could work. I could look at adding such properties but don't know how to change the -g option. But considering these are all machines that Mark maintains maybe he should do something about it. The easiest were if he agreed to drop -g option but he never agrees removing anything so then he should provide patches to clean this up the way he prefers. I could try to make patches but I'm afraid those would become wasted effort so may I only do it when there's an approved way that will be accepted.

I don't think these types of snide comment are appropriate.

ATB,

Mark.

#26 lore raw

Re: [PATCH 7/8] hw/ppc: Set graphic display dimensions generically

Quoted 5 lines · Mark Cave-Ayland
Quoted 1 line · BALATON Zoltan

Maybe turning these into properties could work. I could look at adding such properties but don't know how to change the -g option. But considering these are all machines that Mark maintains maybe he should do something about it. The easiest were if he agreed to drop -g option but he never agrees removing anything so then he should provide patches to clean this up the way he prefers. I could try to make patches but I'm afraid those would become wasted effort so may I only do it when there's an approved way that will be accepted.

I don't think these types of snide comment are appropriate.

Sorry, this is just my experience so far with patches that touch files you maintain. Last example is trying to change Sun machines to not use global vmstate that could have been done to clean this up and bring it in line with everyting else as these Sun machines are the last active user of this and have no migration guarantee but you insisted to keep it until the last possible minute. I did not mean to offend you, just wanted to say that since whatever I submit usually does not meet your preferred way it's best if I don't try to make patches that then would be discarded because you want something else and you should at lest tell in advance what would be your preference here.

Regards,
BALATON Zoltan

#27 lore raw

Re: [PATCH 7/8] hw/ppc: Set graphic display dimensions generically

In reply to BALATON Zoltan

Il dom 15 feb 2026, 10:51 BALATON Zoltan <[email protected]> ha scritto:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

hw/ppc/ppc.c void ppc_irq_reset(PowerPCCPU *cpu) · line 1567

Quoted 6 lines
hw/ppc/ppc.c +6 -0
+void ppc_graphic_dimensions(int *width, int *height, int *depth)
+{
+    *width = graphic_width ?: 800;
+    *height = graphic_height ?: 600;
+    *depth = graphic_depth ?: 32;
+}

I think there's no reason to have this common to all ppc machines.

I agree with you here that it's better to just inline this in all the boards that need it, because there's no reason to have 800x600x32 across such disparate machines.

Quoted 6 lines

Can you provide a patch showing how you'd prefer it to be done?

Maybe turning these into properties could work. I could look at adding such properties but don't know how to change the -g option. But considering these are all machines that Mark maintains maybe he should do something about it

I am not sure what you'd be requesting of him?

The easiest were if he agreed to drop -g option but he

Quoted 1 line

never agrees removing anything

Not sure who's he? Is it me since I asked Philippe to keep -g, or Mark? And if it's Mark, I am not sure what you're trying to obtain by involving (and in a pretty rude way, too) someone who's not even part of the thread.

so then he should provide patches to clean

Quoted 4 lines

this up the way he prefers. I could try to make patches but I'm afraid those would become wasted effort so may I only do it when there's an approved way that will be accepted.

The -g 800x600x32 option, if desired, can become simply a shortcut for -M gfxwidth=800,gfxheight=600,gfxdepth=32 (or gfx.width=800,gfx.height=600,gfx.depth=32), which is more similar to how smp or boot work). This would actually be easier to implement with Philippe's move of all graphics_* accesses to board code, so his patches should go in either way. And then the globals can be removed altogether.

Paolo

Quoted 2 lines

Regards,
BALATON Zoltan

#28 lore raw

Re: [PATCH 7/8] hw/ppc: Set graphic display dimensions generically

Quoted 25 lines · Paolo Bonzini

Il dom 15 feb 2026, 10:51 BALATON Zoltan <[email protected]> ha scritto:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

hw/ppc/ppc.c void ppc_irq_reset(PowerPCCPU *cpu) · line 1567

Quoted 6 lines
hw/ppc/ppc.c +6 -0
+void ppc_graphic_dimensions(int *width, int *height, int *depth)
+{
+    *width = graphic_width ?: 800;
+    *height = graphic_height ?: 600;
+    *depth = graphic_depth ?: 32;
+}

I think there's no reason to have this common to all ppc machines.

I agree with you here that it's better to just inline this in all the boards that need it, because there's no reason to have 800x600x32 across such disparate machines.

Quoted 6 lines

Can you provide a patch showing how you'd prefer it to be done?

Maybe turning these into properties could work. I could look at adding such properties but don't know how to change the -g option. But considering these are all machines that Mark maintains maybe he should do something about it

I am not sure what you'd be requesting of him?

Quoted 7 lines

The easiest were if he agreed to drop -g option but he

Quoted 1 line

never agrees removing anything

Not sure who's he? Is it me since I asked Philippe to keep -g, or Mark? And if it's Mark, I am not sure what you're trying to obtain by involving (and in a pretty rude way, too) someone who's not even part of the thread.

Mark is cc-ed on this thread and it seems this -g option is only used by machines he maintains. My previous experience with patches submitted to things he maintains is that this most of the time leads to long discussions on why what I propose is wrong and how else should it be done instead. (I'm not saying that it's because it's me who submits the patch, I've seen this happening to other contributors too but it looks like Mark has strong views on how things should be done and he's reluctant to accept anything else.) Because of that I try not to touch anything that Mark maintains unless he says beforehand what would be acceptable. I did not mean it to be rude or attack him but I also think this isn't the best way to work either. But given these cicrumstances I think Mark should state his peference about this as at the end he is the maintainer who will have to approve it.

Quoted 11 lines

so then he should provide patches to clean

Quoted 3 lines

this up the way he prefers. I could try to make patches but I'm afraid those would become wasted effort so may I only do it when there's an approved way that will be accepted.

The -g 800x600x32 option, if desired, can become simply a shortcut for -M gfxwidth=800,gfxheight=600,gfxdepth=32 (or gfx.width=800,gfx.height=600,gfx.depth=32), which is more similar to how smp or boot work). This would actually be easier to implement with Philippe's move of all graphics_* accesses to board code, so his patches should go in either way. And then the globals can be removed altogether.

A problem with global option may be that resolution is not really a machine property but that of the display and one machine may have more than one display. Currently those display devices that support EDID use xres,yres,xmin,ymin,xmax,ymax properties and some devices like VGA have DEFINE_EDID_PROPERTIES to forward these to the edid generation. For others it can be set less intuitively with -global. (This was asked by somebody for ati-vga recently so I plan to add forwarding properties for that.) Maybe we should move into that direction and make these properties of the display devices and call them xres,yres too for consistency. But there may be some complication here with fw_cfg and OpenBIOS too so in that case just keeping the globals and using machine properties may be simpler.

Regards,
BALATON Zoltan

#29 lore raw

Re: [PATCH 7/8] hw/ppc: Set graphic display dimensions generically

Quoted 41 lines · BALATON Zoltan
Quoted 25 lines · Paolo Bonzini

Il dom 15 feb 2026, 10:51 BALATON Zoltan <[email protected]> ha scritto:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

hw/ppc/ppc.c void ppc_irq_reset(PowerPCCPU *cpu) · line 1567

Quoted 6 lines
hw/ppc/ppc.c +6 -0
+void ppc_graphic_dimensions(int *width, int *height, int *depth)
+{
+    *width = graphic_width ?: 800;
+    *height = graphic_height ?: 600;
+    *depth = graphic_depth ?: 32;
+}

I think there's no reason to have this common to all ppc machines.

I agree with you here that it's better to just inline this in all the boards that need it, because there's no reason to have 800x600x32 across such disparate machines.

Quoted 6 lines

Can you provide a patch showing how you'd prefer it to be done?

Maybe turning these into properties could work. I could look at adding such properties but don't know how to change the -g option. But considering these are all machines that Mark maintains maybe he should do something about it

I am not sure what you'd be requesting of him?

Quoted 7 lines

The easiest were if he agreed to drop -g option but he

Quoted 1 line

never agrees removing anything

Not sure who's he? Is it me since I asked Philippe to keep -g, or Mark? And if it's Mark, I am not sure what you're trying to obtain by involving (and in a pretty rude way, too) someone who's not even part of the thread.

Mark is cc-ed on this thread and it seems this -g option is only used by machines he maintains. My previous experience with patches submitted to things he maintains is that this most of the time leads to long discussions on why what I propose is wrong and how else should it be done instead. (I'm not saying that it's because it's me who submits the patch, I've seen this happening to other contributors too but it looks like Mark has strong views on how things should be done and he's reluctant to accept anything else.) Because of that I try not to touch anything that Mark maintains unless he says beforehand what would be acceptable. I did not mean it to be rude or attack him but I also think this isn't the best way to work either. But given these cicrumstances I think Mark should state his peference about this as at the end he is the maintainer who will have to approve it.

Quoted 5 lines

so then he should provide patches to clean

Quoted 3 lines

this up the way he prefers. I could try to make patches but I'm afraid those would become wasted effort so may I only do it when there's an approved way that will be accepted.

Quoted 8 lines
Quoted 6 lines

The -g 800x600x32 option, if desired, can become simply a shortcut for -M gfxwidth=800,gfxheight=600,gfxdepth=32 (or gfx.width=800,gfx.height=600,gfx.depth=32), which is more similar to how smp or boot work). This would actually be easier to implement with Philippe's move of all graphics_* accesses to board code, so his patches should go in either way. And then the globals can be removed altogether.

A problem with global option may be that resolution is not really a machine property but that of the display and one machine may have more than one display. Currently those display devices that support EDID use xres,yres,xmin,ymin,xmax,ymax properties and some devices like VGA have

Ther's no xmin,ymin but there's refresh_rate. However depth is missing.

Quoted 1 line

DEFINE_EDID_PROPERTIES to forward these to the edid generation. For others it can be set less intuitively with -global. (This was asked by somebody for ati-vga recently so I plan to add forwarding properties for that.) Maybe we should move into that direction and make these properties of the display devices and call them xres,yres too for consistency. But there may be some complication here with fw_cfg and OpenBIOS too so in that case just keeping the globals and using machine properties may be simpler.

Another problem with -g is that it only works with a few obscure machines and will do nothing for most of the other machines which is confusing. So in the longer term I think it should either be deprecated and these machines changed to use properties on display devices like the others or as you proposed last year it may need to become an option to set defaults for all displays which is simliar to audiodev that was turned into a machine property from a top level option a while ago.

Anyway these are just my comments to this topic that I wanted to share and then the involved parties will do whatever they want. I wanted to share this in the hope to add some points that I think may be relevant.

Regards,
BALATON Zoltan

#30 lore raw

Re: [PATCH 7/8] hw/ppc: Set graphic display dimensions generically

In reply to Philippe Mathieu-Daudé
Quoted 180 lines · Philippe Mathieu-Daudé

If a dimension is not set, have the machine init code set the default value by calling the ppc_graphic_dimensions() helper, common to all PowerPC machines. Declare local variables to avoid using the global ones.

---
  include/hw/ppc/ppc.h    |  2 ++
  hw/ppc/mac_newworld.c   | 10 ++++++----
  hw/ppc/mac_oldworld.c   | 10 ++++++----
  hw/ppc/ppc.c            |  8 ++++++++
  hw/ppc/prep.c           |  4 ++++
  hw/ppc/spapr.c          |  4 ++++
  system/globals-target.c |  6 ------
  7 files changed, 30 insertions(+), 14 deletions(-)
include/hw/ppc/ppc.h +2 -0
index cb51d704c6d..14cc09ab22b 100644
@@ -102,6 +102,8 @@ enum {
      ARCH_MAC99_U3,
  };
 
+void ppc_graphic_dimensions(int *width, int *height, int *depth);
+
  #define FW_CFG_PPC_WIDTH        (FW_CFG_ARCH_LOCAL + 0x00)
  #define FW_CFG_PPC_HEIGHT       (FW_CFG_ARCH_LOCAL + 0x01)
  #define FW_CFG_PPC_DEPTH        (FW_CFG_ARCH_LOCAL + 0x02)
hw/ppc/mac_newworld.c +6 -4
index 7275563a155..daf0029c01a 100644
@@ -156,6 +156,7 @@ static void ppc_core99_init(MachineState *machine)
      DeviceState *uninorth_internal_dev = NULL, *uninorth_agp_dev = NULL;
      hwaddr nvram_addr = 0xFFF04000;
      uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
+    int graphic_width, graphic_height, graphic_depth;
 
      /* init CPUs */
      for (i = 0; i < machine->smp.cpus; i++) {
@@ -432,10 +433,6 @@ static void ppc_core99_init(MachineState *machine)
 
      pci_vga_init(pci_bus);
 
-    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
-        graphic_depth = 15;
-    }
-
      pci_init_nic_devices(pci_bus, mc->default_nic);
 
      /* The NewWorld NVRAM is not located in the MacIO device */
@@ -480,6 +477,11 @@ static void ppc_core99_init(MachineState *machine)
      fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
      fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device);
 
+    ppc_graphic_dimensions(&graphic_width, &graphic_height, &graphic_depth);
+    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
+        graphic_depth = 15;
+    }
+
      fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
      fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
      fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
hw/ppc/mac_oldworld.c +6 -4
index e679d338985..ea1f778877c 100644
@@ -108,6 +108,7 @@ static void ppc_heathrow_init(MachineState *machine)
      DriveInfo *dinfo, *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
      void *fw_cfg;
      uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
+    int graphic_width, graphic_height, graphic_depth;
 
      /* init CPUs */
      for (i = 0; i < machine->smp.cpus; i++) {
@@ -288,10 +289,6 @@ static void ppc_heathrow_init(MachineState *machine)
          pci_create_simple(pci_bus, -1, "pci-ohci");
      }
 
-    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
-        graphic_depth = 15;
-    }
-
      /* No PCI init: the BIOS will do it */
 
      dev = qdev_new(TYPE_FW_CFG_MEM);
@@ -321,6 +318,11 @@ static void ppc_heathrow_init(MachineState *machine)
      fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
      fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device);
 
+    ppc_graphic_dimensions(&graphic_width, &graphic_height, &graphic_depth);
+    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {
+        graphic_depth = 15;
+    }
+
      fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
      fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
      fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
hw/ppc/ppc.c +8 -0
index a512d4fa647..d7b4466d701 100644
@@ -29,6 +29,7 @@
  #include "qemu/timer.h"
  #include "exec/cpu-interrupt.h"
  #include "system/cpus.h"
+#include "system/system.h"
  #include "qemu/log.h"
  #include "qemu/main-loop.h"
  #include "qemu/error-report.h"
@@ -1557,3 +1558,10 @@ void ppc_irq_reset(PowerPCCPU *cpu)
          kvmppc_set_interrupt(cpu, PPC_INTERRUPT_EXT, 0);
      }
  }
+
+void ppc_graphic_dimensions(int *width, int *height, int *depth)
+{
+    *width = graphic_width ?: 800;
+    *height = graphic_height ?: 600;
+    *depth = graphic_depth ?: 32;
+}
hw/ppc/prep.c +4 -0
index c4efd1d3908..7077b047b25 100644
@@ -43,6 +43,7 @@
  #include "exec/target_page.h"
  #include "system/kvm.h"
  #include "system/reset.h"
+#include "system/system.h"
  #include "trace.h"
  #include "elf.h"
  #include "qemu/units.h"
@@ -250,6 +251,7 @@ static void ibm_40p_init(MachineState *machine)
      uint32_t kernel_base = 0, initrd_base = 0;
      long kernel_size = 0, initrd_size = 0;
      char boot_device;
+    int graphic_width, graphic_height, graphic_depth;
 
      if (kvm_enabled()) {
          error_report("machine %s does not support the KVM accelerator",
@@ -412,6 +414,8 @@ static void ibm_40p_init(MachineState *machine)
      fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size);
      fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_PREP);
 
+    ppc_graphic_dimensions(&graphic_width, &graphic_height, &graphic_depth);
+
      fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
      fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
      fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
hw/ppc/spapr.c +4 -0
index 274f38785f2..c50c7da34d5 100644
@@ -1143,6 +1143,7 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset)
  {
      MachineState *machine = MACHINE(spapr);
      int chosen;
+    int graphic_width, graphic_height, graphic_depth;
 
      _FDT(chosen = fdt_add_subnode(fdt, 0, "chosen"));
 
@@ -1177,6 +1178,9 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset)
          if (machine->boot_config.has_menu && machine->boot_config.menu) {
              _FDT((fdt_setprop_cell(fdt, chosen, "qemu,boot-menu", true)));
          }
+
+        ppc_graphic_dimensions(&graphic_width, &graphic_height, &graphic_depth);
+
          _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-width", graphic_width));
          _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-height", graphic_height));
          _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-depth", graphic_depth));
system/globals-target.c +0 -0
index 17a27a06218..ffa6c308b59 100644
@@ -9,12 +9,6 @@
  #include "qemu/osdep.h"
  #include "system/system.h"

system/globals-target.c line 20

Quoted 10 lines
system/globals-target.c +0 -6
 
-#if defined(TARGET_SPARC) || defined(TARGET_M68K)
  int graphic_width;
  int graphic_height;
  int graphic_depth;
-#else
-int graphic_width = 800;
-int graphic_height = 600;
-int graphic_depth = 32;
-#endif

Given that these machines are so different from each other, I don't think this really warrants a separate ppc_graphic_dimensions() function. I think just inlining the defaults logic as you've done already for other displays will be fine.

ATB,

Mark.

#31 lore raw

PATCH 8/8 system/globals: Build as common code

In reply to Philippe Mathieu-Daudé

Now than all targets have the graphic dimension variables initialized the same way, we can move them to the common file unit, having them built once. Remove the now empty globals-target.c file.

---
 system/globals-target.c | 14 --------------
 system/globals.c        |  3 +++
 system/meson.build      |  4 ----
 3 files changed, 3 insertions(+), 18 deletions(-)
 delete mode 100644 system/globals-target.c
system/globals-target.c deleted +0 -14
deleted file mode 100644
index ffa6c308b59..00000000000
@@ -1,14 +0,0 @@
-/*
- * Global variables that should not exist (target specific)
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- *
- * SPDX-License-Identifier: MIT
- */
-
-#include "qemu/osdep.h"
-#include "system/system.h"
-
-int graphic_width;
-int graphic_height;
-int graphic_depth;
system/globals.c +3 -0
index c33f6ed3902..34fd3ce9c72 100644
@@ -49,6 +49,9 @@ bool enable_cpu_pm;
 int autostart = 1;
 int vga_interface_type = VGA_NONE;
 bool vga_interface_created;
+int graphic_width;
+int graphic_height;
+int graphic_depth;
 Chardev *parallel_hds[MAX_PARALLEL_PORTS];
 QEMUOptionRom option_rom[MAX_OPTION_ROMS];
 int nb_option_roms;
system/meson.build +0 -4
index d91703d3dcc..579e8353d53 100644
@@ -1,7 +1,3 @@
-specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: [files(
-  'globals-target.c',
-)])
-
 system_ss.add(files(
   'vl.c',
 ), sdl, libpmem, libdaxctl)
Signature · 1 line
2.52.0
Reviewed-by on v1 8/8
#32 lore raw

Re: [PATCH 8/8] system/globals: Build as common code

Quoted 5 lines · Philippe Mathieu-Daudé

Now than all targets have the graphic dimension variables initialized the same way, we can move them to the common file unit, having them built once. Remove the now empty globals-target.c file.

Quoted 8 lines
---
  system/globals-target.c | 14 --------------
  system/globals.c        |  3 +++
  system/meson.build      |  4 ----
  3 files changed, 3 insertions(+), 18 deletions(-)

delete mode 100644 system/globals-target.c

#33 lore raw

Re: [PATCH 8/8] system/globals: Build as common code

In reply to Philippe Mathieu-Daudé
Quoted 1 line · Philippe Mathieu-Daudé

Now than all targets have the graphic dimension variables

Typo: ^^^^ that

Quoted 37 lines

initialized the same way, we can move them to the common file unit, having them built once. Remove the now empty globals-target.c file.

---

system/globals-target.c | 14 --------------
system/globals.c        |  3 +++
system/meson.build      |  4 ----
3 files changed, 3 insertions(+), 18 deletions(-)

delete mode 100644 system/globals-target.c

system/globals-target.c deleted +0 -14
deleted file mode 100644
index ffa6c308b59..00000000000
@@ -1,14 +0,0 @@
-/*
- * Global variables that should not exist (target specific)
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- *
- * SPDX-License-Identifier: MIT
- */
-
-#include "qemu/osdep.h"
-#include "system/system.h"
-
-int graphic_width;
-int graphic_height;
-int graphic_depth;
system/globals.c +0 -0
index c33f6ed3902..34fd3ce9c72 100644

system/globals.c bool enable_cpu_pm; · line 54

Quoted 6 lines
system/globals.c +3 -0
@@ -49,6 +49,9 @@ bool enable_cpu_pm;
 int autostart = 1;
 int vga_interface_type = VGA_NONE;
 bool vga_interface_created;
+int graphic_width;
+int graphic_height;
+int graphic_depth;

Where do other machines get their default values from now? This used to have #else 800x600x32 which is the default resolution when not specifying a -g option and some machines may depend on that. Where that default is established now?

Regards,
BALATON Zoltan

Quoted 16 lines
system/globals.c +0 -0
 Chardev *parallel_hds[MAX_PARALLEL_PORTS];
 QEMUOptionRom option_rom[MAX_OPTION_ROMS];
 int nb_option_roms;
system/meson.build +0 -4
index d91703d3dcc..579e8353d53 100644
@@ -1,7 +1,3 @@
-specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: [files(
-  'globals-target.c',
-)])
-

system_ss.add(files(
'vl.c',
), sdl, libpmem, libdaxctl)

#34 lore raw

Re: [PATCH 8/8] system/globals: Build as common code

Quoted 43 lines · BALATON Zoltan
Quoted 1 line · Philippe Mathieu-Daudé

Now than all targets have the graphic dimension variables

Typo: ^^^^ that

Quoted 38 lines

initialized the same way, we can move them to the common file unit, having them built once. Remove the now empty globals-target.c file.

---

system/globals-target.c | 14 --------------
system/globals.c        |  3 +++
system/meson.build      |  4 ----
3 files changed, 3 insertions(+), 18 deletions(-)

delete mode 100644 system/globals-target.c

system/globals-target.c deleted +0 -14
deleted file mode 100644
index ffa6c308b59..00000000000
@@ -1,14 +0,0 @@
-/*
- * Global variables that should not exist (target specific)
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- *
- * SPDX-License-Identifier: MIT
- */
-
-#include "qemu/osdep.h"
-#include "system/system.h"
-
-int graphic_width;
-int graphic_height;
-int graphic_depth;
system/globals.c +0 -0
index c33f6ed3902..34fd3ce9c72 100644
@@ -49,6 +49,9 @@ bool enable_cpu_pm;
 int autostart = 1;
Quoted 8 lines

system/globals.c bool enable_cpu_pm; · line 54

Quoted 5 lines
system/globals.c +3 -0
 int vga_interface_type = VGA_NONE;
 bool vga_interface_created;
+int graphic_width;
+int graphic_height;
+int graphic_depth;

Where do other machines get their default values from now? This used to have #else 800x600x32 which is the default resolution when not specifying a -g option and some machines may depend on that. Where that default is established now?

So it seems this reverts your commit 5dc4337f7908 from a year ago. The message linked in that commit message says these are only used by ppc and sparc machines. In that case maybe not needed here as global and better be moved to ppc.{h,c} after removing the special cases as I thought in previous patch.

Regards,
BALATON Zoltan

#35 lore raw

Re: [PATCH 8/8] system/globals: Build as common code

Quoted 54 lines · BALATON Zoltan
Quoted 44 lines · BALATON Zoltan
Quoted 1 line · Philippe Mathieu-Daudé

Now than all targets have the graphic dimension variables

Typo: ^^^^ that

Quoted 39 lines

initialized the same way, we can move them to the common file unit, having them built once. Remove the now empty globals-target.c file.

---

system/globals-target.c | 14 --------------
system/globals.c        |  3 +++
system/meson.build      |  4 ----
3 files changed, 3 insertions(+), 18 deletions(-)

delete mode 100644 system/globals-target.c

system/globals-target.c deleted +0 -14
deleted file mode 100644
index ffa6c308b59..00000000000
@@ -1,14 +0,0 @@
-/*
- * Global variables that should not exist (target specific)
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- *
- * SPDX-License-Identifier: MIT
- */
-
-#include "qemu/osdep.h"
-#include "system/system.h"
-
-int graphic_width;
-int graphic_height;
-int graphic_depth;
system/globals.c +0 -0
index c33f6ed3902..34fd3ce9c72 100644
@@ -49,6 +49,9 @@ bool enable_cpu_pm;
 int autostart = 1;
 int vga_interface_type = VGA_NONE;
Quoted 8 lines

system/globals.c bool enable_cpu_pm; · line 54

Quoted 4 lines
system/globals.c +3 -0
 bool vga_interface_created;
+int graphic_width;
+int graphic_height;
+int graphic_depth;

Where do other machines get their default values from now? This used to have #else 800x600x32 which is the default resolution when not specifying a -g option and some machines may depend on that. Where that default is
established now?

Quoted 1 line

So it seems this reverts your commit 5dc4337f7908 from a year ago. The message linked in that commit message says these are only used by ppc and sparc machines. In that case maybe not needed here as global and better be moved to ppc.{h,c} after removing the special cases as I thought in previous patch.

Of course I should also think before speaking because then where do sparc and q800 get those variables and the command line parsing that sets them... So this needs to stay as globals for now but can be set to 800x600x32 as global defaults (that sparc an 188 will replace with their own) so the ppc patch is not needed then.

Regards,
BALATON Zoltan

#36 lore raw

Re: [PATCH 8/8] system/globals: Build as common code

In reply to BALATON Zoltan
Quoted 42 lines · BALATON Zoltan
Quoted 1 line · Philippe Mathieu-Daudé

Now than all targets have the graphic dimension variables

Typo: ^^^^ that

Quoted 37 lines

initialized the same way, we can move them to the common file unit, having them built once. Remove the now empty globals-target.c file.

---
system/globals-target.c | 14 --------------
system/globals.c        |  3 +++
system/meson.build      |  4 ----

3 files changed, 3 insertions(+), 18 deletions(-)

delete mode 100644 system/globals-target.c

system/globals-target.c deleted +0 -14
deleted file mode 100644
index ffa6c308b59..00000000000
@@ -1,14 +0,0 @@
-/*
- * Global variables that should not exist (target specific)
- *
- * Copyright (c) 2003-2008 Fabrice Bellard
- *
- * SPDX-License-Identifier: MIT
- */
-
-#include "qemu/osdep.h"
-#include "system/system.h"
-
-int graphic_width;
-int graphic_height;
-int graphic_depth;
system/globals.c +0 -0
index c33f6ed3902..34fd3ce9c72 100644
@@ -49,6 +49,9 @@ bool enable_cpu_pm;
Quoted 8 lines

system/globals.c bool enable_cpu_pm; · line 54

Quoted 6 lines
system/globals.c +3 -0
 int autostart = 1;
 int vga_interface_type = VGA_NONE;
 bool vga_interface_created;
+int graphic_width;
+int graphic_height;
+int graphic_depth;

Where do other machines get their default values from now?

These are the same globals... If you use -g WxH[xD] they will be initialized from 0 -> W, 0 -> H, 0 -> D; then machine_init code will notice the globals aren't 0 anymore.

Quoted 22 lines

This used to have #else 800x600x32 which is the default resolution when not specifying a -g option and some machines may depend on that. Where that default is established now?

Regards,
BALATON Zoltan

Quoted 16 lines
system/globals.c +0 -0
 Chardev *parallel_hds[MAX_PARALLEL_PORTS];
 QEMUOptionRom option_rom[MAX_OPTION_ROMS];
 int nb_option_roms;
system/meson.build +0 -4
index d91703d3dcc..579e8353d53 100644
@@ -1,7 +1,3 @@
-specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: [files(
-  'globals-target.c',
-)])
-

system_ss.add(files(
  'vl.c',
), sdl, libpmem, libdaxctl)

#37 lore raw
In reply to Philippe Mathieu-Daudé

I was expecting Paolo to be picked in the Cc list but apparently he isn't maintaining any of these files; Cc'ing explicitly because of his comments in
https://lore.kernel.org/qemu-devel/[email protected]/

Quoted 31 lines · Philippe Mathieu-Daudé

Slightly rework how the graphic dimension variables for the M68k / PPC / SPARC targets are initialized, removing the need for the target-specific globals-target.c file.

Philippe Mathieu-Daudé (8):
hw/display/macfb: Constify macfb_sense_table[] array hw/display/macfb: Constify macfb_mode_table[] array hw/m68k/q800: Use MacFbMode fields in q800_machine_init() hw/m68k/q800: Set MACFB_DISPLAY_APPLE_21_COLOR within MacFrameBuffer hw/m68k: Set graphic display dimensions generically hw/sparc: Set graphic display dimensions generically hw/ppc: Set graphic display dimensions generically system/globals: Build as common code

  include/hw/display/macfb.h |  2 +-
  include/hw/ppc/ppc.h       |  2 ++
  hw/display/macfb.c         | 18 +++++++++++-------
  hw/m68k/q800.c             | 17 ++++++-----------
  hw/ppc/mac_newworld.c      | 10 ++++++----
  hw/ppc/mac_oldworld.c      | 10 ++++++----
  hw/ppc/ppc.c               |  8 ++++++++
  hw/ppc/prep.c              |  4 ++++
  hw/ppc/spapr.c             |  4 ++++
  hw/sparc/sun4m.c           |  9 +++++++++
  hw/sparc64/sun4u.c         | 10 ++++++++++
  system/globals-target.c    | 24 ------------------------
  system/globals.c           |  3 +++
  system/meson.build         |  4 ----
  14 files changed, 70 insertions(+), 55 deletions(-)

delete mode 100644 system/globals-target.c