rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] rust: pci: add config space read/write support, take 1
@ 2025-10-16 21:02 Zhi Wang
  2025-10-16 21:02 ` [PATCH v2 1/5] rust/io: factor common I/O helpers into Io trait and specialize Mmio<SIZE> Zhi Wang
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Zhi Wang @ 2025-10-16 21:02 UTC (permalink / raw)
  To: rust-for-linux
  Cc: dakr, bhelgaas, kwilczynski, ojeda, alex.gaynor, boqun.feng, gary,
	bjorn3_gh, lossin, a.hindborg, aliceryhl, tmgross, linux-pci,
	linux-kernel, cjia, smitra, ankita, aniketa, kwankhede, targupta,
	zhiw, zhiwang, acourbot, joelagnelf, jhubbard, markus.probst

In the NVIDIA vGPU RFC [1], the PCI configuration space access is
required in nova-core for preparing gspVFInfo when vGPU support is
enabled. This series is the following up of the discussion with Danilo
for how to introduce support of PCI configuration space access in Rust
PCI abstrations. Bascially, we are thinking of introducing another
backend for PCI configuration space access similar with Kernel::Io.

This ideas of this series are:

- Factor out a common trait 'Io' for other accessors to share the
  same compiling/runtime check like before.

- Factor the MMIO read/write macros from the define_read! and
  define_write! macros. Thus, define_{read, write}! can be used in other
  backend.

- Add a helper to query configuration space size. This is mostly for
  runtime check.

- Implement the PCI configuration space access backend in PCI
  abstractions.

v2:

- Factor out common trait as 'Io' and keep the rest routines in original
  'Io' as 'Mmio'. (Danilo)

- Rename 'IoRaw' to 'MmioRaw'. Update the bus MMIO implemention to use
  'MmioRaw'.

- Intorduce pci::Device<Bound>::config_space(). (Danilo)

- Implement both infallible and fallible read/write routines, the device
  driver devicdes which version should be used.

Moving forward:

- Define and use register! macros.
- Introduce { cap, ecap } search and read.

RFC v1:
https://lore.kernel.org/all/20251010080330.183559-1-zhiw@nvidia.com/

[1] https://lore.kernel.org/all/20250903221111.3866249-1-zhiw@nvidia.com/

Zhi Wang (5):
  rust/io: factor common I/O helpers into Io trait and specialize
    Mmio<SIZE>
  rust: io: factor out MMIO read/write macros
  rust: pci: add a helper to query configuration space size
  rust: pci: add config space read/write support
  nova-core: test configuration routine.

 drivers/gpu/nova-core/driver.rs      |   4 +
 drivers/gpu/nova-core/regs/macros.rs |  36 +++---
 rust/kernel/io.rs                    | 161 +++++++++++++++++----------
 rust/kernel/io/mem.rs                |  16 +--
 rust/kernel/pci.rs                   |  79 ++++++++++++-
 5 files changed, 206 insertions(+), 90 deletions(-)

-- 
2.47.3


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-10-21 14:07 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-16 21:02 [PATCH v2 0/5] rust: pci: add config space read/write support, take 1 Zhi Wang
2025-10-16 21:02 ` [PATCH v2 1/5] rust/io: factor common I/O helpers into Io trait and specialize Mmio<SIZE> Zhi Wang
2025-10-17  1:26   ` Bjorn Helgaas
2025-10-17 10:56   ` Danilo Krummrich
2025-10-20 11:44   ` Alexandre Courbot
2025-10-20 19:34   ` John Hubbard
2025-10-20 23:36   ` kernel test robot
2025-10-16 21:02 ` [PATCH v2 2/5] rust: io: factor out MMIO read/write macros Zhi Wang
2025-10-17 11:01   ` Danilo Krummrich
2025-10-16 21:02 ` [PATCH v2 3/5] rust: pci: add a helper to query configuration space size Zhi Wang
2025-10-17 11:09   ` Danilo Krummrich
2025-10-16 21:02 ` [PATCH v2 4/5] rust: pci: add config space read/write support Zhi Wang
2025-10-16 21:02 ` [PATCH v2 5/5] nova-core: test configuration routine Zhi Wang
2025-10-17  4:55   ` Zhi Wang
2025-10-17 11:11     ` Danilo Krummrich
2025-10-21 14:07 ` [PATCH v2 0/5] rust: pci: add config space read/write support, take 1 Alexandre Courbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).