Commit graph

1681 commits

Author SHA1 Message Date
Dave Airlie
15392f7640 DRM Rust changes for v7.0-rc1
DRM:
   - Fix documentation for Registration constructors.
   - Use pin_init::zeroed() for fops initialization.
   - Annotate DRM helpers with __rust_helper.
   - Improve safety documentation for gem::Object::new().
   - Update AlwaysRefCounted imports.
 
 MM:
   - Prevent integer overflow in page_align().
 
 Nova (Core):
   - Prepare for Turing support. This includes parsing and handling
     Turing-specific firmware headers and sections as well as a Turing
     Falcon HAL implementation.
   - Get rid of the Result<impl PinInit<T, E>> anti-pattern.
   - Relocate initializer-specific code into the appropriate initializer.
   - Use CStr::from_bytes_until_nul() to remove custom helpers.
   - Improve handling of unexpected firmware values.
   - Clean up redundant debug prints.
   - Replace c_str!() with native Rust C-string literals.
   - Update nova-core task list.
 
 Nova (DRM):
   - Align GEM object size to system page size.
 
 Tyr:
   - Use generated uAPI bindings for GpuInfo.
   - Replace manual sleeps with read_poll_timeout().
   - Replace c_str!() with native Rust C-string literals.
   - Suppress warnings for unread fields.
   - Fix incorrect register name in print statement.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQS2q/xV6QjXAdC7k+1FlHeO1qrKLgUCaXe+mAAKCRBFlHeO1qrK
 Lj8OAP0bfaO2pjlY/6XEE6oCSCuEeb/S9aYIeHeh+UiOKVqz/AD/QmLLWGF8zdxQ
 0+0f4jDvHJYR4fdTxTQns4+yyJIB0go=
 =JXPV
 -----END PGP SIGNATURE-----

Merge tag 'drm-rust-next-2026-01-26' of https://gitlab.freedesktop.org/drm/rust/kernel into drm-next

DRM Rust changes for v7.0-rc1

DRM:
  - Fix documentation for Registration constructors.
  - Use pin_init::zeroed() for fops initialization.
  - Annotate DRM helpers with __rust_helper.
  - Improve safety documentation for gem::Object::new().
  - Update AlwaysRefCounted imports.

MM:
  - Prevent integer overflow in page_align().

Nova (Core):
  - Prepare for Turing support. This includes parsing and handling
    Turing-specific firmware headers and sections as well as a Turing
    Falcon HAL implementation.
  - Get rid of the Result<impl PinInit<T, E>> anti-pattern.
  - Relocate initializer-specific code into the appropriate initializer.
  - Use CStr::from_bytes_until_nul() to remove custom helpers.
  - Improve handling of unexpected firmware values.
  - Clean up redundant debug prints.
  - Replace c_str!() with native Rust C-string literals.
  - Update nova-core task list.

Nova (DRM):
  - Align GEM object size to system page size.

Tyr:
  - Use generated uAPI bindings for GpuInfo.
  - Replace manual sleeps with read_poll_timeout().
  - Replace c_str!() with native Rust C-string literals.
  - Suppress warnings for unread fields.
  - Fix incorrect register name in print statement.
Signed-off-by: Dave Airlie <airlied@redhat.com>

From: "Danilo Krummrich" <dakr@kernel.org>
Link: https://patch.msgid.link/DFYW1WV6DUCG.3K8V2DAVD1Q4A@kernel.org
2026-01-28 13:35:23 +10:00
Gary Guo
a863b21b1e rust: macros: convert concat_idents! to use syn
This eliminates the need for `expect_punct` helper.

Reviewed-by: Tamir Duberstein <tamird@gmail.com>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260112170919.1888584-8-gary@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-28 00:55:25 +01:00
Gary Guo
8db9164b76 rust: macros: convert #[export] to use syn
This eliminates the custom `function_name` helper.

Reviewed-by: Tamir Duberstein <tamird@gmail.com>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260112170919.1888584-7-gary@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-28 00:55:25 +01:00
Gary Guo
5f70457720 rust: macros: use quote! for module! macro
This has no behavioural change, but is good for maintainability. With
`quote!`, we're no longer using string templates, so we don't need to
quote " and {} inside the template anymore. Further more, editors can
now highlight the code template.

This also improves the robustness as it eliminates the need for string
quoting and escaping.

Co-developed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260112170919.1888584-6-gary@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-28 00:55:24 +01:00
Gary Guo
c578ad703a rust: macros: use syn to parse module! macro
With `syn` being available in the kernel, use it to parse the complex
custom `module!` macro to replace existing helpers. Only parsing is
changed in this commit, the code generation is untouched.

This has the benefit of better error message when the macro is used
incorrectly, as it can point to a concrete span on what's going wrong.

For example, if a field is specified twice, previously it reads:

    error: proc macro panicked
      --> samples/rust/rust_minimal.rs:7:1
       |
    7  | / module! {
    8  | |     type: RustMinimal,
    9  | |     name: "rust_minimal",
    10 | |     author: "Rust for Linux Contributors",
    11 | |     description: "Rust minimal sample",
    12 | |     license: "GPL",
    13 | |     license: "GPL",
    14 | | }
       | |_^
       |
       = help: message: Duplicated key "license". Keys can only be specified once.

now it reads:

    error: duplicated key "license". Keys can only be specified once.
      --> samples/rust/rust_minimal.rs:13:5
       |
    13 |     license: "GPL",
       |     ^^^^^^^

Reviewed-by: Tamir Duberstein <tamird@gmail.com>
Signed-off-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Link: https://patch.msgid.link/20260112170919.1888584-5-gary@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-28 00:55:24 +01:00
Gary Guo
5f160950a5 rust: macros: convert #[vtable] macro to use syn
`#[vtable]` is converted to use syn. This is more robust than the
previous heuristic-based searching of defined methods and functions.

When doing so, the trait and impl are split into two code paths as the
types are distinct when parsed by `syn`.

Reviewed-by: Tamir Duberstein <tamird@gmail.com>
Signed-off-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Link: https://patch.msgid.link/20260112170919.1888584-4-gary@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-28 00:55:24 +01:00
Gary Guo
f637bafe1f rust: macros: use quote! from vendored crate
With `quote` crate now vendored in the kernel, we can remove our custom
`quote!` macro implementation and just rely on that crate instead.

The `quote` crate uses types from the `proc-macro2` library so we also
update to use that, and perform conversion in the top-level lib.rs.

Clippy complains about unnecessary `.to_string()` as `proc-macro2`
provides additional `PartialEq` impl, so they are removed.

Reviewed-by: Tamir Duberstein <tamird@gmail.com>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Gary Guo <gary@garyguo.net>
Acked-by: David Gow <davidgow@google.com> # for kunit
Link: https://patch.msgid.link/20260112170919.1888584-3-gary@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-28 00:55:24 +01:00
Miguel Ojeda
99ba0fa10d pin-init changes for v7.0
Added:
 
 - '&'static mut MaybeUninit<T>' now implements 'InPlaceWrite'. This
   enables users to use external allocation mechanisms such as
   'static_cell'.
 
 - Gary Guo as a Maintainer.
 
 Changed:
 
 - Rewrote all proc-macros ('[pin_]init!', '#[pin_data]',
   '#[pinned_drop]', 'derive([Maybe]Zeroable)'),  using 'syn' with better
   diagnostics.
 
 - 'derive([Maybe]Zeroable)' now support tuple structs.
 
 - '[pin_]init!' now supports attributes on fields (such as
   '#[cfg(...)]').
 
 - Add a '#[default_error(<type>)]' attribute to '[pin_]init!' to
   override the default error (when no '? Error' is specified).
 
 - Support packed struct in '[pin_]init!' with
   '#[disable_initialized_field_access]'.
 
 Removed:
 
 - 'try_[pin_]init!' have been removed in favor of merging their feature
   with '[pin_]init!'. The kernel's own 'try_[pin_]init!' macros have
   been updated to use the 'default_error' attribute.
 
 Fixed:
 
 - Corrected 'T: Sized' bounds to 'T: ?Sized' in the generated
   'PinnedDrop' check by '#[pin_data]'.
 -----BEGIN PGP SIGNATURE-----
 
 iIgEABYKADAWIQQjEG/HT3UeYLJybLTomd21rZaLygUCaXHz9BIcbG9zc2luQGtl
 cm5lbC5vcmcACgkQ6Jndta2Wi8q1AQD+IAf84ueKJ8vEfiSRP0IgteZakHxFHCyZ
 Uqsn0MQRUTgA/238IG65zYkrT8jaT3FY+LSoaNRY4rNS8/l9bxFWqqwA
 =dBj9
 -----END PGP SIGNATURE-----

Merge tag 'pin-init-v7.0' of https://github.com/Rust-for-Linux/linux into rust-next

Pull pin-init updates from Benno Lossin:
 "Added:

   - Implement 'InPlaceWrite' for '&'static mut MaybeUninit<T>'. This
     enables users to use external allocation mechanisms such as
     'static_cell'.

   - Add Gary Guo as a Maintainer.

  Changed:

   - Rewrote all proc-macros ('[pin_]init!', '#[pin_data]',
     '#[pinned_drop]', 'derive([Maybe]Zeroable)'), using 'syn' with
     better diagnostics.

   - Support tuple structs in 'derive([Maybe]Zeroable)'.

   - Support attributes on fields in '[pin_]init!' (such as
     '#[cfg(...)]').

   - Add a '#[default_error(<type>)]' attribute to '[pin_]init!' to
     override the default error (when no '? Error' is specified).

   - Support packed structs in '[pin_]init!' with
     '#[disable_initialized_field_access]'.

  Removed:

   - Remove 'try_[pin_]init!' in favor of merging their feature
     with '[pin_]init!'. Update the kernel's own 'try_[pin_]init!'
     macros to use the 'default_error' attribute.

  Fixed:

   - Correct 'T: Sized' bounds to 'T: ?Sized' in the generated
     'PinnedDrop' check by '#[pin_data]'."

* tag 'pin-init-v7.0' of https://github.com/Rust-for-Linux/linux:
  rust: pin-init: Implement `InPlaceWrite<T>` for `&'static mut MaybeUninit<T>`
  MAINTAINERS: add Gary Guo to pin-init
  rust: pin-init: internal: init: simplify Zeroable safety check
  rust: pin-init: internal: init: add escape hatch for referencing initialized fields
  rust: pin-init: internal: init: add support for attributes on initializer fields
  rust: init: use `#[default_error(err)]` for the initializer macros
  rust: pin-init: add `#[default_error(<type>)]` attribute to initializer macros
  rust: pin-init: rewrite the initializer macros using `syn`
  rust: pin-init: add `?Sized` bounds to traits in `#[pin_data]` macro
  rust: pin-init: rewrite `#[pin_data]` using `syn`
  rust: pin-init: rewrite the `#[pinned_drop]` attribute macro using `syn`
  rust: pin-init: rewrite `derive(Zeroable)` and `derive(MaybeZeroable)` using `syn`
  rust: pin-init: internal: add utility API for syn error handling
  rust: pin-init: add `syn` dependency and remove `proc-macro[2]` and `quote` workarounds
  rust: pin-init: allow the crate to refer to itself as `pin-init` in doc tests
  rust: pin-init: remove `try_` versions of the initializer macros
2026-01-28 00:19:32 +01:00
Rafael J. Wysocki
b753c3204d CPUFreq arm updates for 7.0
- Update cpufreq-dt-platdev list for tegra, qcom, TI (Aaron Kling,
   Dhruva Gole, and Konrad Dybcio).
 
 - Minor improvements to the cpufreq / cpumask rust implementation
   (Alexandre Courbot, Alice Ryhl, Tamir Duberstein, and Yilin Chen).
 
 - Add support for AM62L3 SoC to ti-cpufreq driver (Dhruva Gole).
 
 - Update FIE arch_freq_scale in ticks for non-PCC regs (Jie Zhan).
 
 - Other minor cleanups / improvements (Felix Gu, Juan Martinez, Luca
   Weiss, and Sergey Shtylyov).
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEx73Crsp7f6M6scA70rkcPK6BEhwFAml4YIcACgkQ0rkcPK6B
 Ehx6hQ//Y8GoICqNQe6IrVQ6b9eJLB/YOP7vPyZuwc0iqT9YWXrMou5xlnmNW/IY
 zj0Wo3l3fidp6eDOo7f21mXALF9yt8kElKq411Oqcg4WVWyAXc9p6ODpWZp/G2/h
 JcmusAkwFPul0XE0QJmlJ54KqtsyjoSWQHtrPzOO54mJEhOL4dWQwqhWP046ed7T
 FVkNRLb7ysY3+weNuAg45SbVJ3FT/a7f8XbdGd5DAz96efbqTyFt+znhfsd3Xti+
 sF75Mq1AEN0Vnfb8ZP4MZUCe7zeVdOVfLFqXXiW/qJOdbRgoD6k2uAOIt2NAcYU/
 sbv6UjaW0NE0oTvKbJ8CLE4IIJudjRgVNjyyGlKHdjBVgMQQk9vr7DIedGLghink
 VABcyerIqhPFGkBkY0IXkLSmhNtKWoLN9w7sMeCwhE34l63Bnie3Sg9JLikRxaXK
 6BAm3+8BiG30tg4WL1LX8UyssnMlUGvvOD9TCP4jOfLQeAk8wWgQ1D+CwWCB5o5j
 jtDwPTOCIN9UQT46lYS+kkqzwf4YTFVdA4c23Tod70gjrtm7Z1a7UzYNxoTGcGS3
 VtrgVnlgPh3/I/95Qpsgoy5D1oeIz9znFoVv6ETPBINy4A4rAsYMA4DEASfM7tIY
 pNhbSTcbtDbp6Eo79hkh5J2ZGoJyTSthrX+irqOz+IQFp8fP9s4=
 =Zz3B
 -----END PGP SIGNATURE-----

Merge tag 'cpufreq-arm-updates-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm

Pull CPUFreq Arm updates for 7.0 from Viresh Kumar:

"- Update cpufreq-dt-platdev list for tegra, qcom, TI (Aaron Kling,
   Dhruva Gole, and Konrad Dybcio).

 - Minor improvements to the cpufreq / cpumask rust implementation
   (Alexandre Courbot, Alice Ryhl, Tamir Duberstein, and Yilin Chen).

 - Add support for AM62L3 SoC to ti-cpufreq driver (Dhruva Gole).

 - Update FIE arch_freq_scale in ticks for non-PCC regs (Jie Zhan).

 - Other minor cleanups / improvements (Felix Gu, Juan Martinez, Luca
   Weiss, and Sergey Shtylyov)."

* tag 'cpufreq-arm-updates-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm:
  cpufreq: scmi: Fix device_node reference leak in scmi_cpu_domain_id()
  cpufreq: ti-cpufreq: add support for AM62L3 SoC
  cpufreq: dt-platdev: Add ti,am62l3 to blocklist
  cpufreq/amd-pstate: Add comment explaining nominal_perf usage for performance policy
  cpufreq: scmi: correct SCMI explanation
  cpufreq: dt-platdev: Block the driver from probing on more QC platforms
  rust: cpumask: rename methods of Cpumask for clarity and consistency
  cpufreq: CPPC: Update FIE arch_freq_scale in ticks for non-PCC regs
  cpufreq: CPPC: Factor out cppc_fie_kworker_init()
  ACPI: CPPC: Factor out and export per-cpu cppc_perf_ctrs_in_pcc_cpu()
  rust: cpufreq: replace `kernel::c_str!` with C-Strings
  cpufreq: Add Tegra186 and Tegra194 to cpufreq-dt-platdev blocklist
  dt-bindings: cpufreq: qcom-hw: document Milos CPUFREQ Hardware
  rust: cpufreq: add __rust_helper to helpers
  rust: cpufreq: always inline functions using build_assert with arguments
