Skip to contentSkip to conversation

M68k for 7.0 patches

GIT PULL Applied Laurent Vivier 2 participants 6 messages Jan 9, 2022 – Jan 10, 2022

lore
Share & tools
lore
#0 lore raw

The following changes since commit df722e33d5da26ea8604500ca8f509245a0ea524:

Merge tag 'bsd-user-arm-pull-request' of gitlab.com:bsdimp/qemu into staging (2022-01-08 09:37:59 -0800)

are available in the Git repository at:

git://github.com/vivier/qemu-m68k.git tags/m68k-for-7.0-pull-request

for you to fetch changes up to 31144eb6393b66b06a13e8a6ad0e730f9e82d4c6:

target/m68k: don't word align SP in stack frame if M68K_FEATURE_UNALIGNED_DATA feature enabled (2022-01-09 12:05:02 +0100)

----------------------------------------------------------------
M68k pull request 20220109

Add virt compat machine type for 7.0
fix q800 -bios parameter
fix VRAM refresh
fix M68K_FEATURE_UNALIGNED_DATA feature

----------------------------------------------------------------

Laurent Vivier (2):
hw: m68k: Add virt compat machine type for 7.0
q800: fix segfault with invalid MacROM

Mark Cave-Ayland (2):
macfb: fix VRAM dirty memory region logging target/m68k: don't word align SP in stack frame if
M68K_FEATURE_UNALIGNED_DATA feature enabled

 hw/display/macfb.c      | 2 +-
 hw/m68k/q800.c          | 5 +++--
 hw/m68k/virt.c          | 9 ++++++++-
 target/m68k/op_helper.c | 5 ++++-
 4 files changed, 16 insertions(+), 5 deletions(-)
Signature · 1 line
2.33.1
#1 lore raw

[PULL 1/4] hw: m68k: Add virt compat machine type for 7.0

Message-Id: <[email protected]>

---
 hw/m68k/virt.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
