Re: [PATCH 3/8] rust: io: use pointer types instead of address

Alexandre Courbot
2026-04-05T14:56:10Z

On Tue Mar 24, 2026 at 12:37 AM JST, Gary Guo wrote:
> From: Gary Guo <gary@garyguo.net>
>
> This carries the size information with the pointer type and metadata, makes
> it possible to use I/O projections and paves the way for IO view types.
>
> With this change, minimum size information becomes available through types;
> so `KnownSize::MIN_SIZE` can be used and `IoKnownSize` trait is no longer
> necessary. The trait is kept for compatibility and can be removed when
> users stop using it for bounds.

Do we have users of `IoKnownSize` that we need to keep it around? I
rebased your series on top of `drm-rust-next` for review and was able to
remove `IoKnownSize` entirely. If possible I'd suggest removing it early
in a dedicated patch right after this one.

>
> PCI config space uses only offsets and not pointers like MMIO; for this
> null pointers (with proper size metadata) is used. This is okay as I/O
> trait impl and I/O projections can operate on invalid pointers, and for PCI
> config space we will only use address info and ignore the provenance.
>
> The current safety comment on `io_read`/`io_write` does not cover the topic
> about alignment, although this is guaranteed by checks in `Io`. Add it so
> it can be relied on by implementor of `IoCapable`.

This patch does quite a few things, is there room for splitting a bit more?