All of lore.kernel.org
 help / color / mirror / Atom feed
From: Link Mauve <linkmauve@linkmauve.fr>
To: Danilo Krummrich <dakr@kernel.org>
Cc: "Daniel Almeida" <daniel.almeida@collabora.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Link Mauve" <linkmauve@linkmauve.fr>,
	rust-for-linux@vger.kernel.org,
	"Madhavan Srinivasan" <maddy@linux.ibm.com>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	"Srinivas Kandagatla" <srini@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	"Eric Biggers" <ebiggers@google.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Lyude Paul" <lyude@redhat.com>,
	"Asahi Lina" <lina+kernel@asahilina.net>,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"Lorenzo Stoakes" <lorenzo.stoakes@oracle.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"FUJITA Tomonori" <fujita.tomonori@gmail.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	officialTechflashYT@gmail.com, "Ash Logan" <ash@heyquark.com>,
	"Roberto Van Eeden" <rw-r-r-0644@protonmail.com>,
	"Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
Subject: Re: [PATCH v2 1/4] rust: io: Add big-endian read and write functions
Date: Thu, 5 Feb 2026 22:20:56 +0100	[thread overview]
Message-ID: <aYUJuF8bI7mwD4ON@luna> (raw)
In-Reply-To: <DG79GRI3NOLS.3ASMS9RJ80IXM@kernel.org>

On Thu, Feb 05, 2026 at 08:05:08PM +0100, Danilo Krummrich wrote:
> On Thu Feb 5, 2026 at 6:28 PM CET, Daniel Almeida wrote:
> >> On 5 Feb 2026, at 12:16, Gary Guo <gary@garyguo.net> wrote:
> >> I think we should have everything default to little endian, and have wrapper
> >> types that do big endian which require expicit construction, similar to
> >> RelaxedMmio in Alex's series.
> >
> > Ah yes, the RelaxedMmio pattern is definitely a good one. I agree that we
> > should head in this direction.
> 
> I strongly disagree.
> 
> This is a great pattern for relaxed ordering because:
> 
>   (1) We need both strict and relaxed ordering.
> 
>   (2) Relaxed ordering is rare, hence it doesn't hurt to write e.g.
> 
> 	io.relaxed().write()
> 
>   (3) If you by accident just write
> 
> 	io.write()
> 
>       i.e. forget to call relaxed() it s not a bug, nothing bad happens.
> 
> Whereas for endianness it is a bad pattern because:
> 
>   (1) Devices are either little-endian or big-endian. Hence, having to write
> 
> 	io.big_endian().write()
> 
>       is excessive, we always want big-endian for a big-endian device.
> 
>   (2) It is error prone, if you forget to call big_endian() first, it is a bug.
> 
>   (3) It is unergonomic in combination with relaxed ordering.
> 
> 	io.big_endian().relaxed().write()
> 
>       (Does the other way around work as well? :)
> 
> It makes much more sense to define once when we request the I/O memory whether
> the device is litte-endian or big-endian.
> 
> This could be done with different request functions, a const generic or a
> function argument, but it should be done at request time.

Could this ever be done in the device tree?  I understand this would
mean having to change all drivers and all device trees that do big
endian, but it seems to be the natural location for this information.  I
have no idea how to structure that though.

-- 
Link Mauve


  reply	other threads:[~2026-02-05 21:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04  4:04 [PATCH v2 0/4] Add Rust abstractions for nvmem-provider Link Mauve
2026-02-04  4:04 ` [PATCH v2 1/4] rust: io: Add big-endian read and write functions Link Mauve
2026-02-04 15:18   ` Danilo Krummrich
2026-02-04 15:20     ` Danilo Krummrich
2026-02-05 14:28     ` Daniel Almeida
2026-02-05 14:56       ` Danilo Krummrich
2026-02-05 15:16       ` Gary Guo
2026-02-05 17:28         ` Daniel Almeida
2026-02-05 19:05           ` Danilo Krummrich
2026-02-05 21:20             ` Link Mauve [this message]
2026-02-05 22:11               ` Danilo Krummrich
2026-02-05 22:31             ` Gary Guo
2026-02-05 22:43               ` Danilo Krummrich
2026-02-08 17:17                 ` Daniel Almeida
2026-02-08 17:52                   ` Danilo Krummrich
2026-02-05 22:46               ` Danilo Krummrich
2026-02-04  4:04 ` [PATCH v2 2/4] rust: nvmem: Add an abstraction for nvmem providers Link Mauve
2026-02-04 15:22   ` Danilo Krummrich
2026-02-05 12:48     ` Link Mauve
2026-02-05 12:57       ` Danilo Krummrich
2026-02-04  4:05 ` [PATCH v2 3/4] nvmem: Replace the Wii and Wii U OTP driver with a Rust one Link Mauve
2026-03-04 18:46   ` Link Mauve
2026-02-04  4:05 ` [PATCH v2 4/4] powerpc: wii_defconfig: Enable Rust Link Mauve
  -- strict thread matches above, loose matches on Subject: below --
2026-02-06 11:54 [PATCH v2 1/4] rust: io: Add big-endian read and write functions kernel test robot

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=aYUJuF8bI7mwD4ON@luna \
    --to=linkmauve@linkmauve.fr \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=ardb@kernel.org \
    --cc=ash@heyquark.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=chleroy@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=ebiggers@google.com \
    --cc=fujita.tomonori@gmail.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=j.neuschaefer@gmx.net \
    --cc=lina+kernel@asahilina.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=lossin@kernel.org \
    --cc=lyude@redhat.com \
    --cc=maddy@linux.ibm.com \
    --cc=martin.petersen@oracle.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=officialTechflashYT@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=rw-r-r-0644@protonmail.com \
    --cc=srini@kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=viresh.kumar@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.