qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/4] M68k for 7.0 patches
@ 2022-01-09 11:41 Laurent Vivier
  2022-01-09 11:41 ` [PULL 1/4] hw: m68k: Add virt compat machine type for 7.0 Laurent Vivier
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Laurent Vivier @ 2022-01-09 11:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: 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

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

-- 
2.33.1



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

* [PULL 1/4] hw: m68k: Add virt compat machine type for 7.0
  2022-01-09 11:41 [PULL 0/4] M68k for 7.0 patches Laurent Vivier
@ 2022-01-09 11:41 ` Laurent Vivier
  2022-01-09 11:41 ` [PULL 2/4] q800: fix segfault with invalid MacROM Laurent Vivier
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Laurent Vivier @ 2022-01-09 11:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth, Cornelia Huck, Laurent Vivier

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20211218114340.1856757-1-laurent@vivier.eu>
---
 hw/m68k/virt.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c
index 0efa4a45c7f4..78e926a55457 100644
--- a/hw/m68k/virt.c
+++ b/hw/m68k/virt.c
@@ -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)
 {
-- 
2.33.1



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

* [PULL 2/4] q800: fix segfault with invalid MacROM
  2022-01-09 11:41 [PULL 0/4] M68k for 7.0 patches Laurent Vivier
  2022-01-09 11:41 ` [PULL 1/4] hw: m68k: Add virt compat machine type for 7.0 Laurent Vivier
@ 2022-01-09 11:41 ` Laurent Vivier
  2022-01-09 11:41 ` [PULL 3/4] macfb: fix VRAM dirty memory region logging Laurent Vivier
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Laurent Vivier @ 2022-01-09 11:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Thomas Huth, Mark Cave-Ayland, 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
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20220107105049.961489-1-laurent@vivier.eu>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/m68k/q800.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index e4c7c9b88ad0..55dfe5036f40 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -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 */
-- 
2.33.1



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

* [PULL 3/4] macfb: fix VRAM dirty memory region logging
  2022-01-09 11:41 [PULL 0/4] M68k for 7.0 patches Laurent Vivier
  2022-01-09 11:41 ` [PULL 1/4] hw: m68k: Add virt compat machine type for 7.0 Laurent Vivier
  2022-01-09 11:41 ` [PULL 2/4] q800: fix segfault with invalid MacROM Laurent Vivier
@ 2022-01-09 11:41 ` Laurent Vivier
  2022-01-09 11:41 ` [PULL 4/4] target/m68k: don't word align SP in stack frame if M68K_FEATURE_UNALIGNED_DATA feature enabled Laurent Vivier
  2022-01-10 16:00 ` [PULL 0/4] M68k for 7.0 patches Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Laurent Vivier @ 2022-01-09 11:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Mark Cave-Ayland, Laurent Vivier

From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

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.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Fixes: 8ac919a065 ("hw/m68k: add Nubus macfb video card")
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220108164147.30813-1-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/display/macfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/macfb.c b/hw/display/macfb.c
index 277d3e663331..4bd7c3ad6a5a 100644
--- a/hw/display/macfb.c
+++ b/hw/display/macfb.c
@@ -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);
-- 
2.33.1



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

* [PULL 4/4] target/m68k: don't word align SP in stack frame if M68K_FEATURE_UNALIGNED_DATA feature enabled
  2022-01-09 11:41 [PULL 0/4] M68k for 7.0 patches Laurent Vivier
                   ` (2 preceding siblings ...)
  2022-01-09 11:41 ` [PULL 3/4] macfb: fix VRAM dirty memory region logging Laurent Vivier
@ 2022-01-09 11:41 ` Laurent Vivier
  2022-01-10 16:00 ` [PULL 0/4] M68k for 7.0 patches Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Laurent Vivier @ 2022-01-09 11:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Mark Cave-Ayland, Laurent Vivier

From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

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.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Fixes: a9431a03f7 ("target/m68k: add M68K_FEATURE_UNALIGNED_DATA feature")
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220108180453.18680-1-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 target/m68k/op_helper.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
index c0f4825034ae..acbd4735154e 100644
--- a/target/m68k/op_helper.c
+++ b/target/m68k/op_helper.c
@@ -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);
-- 
2.33.1



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

* Re: [PULL 0/4] M68k for 7.0 patches
  2022-01-09 11:41 [PULL 0/4] M68k for 7.0 patches Laurent Vivier
                   ` (3 preceding siblings ...)
  2022-01-09 11:41 ` [PULL 4/4] target/m68k: don't word align SP in stack frame if M68K_FEATURE_UNALIGNED_DATA feature enabled Laurent Vivier
@ 2022-01-10 16:00 ` Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2022-01-10 16:00 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: qemu-devel

On Sun, 9 Jan 2022 at 11:44, Laurent Vivier <laurent@vivier.eu> wrote:
>
> 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
>
> ----------------------------------------------------------------
>


Applied, thanks.

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

-- PMM


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

end of thread, other threads:[~2022-01-10 16:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-09 11:41 [PULL 0/4] M68k for 7.0 patches Laurent Vivier
2022-01-09 11:41 ` [PULL 1/4] hw: m68k: Add virt compat machine type for 7.0 Laurent Vivier
2022-01-09 11:41 ` [PULL 2/4] q800: fix segfault with invalid MacROM Laurent Vivier
2022-01-09 11:41 ` [PULL 3/4] macfb: fix VRAM dirty memory region logging Laurent Vivier
2022-01-09 11:41 ` [PULL 4/4] target/m68k: don't word align SP in stack frame if M68K_FEATURE_UNALIGNED_DATA feature enabled Laurent Vivier
2022-01-10 16:00 ` [PULL 0/4] M68k for 7.0 patches Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).