qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	Matt Jacobson <mhjacobson@me.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH 0/1] hw/m68k: add working floppy controller for q800
Date: Mon, 8 Dec 2025 13:44:06 +0100	[thread overview]
Message-ID: <40e6c8dc-0194-4ce7-82dd-c07547e3ccce@vivier.eu> (raw)
In-Reply-To: <ab79a32b-24b3-418e-a2c5-6427cf174d35@ilande.co.uk>

Le 05/12/2025 à 22:20, Mark Cave-Ayland a écrit :
> On 03/12/2025 06:43, Matt Jacobson wrote:
> 
>> [Please notify me of any process errors -- this is my first contribution to
>> QEMU.  Thanks.]
>>
>> Implement the SWIM2 floppy controller for the q800 machine.
>> (For details, see: <https://archive.org/details/SWIMDesignDocs/SWIM2%20ERS/>.)
>>
>> Reading and writing work, and booting from a system disk works.
>> Tested with the Quadra 800 ROM and System 7.
>>
>> Future areas of work here could include:
>>
>> * Allowing for disk formatting/duplication to work
>> * Fleshing out the SWIM1 and hooking it up to the emulated drive
>> * Implementing the IWM for earlier machines (this could share code with SWIM1)
>>
>> Matt Jacobson (1):
>>    hw/m68k: add working floppy controller for q800
>>
>>   hw/block/meson.build               |   2 +-
>>   hw/block/sony_superdrive.c         | 940 +++++++++++++++++++++++++++++
>>   hw/block/swim2.c                   | 657 ++++++++++++++++++++
>>   hw/block/trace-events              |  17 +
>>   hw/m68k/q800.c                     |   4 +-
>>   include/hw/block/sony_superdrive.h |  55 ++
>>   include/hw/block/swim2.h           |  66 ++
>>   include/hw/m68k/q800.h             |   4 +-
>>   8 files changed, 1740 insertions(+), 5 deletions(-)
>>   create mode 100644 hw/block/sony_superdrive.c
>>   create mode 100644 hw/block/swim2.c
>>   create mode 100644 include/hw/block/sony_superdrive.h
>>   create mode 100644 include/hw/block/swim2.h
> 
> Thanks for the contribution! I've applied this patch and managed to get it to compile successfully, 
> but I'm struggling to find a suitable disk image that works. Can you point me towards both a GCR and 
> an MFM image I can use for testing? I think this might be because the images I use here are simply 
> HFS(+) images.

Perhaps you can try:
https://sourceforge.net/projects/emile/files/emile-rescue/emile-rescue-0.12/

There was a time when the kernel and a ramdisk could fit on an 1.44 MB disk...

> Some initial thoughts from looking over the code:
> 
> - The basic implementation looks fairly good from what I can see, but I can see a number of places 
> that don't match our code style guidelines. You can do a basic style check running "./scripts/ 
> checkpatch.pl HEAD~1..HEAD" from a git checkout with your patch applied which will pick up the 
> majority of issues.
> 
> - Having everything in one patch makes it harder to review: I think it would make sense to introduce 
> the SONY drive in one patch, the updated SWIM2 controller in another, and then a final patch to 
> update the q800 machine to switch over the SWIM2. And maybe even an extra patch to remove the 
> existing SWIM1 stub? The stub was added with just enough implemented to allow Linux to boot.
> 
> - Have you tested with an A/UX 3.0.1 boot floppy? A number of people are interested to run AUX 3.0.1 
> as per https://www.emaculation.com/doku.php/m68k-qemu-on-windows#running_qemu-system- 
> m68k_with_a_ux_3x_guests_in_windows and it would be good to be able to use the real floppy image here.
> 
> - QEMU already has a fairly good Fifo8 implementation: is it possible to use that or Fifo32 instead 
> of reinventing it here?
> 
> - It's worth updating the cover letter to include an example command line. I had to go digging into 
> the patch to discover that I needed to add something like "-drive file=/tmp/ 
> Install.img,if=none,id=floppy" to attempt a floppy boot. Configuring internal devices can be fiddly: 
> I'm wondering if there is existing precedent in the way PC floppy drives work that we can use to 
> keep things consistent?
> 
> - When booting a test Linux image I got stuck in a boot loop, both with and without a floppy 
> inserted in the drive:
> 
> swim2_mmio_read addr=0x1e00 size=1 reg=7 [HANDSHAKE] value=0x8 mode=0xca setup=0x28 phase=0x74 fifo=0
> swim2_mmio_read addr=0x1e00 size=1 reg=7 [HANDSHAKE] value=0x8 mode=0xca setup=0x28 phase=0x74 fifo=0
> ...
> ...
> 
> Since the Linux maintainers make use of QEMU for testing, I think we need to get this working. 
> Laurent - do you know if the 68K Mac kernel driver works on real hardware?

Well, I wrote it, and didn't test for a while.

It only supports read access. I wrote it to be able to boot linux from a floppy and allow the kernel 
to read initrd from another.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/block/swim.c

Thanks,
Laurent


      reply	other threads:[~2025-12-08 12:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-03  6:43 [PATCH 0/1] hw/m68k: add working floppy controller for q800 Matt Jacobson
2025-12-03  6:43 ` [PATCH 1/1] " Matt Jacobson
2025-12-05 21:20 ` [PATCH 0/1] " Mark Cave-Ayland
2025-12-08 12:44   ` Laurent Vivier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40e6c8dc-0194-4ce7-82dd-c07547e3ccce@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mhjacobson@me.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).