public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Zhi Wang" <zhiw@nvidia.com>
Cc: <rust-for-linux@vger.kernel.org>, <linux-pci@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <aliceryhl@google.com>,
	<bhelgaas@google.com>, <kwilczynski@kernel.org>,
	<ojeda@kernel.org>, <alex.gaynor@gmail.com>,
	<boqun.feng@gmail.com>, <gary@garyguo.net>,
	<bjorn3_gh@protonmail.com>, <lossin@kernel.org>,
	<a.hindborg@kernel.org>, <tmgross@umich.edu>,
	<markus.probst@posteo.de>, <helgaas@kernel.org>,
	<cjia@nvidia.com>, <smitra@nvidia.com>, <ankita@nvidia.com>,
	<aniketa@nvidia.com>, <kwankhede@nvidia.com>,
	<targupta@nvidia.com>, <acourbot@nvidia.com>,
	<joelagnelf@nvidia.com>, <jhubbard@nvidia.com>,
	<zhiwang@kernel.org>, <daniel.almeida@collabora.com>,
	<ukleinek@kernel.org>, <m.wilczynski@samsung.com>
Subject: Re: [PATCH v12 2/5] rust: io: separate generic I/O helpers from MMIO implementation
Date: Thu, 22 Jan 2026 13:52:29 +0100	[thread overview]
Message-ID: <DFV4RTLGQU1C.1FNHL8AC2DW2L@kernel.org> (raw)
In-Reply-To: <20260121202212.4438-3-zhiw@nvidia.com>

(Cc: Uwe, Michal)

On Wed Jan 21, 2026 at 9:22 PM CET, Zhi Wang wrote:
> The previous Io<SIZE> type combined both the generic I/O access helpers
> and MMIO implementation details in a single struct. This coupling prevented
> reusing the I/O helpers for other backends, such as PCI configuration
> space.
>
> Establish a clean separation between the I/O interface and concrete
> backends by separating generic I/O helpers from MMIO implementation.
>
> Introduce a new trait hierarchy to handle different access capabilities:
>
> - IoCapable<T>: A marker trait indicating that a backend supports I/O
>   operations of a certain type (u8, u16, u32, or u64).
>
> - Io trait: Defines fallible (try_read8, try_write8, etc.) and infallibile
>   (read8, write8, etc.) I/O methods with runtime bounds checking and
>   compile-time bounds checking.
>
> - IoKnownSize trait: The marker trait for types support infallible I/O
>   methods.
>
> Move the MMIO-specific logic into a dedicated Mmio<SIZE> type that
> implements the Io traits. Rename IoRaw to MmioRaw and update consumers to
> use the new types.
>
> Cc: Alexandre Courbot <acourbot@nvidia.com>
> Cc: Alice Ryhl <aliceryhl@google.com>
> Cc: Bjorn Helgaas <helgaas@kernel.org>
> Cc: Gary Guo <gary@garyguo.net>
> Cc: Danilo Krummrich <dakr@kernel.org>
> Cc: John Hubbard <jhubbard@nvidia.com>
> Signed-off-by: Zhi Wang <zhiw@nvidia.com>
> ---
>  drivers/gpu/drm/tyr/regs.rs            |   1 +
>  drivers/gpu/nova-core/gsp/sequencer.rs |   5 +-
>  drivers/gpu/nova-core/regs/macros.rs   |  90 +++---
>  drivers/gpu/nova-core/vbios.rs         |   1 +
>  drivers/pwm/pwm_th1520.rs              |   5 +-
>  rust/kernel/devres.rs                  |  19 +-
>  rust/kernel/io.rs                      | 398 ++++++++++++++++++++-----
>  rust/kernel/io/mem.rs                  |  16 +-
>  rust/kernel/io/poll.rs                 |  16 +-
>  rust/kernel/pci/io.rs                  |  12 +-
>  samples/rust/rust_driver_pci.rs        |   1 +
>  11 files changed, 433 insertions(+), 131 deletions(-)

<snip>

> diff --git a/drivers/pwm/pwm_th1520.rs b/drivers/pwm/pwm_th1520.rs
> index e3b7e77356fc..616ca398b2c5 100644
> --- a/drivers/pwm/pwm_th1520.rs
> +++ b/drivers/pwm/pwm_th1520.rs
> @@ -26,7 +26,10 @@
>      clk::Clk,
>      device::{Bound, Core, Device},
>      devres,
> -    io::mem::IoMem,
> +    io::{
> +        mem::IoMem,
> +        Io, //
> +    },
>      of, platform,
>      prelude::*,
>      pwm, time,

  parent reply	other threads:[~2026-01-22 12:52 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21 20:22 [PATCH v12 0/5] rust: pci: add config space read/write support Zhi Wang
2026-01-21 20:22 ` [PATCH v12 1/5] rust: devres: style for imports Zhi Wang
2026-01-22  4:25   ` Alexandre Courbot
2026-01-21 20:22 ` [PATCH v12 2/5] rust: io: separate generic I/O helpers from MMIO implementation Zhi Wang
2026-01-22  4:28   ` Alexandre Courbot
2026-01-22 11:52   ` Gary Guo
2026-01-22 12:52   ` Danilo Krummrich [this message]
2026-01-23  9:13   ` Alice Ryhl
2026-01-21 20:22 ` [PATCH v12 3/5] rust: io: factor out MMIO read/write macros Zhi Wang
2026-01-22  4:30   ` Alexandre Courbot
2026-01-22 11:54     ` Gary Guo
2026-01-21 20:22 ` [PATCH v12 4/5] rust: pci: add config space read/write support Zhi Wang
2026-01-22  4:25   ` Alexandre Courbot
2026-01-22 11:59   ` Gary Guo
2026-01-22 12:40     ` Danilo Krummrich
2026-01-22 12:52       ` Zhi Wang
2026-01-22 14:26       ` Gary Guo
2026-01-21 20:22 ` [PATCH v12 5/5] sample: rust: pci: add tests for config space routines Zhi Wang
2026-01-22  4:31   ` Alexandre Courbot
2026-01-26  5:08     ` Alexandre Courbot
2026-01-26  9:05       ` Zhi Wang
2026-01-26 10:21         ` Zhi Wang
2026-01-26 10:35         ` Alexandre Courbot
2026-01-22 12:00   ` Gary Guo
2026-01-24  0:12 ` [PATCH v12 0/5] rust: pci: add config space read/write support Danilo Krummrich

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=DFV4RTLGQU1C.1FNHL8AC2DW2L@kernel.org \
    --to=dakr@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=aniketa@nvidia.com \
    --cc=ankita@nvidia.com \
    --cc=bhelgaas@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=cjia@nvidia.com \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=helgaas@kernel.org \
    --cc=jhubbard@nvidia.com \
    --cc=joelagnelf@nvidia.com \
    --cc=kwankhede@nvidia.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=m.wilczynski@samsung.com \
    --cc=markus.probst@posteo.de \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=smitra@nvidia.com \
    --cc=targupta@nvidia.com \
    --cc=tmgross@umich.edu \
    --cc=ukleinek@kernel.org \
    --cc=zhiw@nvidia.com \
    --cc=zhiwang@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox