[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DG9RSIS5VPK1.M72N8UYI6SDC@kernel.org>
Date: Sun, 08 Feb 2026 18:52:09 +0100
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Daniel Almeida" <daniel.almeida@...labora.com>
Cc: "Gary Guo" <gary@...yguo.net>, "Link Mauve" <linkmauve@...kmauve.fr>,
<rust-for-linux@...r.kernel.org>, "Madhavan Srinivasan"
<maddy@...ux.ibm.com>, "Michael Ellerman" <mpe@...erman.id.au>, "Nicholas
Piggin" <npiggin@...il.com>, "Christophe Leroy (CS GROUP)"
<chleroy@...nel.org>, "Srinivas Kandagatla" <srini@...nel.org>, "Miguel
Ojeda" <ojeda@...nel.org>, "Boqun Feng" <boqun@...nel.org>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, "Benno Lossin"
<lossin@...nel.org>, "Andreas Hindborg" <a.hindborg@...nel.org>, "Alice
Ryhl" <aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>, "Ard
Biesheuvel" <ardb@...nel.org>, "Martin K. Petersen"
<martin.petersen@...cle.com>, "Eric Biggers" <ebiggers@...gle.com>, "Greg
Kroah-Hartman" <gregkh@...uxfoundation.org>, "Lyude Paul"
<lyude@...hat.com>, "Asahi Lina" <lina+kernel@...hilina.net>, "Viresh
Kumar" <viresh.kumar@...aro.org>, "Lorenzo Stoakes"
<lorenzo.stoakes@...cle.com>, "Tamir Duberstein" <tamird@...nel.org>,
"FUJITA Tomonori" <fujita.tomonori@...il.com>,
<linuxppc-dev@...ts.ozlabs.org>, <linux-kernel@...r.kernel.org>,
<officialTechflashYT@...il.com>, "Ash Logan" <ash@...quark.com>, "Roberto
Van Eeden" <rw-r-r-0644@...tonmail.com>,
Jonathan Neuschäfer <j.neuschaefer@....net>
Subject: Re: [PATCH v2 1/4] rust: io: Add big-endian read and write
functions
On Sun Feb 8, 2026 at 6:17 PM CET, Daniel Almeida wrote:
>
>
>> On 5 Feb 2026, at 19:43, Danilo Krummrich <dakr@...nel.org> wrote:
>>
>> On Thu Feb 5, 2026 at 11:31 PM CET, Gary Guo wrote:
>>> On Thu Feb 5, 2026 at 7:05 PM GMT, Danilo Krummrich wrote:
>>>> (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.
>>>
>>> You don't need to always write this. You just need to do `big_endian()` once
>>> when you obtain the io, and then keep using `BigEndian<Mmio>` instead of just
>>> `Mmio`, and the rest of code is still `.write()`.
>>
>> <snip>
>>
>>>> (2) It is error prone, if you forget to call big_endian() first, it is a bug.
>>>
>>> Moot point when `big_endian()` is only done once.
>>
>> Well, you need to do it at least once per driver entry point. For DRM IOCTLs for
>> instance you also have to consider that it is always Devres<Mmio>.
>>
>
> Well, this is also the case for relaxed(). I basically made peace with the fact that
>
> let mmio = mmio.relaxed();
> < use mmio >
>
> is going to be a reality per driver entrypoint, unless I misunderstood?
Well, there are two differences: Firstly, relaxed ordering should only be
possible in certain situations, but not always and not for every driver entry
point. Secondly, if you mistakenly forget it, you may suffer from a pretty
slight performance hit, but it is not going to be a bug.
Powered by blists - more mailing lists