2026-01-27 14:46:28 +01:00
Miguel Ojeda
74a862d251 Rust XArray abstraction changes for v6.20/v7.0
- Add `__rust_helper` to xarray abstraction C helpers.
 -----BEGIN PGP SIGNATURE-----
 
 iQJKBAABCgA0FiEEEsH5R1a/fCoV1sAS4bgaPnkoY3cFAmluEbcWHGEuaGluZGJv
 cmdAa2VybmVsLm9yZwAKCRDhuBo+eShjd+BiEACgf86Dx8NTWCZWDQXdtWge5cXt
 By2dD1TkIcmWTWHLd2xDGki9VqUNi9WzYEYNUnu101achtYiTpt4b7y4kIkNWar4
 zosLtICeHwKHtOfhLdysCrcyE6lUsUcXsObFDKCPW9wt5kBxl+kB7a/yMu6W2E5U
 WbR7CSR6DpluHBQJ+Q2VOAcW7buFweYNPqNuPhZE6mZefeK5rYU/h5XU+EKP4zhP
 N/vwDCFMD9EhBEoXKj4YgxSw1lmX4b9b6p2VPOC9U96J53hlsHRNILC6+LD01BSm
 P8jbHkPv2I4nDn53Fsh0rHLEwiAR+CAfj2dJ3RguOOoG5yKXrmFtdMEhIQb6/aQ2
 vMnkvIgjB1gkiYQ8/kz7aqzEYkOi+fLKtdCvvngnQh4EU0cg9V6IKzYar7SKwd4r
 SpW4JQ1laMEa13xjKenQxBksA1xfhsQbLJDtjWB16hViJCgz3t/C6NPa+Zmu5WGg
 run3LxeZuUs/9fcQewwZ6wd2ePoEhEY66k2FYhVy/osOHWF1Z6XJLqTW5mEgAwl7
 P+6st0HCHzvcDLxqIuRQkYOQN11xBZjg2nTTUG8uKSgtCaj0mJBrysvsKa9I8CMD
 Gni4uywu4EQzxH5tyxVNmW1dRV+KDQP0y2+wLE1CXLSyYLbbLYJhiOxEE9qABSOL
 mIEWD+QnK67u/HwcGg==
 =9PpZ
 -----END PGP SIGNATURE-----

Merge tag 'rust-xarray-for-v6.20-v7.0' of https://github.com/Rust-for-Linux/linux into rust-next

Pull XArray update from Andreas Hindborg:

 - Add '__rust_helper' to XArray abstraction C helpers.

* tag 'rust-xarray-for-v6.20-v7.0' of https://github.com/Rust-for-Linux/linux:
  rust: xarray: add __rust_helper to helpers
2026-01-27 12:30:33 +01:00
Yilin Chen
11af6e102d rust: cpumask: rename methods of Cpumask for clarity and consistency
Rename `as_ref` and `as_mut_ref` to `from_raw` and `from_raw_mut` to
align with the established naming convention for constructing types
from raw pointers in the kernel's Rust codebase.

