linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V6 00/15] Rust bindings for cpufreq and OPP core + sample driver
@ 2025-01-07 11:21 Viresh Kumar
  2025-01-07 11:21 ` [PATCH V6 01/15] PM / OPP: Expose refcounting helpers for the Rust implementation Viresh Kumar
                   ` (15 more replies)
  0 siblings, 16 replies; 48+ messages in thread
From: Viresh Kumar @ 2025-01-07 11:21 UTC (permalink / raw)
  To: Rafael J. Wysocki, Miguel Ojeda, Danilo Krummrich, Alex Gaynor,
	Alice Ryhl, Andreas Hindborg, Benno Lossin, Björn Roy Baron,
	Boqun Feng, Danilo Krummrich, Gary Guo, Greg Kroah-Hartman,
	Miguel Ojeda, Nishanth Menon, Stephen Boyd, Trevor Gross,
	Viresh Kumar, Viresh Kumar
  Cc: linux-pm, Vincent Guittot, rust-for-linux, Manos Pitsidianakis,
	Erik Schilling, Alex Bennée, Joakim Bech, Rob Herring,
	linux-kernel

Miguel / Danilo,

I would like to get some of this (if not all) merged now into the rust/dev
branch, since this stuff has been around for some time and many other
dependencies are already merged new (like OF, platform, device/driver). Please
suggest how can we move forward to get that done.

-------------------------8<-------------------------

This patch series introduces initial Rust bindings for two subsystems: cpufreq
and Operating Performance Points (OPP). The bindings cover most of the
interfaces exposed by these subsystems.

Included in this series is a sample `cpufreq` driver, `rcpufreq-dt`, which is a
duplicate of the existing `cpufreq-dt` driver. The `cpufreq-dt` driver is a
generic, platform-agnostic, device-tree-based driver used on many ARM platforms.

Currently, the implementation has been tested using QEMU, verifying that
frequency transitions, various configurations, and driver binding/unbinding
functions as expected. However, performance measurements have not been
conducted.

For those interested in trying these patches, along with a few dependencies,
they can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/linux.git rust/cpufreq-dt

The series includes all the patches to make it work:
- few new APIs to cpufreq/OPP frameworks.
- Avoiding using BIT() macro in cpufreq core (we need to make Rust work with
  it).
- Renaming of the cpufreq-dt platform device (this too needs to be fixed in
  Rust).
- Basic Rust bindings for clk and cpumask layers.

The work is based on `staging/dev` from the Rust tree, which is derived
from v6.13-rc3.

V5->V6:
- Rebase over latest rust/dev branch, which changed few interfaces that the
  patches were using.
- Included all other patches, which weren't included until now to focus only on
  core APIs.
- Other minor cleanups, additions.

V4->V5:
- Rename Registration::register() as new().
- Provide a new API: Registration::new_foreign_owned() and use it for
  rcpufreq_dt driver.
- Update MAINTAINERS file.

V3->V4:
- Fix bugs with freeing of OPP structure. Dropped the Drop routine and fixed
  reference counting.
- Registration object of the cpufreq core is modified a bit to remove the
  registered field, and few other cleanups.
- Use Devres for instead of platform data.
- Improve SAFETY comments.

V2->V3:
- Rebased on latest rust-device changes, which removed `Data` and so few changes
  were required to make it work.
- use srctree links (Alice Ryhl).
- Various changes the OPP creation APIs, new APIs: from_raw_opp() and
  from_raw_opp_owned() (Alice Ryhl).
- Inline as_raw() helpers (Alice Ryhl).
- Add new interface (`OPP::Token`) for dynamically created OPPs.
- Add Reviewed-by tag from Manos.
- Modified/simplified cpufreq registration structure / method a bit.

V1->V2:
- Create and use separate bindings for OF, clk, cpumask, etc (not included in
  this patchset but pushed to the above branch). This helped removing direct
  calls from the driver.
- Fix wrong usage of Pinning + Vec.
- Use Token for OPP Config.
- Use Opaque, transparent and Aref for few structures.
- Broken down into smaller patches to make it easy for reviewers.
- Based over staging/rust-device.

Thanks.

