rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] rust: add initial scatterlist abstraction
@ 2025-05-28 22:14 Abdiel Janulgue
  2025-05-28 22:14 ` [PATCH 1/2] rust: add initial scatterlist bindings Abdiel Janulgue
  2025-05-28 22:14 ` [PATCH 2/2] samples: rust: add sample code for " Abdiel Janulgue
  0 siblings, 2 replies; 32+ messages in thread
From: Abdiel Janulgue @ 2025-05-28 22:14 UTC (permalink / raw)
  To: jgg, acourbot, dakr, lyude
  Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, Valentin Obst, open list, Marek Szyprowski,
	Robin Murphy, airlied, rust-for-linux,
	open list:DMA MAPPING HELPERS, Petr Tesarik, Andrew Morton,
	Herbert Xu, Sui Jingfeng, Randy Dunlap, Michael Kelley,
	Abdiel Janulgue

Hello all, this patch series is the next version of the initial
scatterlist rust abstraction initially sent as RFC[0]. I appreciate
all the feedback especially from Jason Gunthorpe[1] and Alexandre
Courbot[2] in shaping the design of the API.

This particular version implements the typestate pattern referred to
by Alexandre to fix the limitations of the scatterlist API. We now
have two iterators, one for building the list and the other when the
list is mapped via DMA for a device. This version introduces a cleaner
flow of the state transitions and enforces restrictions in calling
functions that are not allowed in a particular state of the sg_table
i.e, querying the dma_addresses on a table that is not yet mapped via
DMA or setting the pages on a sg_table that is already mapped via DMA.

Doesn't apply to rust-next yet but is based instead on top of
driver-core-next which provides the needed Device<Bound> functionality.

[0] https://lore.kernel.org/rust-for-linux/20250512095544.3334680-1-abdiel.janulgue@gmail.com/
[1] https://lore.kernel.org/rust-for-linux/20250512164247.GF138689@ziepe.ca/
[2] https://lore.kernel.org/rust-for-linux/D9VWA9ZQLY85.277DFA3YTH5R0@nvidia.com/

Abdiel Janulgue (2):
  rust: add initial scatterlist bindings
  samples: rust: add sample code for scatterlist bindings

 rust/bindings/bindings_helper.h |   1 +
 rust/helpers/helpers.c          |   1 +
 rust/helpers/scatterlist.c      |  25 +++
 rust/kernel/dma.rs              |  17 ++
 rust/kernel/lib.rs              |   1 +
 rust/kernel/scatterlist.rs      | 369 ++++++++++++++++++++++++++++++++
 samples/rust/rust_dma.rs        |  21 +-
 7 files changed, 434 insertions(+), 1 deletion(-)
 create mode 100644 rust/helpers/scatterlist.c
 create mode 100644 rust/kernel/scatterlist.rs


-- 
2.43.0


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

end of thread, other threads:[~2025-06-30  7:11 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-28 22:14 [PATCH 0/2] rust: add initial scatterlist abstraction Abdiel Janulgue
2025-05-28 22:14 ` [PATCH 1/2] rust: add initial scatterlist bindings Abdiel Janulgue
2025-05-29  0:45   ` Jason Gunthorpe
2025-05-29 14:14     ` Petr Tesařík
2025-05-29 14:36       ` Jason Gunthorpe
2025-05-30 14:02     ` Alexandre Courbot
2025-05-30 14:14       ` Jason Gunthorpe
2025-05-30 14:44         ` Alexandre Courbot
2025-05-30 14:50           ` Jason Gunthorpe
2025-05-30 15:18             ` Danilo Krummrich
2025-05-31 12:54             ` Alexandre Courbot
2025-06-02 11:40               ` Jason Gunthorpe
2025-06-02 12:25                 ` Abdiel Janulgue
2025-06-02 12:41                 ` Alexandre Courbot
2025-06-04 18:21       ` Lyude Paul
2025-06-05  5:51         ` Alexandre Courbot
2025-06-05 13:30           ` Abdiel Janulgue
2025-06-05 13:56             ` Alexandre Courbot
2025-06-09 17:44               ` Lyude Paul
2025-06-18  1:03                 ` Alexandre Courbot
2025-06-26 20:31                   ` Abdiel Janulgue
2025-06-26 22:43                     ` Jason Gunthorpe
2025-06-26 23:44                       ` Danilo Krummrich
2025-06-28 11:07                     ` Alexandre Courbot
2025-06-05 13:22       ` Abdiel Janulgue
2025-06-28 11:18         ` Alexandre Courbot
2025-06-30  7:11           ` Abdiel Janulgue
2025-06-05 15:35       ` Boqun Feng
2025-06-05 16:02         ` Jason Gunthorpe
2025-06-05 16:18           ` Boqun Feng
2025-05-30 11:04   ` Alexandre Courbot
2025-05-28 22:14 ` [PATCH 2/2] samples: rust: add sample code for " Abdiel Janulgue

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).