2002-01-03 22:11:22

by Manfred Spraul

[permalink] [raw]
Subject: Who uses hdx=bswap or hdx=swapdata?

Is the hdx=bswap or hdx=swapdata option actually in use?
When is it needed?
The current implementation can cause data corruptions on SMP with PIO
transfers:
It modifies the source buffer during disk writes, and these temporary
modifications (within the irq handler) are visible with mmap on SMP.

Is it possible to remove the option entirely, or should it be fixed?

--
Manfred


2002-01-03 22:24:03

by Cort Dougan

[permalink] [raw]
Subject: Re: Who uses hdx=bswap or hdx=swapdata?

It used to be necessary on the IBM 830 CDROM but I think those have fallen
into disrepair and have undergone many changes. The 830's likely need that
still but probably can't boot for other reasons now, though.

} Is the hdx=bswap or hdx=swapdata option actually in use?
} When is it needed?
} The current implementation can cause data corruptions on SMP with PIO
} transfers:
} It modifies the source buffer during disk writes, and these temporary
} modifications (within the irq handler) are visible with mmap on SMP.
}
} Is it possible to remove the option entirely, or should it be fixed?
}
} --
} Manfred
}
} -
} To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
} the body of a message to [email protected]
} More majordomo info at http://vger.kernel.org/majordomo-info.html
} Please read the FAQ at http://www.tux.org/lkml/

2002-01-03 22:29:04

by Alan

[permalink] [raw]
Subject: Re: Who uses hdx=bswap or hdx=swapdata?

> Is the hdx=bswap or hdx=swapdata option actually in use?
> When is it needed?

Certain M68K machines

> The current implementation can cause data corruptions on SMP with PIO
> transfers:
>
> Is it possible to remove the option entirely, or should it be fixed?

Show me an SMP Atari ST 8)

2002-01-03 22:42:12

by Russell King

[permalink] [raw]
Subject: Re: Who uses hdx=bswap or hdx=swapdata?

On Thu, Jan 03, 2002 at 10:32:39PM +0000, Alan Cox wrote:
> > Is the hdx=bswap or hdx=swapdata option actually in use?
> > When is it needed?
>
> Certain M68K machines

Is this parameter actually used on these machines, or do we rely on
the code in atapi_{input,output}_bytes:

#if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
if (MACH_IS_ATARI || MACH_IS_Q40) {
/* Atari has a byte-swapped IDE interface */
insw_swapw(IDE_DATA_REG, buffer, bytecount / 2);
return;
}
#endif /* CONFIG_ATARI */

and:

#if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
if (MACH_IS_ATARI || MACH_IS_Q40) {
/* Atari has a byte-swapped IDE interface */
outsw_swapw(IDE_DATA_REG, buffer, bytecount / 2);
return;
}
#endif /* CONFIG_ATARI */

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

2002-01-04 09:12:32

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: Who uses hdx=bswap or hdx=swapdata?

On Thu, 3 Jan 2002, Alan Cox wrote:
> > Is the hdx=bswap or hdx=swapdata option actually in use?
> > When is it needed?
>
> Certain M68K machines
>
> > The current implementation can cause data corruptions on SMP with PIO
> > transfers:
> >
> > Is it possible to remove the option entirely, or should it be fixed?
>
> Show me an SMP Atari ST 8)

IIRC it's used to access non-Atari IDE disks on Atari (which has a byte-swapped
IDE interface) and vice-versa.

So yes, you can use it on SMP machines, to access disks that were used before
on Atari.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2002-01-04 09:31:21

by Chris Lawrence

[permalink] [raw]
Subject: Re: Who uses hdx=bswap or hdx=swapdata?

On Jan 04, Geert Uytterhoeven wrote:
> On Thu, 3 Jan 2002, Alan Cox wrote:
> > > Is the hdx=bswap or hdx=swapdata option actually in use?
> > > When is it needed?
> >
> > Certain M68K machines
> >
> > > The current implementation can cause data corruptions on SMP with PIO
> > > transfers:
> > >
> > > Is it possible to remove the option entirely, or should it be fixed?
> >
> > Show me an SMP Atari ST 8)
>
> IIRC it's used to access non-Atari IDE disks on Atari (which has a byte-swapped
> IDE interface) and vice-versa.
>
> So yes, you can use it on SMP machines, to access disks that were used before
> on Atari.

The byteswapping flags are also used by people hacking TiVos; the
non-MIPS models have byte-swapped IDE interfaces, and so the bswap
flag is needed to mount a TiVo disk on a PC.


Chris
--
Chris Lawrence <[email protected]> - http://www.lordsutch.com/chris/

Instructor and Ph.D. Candidate, Political Science, Univ. of Mississippi
208 Deupree Hall - 662-915-5765

2002-01-04 10:27:23

by Alan

[permalink] [raw]
Subject: Re: Who uses hdx=bswap or hdx=swapdata?

> IIRC it's used to access non-Atari IDE disks on Atari (which has a byte-swapped
> IDE interface) and vice-versa.
>
> So yes, you can use it on SMP machines, to access disks that were used before
> on Atari.

For 2.5 would it perhaps be cleaner if we had a bswapping loop device. Sort
of very bad crypto mode ?

2002-01-04 10:57:57

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: Who uses hdx=bswap or hdx=swapdata?

On Fri, 4 Jan 2002, Alan Cox wrote:
> > IIRC it's used to access non-Atari IDE disks on Atari (which has a byte-swapped
> > IDE interface) and vice-versa.
> >
> > So yes, you can use it on SMP machines, to access disks that were used before
> > on Atari.
>
> For 2.5 would it perhaps be cleaner if we had a bswapping loop device. Sort
> of very bad crypto mode ?

Don't mention crypto, or Atari will come after us with the DMCA sword, claiming
they deliberately implemented access control? ;-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2002-01-04 17:15:43

by Michael Schmitz

[permalink] [raw]
Subject: Re: Who uses hdx=bswap or hdx=swapdata?

> > For 2.5 would it perhaps be cleaner if we had a bswapping loop device. Sort
> > of very bad crypto mode ?
>
> Don't mention crypto, or Atari will come after us with the DMCA sword, claiming
> they deliberately implemented access control? ;-)

Caution - I recall that on some m68k boxes we had to further byteswap
specific parts of the identify data or they wouldn't make sense. The IDE
driver will still have to be aware of these exceptions. I can't recall the
particulars anymore - Geert?

Since hdx=swapdata only works on disks replacing this with a byteswapping
loop device sounds fine (loopback being used for anything
kernel-internally now :-)

Michael

2002-01-04 17:21:33

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: Who uses hdx=bswap or hdx=swapdata?

On Fri, 4 Jan 2002, Michael Schmitz wrote:
> > > For 2.5 would it perhaps be cleaner if we had a bswapping loop device. Sort
> > > of very bad crypto mode ?
> >
> > Don't mention crypto, or Atari will come after us with the DMCA sword, claiming
> > they deliberately implemented access control? ;-)
>
> Caution - I recall that on some m68k boxes we had to further byteswap
> specific parts of the identify data or they wouldn't make sense. The IDE
> driver will still have to be aware of these exceptions. I can't recall the
> particulars anymore - Geert?

That's the drive identification. It indeed shouldn't be swapped once again when
accessing a `non-native' IDE disk.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2002-01-04 18:43:56

by Bernd Eckenfels

[permalink] [raw]
Subject: Re: Who uses hdx=bswap or hdx=swapdata?

In article <Pine.LNX.4.33.0201041751360.5790-100000@opal.biophys.uni-duesseldorf.de> you wrote:

> Since hdx=swapdata only works on disks replacing this with a byteswapping
> loop device sounds fine (loopback being used for anything
> kernel-internally now :-)

It does not make sense to swap all data in data blocks, because:
tid eo son tameks neest owspaa lld ta anid ta albcosk

Greetings
Bernd

2002-01-04 23:11:23

by Richard Zidlicky

[permalink] [raw]
Subject: Re: Who uses hdx=bswap or hdx=swapdata?

On Fri, Jan 04, 2002 at 06:20:11PM +0100, Geert Uytterhoeven wrote:
> On Fri, 4 Jan 2002, Michael Schmitz wrote:
> > > > For 2.5 would it perhaps be cleaner if we had a bswapping loop device. Sort
> > > > of very bad crypto mode ?
> > >
> > > Don't mention crypto, or Atari will come after us with the DMCA sword, claiming
> > > they deliberately implemented access control? ;-)
> >
> > Caution - I recall that on some m68k boxes we had to further byteswap
> > specific parts of the identify data or they wouldn't make sense. The IDE
> > driver will still have to be aware of these exceptions. I can't recall the
> > particulars anymore - Geert?
>
> That's the drive identification. It indeed shouldn't be swapped once again when
> accessing a `non-native' IDE disk.

sometimes it should, eg some of the ioctls that read data via special
commands from the drive that could also use byteswapping - ide-smart
comes to my mind.

Btw the Q40 has also byteswapped IDE bus like the atari.

We already have atapi_{input|output}_bytes bytes that does the
swapping, and m68k has {ins|outs}[wl]_swapw. Perhaps one of this
could be reused to do the bswap?

Bye
Richard

2002-01-12 22:41:21

by Manfred Spraul

[permalink] [raw]
Subject: Re: Who uses hdx=bswap or hdx=swapdata?

Alan Cox wrote:
>
> > IIRC it's used to access non-Atari IDE disks on Atari (which has a byte-swapped
> > IDE interface) and vice-versa.
> >
> > So yes, you can use it on SMP machines, to access disks that were used before
> > on Atari.
>
> For 2.5 would it perhaps be cleaner if we had a bswapping loop device. Sort
> of very bad crypto mode ?

I tried to implement that, but hdx=bswap operates on drives, and loop on
partitions. Do you have another idea? It probably has to wait until the
partition code is further cleaned up.

--
Manfred

2002-01-13 11:20:37

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: Who uses hdx=bswap or hdx=swapdata?

On Sat, 12 Jan 2002, Manfred Spraul wrote:
> Alan Cox wrote:
> > > IIRC it's used to access non-Atari IDE disks on Atari (which has a byte-swapped
> > > IDE interface) and vice-versa.
> > >
> > > So yes, you can use it on SMP machines, to access disks that were used before
> > > on Atari.
> >
> > For 2.5 would it perhaps be cleaner if we had a bswapping loop device. Sort
> > of very bad crypto mode ?
>
> I tried to implement that, but hdx=bswap operates on drives, and loop on
> partitions. Do you have another idea? It probably has to wait until the
> partition code is further cleaned up.

And if you use e.g. /dev/hda as loop parameter instead of /dev/hdaX?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds