[Qemu-devel] [PATCH v7 00/10] hw/m68k: add Apple Machintosh Quadra 800 machine

Laurent Vivier posted 10 patches 4 years, 11 months ago
Test FreeBSD passed
Test docker-clang@ubuntu passed
Test s390x passed
Test docker-mingw@fedora passed
Test checkpatch failed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190525225013.13916-1-laurent@vivier.eu
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>
There is a newer version of this series
MAINTAINERS                         |  14 +
arch_init.c                         |   4 +
default-configs/m68k-softmmu.mak    |   1 +
hw/Kconfig                          |   1 +
hw/Makefile.objs                    |   1 +
hw/block/Kconfig                    |   3 +
hw/block/Makefile.objs              |   1 +
hw/block/swim.c                     | 415 ++++++++++++++
hw/char/escc.c                      |  30 +-
hw/display/Kconfig                  |   4 +
hw/display/Makefile.objs            |   1 +
hw/display/macfb.c                  | 475 +++++++++++++++
hw/m68k/Kconfig                     |  12 +
hw/m68k/Makefile.objs               |   1 +
hw/m68k/bootinfo.h                  | 100 ++++
hw/m68k/q800.c                      | 369 ++++++++++++
hw/misc/Kconfig                     |   4 +
hw/misc/Makefile.objs               |   1 +
hw/misc/mac_via.c                   | 856 ++++++++++++++++++++++++++++
hw/net/dp8393x.c                    |  88 ++-
hw/nubus/Kconfig                    |   2 +
hw/nubus/Makefile.objs              |   4 +
hw/nubus/mac-nubus-bridge.c         |  45 ++
hw/nubus/nubus-bridge.c             |  34 ++
hw/nubus/nubus-bus.c                | 111 ++++
hw/nubus/nubus-device.c             | 215 +++++++
hw/scsi/esp.c                       | 293 +++++++++-
include/hw/block/swim.h             |  76 +++
include/hw/char/escc.h              |   1 +
include/hw/display/macfb.h          |  64 +++
include/hw/misc/mac_via.h           | 114 ++++
include/hw/nubus/mac-nubus-bridge.h |  24 +
include/hw/nubus/nubus.h            |  69 +++
include/hw/scsi/esp.h               |   7 +
qemu-options.hx                     |   2 +-
vl.c                                |   3 +-
36 files changed, 3377 insertions(+), 68 deletions(-)
create mode 100644 hw/block/swim.c
create mode 100644 hw/display/macfb.c
create mode 100644 hw/m68k/bootinfo.h
create mode 100644 hw/m68k/q800.c
create mode 100644 hw/misc/mac_via.c
create mode 100644 hw/nubus/Kconfig
create mode 100644 hw/nubus/Makefile.objs
create mode 100644 hw/nubus/mac-nubus-bridge.c
create mode 100644 hw/nubus/nubus-bridge.c
create mode 100644 hw/nubus/nubus-bus.c
create mode 100644 hw/nubus/nubus-device.c
create mode 100644 include/hw/block/swim.h
create mode 100644 include/hw/display/macfb.h
create mode 100644 include/hw/misc/mac_via.h
create mode 100644 include/hw/nubus/mac-nubus-bridge.h
create mode 100644 include/hw/nubus/nubus.h
[Qemu-devel] [PATCH v7 00/10] hw/m68k: add Apple Machintosh Quadra 800 machine
Posted by Laurent Vivier 4 years, 11 months ago
I'm rebasing some of these patches for seven years now,
too many years...

if you want to test the machine, I'm sorry, it doesn't boot
a MacROM, but you can boot a linux kernel from the command line.

You can install your own disk using debian-installer, with:

    ...
    -M q800 \
    -serial none -serial mon:stdio \
    -m 1000M \
    -net nic,model=dp83932,addr=09:00:07:12:34:57 \
    -append "console=ttyS0 vga=off" \
    -kernel vmlinux-4.16.0-1-m68k \
    -initrd initrd.gz \
    -drive file=debian-10.0-m68k-NETINST-1.iso,media=cdrom \
    -drive file=m68k.qcow2,format=qcow2 \
    -nographic

If you use a graphic adapter instead of "-nographic", you can use "-g" to set the
size of the display (I use "-g 1600x800x24").

You can get the ISO from:

