rust: add pointer projection infrastructure and convert DMA
Status from this message: Applied to drm-rust-fixes, thanks!
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest3 patches 8 repliesApplied
- v32 patches 13 repliesSuperseded
- v22 patches 3 repliesSuperseded
Changes in v4 from the cover letter
- Add KnownSize trait for documenting safety requirement of
ProjectIndex and updated safety comments accordingly (Benno)
- Some comment rewording (Benno)
- Move code to be under ptr module.
- Link to v3: https://lore.kernel.org/rust-for-linux/[email protected]/
Patches in v4 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | rust: ptr: add `KnownSize` trait to support DST size info extractionrust/ rust/ | +27 | 4 replies | |
| 2/3 | rust: ptr: add projection infrastructurerust/ rust/ rust/ +1 more | +303 | 2 replies | |
| 3/3 | rust: dma: use pointer projection infra for `dma_{read,write}` macrodrivers/ drivers/ drivers/ +2 more | +81 | 0 replies |
Reviews trailers per patch
All 3 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Benno Lossin | Miguel Ojeda |
|---|---|---|
| Series | A-b | |
| 1/3 | R-b | |
| 2/3 | R-b | |
| 3/3 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v4 0/3] rust: add pointer projection infrastructure and convert DMA
From: Gary Guo <[email protected]>
This adds a general pointer projection infrastructure which is intended to serve as the basis for generic I/O projections. The idea is that we will have a unified way of reading/writing MMIO or DMA allocation, creating typed subviews into them, and able to read/write subfields safely.
This is the first step towards that direction, where an infra for projecting arbitrary pointers are added. This takes care to not assume pointers are part of a valid allocation, so it can be used to project I/O pointers, too. dma_read! and dma_write! is converted to use this infra, as they currently have soundness issues [1] and users have already encountered limitation of it [2].
---
Changes since v3:
- Add KnownSize trait for documenting safety requirement of
ProjectIndex and updated safety comments accordingly (Benno)
- Some comment rewording (Benno)
- Move code to be under ptr module.
- Link to v3: https://lore.kernel.org/rust-for-linux/[email protected]/
Changes since v2:
- Fix off-by-one issue (Aditya)
- Fix comment (Aditya)
- Link to v2: https://lore.kernel.org/rust-for-linux/[email protected]/
Changes since v1:
- Squashed patch 2,3,4 so that all users are converted in single commit
(Danilo)
- I discovered an additional soundness bug in dma_read/write macros
where it can create misaligned access. This is addressed in this new
version.
- Updated sample driver to have a function that does check instead use a budget-try block (Benno)
- Improved diagnostics when index projection is used on types that are
not slices.
- Link to v1: https://lore.kernel.org/rust-for-linux/[email protected]/
---
Gary Guo (3):
rust: ptr: add KnownSize trait to support DST size info extraction
rust: ptr: add projection infrastructure
rust: dma: use pointer projection infra for dma_{read,write} macro
drivers/gpu/nova-core/gsp.rs | 14 +- drivers/gpu/nova-core/gsp/boot.rs | 2 +- drivers/gpu/nova-core/gsp/cmdq.rs | 10 +- rust/kernel/dma.rs | 114 +++++------- rust/kernel/lib.rs | 4 + rust/kernel/ptr.rs | 30 ++- rust/kernel/ptr/projection.rs | 294 ++++++++++++++++++++++++++++++ samples/rust/rust_dma.rs | 30 +-- scripts/Makefile.build | 4 +- 9 files changed, 411 insertions(+), 91 deletions(-) create mode 100644 rust/kernel/ptr/projection.rs
base-commit: 877552aa875839314afad7154b5a561889e87ea9
Signature · 1 line
2.51.2