From: "Maciej W. Rozycki" <macro@linux-mips.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Enrico Weigelt, metux IT consult" <info@metux.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
linux-arch@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: RFC: arch: shall we have generic readl_be()/writel_be()/... or in_be32()/out_be32() ?
Date: Fri, 11 Dec 2020 13:20:09 +0000 (GMT) [thread overview]
Message-ID: <alpine.LFD.2.21.2012111250320.2104409@eddie.linux-mips.org> (raw)
In-Reply-To: <20201209202024.GA1355417@rowland.harvard.edu>
On Wed, 9 Dec 2020, Alan Stern wrote:
> > I believe we should have generic functions, that all archs implement
> > (possibly doing automatic conversion, if necessary), which are used
> > by everybody else.
> >
> > What's your oppionion on that ?
>
> It certainly seems reasonable. Another possibility, less stringent, is
> to require that definitions exist on all architectures that can have
> big-endian MMIO (or port-based IO). For example, any architecture
> which might select CONFIG_EHCI_BIG_ENDIAN_MMIO, as used in ehci.h.
Lane swapping is a complex matter where there is an endianness mismatch
between buses. A bus bridge may implement the byte lane match policy or
the bit lane match policy, or even both to choose from, perhaps on a
case-by-case basis for individual accesses (e.g. with a pair of address
windows decoded to the other bus according to a different policy each; I
actually have such a system).
Consequently not only data transferred may have to be transformed, but so
may have the address used. Also the transformation will be different
depending on whether data accessed is to be interpreted numerically (where
the bit lane match policy is more suitable) such as with CSR access, or as
a byte stream (where the byte lane match policy is) such as with PIO data
moves.
See arch/mips/include/asm/io.h and arch/mips/include/asm/*/mangle-port.h
for an example where we take care of different cases.
Building infrastructure for doing this all in a generic manner would I
think be a good idea, but then a major effort as well, and you'd have to
coordinate it with all the arch maintainers.
Maciej
prev parent reply other threads:[~2020-12-11 13:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-09 11:08 RFC: arch: shall we have generic readl_be()/writel_be()/... or in_be32()/out_be32() ? Enrico Weigelt, metux IT consult
2020-12-09 20:20 ` Alan Stern
2020-12-11 13:20 ` Maciej W. Rozycki [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=alpine.LFD.2.21.2012111250320.2104409@eddie.linux-mips.org \
--to=macro@linux-mips.org \
--cc=info@metux.net \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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).