hw/m68k/virt.c +8 -1
index 0efa4a45c7f4..78e926a55457 100644
@@ -304,10 +304,17 @@ type_init(virt_machine_register_types)
     } \
     type_init(machvirt_machine_##major##_##minor##_init);
 
+static void virt_machine_7_0_options(MachineClass *mc)
+{
+}
+DEFINE_VIRT_MACHINE(7, 0, true)
+
 static void virt_machine_6_2_options(MachineClass *mc)
 {
+    virt_machine_7_0_options(mc);
+    compat_props_add(mc->compat_props, hw_compat_6_2, hw_compat_6_2_len);
 }
-DEFINE_VIRT_MACHINE(6, 2, true)
+DEFINE_VIRT_MACHINE(6, 2, false)
 
 static void virt_machine_6_1_options(MachineClass *mc)
 {
Signature · 1 line
2.33.1
#2 lore raw

[PULL 3/4] macfb: fix VRAM dirty memory region logging

In reply to Laurent Vivier

From: Mark Cave-Ayland <[email protected]>

The macfb VRAM memory region was configured with coalescing rather than dirty memory logging enabled, causing some areas of the screen not to redraw after a full screen update.

Fixes 8ac919a065 ("hw/m68k: add Nubus macfb video card")

Message-Id: <[email protected]>

---
 hw/display/macfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/display/macfb.c +1 -1
index 277d3e663331..4bd7c3ad6a5a 100644
@@ -661,9 +661,9 @@ static bool macfb_common_realize(DeviceState *dev, MacfbState *s, Error **errp)
 
     memory_region_init_ram(&s->mem_vram, OBJECT(dev), "macfb-vram",
                            MACFB_VRAM_SIZE, &error_abort);
+    memory_region_set_log(&s->mem_vram, true, DIRTY_MEMORY_VGA);
     s->vram = memory_region_get_ram_ptr(&s->mem_vram);
     s->vram_bit_mask = MACFB_VRAM_SIZE - 1;
-    memory_region_set_coalescing(&s->mem_vram);
 
     s->vbl_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, macfb_vbl_timer, s);
     macfb_update_mode(s);
Signature · 1 line
2.33.1
#3 lore raw

[PULL 4/4] target/m68k: don't word align SP in stack frame if M68K_FEATURE_UNALIGNED_DATA feature enabled

In reply to Laurent Vivier

From: Mark Cave-Ayland <[email protected]>

Commit a9431a03f7 ("target/m68k: add M68K_FEATURE_UNALIGNED_DATA feature") added a new feature for processors from the 68020 onwards which do not require data accesses to be word aligned.

Unfortunately the original commit missed an additional case whereby the SP is still word aligned when setting up an additional format 1 stack frame so add the necessary M68K_FEATURE_UNALIGNED_DATA feature guard.

Fixes a9431a03f7 ("target/m68k: add M68K_FEATURE_UNALIGNED_DATA feature")

Message-Id: <[email protected]>

---
 target/m68k/op_helper.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
target/m68k/op_helper.c +4 -1
index c0f4825034ae..acbd4735154e 100644
@@ -415,7 +415,10 @@ static void m68k_interrupt_all(CPUM68KState *env, int is_hw)
         oldsr = sr;
         env->aregs[7] = sp;
         cpu_m68k_set_sr(env, sr &= ~SR_M);
-        sp = env->aregs[7] & ~1;
+        sp = env->aregs[7];
+        if (!m68k_feature(env, M68K_FEATURE_UNALIGNED_DATA)) {
+            sp &= ~1;
+        }
         do_stack_frame(env, &sp, 1, oldsr, 0, retaddr);
     } else {
         do_stack_frame(env, &sp, 0, oldsr, 0, retaddr);
Signature · 1 line
2.33.1
#4 lore raw

[PULL 2/4] q800: fix segfault with invalid MacROM

In reply to Laurent Vivier

"qemu-system-m68k -M q800 -bios /dev/null" crashes with a segfault in q800_init().
This happens because the code doesn't check that rom_ptr() returned a non-NULL pointer .

To avoid NULL pointer, don't allow 0 sized file and use bios_size with rom_ptr().

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/756

Message-Id: <[email protected]>

---
 hw/m68k/q800.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
hw/m68k/q800.c +3 -2
index e4c7c9b88ad0..55dfe5036f40 100644
@@ -672,12 +672,13 @@ static void q800_init(MachineState *machine)
 
         /* Remove qtest_enabled() check once firmware files are in the tree */
         if (!qtest_enabled()) {
-            if (bios_size < 0 || bios_size > MACROM_SIZE) {
+            if (bios_size <= 0 || bios_size > MACROM_SIZE) {
                 error_report("could not load MacROM '%s'", bios_name);
                 exit(1);
             }
 
-            ptr = rom_ptr(MACROM_ADDR, MACROM_SIZE);
+            ptr = rom_ptr(MACROM_ADDR, bios_size);
+            assert(ptr != NULL);
             stl_phys(cs->as, 0, ldl_p(ptr));    /* reset initial SP */
             stl_phys(cs->as, 4,
                      MACROM_ADDR + ldl_p(ptr + 4)); /* reset initial PC */
Signature · 1 line
2.33.1
#5 lore raw
In reply to Laurent Vivier
Quoted 16 lines · Laurent Vivier

The following changes since commit df722e33d5da26ea8604500ca8f509245a0ea524:

Merge tag 'bsd-user-arm-pull-request' of gitlab.com:bsdimp/qemu into staging (2022-01-08 09:37:59 -0800)

are available in the Git repository at:

git://github.com/vivier/qemu-m68k.git tags/m68k-for-7.0-pull-request

for you to fetch changes up to 31144eb6393b66b06a13e8a6ad0e730f9e82d4c6:

target/m68k: don't word align SP in stack frame if M68K_FEATURE_UNALIGNED_DATA feature enabled (2022-01-09 12:05:02 +0100)

----------------------------------------------------------------
M68k pull request 20220109

Quoted 7 lines

Add virt compat machine type for 7.0
fix q800 -bios parameter
fix VRAM refresh
fix M68K_FEATURE_UNALIGNED_DATA feature

----------------------------------------------------------------

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/7.0
for any user-visible changes.

-- PMM