https://cdimage.debian.org/cdimage/ports/10.0/m68k/iso-cd/debian-10.0-m68k-NETINST-1.iso

and extract the kernel and initrd.gz:

guestfish --add debian-10.0-m68k-NETINST-1.iso --ro \
          --mount /dev/sda:/ <<_EOF_
copy-out /install/cdrom/initrd.gz .
copy-out /install/kernels/vmlinux-4.16.0-1-m68k .
_EOF_

The mirror to use is: http://ftp.ports.debian.org/debian-ports/
when it fails, continue without boot loader.

In the same way, you can extract the kernel and the initramfs from the qcow2
image to use it with "-kernel" and "-initrd":

guestfish --add m68k.qcow2 --mount /dev/sda2:/ <<_EOF_
copy-out /boot/vmlinux-4.16.0-1-m68k .
copy-out /boot/initrd.img-4.16.0-1-m68k .
_EOF_

and boot with:

   ...
   -append "root=/dev/sda2 rw console=ttyS0 console=tty \
   -kernel vmlinux-4.16.0-1-m68k \
   -initrd initrd.img-4.16.0-1-m68k

v7: rebase and port to Kconfig
    move IRQ controller back to q800.c (we don't need an object for this)
    update log message for ESP changes and add some g_assert()
    re-order patches: put esp, escc and dp8393x first

v6: Rebase onto git master (this now includes the m68k EXCP_ILLEGAL fix required
      for this patchset to boot)
    Add Hervé's R-B tags
    Drop ASC (Apple Sound Chip) device since the Linux driver is broken and
      it is not required for a successful boot
    Remove extra esp_raise_irq() from ESP pseudo-DMA patch (Hervé)
    Remove "return" from unimplemented write functions and instead add a
      "read only" comment (Hervé)
    Rename MAX_FD to SWIM_MAX_FD in SWIM floppy controller patch to prevent
      potential conflicts with other files (Hervé)

v5: Rebase onto git master
    Add Philippe's R-B to patch 10
    Include the command line to boot a Linux kernel under the q800 machine in the
    commit message for patch 11 (Philippe)
    Fix up comments in hw/misc/mac_via.c (Thomas)
    Add asserts to VIA ADB support to prevent potential buffer overflows (Thomas)
    Move macfb surface/resolution checks to realise and remove hw_error (Thomas)
    Move macfb draw_line functions inline and remove macfb-template.h (Mark)
    Use guest address rather than source pointer in draw_line functions - this brings
      macfb in line with the VGA device and can prevent a potential buffer overflow
    Use g_strdup_printf() for memory region names in NuBus devices instead of
      hardcoded length char arrays (Thomas)
    Move NuBus QOM types from patch 7 to patch 8 (spotted by Thomas)
    Move CONFIG_COLDFIRE sections together in hw/m68k/Makefile.objs (Thomas)
    Remove obsolete comment from q800.c in patch 11 (Thomas)

v4: Drop RFC from subject prefix as this is getting close to final
    Rebased onto master (fixing ESP, rom_ptr() conflicts)
    Reworked q800.c based upon Thomas' comments about cpu_init() and
      qemu_check_nic_model()
    Address Thomas' comments on using error_report() instead of hw_error()
    Change the NuBus memory regions from DEVICE_NATIVE_ENDIAN to
      DEVICE_BIG_ENDIAN
    Split macfb Nubus support into separate commit
    Change VMSTATE_BUFFER_UNSAFE() to VMSTATE_UINT8_ARRAY() in macfb.c as
      suggested by David
    Remove dummy Apple Sound Chip migration state as pointed out by David
    Keep VIA ADB state and buffers in the mac_via device rather than adding
      to existing ADBState (this matches the pattern used in the PPC CUDA/PMU
      VIAs)
    Remove blacklisting for q800 machine from "make check" as requested by
      Thomas with the following fixes:
        - Fix incorrect MemoryRegion owner in ASC device
        - Add qtest_enabled() check in q800_init() to allow testing when no
          kernel is specified
        - Move some Mac VIA initialisation from init to realize
    Remove legacy drive properties from SWIM floppy controller and instead
      expose separate floppy bus and drive devices as requested by Kevin

v3: fix subject prefix "C" -> "RFC"

v2: remove the dp8393x fixes, because one of the patch breaks something
    Update "dp8393x: manage big endian bus" with idea from Thomas
    Mark has reworked most of the patches:
    - use mos6522
    - some code move, renamings and cleanup

Laurent Vivier (9):
  escc: introduce a selector for the register bit
  esp: add pseudo-DMA as used by Macintosh
  dp8393x: manage big endian bus
  hw/m68k: add via support
  hw/m68k: implement ADB bus support for via
  hw/m68k: add macfb video card
  hw/m68k: add Nubus support
  hw/m68k: add a dummy SWIM floppy controller
  hw/m68k: define Macintosh Quadra 800

Mark Cave-Ayland (1):
  hw/m68k: add Nubus support for macfb video card

 MAINTAINERS                         |  14 +
 arch_init.c                         |   4 +
 default-configs/m68k-softmmu.mak    |   1 +
 hw/Kconfig                          |   1 +
 hw/Makefile.objs                    |   1 +
 hw/block/Kconfig                    |   3 +
 hw/block/Makefile.objs              |   1 +
 hw/block/swim.c                     | 415 ++++++++++++++
 hw/char/escc.c                      |  30 +-
 hw/display/Kconfig                  |   4 +
 hw/display/Makefile.objs            |   1 +
 hw/display/macfb.c                  | 475 +++++++++++++++
 hw/m68k/Kconfig                     |  12 +
 hw/m68k/Makefile.objs               |   1 +
 hw/m68k/bootinfo.h                  | 100 ++++
 hw/m68k/q800.c                      | 369 ++++++++++++
 hw/misc/Kconfig                     |   4 +
 hw/misc/Makefile.objs               |   1 +
 hw/misc/mac_via.c                   | 856 ++++++++++++++++++++++++++++
 hw/net/dp8393x.c                    |  88 ++-
 hw/nubus/Kconfig                    |   2 +
 hw/nubus/Makefile.objs              |   4 +
 hw/nubus/mac-nubus-bridge.c         |  45 ++
 hw/nubus/nubus-bridge.c             |  34 ++
 hw/nubus/nubus-bus.c                | 111 ++++
 hw/nubus/nubus-device.c             | 215 +++++++
 hw/scsi/esp.c                       | 293 +++++++++-
 include/hw/block/swim.h             |  76 +++
 include/hw/char/escc.h              |   1 +
 include/hw/display/macfb.h          |  64 +++
 include/hw/misc/mac_via.h           | 114 ++++
 include/hw/nubus/mac-nubus-bridge.h |  24 +
 include/hw/nubus/nubus.h            |  69 +++
 include/hw/scsi/esp.h               |   7 +
 qemu-options.hx                     |   2 +-
 vl.c                                |   3 +-
 36 files changed, 3377 insertions(+), 68 deletions(-)
 create mode 100644 hw/block/swim.c
 create mode 100644 hw/display/macfb.c
 create mode 100644 hw/m68k/bootinfo.h
 create mode 100644 hw/m68k/q800.c
 create mode 100644 hw/misc/mac_via.c
 create mode 100644 hw/nubus/Kconfig
 create mode 100644 hw/nubus/Makefile.objs
 create mode 100644 hw/nubus/mac-nubus-bridge.c
 create mode 100644 hw/nubus/nubus-bridge.c
 create mode 100644 hw/nubus/nubus-bus.c
 create mode 100644 hw/nubus/nubus-device.c
 create mode 100644 include/hw/block/swim.h
 create mode 100644 include/hw/display/macfb.h
 create mode 100644 include/hw/misc/mac_via.h
 create mode 100644 include/hw/nubus/mac-nubus-bridge.h
 create mode 100644 include/hw/nubus/nubus.h

-- 
2.20.1


Re: [Qemu-devel] [PATCH v7 00/10] hw/m68k: add Apple Machintosh Quadra 800 machine
Posted by no-reply@patchew.org 4 years, 11 months ago
Patchew URL: https://patchew.org/QEMU/20190525225013.13916-1-laurent@vivier.eu/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190525225013.13916-1-laurent@vivier.eu
Type: series
Subject: [Qemu-devel] [PATCH v7 00/10] hw/m68k: add Apple Machintosh Quadra 800 machine

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

From https://github.com/patchew-project/qemu
 * [new tag]               patchew/20190525225013.13916-1-laurent@vivier.eu -> patchew/20190525225013.13916-1-laurent@vivier.eu
Switched to a new branch 'test'
f556bdda0b hw/m68k: define Macintosh Quadra 800
937de47b17 hw/m68k: add a dummy SWIM floppy controller
6c6978f083 hw/m68k: add Nubus support for macfb video card
e20d403316 hw/m68k: add Nubus support
3e9f2296f1 hw/m68k: add macfb video card
d1247477c0 hw/m68k: implement ADB bus support for via
beee051e0f hw/m68k: add via support
48c6f3a154 dp8393x: manage big endian bus
700fe1c320 esp: add pseudo-DMA as used by Macintosh
46fe7b4c2a escc: introduce a selector for the register bit

=== OUTPUT BEGIN ===
1/10 Checking commit 46fe7b4c2a99 (escc: introduce a selector for the register bit)
2/10 Checking commit 700fe1c32069 (esp: add pseudo-DMA as used by Macintosh)
WARNING: Block comments use a leading /* on a separate line
#284: FILE: hw/scsi/esp.c:351:
+        /* If there is still data to be read from the device then

WARNING: Block comments use * on subsequent lines
#285: FILE: hw/scsi/esp.c:352:
+        /* If there is still data to be read from the device then
+           complete the DMA operation immediately.  Otherwise defer

WARNING: Block comments use a trailing */ on a separate line
#286: FILE: hw/scsi/esp.c:353:
+           until the scsi layer has completed.  */

total: 0 errors, 3 warnings, 452 lines checked

Patch 2/10 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/10 Checking commit 48c6f3a1541d (dp8393x: manage big endian bus)
4/10 Checking commit beee051e0f54 (hw/m68k: add via support)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#39: 
new file mode 100644

WARNING: Block comments use a leading /* on a separate line
#91: FILE: hw/misc/mac_via.c:48:
+#define VIA1A_vSccWrReq 0x80   /* SCC write. (input)

WARNING: Block comments use a leading /* on a separate line
#98: FILE: hw/misc/mac_via.c:55:
+#define VIA1A_vRev8     0x40   /* Revision 8 board ???

WARNING: Block comments use a leading /* on a separate line
#108: FILE: hw/misc/mac_via.c:65:
+#define VIA1A_vHeadSel  0x20   /* Head select for IWM.

WARNING: Block comments use a leading /* on a separate line
#113: FILE: hw/misc/mac_via.c:70:
+#define VIA1A_vOverlay  0x10   /* [Macintosh Family] On SE/30,II,IIx,IIcx

WARNING: Block comments use a leading /* on a separate line
#127: FILE: hw/misc/mac_via.c:84:
+#define VIA1A_vSync     0x08   /* [CHRP] Sync Modem: modem clock select:

WARNING: Block comments use a leading /* on a separate line
#135: FILE: hw/misc/mac_via.c:92:
+/* Macintosh Family Hardware sez: bits 0-2 of VIA1A are volume control

WARNING: Block comments use a leading /* on a separate line
#150: FILE: hw/misc/mac_via.c:107:
+/* Info on VIA1B is from Macintosh Family Hardware & MkLinux.

WARNING: Block comments use a trailing */ on a separate line
#151: FILE: hw/misc/mac_via.c:108:
+ * CHRP offers no info. */

WARNING: Block comments use a leading /* on a separate line
#152: FILE: hw/misc/mac_via.c:109:
+#define VIA1B_vSound   0x80    /* Sound enable (for compatibility with

WARNING: Block comments use a trailing */ on a separate line
#155: FILE: hw/misc/mac_via.c:112:
+                                * 0=error, 1=OK. */

WARNING: Block comments use a leading /* on a separate line
#156: FILE: hw/misc/mac_via.c:113:
+#define VIA1B_vMystery 0x40    /* On IIci, parity enable. 0=enabled,1=disabled

WARNING: Block comments use a trailing */ on a separate line
#159: FILE: hw/misc/mac_via.c:116:
+                                * as a slot $E interrupt. */

WARNING: Block comments use a leading /* on a separate line
#186: FILE: hw/misc/mac_via.c:143:
+/* RAM size bits decoded as follows:

WARNING: Block comments use a leading /* on a separate line
#198: FILE: hw/misc/mac_via.c:155:
+#define VIA2B_vVBL    0x80    /* VBL output to VIA1 (60.15Hz) driven by

WARNING: Block comments use a trailing */ on a separate line
#201: FILE: hw/misc/mac_via.c:158:
+                               * [MkLinux] RBV_PARODD: 1=odd,0=even. */

WARNING: Block comments use a leading /* on a separate line
#202: FILE: hw/misc/mac_via.c:159:
+#define VIA2B_vSndJck 0x40    /* External sound jack status.

WARNING: Block comments use a trailing */ on a separate line
#203: FILE: hw/misc/mac_via.c:160:
+                               * 0=plug is inserted.  On SE/30, always 0 */

WARNING: Block comments use a leading /* on a separate line
#206: FILE: hw/misc/mac_via.c:163:
+#define VIA2B_vMode32 0x08    /* 24/32bit switch - doubles as cache flush

WARNING: Block comments use a leading /* on a separate line
#214: FILE: hw/misc/mac_via.c:171:
+#define VIA2B_vPower  0x04   /* Power off, 0=shut off power.

WARNING: Block comments use a leading /* on a separate line
#217: FILE: hw/misc/mac_via.c:174:
+#define VIA2B_vBusLk  0x02   /* Lock NuBus transactions, 0=locked.

WARNING: Block comments use a leading /* on a separate line
#220: FILE: hw/misc/mac_via.c:177:
+#define VIA2B_vCDis   0x01   /* Cache control. On IIci, 1=disable cache card

WARNING: Block comments use a leading /* on a separate line
#234: FILE: hw/misc/mac_via.c:191:
+/* Apple sez: http://developer.apple.com/technotes/ov/ov_04.html

WARNING: Block comments use a leading /* on a separate line
#263: FILE: hw/misc/mac_via.c:220:
+                         /*            CHRP sez never ever to *write* this.

WARNING: Block comments use a leading /* on a separate line
#279: FILE: hw/misc/mac_via.c:236:
+/* Apple Macintosh Family Hardware Refenece

ERROR: space prohibited after that '&&' (ctx:WxW)
#361: FILE: hw/misc/mac_via.c:318:
+        if (!(v1s->last_b & VIA1B_vRTCClk) && (s->b & VIA1B_vRTCClk)) {
                                            ^

total: 1 errors, 25 warnings, 788 lines checked

Patch 4/10 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

5/10 Checking commit d1247477c045 (hw/m68k: implement ADB bus support for via)
6/10 Checking commit 3e9f2296f16e (hw/m68k: add macfb video card)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#53: 
new file mode 100644

total: 0 errors, 1 warnings, 502 lines checked

Patch 6/10 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
7/10 Checking commit e20d40331612 (hw/m68k: add Nubus support)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#38: 
new file mode 100644

total: 0 errors, 1 warnings, 518 lines checked

Patch 7/10 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
8/10 Checking commit 6c6978f083af (hw/m68k: add Nubus support for macfb video card)
9/10 Checking commit 937de47b17b1 (hw/m68k: add a dummy SWIM floppy controller)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#37: 
new file mode 100644

WARNING: Block comments use a leading /* on a separate line
#233: FILE: hw/block/swim.c:192:
+    /* rerror/werror aren't supported by fdc and therefore not even registered

WARNING: Block comments use a trailing */ on a separate line
#235: FILE: hw/block/swim.c:194:
+     * blkconf_apply_backend_options(). */

WARNING: Block comments use a leading /* on a separate line
#245: FILE: hw/block/swim.c:204:
+    /* 'enospc' is the default for -drive, 'report' is what blk_new() gives us

WARNING: Block comments use a trailing */ on a separate line
#246: FILE: hw/block/swim.c:205:
+     * for empty drives. */

total: 0 errors, 5 warnings, 504 lines checked

Patch 9/10 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
10/10 Checking commit f556bdda0b87 (hw/m68k: define Macintosh Quadra 800)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#95: 
new file mode 100644

WARNING: Block comments use a leading /* on a separate line
#274: FILE: hw/m68k/q800.c:69:
+/* the video base, whereas it a Nubus address,

WARNING: Block comments use a leading /* on a separate line
#387: FILE: hw/m68k/q800.c:182:
+    /* MacSonic driver needs an Apple MAC address

total: 0 errors, 3 warnings, 511 lines checked

Patch 10/10 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190525225013.13916-1-laurent@vivier.eu/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com