Rust for Linux List
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Rust: add runtime PM support
@ 2026-07-21 15:34 Beata Michalska
  2026-07-21 15:34 ` [PATCH v2 1/3] rust: " Beata Michalska
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Beata Michalska @ 2026-07-21 15:34 UTC (permalink / raw)
  To: ojeda, dakr, gregkh, rafael
  Cc: boqun, gary, bjorn3_gh, lossin, a.hindborg, aliceryhl, tmgross,
	daniel.almeida, boris.brezillon, work, samitolvanen,
	rust-for-linux, driver-core, linux-kernel, linux-pm

This series adds initial Rust support for Linux runtime PM.

The concept for Rust abstraction gets introduced in the first patch.
It provides callback registration, PM callback dispatch through PMOps trait,
scoped request helpers for common runtime PM operations and configuration
helpers.

The abstraction intends to keep the request semantics aligned with
the C runtime PM core.

Second patch integrates dev_pm_ops into the Rust platform driver abstraction,
enabling drivers to register PM callbacks with the core.

The last in the series is provided for demonstrative purposes
(not intended to be an actual merge material).

This has been lightly tested with the Tyr driver.

It is based on Danilo's drm-lifetime branch [1]

Note: Currently the PM abstraction stores the payload data associated with the
PM transitions within `struct device_private`. Newly introduced member has been
deliberately named 'rust_private', wiht the intention to be extended to cover
data registgry (on the Rust side) for any future cases that might need to take
the same approach as PM abstraction. And those are comming.
The work is ongoing and hopefully will be available soon.
For the time beinng the
	`rust_private`
is intended to represent
	`rust_pm_private`.

TBC

---
v2:
- Moving away from the old PMContext<T, Dormant/Active> type-state design
- Introducing an explicit Registration<'a, T> object.
- PMContext now carries a lifetime and is derived from the registration
- Callback data is no longer recovered through driver data
- Simplified PMOps
- Runtime payload handling change
- Request helpers slightly extended

---
[1] https://git.kernel.org/pub/scm/linux/kernel/git/dakr/linux.git/log/?h=drm-lifetime
---

Beata Michalska (3):
  rust: add runtime PM support
  rust: platform: wire runtime PM callbacks
  drm/tyr: enable runtime PM

 drivers/base/base.h             |    3 +
 drivers/gpu/drm/tyr/driver.rs   |  112 +++-
 drivers/gpu/drm/tyr/file.rs     |    7 +-
 rust/bindings/bindings_helper.h |    1 +
 rust/helpers/helpers.c          |    1 +
 rust/helpers/pm_runtime.c       |   44 ++
 rust/kernel/lib.rs              |    1 +
 rust/kernel/platform.rs         |    9 +
 rust/kernel/pm.rs               | 1020 +++++++++++++++++++++++++++++++
 9 files changed, 1177 insertions(+), 21 deletions(-)
 create mode 100644 rust/helpers/pm_runtime.c
 create mode 100644 rust/kernel/pm.rs

-- 
2.43.0


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

end of thread, other threads:[~2026-07-27 15:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-21 15:34 [PATCH v2 0/3] Rust: add runtime PM support Beata Michalska
2026-07-21 15:34 ` [PATCH v2 1/3] rust: " Beata Michalska
2026-07-27 14:56   ` Onur Özkan
2026-07-21 15:34 ` [PATCH v2 2/3] rust: platform: wire runtime PM callbacks Beata Michalska
2026-07-21 15:34 ` [PATCH v2 3/3] drm/tyr: enable runtime PM Beata Michalska
2026-07-27 15:00   ` Onur Özkan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox