Re: [20/80] ALSA: lx6464es - fix device communication via command bus

From: Linus Torvalds
Date: Wed Dec 07 2011 - 13:10:19 EST


On Wed, Dec 7, 2011 at 10:00 AM, H. Peter Anvin <hpa@xxxxxxxxx> wrote:
>
> I agree in principle, although I am really not happy about the idea of
> disallowing 64-bit writes from device drivers that haven't explicitly
> indicated they won't support it.

I'd really prefer going in the other direction. Especially since
64-bit writes would be optional *anyway* (ie impossible on 32-bit
hosts). So a driver should explicitly say "I can do 64-bit stuff"
rather than having to say "I cannot do it".

And if a driver *has* to have 64-bit accesses, it had better do them
all by hand, using "writeq()" and being dependent on the architecture
actually having that support. No "memcpy_toio" and friends at all.

So adding a "memcpy_toio64()" that defaults to the normal 32-bit max
but *might* do 64-bit copies sounds fine to me. But we really should
default to something that is consistent across architectures, and that
is not 64-bit accesses.

Old PCI setups actually had trouble with 64-bit accesses afaik, and
would literally get them wrong at a hardware level. I'm sure that's
not true of anything you can actually plug into a machine that
actually has a 64-bit x86 in it, but it's an example of actual
hardware limitations. I'm pretty sure there are 64-bit alpha machines
that are from that kind of timeframe, to give an example of a natively
64-bit architecture where a 64-bit write would simply not have worked
on a hardware level.

I'd suggest adding a architecture-neutral weak alias from
memcpy_toio64 to memcpy_toio (and other combinations), and then we can
independently start using it in drivers and/or start adding it in
various architectures. That automatically gives us the default
fallback for architectures that don't care or can't do it.

Hmm?

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/