Viresh Kumar (15):
  PM / OPP: Expose refcounting helpers for the Rust implementation
  cpufreq: Add cpufreq_table_len()
  cpufreq: Rust implementation doesn't parse BIT() macro
  rust: device: Add few helpers
  rust: Add bindings for cpumask
  rust: Add bare minimal bindings for clk framework
  rust: Add initial bindings for OPP framework
  rust: Extend OPP bindings for the OPP table
  rust: Extend OPP bindings for the configuration options
  rust: Add initial bindings for cpufreq framework
  rust: Extend cpufreq bindings for policy and driver ops
  rust: Extend cpufreq bindings for driver registration
  rust: Extend OPP bindings with CPU frequency table
  cpufreq: Add Rust based cpufreq-dt driver
  DO-NOT_MERGE: cpufreq: Rename cpufreq-dt platdev

 MAINTAINERS                          |    2 +
 drivers/cpufreq/Kconfig              |   12 +
 drivers/cpufreq/Makefile             |    1 +
 drivers/cpufreq/cpufreq-dt-platdev.c |    2 +-
 drivers/cpufreq/rcpufreq_dt.rs       |  232 ++++++
 drivers/opp/core.c                   |   17 +-
 drivers/opp/opp.h                    |    1 -
 include/linux/cpufreq.h              |   27 +-
 include/linux/pm_opp.h               |    6 +
 rust/bindings/bindings_helper.h      |    5 +
 rust/helpers/cpufreq.c               |   16 +
 rust/helpers/cpumask.c               |   35 +
 rust/helpers/helpers.c               |    2 +
 rust/kernel/clk.rs                   |   48 ++
 rust/kernel/cpufreq.rs               | 1079 ++++++++++++++++++++++++++
 rust/kernel/cpumask.rs               |   85 ++
 rust/kernel/device.rs                |   21 +
 rust/kernel/lib.rs                   |    6 +
 rust/kernel/opp.rs                   |  886 +++++++++++++++++++++
 19 files changed, 2468 insertions(+), 15 deletions(-)
 create mode 100644 drivers/cpufreq/rcpufreq_dt.rs
 create mode 100644 rust/helpers/cpufreq.c
 create mode 100644 rust/helpers/cpumask.c
 create mode 100644 rust/kernel/clk.rs
 create mode 100644 rust/kernel/cpufreq.rs
 create mode 100644 rust/kernel/cpumask.rs
 create mode 100644 rust/kernel/opp.rs

-- 
2.31.1.272.g89b43f80a514


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

end of thread, other threads:[~2025-01-13  7:53 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-07 11:21 [PATCH V6 00/15] Rust bindings for cpufreq and OPP core + sample driver Viresh Kumar
2025-01-07 11:21 ` [PATCH V6 01/15] PM / OPP: Expose refcounting helpers for the Rust implementation Viresh Kumar
2025-01-07 11:58   ` Greg KH
2025-01-08  9:11     ` Viresh Kumar
2025-01-08 11:53       ` Greg KH
2025-01-07 11:21 ` [PATCH V6 02/15] cpufreq: Add cpufreq_table_len() Viresh Kumar
2025-01-07 11:59   ` Greg KH
2025-01-08 11:12     ` Viresh Kumar
2025-01-08 11:50       ` Greg KH
2025-01-09  4:41         ` Viresh Kumar
2025-01-09  7:35           ` Greg KH
2025-01-13  7:30             ` Viresh Kumar
2025-01-13  7:53               ` Greg KH
2025-01-07 11:21 ` [PATCH V6 03/15] cpufreq: Rust implementation doesn't parse BIT() macro Viresh Kumar
2025-01-07 12:00   ` Greg KH
2025-01-07 13:29     ` Daniel Almeida
2025-01-08  6:53       ` Viresh Kumar
2025-01-08  9:01         ` Alice Ryhl
2025-01-08  9:27           ` Viresh Kumar
2025-01-08  5:37     ` Viresh Kumar
2025-01-08 14:47   ` Miguel Ojeda
2025-01-07 11:21 ` [PATCH V6 04/15] rust: device: Add few helpers Viresh Kumar
2025-01-07 11:56   ` Greg Kroah-Hartman
2025-01-08 11:02     ` Viresh Kumar
2025-01-08 11:52       ` Greg Kroah-Hartman
2025-01-08 11:55         ` Alice Ryhl
2025-01-08 12:14           ` Greg Kroah-Hartman
2025-01-08 13:42         ` Danilo Krummrich
2025-01-09  6:36           ` Viresh Kumar
2025-01-09  5:14         ` Viresh Kumar
2025-01-07 11:56   ` Danilo Krummrich
2025-01-07 11:21 ` [PATCH V6 05/15] rust: Add bindings for cpumask Viresh Kumar
2025-01-07 12:01   ` Greg KH
2025-01-07 11:21 ` [PATCH V6 06/15] rust: Add bare minimal bindings for clk framework Viresh Kumar
2025-01-07 11:21 ` [PATCH V6 07/15] rust: Add initial bindings for OPP framework Viresh Kumar
2025-01-07 11:21 ` [PATCH V6 08/15] rust: Extend OPP bindings for the OPP table Viresh Kumar
2025-01-07 11:21 ` [PATCH V6 09/15] rust: Extend OPP bindings for the configuration options Viresh Kumar
2025-01-07 11:21 ` [PATCH V6 10/15] rust: Add initial bindings for cpufreq framework Viresh Kumar
2025-01-07 11:21 ` [PATCH V6 11/15] rust: Extend cpufreq bindings for policy and driver ops Viresh Kumar
2025-01-07 11:21 ` [PATCH V6 12/15] rust: Extend cpufreq bindings for driver registration Viresh Kumar
2025-01-07 11:21 ` [PATCH V6 13/15] rust: Extend OPP bindings with CPU frequency table Viresh Kumar
2025-01-07 11:21 ` [PATCH V6 14/15] cpufreq: Add Rust based cpufreq-dt driver Viresh Kumar
2025-01-07 12:04   ` Greg KH
2025-01-07 11:21 ` [PATCH V6 15/15] DO-NOT_MERGE: cpufreq: Rename cpufreq-dt platdev Viresh Kumar
2025-01-07 11:47 ` [PATCH V6 00/15] Rust bindings for cpufreq and OPP core + sample driver Danilo Krummrich
2025-01-08  5:20   ` Viresh Kumar
2025-01-08 15:03     ` Miguel Ojeda
2025-01-09  3:50       ` Viresh Kumar

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