Signed-off-by: Yilin Chen <1479826151@qq.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2026-01-27 11:21:23 +05:30
Tamir Duberstein
e05d9e5c8b rust: cpufreq: replace kernel::c_str! with C-Strings
C-String literals were added in Rust 1.77. Replace instances of
`kernel::c_str!` with C-String literals where possible.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2026-01-27 11:21:22 +05:30
Alice Ryhl
9d84fd86d9 rust: cpufreq: add __rust_helper to helpers
This is needed to inline these helpers into Rust code.

Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2026-01-27 11:21:22 +05:30
Alexandre Courbot
8c8b12a556 rust: cpufreq: always inline functions using build_assert with arguments
`build_assert` relies on the compiler to optimize out its error path.
Functions using it with its arguments must thus always be inlined,
otherwise the error path of `build_assert` might not be optimized out,
triggering a build error.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2026-01-27 11:21:22 +05:30
Alice Ryhl
105ddfb2d2 rust: task: restrict Task::group_leader() to current
The Task::group_leader() method currently allows you to access the
group_leader() of any task, for example one you hold a refcount to.  But
this is not safe in general since the group leader could change when a
task exits.  See for example commit a15f37a401 ("kernel/sys.c: fix the
racy usage of task_lock(tsk->group_leader) in sys_prlimit64() paths").

All existing users of Task::group_leader() call this method on current,
which is guaranteed running, so there's not an actual issue in Rust code
today.  But to prevent code in the future from making this mistake,
restrict Task::group_leader() so that it can only be called on current.

There are some other cases where accessing task->group_leader is okay. 
For example it can be safe if you hold tasklist_lock or rcu_read_lock(). 
However, only supporting current->group_leader is sufficient for all
in-tree Rust users of group_leader right now.  Safe Rust functionality for
accessing it under rcu or while holding tasklist_lock may be added in the
future if required by any future Rust module.

This patch is a bugfix in that it prevents users of this API from writing
incorrect code.  It doesn't change behavior of correct code.

Link: https://lkml.kernel.org/r/20260107-task-group-leader-v2-1-8fbf816f2a2f@google.com
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Fixes: 313c4281bc ("rust: add basic `Task`")
Reported-by: Oleg Nesterov <oleg@redhat.com>
Closes: https://lore.kernel.org/all/aTLnV-5jlgfk1aRK@redhat.com/
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Cc: Andreas Hindborg <a.hindborg@kernel.org>
Cc: Benno Lossin <lossin@kernel.org>
Cc: "Björn Roy Baron" <bjorn3_gh@protonmail.com>
Cc: Björn Roy Baron <bjorn3_gh@protonmail.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: FUJITA Tomonori <fujita.tomonori@gmail.com>
Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Panagiotis Foliadis <pfoliadis@posteo.net>
Cc: Shankari Anand <shankari.ak0208@gmail.com>
Cc: Trevor Gross <tmgross@umich.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2026-01-26 19:07:13 -08:00
Danilo Krummrich
eb3dad518e Linux 6.19-rc7
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCgA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAml2lQweHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiG0dcH/2yLU3IKlHSSgEDL
 Qq3oBuRK/zoVOdy+CM+TmTdl2d1LnBd8J547xFStB7kVGf5mEkdFZdHLBSHRnKDf
 ia1SGec06kyLpRX6x5T6FsfwOhkBmVsp59X0coM57QWxxenybugtzPvDO2TQ8/G4
 buixJI0jJVgwRwXNzWB4n2W6FxNGui2A7gEN2mjtvkM2t/aDkiDjEqB8ve0pZJX9
 4EWhxOgRFzwWgkd/bY+4wgXVXEt3GtI+3VvNncRqLIO00A/AnZOYmH4S2RQUDszD
 IbyDscYYxloZcZMDXc3PN2WgD9DCGKuP3GpJGsOHbl0DN6JkqI9nwGsOFZKGVOeF
 vbajwPE=
 =iAOa
 -----END PGP SIGNATURE-----

Merge tag 'v6.19-rc7' into driver-core-next

We need the driver-core fixes in here as well to build on top of.

Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-01-26 13:23:52 +01:00
Greg Kroah-Hartman
dbd91d4f55 Merge 6.19-rc7 into char-misc-next
We need the char/misc/iio fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-01-26 12:04:04 +01:00
Alice Ryhl
e741e19d76 rust: workqueue: add __rust_helper to helpers
This is needed to inline these helpers into Rust code.

Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://patch.msgid.link/20260105-define-rust-helper-v2-26-51da5f454a67@google.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-26 03:51:31 +01:00
Alice Ryhl
93ad1d734e rust: uaccess: add __rust_helper to helpers
This is needed to inline these helpers into Rust code.

Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260105-define-rust-helper-v2-23-51da5f454a67@google.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-26 03:51:16 +01:00
Alice Ryhl
4890cd1d33 rust: slab: add __rust_helper to helpers
This is needed to inline these helpers into Rust code.

Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Link: https://patch.msgid.link/20260105-define-rust-helper-v2-19-51da5f454a67@google.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-26 03:50:50 +01:00
Alice Ryhl
ac585bf970 rust: rbtree: add __rust_helper to helpers
This is needed to inline these helpers into Rust code.

Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260105-define-rust-helper-v2-15-51da5f454a67@google.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-26 03:50:41 +01:00
Alice Ryhl
fffdb58732 rust: of: add __rust_helper to helpers
This is needed to inline these helpers into Rust code.

Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20260105-define-rust-helper-v2-12-51da5f454a67@google.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-26 03:50:21 +01:00
Alice Ryhl
5092aeaf70 rust: mm: add __rust_helper to helpers
This is needed to inline these helpers into Rust code.

Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Link: https://patch.msgid.link/20260105-define-rust-helper-v2-11-51da5f454a67@google.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-26 03:49:56 +01:00
Alice Ryhl
fa6cbf1f5a rust: maple_tree: add __rust_helper to helpers
This is needed to inline these helpers into Rust code.

Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Acked-by: Andrew Ballance <andrewjballance@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Link: https://patch.msgid.link/20260105-define-rust-helper-v2-10-51da5f454a67@google.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-26 03:49:09 +01:00
Alice Ryhl
227d1955bf rust: err: add __rust_helper to helpers
This is needed to inline these helpers into Rust code.

Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260105-define-rust-helper-v2-8-51da5f454a67@google.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-26 03:49:04 +01:00
Alice Ryhl
7caeac0b38 rust: bug: add __rust_helper to helpers
This is needed to inline these helpers into Rust code.

Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260105-define-rust-helper-v2-3-51da5f454a67@google.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-26 03:48:25 +01:00
Alexandre Courbot
209c70953a rust: transmute: implement FromBytes and AsBytes for inhabited ZSTs
This is useful when using types that may or may not be empty in generic
code relying on these traits. It is also safe because technically a
no-op.

Reviewed-by: Alistair Popple <apopple@nvidia.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Link: https://patch.msgid.link/20251215-transmute_unit-v4-1-477d71ec7c23@nvidia.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-26 03:16:31 +01:00
Peter Novak
7f87c7a003 rust: use consistent backtick formatting for NULL in docs
Some doc comments use `NULL` while others use plain NULL.  Make it
consistent by adding backticks everywhere, matching the majority of
existing usage.

Signed-off-by: Peter Novak <seimun018r@gmail.com>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Acked-by: David Gow <davidgow@google.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Link: https://patch.msgid.link/20251130211233.367946-1-seimun018r@gmail.com
[ Reworded slightly. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-26 03:13:27 +01:00
Shivam Kalra
5016cae970 rust: num: bounded: clean __new documentation and comments
Following commit 3a1ec424dd ("rust: num: bounded: mark __new as
unsafe"), remove the redundant paragraph in the documentation of __new now
that the Safety section explicitly covers the requirement.

Additionally, add an INVARIANT comment inside the function body where
the Bounded instance is actually constructed to document that the type
invariant is upheld.

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://lore.kernel.org/rust-for-linux/CANiq72mUCUh72BWP4eD1PTDpwdb1ML+Xgfom-Ys6thJooqQPwQ@mail.gmail.com/
Signed-off-by: Shivam Kalra <shivamklr@cock.li>
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Link: https://patch.msgid.link/20260123132132.53854-1-shivamklr@cock.li
[ Reworded slightly. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-26 02:53:16 +01:00
Miguel Ojeda
bd36f6e2ab rust: sync: atomic: Provide stub for rusttest 32-bit hosts
For arm32, on a x86_64 builder, running the `rusttest` target yields:

    error[E0080]: evaluation of constant value failed
      --> rust/kernel/static_assert.rs:37:23
       |
    37 |         const _: () = ::core::assert!($condition $(,$arg)?);
       |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: size_of::<isize>() == size_of::<isize_atomic_repr>()', rust/kernel/sync/atomic/predefine.rs:68:1
       |
      ::: rust/kernel/sync/atomic/predefine.rs:68:1
       |
    68 | static_assert!(size_of::<isize>() == size_of::<isize_atomic_repr>());
       | -------------------------------------------------------------------- in this macro invocation
       |
       = note: this error originates in the macro `::core::assert` which comes from the expansion of the macro `static_assert` (in Nightly builds, run with -Z macro-backtrace for more info)

The reason is that `rusttest` runs on the host, so for e.g. a x86_64
builder `isize` is 64 bits but it is not a `CONFIG_64BIT` build.

Fix it by providing a stub for `rusttest` as usual.

Fixes: 84c6d36bca ("rust: sync: atomic: Add Atomic<{usize,isize}>")
Cc: stable@vger.kernel.org
Reviewed-by: Onur Özkan <work@onurozkan.dev>
Acked-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://patch.msgid.link/20260123233432.22703-1-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-26 02:18:58 +01:00
Atharv Dubey
1cab087487 rust: auxiliary: use pin_init::zeroed() for device ID
Replace the previous `unsafe { core::mem::zeroed() }` initialization
for `bindings::auxillary_device_id` with `pin_init::zeroed()`. This removes
the explicit unsafe block and uses the safer pinned zero-initialization
helper.

Suggested-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Atharv Dubey <atharvd440@gmail.com>
Link: https://github.com/Rust-for-Linux/linux/issues/1189
Link: https://patch.msgid.link/20251129124706.26263-1-atharvd440@gmail.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-01-25 23:09:09 +01:00
Ke Sun
ae3bf76122 rust: debugfs: use pin_init::zeroed() for file_operations
Replace unsafe core::mem::zeroed() with pin_init::zeroed() for
file_operations initialization in all debugfs file operation
implementations.

Suggested-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Ke Sun <sunke@kylinos.cn>
Link: https://github.com/Rust-for-Linux/linux/issues/1189
Link: https://patch.msgid.link/20260120083824.477339-5-sunke@kylinos.cn
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-01-25 20:53:30 +01:00
Linus Torvalds
5dbeeb268b Driver core fixes for 6.19-rc7
- Always inline I/O and IRQ methods using build_assert!() to avoid
     false positive build errors.
 
   - Do not free the driver's device private data in I2C shutdown()
     avoiding race conditions that can lead to UAF bugs.
 
   - Drop the driver's device private data after the driver has been
     fully unbound from its device to avoid UAF bugs from &Device<Bound>
     scopes, such as IRQ callbacks.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQS2q/xV6QjXAdC7k+1FlHeO1qrKLgUCaXTJdAAKCRBFlHeO1qrK
 Lqt/AQDN7X8D6ABCPpYVZ0KKZZulLXjmv52CqtXc1IHBuergCgD/TEOu+t41amVb
 EkSO6/yN/NwMP0+eEF+XT1ybM3CYDQI=
 =8bg5
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-6.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core

Pull driver core fixes from Danilo Krummrich:

 - Always inline I/O and IRQ methods using build_assert!() to avoid
   false positive build errors

 - Do not free the driver's device private data in I2C shutdown()
   avoiding race conditions that can lead to UAF bugs

 - Drop the driver's device private data after the driver has been
   fully unbound from its device to avoid UAF bugs from &Device<Bound>
   scopes, such as IRQ callbacks

* tag 'driver-core-6.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core:
  rust: driver: drop device private data post unbind
  rust: driver: add DriverData type to the DriverLayout trait
  rust: driver: add DEVICE_DRIVER_OFFSET to the DriverLayout trait
  rust: driver: introduce a DriverLayout trait
  rust: auxiliary: add Driver::unbind() callback
  rust: i2c: do not drop device private data on shutdown()
  rust: irq: always inline functions using build_assert with arguments
  rust: io: always inline functions using build_assert with arguments
2026-01-24 10:13:22 -08:00
Gary Guo
600de1c008 rust: pci: remove redundant .as_ref() for dev_* print
This is now handled by the macro itself.

Signed-off-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260123175854.176735-2-gary@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-01-24 01:12:49 +01:00
Gary Guo
a38cd1fea9 rust: device: support dev_printk on all devices
Currently, `dev_*` only works on the core `Device`, but not on any other
bus or class device objects. This causes a pattern of
`dev_info!(pdev.as_ref())` which is not ideal.

This adds support of using these devices directly with `dev_*` macros, by
adding `AsRef` call inside the macro. To make sure we can still use just
`kernel::device::Device`, as `AsRef` implementation is added for it; this
is typical for types that is designed to use with `AsRef` anyway, for
example, `str` implements `AsRef<str>` and `Path` implements `AsRef<Path>`.

Signed-off-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260123175854.176735-1-gary@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-01-24 01:12:49 +01:00
Zhi Wang
4dc0bacb1d rust: pci: add config space read/write support
Drivers might need to access PCI config space for querying capability
structures and access the registers inside the structures.

For Rust drivers need to access PCI config space, the Rust PCI abstraction
needs to support it in a way that upholds Rust's safety principles.

Introduce a `ConfigSpace` wrapper in Rust PCI abstraction to provide safe
accessors for PCI config space. The new type implements the `Io` trait and
`IoCapable<T>` for u8, u16, and u32 to share offset validation and
bound-checking logic with other I/O backends.

The `ConfigSpace` type uses marker types (`Normal` and `Extended`) to
represent configuration space sizes at the type level.

Cc: Alexandre Courbot <acourbot@nvidia.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Gary Guo <gary@garyguo.net>
Cc: Joel Fernandes <joelagnelf@nvidia.com>
Signed-off-by: Zhi Wang <zhiw@nvidia.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://lore.kernel.org/all/DFV4IJDQC2J6.1Q91JOAL6CJSG@kernel.org/ [1]
Link: https://patch.msgid.link/20260121202212.4438-5-zhiw@nvidia.com
[ Applied the diff from [1], considering subsequent comment; remove
  #[expect(unused)] from define_{read,write}!(). - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-01-23 21:23:16 +01:00
Zhi Wang
5981d03c27 rust: io: factor out MMIO read/write macros
Refactor the existing MMIO accessors to use common call macros
instead of inlining the bindings calls in each `define_{read,write}!`
expansion.

This factoring separates the common offset/bounds checks from the
low-level call pattern, making it easier to add additional I/O accessor
families.

No functional change intended.

Cc: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Zhi Wang <zhiw@nvidia.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Link: https://patch.msgid.link/20260121202212.4438-4-zhiw@nvidia.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-01-23 21:21:39 +01:00
Zhi Wang
121d87b28e rust: io: separate generic I/O helpers from MMIO implementation
The previous Io<SIZE> type combined both the generic I/O access helpers
and MMIO implementation details in a single struct. This coupling prevented
reusing the I/O helpers for other backends, such as PCI configuration
space.

Establish a clean separation between the I/O interface and concrete
backends by separating generic I/O helpers from MMIO implementation.

Introduce a new trait hierarchy to handle different access capabilities:

- IoCapable<T>: A marker trait indicating that a backend supports I/O
  operations of a certain type (u8, u16, u32, or u64).

- Io trait: Defines fallible (try_read8, try_write8, etc.) and infallibile
  (read8, write8, etc.) I/O methods with runtime bounds checking and
  compile-time bounds checking.

- IoKnownSize trait: The marker trait for types support infallible I/O
  methods.

Move the MMIO-specific logic into a dedicated Mmio<SIZE> type that
implements the Io traits. Rename IoRaw to MmioRaw and update consumers to
use the new types.

Cc: Alexandre Courbot <acourbot@nvidia.com>
Cc: Alice Ryhl <aliceryhl@google.com>
Cc: Bjorn Helgaas <helgaas@kernel.org>
Cc: Gary Guo <gary@garyguo.net>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Zhi Wang <zhiw@nvidia.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260121202212.4438-3-zhiw@nvidia.com
[ Add #[expect(unused)] to define_{read,write}!(). - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-01-23 21:20:11 +01:00
Lyude Paul
638eeda8ab rust/drm: Fix Registration::{new,new_foreign_owned}() docs
Looks like we've actually had a malformed rustdoc reference in the rustdocs
for Registration::new_foreign_owned() for a while that, when fixed, still
couldn't resolve properly because it refers to a private item.

This is probably leftover from when Registration::new() was public, so drop
the documentation from that function and fixup the documentation for
Registration::new_foreign_owned().

Signed-off-by: Lyude Paul <lyude@redhat.com>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Fixes: 0600032c54 ("rust: drm: add DRM driver registration")
Cc: <stable@vger.kernel.org> # v6.16+
Link: https://patch.msgid.link/20260122221037.3462081-1-lyude@redhat.com
2026-01-23 14:18:07 -05:00
Zhi Wang
7043698aee rust: devres: style for imports
Convert all imports in the devres to use "kernel vertical" style.

Cc: Gary Guo <gary@garyguo.net>
Cc: Miguel Ojeda <ojeda@kernel.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Zhi Wang <zhiw@nvidia.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Link: https://patch.msgid.link/20260121202212.4438-2-zhiw@nvidia.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-01-23 19:16:11 +01:00
Miguel Ojeda
4c4e62321a rust: proc-macro2: rebuild if the version text changes
The Rust compiler cannot use dependencies built by other versions, e.g.:

    error[E0514]: found crate `proc_macro2` compiled by an incompatible version of rustc
     --> rust/quote/ext.rs:5:5
      |
    5 | use proc_macro2::{TokenStream, TokenTree};
      |     ^^^^^^^^^^^
      |
      = note: the following crate versions were found:
              crate `proc_macro2` compiled by rustc 1.92.0 (ded5c06cf 2025-12-08): ./rust/libproc_macro2.rlib
      = help: please recompile that crate using this compiler (rustc 1.93.0 (254b59607 2026-01-19)) (consider running `cargo clean` first)

Thus trigger a rebuild if the version text changes like we do in other
top-level cases (e.g. see commit aeb0e24abb ("kbuild: rust: replace
proc macros dependency on `core.o` with the version text")).

The build errors for now are hard to trigger, since we do not yet use
the new crates we just introduced (the use cases are coming in the next
merge window), but they can still be seen if e.g. one manually removes
one of the targets, so fix it already.

Fixes: 158a3b7211 ("rust: proc-macro2: enable support in kbuild")
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260122054135.138445-1-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-23 10:44:27 +01:00
Miguel Ojeda
12248a3862 rust: iommu: fix srctree link warning
The Rust kernel code should be kept `rustdoc`-clean [1].

Our custom `srctree` link checker in the `rustdoc` target reports:

    warning: srctree/ link to include/io-pgtable.h does not exist

Thus fix it.

Link: https://rust-for-linux.com/contributing#submit-checklist-addendum [1]
Fixes: 2e2f6b0ef8 ("rust: iommu: add io_pgtable abstraction")
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2026-01-22 09:19:30 +01:00
Miguel Ojeda
7222dd071b rust: iommu: fix Rust formatting
The Rust kernel code should be kept `rustfmt`-clean [1].

Thus run the `rustfmt` target to fix the formatting issue.

Link: https://rust-for-linux.com/contributing#submit-checklist-addendum [1]
Fixes: 2e2f6b0ef8 ("rust: iommu: add io_pgtable abstraction")
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
2026-01-22 09:19:30 +01:00
Ke Sun
880528eaa6 rust: block: mq: use pin_init::zeroed() for tag_set
Replace unsafe core::mem::zeroed() with pin_init::zeroed() for
blk_mq_tag_set initialization.

Signed-off-by: Ke Sun <sunke@kylinos.cn>
Acked-by: Andreas Hindborg <a.hindborg@kernel.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://lore.kernel.org/r/20260120083824.477339-4-sunke@kylinos.cn
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-01-21 07:37:15 -07:00
Ke Sun
d7a4693a25 rust: block: mq: use pin_init::zeroed() for queue_limits
Replace unsafe core::mem::zeroed() with pin_init::zeroed() for
queue_limits initialization.

Signed-off-by: Ke Sun <sunke@kylinos.cn>
Acked-by: Andreas Hindborg <a.hindborg@kernel.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://lore.kernel.org/r/20260120083824.477339-3-sunke@kylinos.cn
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-01-21 07:37:15 -07:00
Ethan Nelson-Moore
d8f87aa5fa net: remove HIPPI support and RoadRunner HIPPI driver
HIPPI has not been relevant for over two decades. It was rapidly
eclipsed by Fibre Channel, and even when it was new, it was
confined to very high-end hardware. The HIPPI code has only
received tree-wide changes and fixes by inspection in the entire
Git history. Remove HIPPI support and the rrunner HIPPI driver,
and move the former maintainer to the CREDITS file. Keep the
include/uapi/linux/if_hippi.h header because it is used by the TUN
code, and to avoid breaking userspace, however unlikely that may be.

Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
Link: https://patch.msgid.link/20260119022451.22344-1-enelsonmoore@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-01-20 19:12:06 -08:00
Alice Ryhl
0332d0408d rust: pwm: Add __rust_helper to helpers
This is needed to inline these helpers into Rust code.

Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Michal Wilczynski <m.wilczynski@samsung.com>
Link: https://patch.msgid.link/20260105-define-rust-helper-v2-14-51da5f454a67@google.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
2026-01-20 18:52:43 +01:00
Kari Argillander
fc1e4eae19 rust: pwm: Simplify to_result call sites and unsafe blocks
Remove unnecessary temporary variables around to_result() calls and move
trailing semicolons outside unsafe blocks to improve readability and
produce cleaner rustfmt output.

No functional change intended.

Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
Acked-by: Michal Wilczynski <m.wilczynski@samsung.com>
Link: https://patch.msgid.link/20260102-pwm-rust-v2-2-2702ce57d571@gmail.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
2026-01-20 18:49:58 +01:00
Kari Argillander
a2633dc243 rust: pwm: Fix potential memory leak on init error
When initializing a PWM chip using pwmchip_alloc(), the allocated device
owns an initial reference that must be released on all error paths.

If __pinned_init() were to fail, the allocated pwm_chip would currently
leak because the error path returns without calling pwmchip_put().

Fixes: 7b3dce814a ("rust: pwm: Add Kconfig and basic data structures")
Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
Acked-by: Michal Wilczynski <m.wilczynski@samsung.com>
Link: https://patch.msgid.link/20260102-pwm-rust-v2-1-2702ce57d571@gmail.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
2026-01-20 18:49:58 +01:00
Markus Probst
85a5ffbd56 rust: pwm: Add UnregisteredChip wrapper around Chip
The `pwm::Registration::register` function provides no guarantee that the
function isn't called twice with the same pwm chip, which is considered
unsafe.

Add `pwm::UnregisteredChip` as wrapper around `pwm::Chip`.
Implement `pwm::UnregisteredChip::register` for the registration. This
function takes ownership of `pwm::UnregisteredChip` and therefore
guarantees that the registration can't be called twice on the same pwm
chip.

Signed-off-by: Markus Probst <markus.probst@posteo.de>
Tested-by: Michal Wilczynski <m.wilczynski@samsung.com>
Acked-by: Michal Wilczynski <m.wilczynski@samsung.com>
Link: https://patch.msgid.link/20251202-pwm_safe_register-v2-1-7a2e0d1e287f@posteo.de
[ukleinek: fixes a typo that Michal pointed out during review]
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
2026-01-20 18:38:05 +01:00