Skip to content

Rust bindings for cpufreq and OPP core + sample driver

Viresh Kumar linux-clk linux-pm lkml rust-for-linux 8 versions – NAK

Status from this message: NAK.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest14 patches 38 repliesNAK
  2. v716 patches 15 repliesSuperseded
  3. v615 patches 32 repliesSuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v58 patches4 repliesSuperseded
v48 patches13 repliesSuperseded
v3 RFC8 patches14 repliesSuperseded
v2 RFC8 patches10 repliesSuperseded
v1 RFC3 patches7 repliesSuperseded

Changes in v8 from the cover letter

- Updated cpumask bindings to work with !CONFIG_CPUMASK_OFFSTACK case.
- Dropped few patches (property_present() and opp helpers), as they are already merged.
- from_cpu() is marked unsafe.
- Included a patch by Anisse Astier, to solve a long standing issue with this series.
- Dropped: "DO-NOT_MERGE: cpufreq: Rename cpufreq-dt platdev."
- Updated MAINTAINERS for new files.
- Other minor changes / cleanups.

Patches in v8

#Subject and filesSizeRepliesApplied
1/14rust: macros: enable use of hyphens in module namesrust/macros/module.rs+10 -70 replies
2/14cpufreq: Use enum for cpufreq flags that use BIT()include/linux/cpufreq.h+51 -450 replies
3/14rust: cpu: Add from_cpu()MAINTAINERS rust/bindings/bindings_helper.h rust/kernel/cpu.rs +1 more+34 -00 replies
4/14rust: Add cpumask helpersMAINTAINERS rust/bindings/bindings_helper.h rust/helpers/cpumask.c +1 more+43 -018 replies
5/14rust: Add bindings for cpumaskMAINTAINERS rust/kernel/cpumask.rs rust/kernel/lib.rs+140 -00 replies
6/14rust: Add bare minimal bindings for clk frameworkMAINTAINERS rust/bindings/bindings_helper.h rust/kernel/clk.rs +1 more+52 -011 replies
7/14rust: Add initial bindings for OPP frameworkMAINTAINERS rust/bindings/bindings_helper.h rust/kernel/lib.rs +1 more+193 -00 replies
8/14rust: Extend OPP bindings for the OPP tablerust/kernel/opp.rs+381 -10 replies
9/14rust: Extend OPP bindings for the configuration optionsrust/kernel/opp.rs+260 -20 replies
10/14rust: Add initial bindings for cpufreq frameworkMAINTAINERS rust/bindings/bindings_helper.h rust/helpers/cpufreq.c +3 more+243 -00 replies
11/14rust: Extend cpufreq bindings for policy and driver opsrust/kernel/cpufreq.rs+355 -20 replies
12/14rust: Extend cpufreq bindings for driver registrationrust/kernel/cpufreq.rs+473 -23 replies
13/14rust: Extend OPP bindings with CPU frequency tablerust/kernel/opp.rs+62 -00 replies
14/14cpufreq: Add Rust based cpufreq-dt driverdrivers/cpufreq/Kconfig drivers/cpufreq/Makefile drivers/cpufreq/rcpufreq_dt.rs +1 more+257 -40 replies

Reviews trailers per patch

4 of 14 patches have a Reviewed-by or Acked-by.

PatchAlice RyhlManos Pitsidianakis
1/14R-b
2/14
3/14
4/14
5/14
6/14
7/14R-b
8/14
9/14R-b
10/14R-b
11/14
12/14
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v8 thread

Cover letter [PATCH V8 00/14] Rust bindings for cpufreq and OPP core + sample driver

Hello,

I am seeking a few Acks for this patch series before merging it into the PM tree for the 6.15 merge window, unless there are any objections.

This 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. It also includes minimal bindings for the clk and cpumask frameworks, which are required by the cpufreq bindings.

Additionally, a sample cpufreq driver, rcpufreq-dt, is included. This is a duplicate of the existing cpufreq-dt driver, which is a platform-agnostic, device-tree-based driver commonly used on ARM platforms.

The implementation has been tested using QEMU, ensuring that frequency transitions, various configurations, and driver binding/unbinding work as expected. However, performance measurements have not been conducted yet.

For those interested in testing these patches, they can be found at:

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

This version is rebased on v6.14-rc1.

--
Viresh

V7->V8:
- Updated cpumask bindings to work with !CONFIG_CPUMASK_OFFSTACK case.
- Dropped few patches (property_present() and opp helpers), as they are already merged.
- from_cpu() is marked unsafe.
- Included a patch by Anisse Astier, to solve a long standing issue with this series.
- Dropped: "DO-NOT_MERGE: cpufreq: Rename cpufreq-dt platdev."
- Updated MAINTAINERS for new files.
- Other minor changes / cleanups.

V6->V7:
- from_cpu() is moved to cpu.rs and doesn't return ARef anymore, but just a reference.
- Dropped cpufreq_table_len() and related validation in cpufreq core.
- Solved the issue with BIT() macro differently, using an enum now.
- Few patches are broken into smaller / independent patches.
- Improved Commit logs and SAFETY comments at few places.
- Removed print message from cpufreq driver.
- Rebased over linux-next/master.
- Few other minor changes.

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.

Anisse Astier (1):
rust: macros: enable use of hyphens in module names

Viresh Kumar (13):
cpufreq: Use enum for cpufreq flags that use BIT()
rust: cpu: Add from_cpu()
rust: Add cpumask 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

 MAINTAINERS                     |    6 +
 drivers/cpufreq/Kconfig         |   12 +
 drivers/cpufreq/Makefile        |    1 +
 drivers/cpufreq/rcpufreq_dt.rs  |  238 +++++++
 include/linux/cpufreq.h         |   96 +--
 rust/bindings/bindings_helper.h |    5 +
 rust/helpers/cpufreq.c          |   10 +
 rust/helpers/cpumask.c          |   40 ++
 rust/helpers/helpers.c          |    2 +
 rust/kernel/clk.rs              |   48 ++
 rust/kernel/cpu.rs              |   31 +
 rust/kernel/cpufreq.rs          | 1054 +++++++++++++++++++++++++++++++
 rust/kernel/cpumask.rs          |  138 ++++
 rust/kernel/lib.rs              |    8 +
 rust/kernel/opp.rs              |  889 ++++++++++++++++++++++++++
 rust/macros/module.rs           |   17 +-
 16 files changed, 2543 insertions(+), 52 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/cpu.rs
 create mode 100644 rust/kernel/cpufreq.rs
 create mode 100644 rust/kernel/cpumask.rs
 create mode 100644 rust/kernel/opp.rs
Signature · 1 line
2.31.1.272.g89b43f80a514