[PATCH v4 0/5] Auxiliary bus Rust abstractions

Danilo Krummrich posted 5 patches 8 months ago
MAINTAINERS                           |   3 +
rust/bindings/bindings_helper.h       |   1 +
rust/helpers/auxiliary.c              |  23 ++
rust/helpers/helpers.c                |   1 +
rust/kernel/auxiliary.rs              | 360 ++++++++++++++++++++++++++
rust/kernel/device.rs                 |  18 ++
rust/kernel/lib.rs                    |   2 +
rust/kernel/types.rs                  |   8 +
samples/rust/Kconfig                  |  12 +
samples/rust/Makefile                 |   1 +
samples/rust/rust_driver_auxiliary.rs | 122 +++++++++
11 files changed, 551 insertions(+)
create mode 100644 rust/helpers/auxiliary.c
create mode 100644 rust/kernel/auxiliary.rs
create mode 100644 samples/rust/rust_driver_auxiliary.rs
[PATCH v4 0/5] Auxiliary bus Rust abstractions
Posted by Danilo Krummrich 8 months ago
This series adds Rust abstractions for the auxiliary bus.

It implements the required abstractions to write auxiliary drivers and create
auxiliary device registrations. A driver sample illustrates how the
corresponding abstractions work.

The auxiliary abstractions are required for the Nova driver project, in order to
connect nova-core with the nova-drm driver.

A branch containing the patches can be found in [1].

[1] https://web.git.kernel.org/pub/scm/linux/kernel/git/dakr/linux.git/log/?h=rust/auxiliary

Changes in v4:
  - drop TryFrom<&Device> for &auxiliary::Device for now; we likely don't need
    it anytime soon
  - sample: rename PciDriver to ParentDriver; add connect() to ParentDriver
  - rebase onto https://lore.kernel.org/rust-for-linux/20250413173758.12068-1-dakr@kernel.org/

Changes in v3:
  - export auxiliary_bus_type
  - implement impl TryFrom<&Device> for &auxiliary::Device
  - implement Send + Sync for Registration and Device

Changes in v2:
  - implement bus device soundness improvements from [2]

Danilo Krummrich (5):
  rust: types: add `Opaque::zeroed`
  rust: device: implement Device::parent()
  rust: auxiliary: add auxiliary device / driver abstractions
  rust: auxiliary: add auxiliary registration
  samples: rust: add Rust auxiliary driver sample

 MAINTAINERS                           |   3 +
 rust/bindings/bindings_helper.h       |   1 +
 rust/helpers/auxiliary.c              |  23 ++
 rust/helpers/helpers.c                |   1 +
 rust/kernel/auxiliary.rs              | 360 ++++++++++++++++++++++++++
 rust/kernel/device.rs                 |  18 ++
 rust/kernel/lib.rs                    |   2 +
 rust/kernel/types.rs                  |   8 +
 samples/rust/Kconfig                  |  12 +
 samples/rust/Makefile                 |   1 +
 samples/rust/rust_driver_auxiliary.rs | 122 +++++++++
 11 files changed, 551 insertions(+)
 create mode 100644 rust/helpers/auxiliary.c
 create mode 100644 rust/kernel/auxiliary.rs
 create mode 100644 samples/rust/rust_driver_auxiliary.rs

-- 
2.49.0
Re: [PATCH v4 0/5] Auxiliary bus Rust abstractions
Posted by Danilo Krummrich 8 months ago
On Mon, Apr 14, 2025 at 03:18:03PM +0200, Danilo Krummrich wrote:
> This series adds Rust abstractions for the auxiliary bus.

With the following changes, applied to nova-next, thanks!

  * abstraction: fix typos, `let _ =` => `drop()`, use `kernel::ffi`
  * sample: use `ok_or()` when accessing auxiliary::Device::parent()

- Danilo
Re: [PATCH v4 0/5] Auxiliary bus Rust abstractions
Posted by Greg KH 8 months ago
On Mon, Apr 14, 2025 at 03:18:03PM +0200, Danilo Krummrich wrote:
> This series adds Rust abstractions for the auxiliary bus.
> 
> It implements the required abstractions to write auxiliary drivers and create
> auxiliary device registrations. A driver sample illustrates how the
> corresponding abstractions work.
> 
> The auxiliary abstractions are required for the Nova driver project, in order to
> connect nova-core with the nova-drm driver.
> 
> A branch containing the patches can be found in [1].
> 
> [1] https://web.git.kernel.org/pub/scm/linux/kernel/git/dakr/linux.git/log/?h=rust/auxiliary

Looks good to me, want to take this through a gpu tree so you can build
on top of it, or do you want it in the driver-core.git tree?

thanks,

greg k-h
Re: [PATCH v4 0/5] Auxiliary bus Rust abstractions
Posted by Danilo Krummrich 8 months ago
On Tue, Apr 15, 2025 at 01:38:29PM +0200, Greg KH wrote:
> On Mon, Apr 14, 2025 at 03:18:03PM +0200, Danilo Krummrich wrote:
> > This series adds Rust abstractions for the auxiliary bus.
> > 
> > It implements the required abstractions to write auxiliary drivers and create
> > auxiliary device registrations. A driver sample illustrates how the
> > corresponding abstractions work.
> > 
> > The auxiliary abstractions are required for the Nova driver project, in order to
> > connect nova-core with the nova-drm driver.
> > 
> > A branch containing the patches can be found in [1].
> > 
> > [1] https://web.git.kernel.org/pub/scm/linux/kernel/git/dakr/linux.git/log/?h=rust/auxiliary
> 
> Looks good to me, want to take this through a gpu tree so you can build
> on top of it, or do you want it in the driver-core.git tree?

Yes, I'd like to take this one through the nova tree.
Re: [PATCH v4 0/5] Auxiliary bus Rust abstractions
Posted by Greg KH 8 months ago
On Tue, Apr 15, 2025 at 02:42:54PM +0200, Danilo Krummrich wrote:
> On Tue, Apr 15, 2025 at 01:38:29PM +0200, Greg KH wrote:
> > On Mon, Apr 14, 2025 at 03:18:03PM +0200, Danilo Krummrich wrote:
> > > This series adds Rust abstractions for the auxiliary bus.
> > > 
> > > It implements the required abstractions to write auxiliary drivers and create
> > > auxiliary device registrations. A driver sample illustrates how the
> > > corresponding abstractions work.
> > > 
> > > The auxiliary abstractions are required for the Nova driver project, in order to
> > > connect nova-core with the nova-drm driver.
> > > 
> > > A branch containing the patches can be found in [1].
> > > 
> > > [1] https://web.git.kernel.org/pub/scm/linux/kernel/git/dakr/linux.git/log/?h=rust/auxiliary
> > 
> > Looks good to me, want to take this through a gpu tree so you can build
> > on top of it, or do you want it in the driver-core.git tree?
> 
> Yes, I'd like to take this one through the nova tree.
> 

Please do!