From: Michael Schmitz <schmitzmic@gmail.com>
To: Finn Thain <fthain@linux-m68k.org>
Cc: William R Sowerbutts <will@sowerbutts.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
linux-m68k <linux-m68k@lists.linux-m68k.org>,
Richard Zidlicky <rz@linux-m68k.org>
Subject: Re: Linux 6.4.4 on m68k - Q40 - pata_falcon causes oops at boot time
Date: Mon, 14 Aug 2023 12:33:48 +1200 [thread overview]
Message-ID: <1403a5b1-7d89-9ae7-e47b-168feb148454@gmail.com> (raw)
In-Reply-To: <a1ffc79b-eb37-5ed6-6984-a0a3674662b1@linux-m68k.org>
Hi Finn,
On 14/08/23 11:37, Finn Thain wrote:
>
>>> The Q40 does not have an on-board IDE controller. IDE is accessed via
>>> a common ISA PC Super-IO card. When you do a 16-bit transfer from the
>>> ISA I/O address the data comes out backwards and the CPU needs to
>>> byteswap it.
>>>
>>> I found it interesting and quite unexpected that 5.13 read data from
>>> the IDE drive byte-swapped. I had prepared a drive for the machine
>>> with an MBR partition table and an ext4 filesystem but the kernel did
>>> not recognise either. After a while I realised I had to byte swap the
>>> entire drive with 'dd conv=swab', and then it worked.
>>>
>>> For my 6.4 patch I enabled byte swapping in the
>>> pata_falcon_data_xfer() function -- this allows me to use an IDE drive
>>> with everything in the normal/compatible byte ordering, which makes
>>> life much easier. I assume this is the intended behaviour.
>> That would be the sane behaviour, but the designers of both the Falcon
>> and apparently the TiVo decided otherwise, wired up the IDE data bus
>> byte-swapped and saved the byteswap operations in the driver. I'm unsure
>> how this was intended to work on Q40.
> Why did Atari do that? Was it because they wanted to interoperate with
> exotic filesystems (i.e. Microsoft) without paying a byte swapping tax in
> software? (Despite the 68000 instructions for that purpose.)
Interoperability cannot have been a concern - otherwise they would have
made sure the on-disk format was compatible. Saving a byte swap
operation for each word transferred must have seemed worth it.
They just took what was available in terms of hard drive interfaces
(SCSI as well as IDE). IDE was 16 bytes wide, and the drive identify
data were ending up in the 'wrong' byte order, so they just swapped
those data.
As far as I know, neither floppy nor disk FAT formats are 100% identical
to the PC ones, just somewhat compatible.
>
>>> I wonder if any existing Q40 users are actually storing all the data
>>> on their drives byte-swapped just to avoid the overhead of
>>> byte-swapping on every read/write. I suppose this would work just fine
>>> until you need to connect that drive to another machine.
>> Yes, it does work just fine with that little inconvenience. (When I had
>> to fix a corrupted partition table an FAT, I had to hook the Falcon disk
>> up to a PC and run ARAnyM on it to get byte-swapped access to the data.)
>>
>> Now the question is how data on legacy Q40 IDE disks have been stored.
>> If it's byte-swapped, we'd better keep that byte order in the current
>> driver (meaning your changes to pata_falcon_data_xfer() won't be needed,
>> but you would have to swap back data on your disk). If it's always been
>> in PC compatible byte order, all data (not just the identify data) must
>> be swapped.
>>
>> I'd like to have Richard's opinion on this (or hear from any other
>> former Q40 user).
>>
> Yes.
>
> If the Linux port for Q40 could use pata_legacy unmodified, that has to be
> more maintainable. However, I could imagine a scenario where the standard
> Q40 firmware, bootloader and/or vendor operating system would cease to
> interoperate with Linux if Linux has no byteswapping IDE driver. If true,
> would it matter?
I use the Atari TOS partition that the Falcon boots into to run the boot
loader from, and I transfer kernels to that partition from Linux using
the vfat file system (after copying them to the Linux partition over
ethernet). That would all break without a byte swapping IDE driver.
Something similar may be true for Q40 users, but there can't be many of
these left, otherwise I'd have expected to hear about the broken
pata_falcon issue a lot sooner.
> Unix has a long tradition of pushing the byteswapping problem onto
> userland for those who need to migrate data. Hence tools like cpio and dd
> which are able to do byteswapping. One has to wonder whether drivers and
> peripherals are the wrong places for that.
Probably not - in that regard, not caring about the on-disk format might
even be the Right Thing to do.
I suspect there's a way to do byte swapping on the fly using a loopback
device and some dm magic, so disks with the 'wrong' byte order could be
accessed on non-native systems. I just have never been bothered enough
about the issue to find out.
Most other Falcon users might use SCSI (and SCSI-SD adapters) to
transport data between systems. Not an option for Q40.
Cheers,
Michael
next prev parent reply other threads:[~2023-08-14 0:34 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <ZLvZmVfzJNHlPTlJ@sowerbutts.com>
2023-07-23 8:35 ` Linux 6.4.4 on m68k - Q40 - pata_falcon causes oops at boot time Geert Uytterhoeven
2023-07-23 9:59 ` Finn Thain
2023-07-23 15:28 ` William R Sowerbutts
2023-07-24 1:43 ` Finn Thain
2023-07-24 11:09 ` William R Sowerbutts
2023-07-26 7:22 ` Finn Thain
2023-07-23 20:26 ` Michael Schmitz
2023-07-24 11:42 ` William R Sowerbutts
2023-07-24 20:26 ` Michael Schmitz
2023-07-26 9:22 ` Finn Thain
2023-07-26 20:13 ` Michael Schmitz
2023-07-27 1:16 ` Finn Thain
2023-07-27 3:17 ` Michael Schmitz
2023-07-27 23:47 ` Finn Thain
2023-07-28 7:21 ` Geert Uytterhoeven
2023-07-28 7:52 ` Michael Schmitz
2023-07-28 8:03 ` Geert Uytterhoeven
2023-07-29 4:56 ` Michael Schmitz
2023-08-13 3:06 ` Michael Schmitz
2023-08-13 7:38 ` Finn Thain
2023-08-13 21:20 ` Michael Schmitz
2023-08-13 22:24 ` William R Sowerbutts
2023-08-13 22:54 ` Michael Schmitz
2023-08-13 23:37 ` Finn Thain
2023-08-14 0:33 ` Michael Schmitz [this message]
2023-08-14 1:15 ` Finn Thain
2023-08-14 2:48 ` Michael Schmitz
2023-08-14 11:18 ` William R Sowerbutts
2023-08-14 20:15 ` Michael Schmitz
2023-08-14 20:24 ` Richard Z
2023-08-14 23:31 ` Finn Thain
2023-08-15 3:05 ` Richard Z
2023-08-15 3:30 ` Michael Schmitz
2023-08-15 9:49 ` William R Sowerbutts
2023-08-15 10:42 ` Geert Uytterhoeven
2023-08-15 20:43 ` Richard Z
2023-08-15 20:13 ` Michael Schmitz
2023-08-15 22:10 ` William R Sowerbutts
2023-08-15 22:38 ` Michael Schmitz
2023-08-14 20:19 ` Richard Z
2023-08-14 21:22 ` Michael Schmitz
2023-08-15 11:04 ` William R Sowerbutts
2023-08-16 17:56 ` William R Sowerbutts
2023-07-27 7:18 ` Geert Uytterhoeven
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=1403a5b1-7d89-9ae7-e47b-168feb148454@gmail.com \
--to=schmitzmic@gmail.com \
--cc=fthain@linux-m68k.org \
--cc=geert@linux-m68k.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=rz@linux-m68k.org \
--cc=will@sowerbutts.com \
/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