Re: [PATCH v2] rust: io: Add a BigEndianMmio wrapper
Link Mauve <[email protected]> Thu, 6 Aug 2026 14:13:33 +0200
| Newsgroups | org.kernel.vger.rust-for-linux,dev.linux.lists.driver-core,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <anR6bfODEukoiCv5@desktop> |
On Thu, Aug 06, 2026 at 12:44:31PM +0100, Gary Guo wrote: > On Thu Aug 6, 2026 at 7:22 AM BST, Link Mauve wrote: > > This allows the user to read from and write to big-endian MMIO devices, > > such as those found on PowerPC systems. > > > > The implementation is pretty much a copy-paste of the RelaxedMmio type, > > with the business logic changed. > > > > This has been tested with various WIP drivers on the Nintendo Wii, and I > > thought it would be nicer to upstream it before those are completely > > ready, to get some review. > > An alternative approach would be to have a generic wrapper `BigEndian<IO>` where > it performs byte-swapping in its `IoCapable` implementation. This is more > composable as it works for all I/O. > > Of course, this means that it won't be using the specialized BE I/O impl, but > then the only architectures that have specialized ioread16be are PPC32 and > SPARC, so maybe it's a reasonable trade-off to make? In the end this should all be inlined anyway, I’ll compare the generated assembly but I expect no change here. > > Best, > Gary […] -- Link Mauve