Rust for Linux List
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Gary Guo" <gary@garyguo.net>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Miguel Ojeda" <ojeda@kernel.org>, "Nishanth Menon" <nm@ti.com>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Viresh Kumar" <vireshk@kernel.org>,
	"Viresh Kumar" <viresh.kumar@linaro.org>
Cc: linux-pm@vger.kernel.org,
	Vincent Guittot <vincent.guittot@linaro.org>,
	linux-kernel@vger.kernel.org,
	Manos Pitsidianakis <manos.pitsidianakis@linaro.org>,
	rust-for-linux@vger.kernel.org
Subject: [PATCH V7 00/16] Rust bindings for cpufreq and OPP core + sample driver
Date: Mon, 13 Jan 2025 16:52:55 +0530	[thread overview]
Message-ID: <cover.1736766672.git.viresh.kumar@linaro.org> (raw)

Hello,

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

This version is rebased on linux-next's master branch (needed changes from
rust-next and driver-core-next branches).

FIXME: I haven't found a solution yet for the last patch 16/16, if someone can
please help ?

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.

Viresh Kumar (16):
  cpufreq: Use enum for cpufreq flags that use BIT()
  PM / OPP: Add reference counting helpers for Rust implementation
  rust: cpu: Add from_cpu()
  rust: device: Add property_present()
  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
  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       |  230 ++++++
 drivers/opp/core.c                   |   17 +-
 drivers/opp/opp.h                    |    1 -
 include/linux/cpufreq.h              |   96 +--
 include/linux/pm_opp.h               |    6 +
 rust/bindings/bindings_helper.h      |    6 +
 rust/helpers/cpufreq.c               |   10 +
 rust/helpers/cpumask.c               |   35 +
 rust/helpers/helpers.c               |    2 +
 rust/kernel/clk.rs                   |   48 ++
 rust/kernel/cpu.rs                   |   26 +
 rust/kernel/cpufreq.rs               | 1056 ++++++++++++++++++++++++++
 rust/kernel/cpumask.rs               |   85 +++
 rust/kernel/device.rs                |    7 +
 rust/kernel/lib.rs                   |    7 +
 rust/kernel/opp.rs                   |  890 ++++++++++++++++++++++
 20 files changed, 2487 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

-- 
2.31.1.272.g89b43f80a514


             reply	other threads:[~2025-01-13 11:23 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13 11:22 Viresh Kumar [this message]
2025-01-13 11:22 ` [PATCH V7 01/16] cpufreq: Use enum for cpufreq flags that use BIT() Viresh Kumar
2025-01-13 11:22 ` [PATCH V7 02/16] PM / OPP: Add reference counting helpers for Rust implementation Viresh Kumar
2025-01-13 11:22 ` [PATCH V7 03/16] rust: cpu: Add from_cpu() Viresh Kumar
2025-01-14 18:44   ` Greg KH
2025-01-15  7:20     ` Viresh Kumar
2025-01-15  7:54       ` Greg KH
2025-01-15  7:58         ` Viresh Kumar
2025-01-15  8:09           ` Greg KH
2025-01-16  9:17             ` Viresh Kumar
2025-01-15  8:10         ` Alice Ryhl
2025-01-15  8:33           ` Viresh Kumar
2025-01-13 11:22 ` [PATCH V7 04/16] rust: device: Add property_present() Viresh Kumar
2025-01-14 18:42   ` Greg Kroah-Hartman
2025-01-14 18:42   ` Greg Kroah-Hartman
2025-01-15  7:15     ` Viresh Kumar
2025-01-15  7:35       ` Viresh Kumar
2025-01-15 17:21         ` Greg Kroah-Hartman
2025-01-13 11:23 ` [PATCH V7 05/16] rust: Add cpumask helpers Viresh Kumar
2025-01-13 11:23 ` [PATCH V7 06/16] rust: Add bindings for cpumask Viresh Kumar
2025-01-22 14:40   ` Miguel Ojeda
2025-01-23  3:43     ` Viresh Kumar
2025-01-13 11:23 ` [PATCH V7 07/16] rust: Add bare minimal bindings for clk framework Viresh Kumar
2025-01-13 11:23 ` [PATCH V7 08/16] rust: Add initial bindings for OPP framework Viresh Kumar
2025-01-13 11:23 ` [PATCH V7 09/16] rust: Extend OPP bindings for the OPP table Viresh Kumar
2025-01-13 11:23 ` [PATCH V7 10/16] rust: Extend OPP bindings for the configuration options Viresh Kumar
2025-01-13 11:23 ` [PATCH V7 11/16] rust: Add initial bindings for cpufreq framework Viresh Kumar
2025-01-13 11:23 ` [PATCH V7 12/16] rust: Extend cpufreq bindings for policy and driver ops Viresh Kumar
2025-01-13 11:23 ` [PATCH V7 13/16] rust: Extend cpufreq bindings for driver registration Viresh Kumar
2025-01-13 11:23 ` [PATCH V7 14/16] rust: Extend OPP bindings with CPU frequency table Viresh Kumar
2025-01-13 11:23 ` [PATCH V7 15/16] cpufreq: Add Rust based cpufreq-dt driver Viresh Kumar
2025-01-13 11:23 ` [PATCH V7 16/16] DO-NOT_MERGE: cpufreq: Rename cpufreq-dt platdev Viresh Kumar
2025-01-22 13:18   ` [PATCH] rust: macros: enable use of hyphens in module names Anisse Astier
2025-01-22 13:39     ` [PATCH v2] " Anisse Astier
2025-01-22 14:38       ` Viresh Kumar
2025-01-30  4:58       ` Viresh Kumar
2025-01-30  6:08         ` Anisse Astier
2025-01-30 11:51       ` Alice Ryhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1736766672.git.viresh.kumar@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=nm@ti.com \
    --cc=ojeda@kernel.org \
    --cc=rafael@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=vincent.guittot@linaro.org \
    --cc=vireshk@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox