From: Boqun Feng <boqun.feng@gmail.com>
To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
Wedson Almeida Filho <wedsonaf@google.com>,
Gary Guo <gary@garyguo.net>, Hector Martin <marcan@marcan.st>,
Arnd Bergmann <arnd@arndb.de>,
Linus Walleij <linus.walleij@linaro.org>
Subject: [Question] Alignment requirement for readX() and writeX()
Date: Sat, 31 Jul 2021 00:42:34 +0800 [thread overview]
Message-ID: <YQQr+twAYHk2jXs6@boqun-archlinux> (raw)
Hi,
The background is that I'm reviewing Wedson's PR on IoMem for
Rust-for-Linux project:
https://github.com/Rust-for-Linux/linux/pull/462
readX() and writeX() are used to provide Rust code to read/write IO
memory. And I want to find whether we need to check the alignment of the
pointer. I wonder whether the addresses passed to readX() and writeX()
need to be aligned to the size of the accesses (e.g. the parameter of
readl() has to be a 4-byte aligned pointer).
The only related information I get so far is the following quote in
Documentation/driver-io/device-io.rst:
On many platforms, I/O accesses must be aligned with respect to
the access size; failure to do so will result in an exception or
unpredictable results.
Does it mean all readX() and writeX() need to use aligned addresses?
Or the alignment requirement is arch-dependent, i.e. if the architecture
supports and has enabled misalignment load and store, no alignment
requirement on readX() and writeX(), otherwise still need to use aligned
addresses.
I know different archs have their own alignment requirement on memory
accesses, just want to make sure the requirement of the readX() and
writeX() APIs.
Thanks a lot!
Regards,
Boqun
next reply other threads:[~2021-07-30 16:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-30 16:42 Boqun Feng [this message]
2021-07-30 16:58 ` [Question] Alignment requirement for readX() and writeX() Arnd Bergmann
2021-07-30 17:30 ` Boqun Feng
2021-07-30 20:24 ` Arnd Bergmann
2021-07-31 1:51 ` Boqun Feng
2021-08-02 8:37 ` David Laight
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=YQQr+twAYHk2jXs6@boqun-archlinux \
--to=boqun.feng@gmail.com \
--cc=arnd@arndb.de \
--cc=gary@garyguo.net \
--cc=linus.walleij@linaro.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcan@marcan.st \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=wedsonaf@google.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;
as well as URLs for NNTP newsgroup(s).