|
Revision tags: v6.15, v6.15-rc7, v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1, v6.14 |
|
| #
e1dfaa33 |
| 20-Mar-2025 |
Antonio Hickey <[email protected]> |
rust: enable `raw_ref_op` feature
Since Rust 1.82.0 the `raw_ref_op` feature is stable [1].
By enabling this feature we can use `&raw const place` and `&raw mut place` instead of using `addr_of!(pl
rust: enable `raw_ref_op` feature
Since Rust 1.82.0 the `raw_ref_op` feature is stable [1].
By enabling this feature we can use `&raw const place` and `&raw mut place` instead of using `addr_of!(place)` and `addr_of_mut!(place)` macros.
Allowing us to reduce macro complexity, and improve consistency with existing reference syntax as `&raw const`, `&raw mut` are similar to `&`, `&mut` making it fit more naturally with other existing code.
Suggested-by: Benno Lossin <[email protected]> Link: https://github.com/Rust-for-Linux/linux/issues/1148 Link: https://blog.rust-lang.org/2024/10/17/Rust-1.82.0.html#native-syntax-for-creating-a-raw-pointer [1] Signed-off-by: Antonio Hickey <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Reviewed-by: Tamir Duberstein <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Removed dashed line change as discussed. Added Link to the explanation of the feature in the Rust 1.82.0 release blog post. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
ad2907b4 |
| 17-Mar-2025 |
Abdiel Janulgue <[email protected]> |
rust: add dma coherent allocator abstraction
Add a simple dma coherent allocator rust abstraction. Based on Andreas Hindborg's dma abstractions from the rnvme driver, which was also based on earlier
rust: add dma coherent allocator abstraction
Add a simple dma coherent allocator rust abstraction. Based on Andreas Hindborg's dma abstractions from the rnvme driver, which was also based on earlier work by Wedson Almeida Filho.
Reviewed-by: Alice Ryhl <[email protected]> Signed-off-by: Abdiel Janulgue <[email protected]> Acked-by: Danilo Krummrich <[email protected]> Link: https://lore.kernel.org/r/[email protected] Nacked-by: Christoph Hellwig <[email protected]> [ Removed period. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
|
Revision tags: v6.14-rc7, v6.14-rc6 |
|
| #
dbd5058b |
| 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: make pin-init its own crate
Rename relative paths inside of the crate to still refer to the same items, also rename paths inside of the kernel crate and adjust the build system to build the cr
rust: make pin-init its own crate
Rename relative paths inside of the crate to still refer to the same items, also rename paths inside of the kernel crate and adjust the build system to build the crate.
[ Remove the `expect` (and thus the `lint_reasons` feature) since the tree now uses `quote!` from `rust/macros/export.rs`. Remove the `TokenStream` import removal, since it is now used as well.
In addition, temporarily (i.e. just for this commit) use an `--extern force:alloc` to prevent an unknown `new_uninit` error in the `rustdoc` target. For context, please see a similar case in:
https://lore.kernel.org/lkml/[email protected]/
And adjusted the message above. - Miguel ]
Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
86f7daca |
| 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: add extensions to the pin-init crate and move relevant documentation there
In preparation of splitting off the pin-init crate from the kernel crate, move all kernel-specific documentation from
rust: add extensions to the pin-init crate and move relevant documentation there
In preparation of splitting off the pin-init crate from the kernel crate, move all kernel-specific documentation from pin-init back into the kernel crate.
Also include an example from the user-space version [1] adapted to the kernel.
The new `init.rs` file will also be populated by kernel-specific extensions to the pin-init crate by the next commits.
Link: https://github.com/Rust-for-Linux/pin-init/blob/c1417c64c71229f0fd444d75e88f33e3c547c829/src/lib.rs#L161 [1] Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
fbf8fb32 |
| 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: move pin-init API into its own directory
In preparation of splitting off the pin-init crate from the kernel crate, move all pin-init API code (including proc-macros) into `rust/pin-init`.
Mov
rust: move pin-init API into its own directory
In preparation of splitting off the pin-init crate from the kernel crate, move all pin-init API code (including proc-macros) into `rust/pin-init`.
Moved modules have their import path adjusted via the `#[path = "..."]` attribute. This allows the files to still be imported in the kernel crate even though the files are in different directories.
Code that is moved out of files (but the file itself stays where it is) is imported via the `include!` macro. This also allows the code to be moved while still being part of the kernel crate.
Note that this commit moves the generics parsing code out of the GPL-2.0 file `rust/macros/helpers.rs` into the Apache-2.0 OR MIT file `rust/pin_init/internal/src/helpers.rs`. I am the sole author of that code and it already is available with that license at [1]. The same is true for the entry-points of the proc-macros `pin_data`, `pinned_drop` and `derive_zeroable` in `rust/macros/lib.rs` that are moved to `rust/pin_data/internal/src/lib.rs`. Although there are some smaller patches that fix the doctests.
Link: https://github.com/Rust-for-Linux/pinned-init [1] Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
374908a1 |
| 03-Mar-2025 |
Miguel Ojeda <[email protected]> |
rust: remove leftover mentions of the `alloc` crate
In commit 392e34b6bc22 ("kbuild: rust: remove the `alloc` crate and `GlobalAlloc`") we stopped using the upstream `alloc` crate.
Thus remove a fe
rust: remove leftover mentions of the `alloc` crate
In commit 392e34b6bc22 ("kbuild: rust: remove the `alloc` crate and `GlobalAlloc`") we stopped using the upstream `alloc` crate.
Thus remove a few leftover mentions treewide.
Cc: [email protected] # Also to 6.12.y after the `alloc` backport lands Fixes: 392e34b6bc22 ("kbuild: rust: remove the `alloc` crate and `GlobalAlloc`") Reviewed-by: Danilo Krummrich <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
|
Revision tags: v6.14-rc5, v6.14-rc4, v6.14-rc3 |
|
| #
78418f30 |
| 10-Feb-2025 |
Lyude Paul <[email protected]> |
rust/kernel: Add faux device bindings
This introduces a module for working with faux devices in rust, along with adding sample code to show how the API is used. Unlike other types of devices, we don
rust/kernel: Add faux device bindings
This introduces a module for working with faux devices in rust, along with adding sample code to show how the API is used. Unlike other types of devices, we don't provide any hooks for device probe/removal - since these are optional for the faux API and are unnecessary in rust.
Signed-off-by: Lyude Paul <[email protected]> Cc: Maíra Canal <[email protected]> Cc: Danilo Krummrich <[email protected]> Cc: Miguel Ojeda <[email protected]> Acked-by: Danilo Krummrich <[email protected]> Link: https://lore.kernel.org/r/2025021026-exert-accent-b4c6@gregkh Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.14-rc2, v6.14-rc1, v6.13, v6.13-rc7, v6.13-rc6, v6.13-rc5, v6.13-rc4, v6.13-rc3, v6.13-rc2 |
|
| #
47cb6bf7 |
| 03-Dec-2024 |
Xiangfei Ding <[email protected]> |
rust: use derive(CoercePointee) on rustc >= 1.84.0
The `kernel` crate relies on both `coerce_unsized` and `dispatch_from_dyn` unstable features.
Alice Ryhl has proposed [1] the introduction of the
rust: use derive(CoercePointee) on rustc >= 1.84.0
The `kernel` crate relies on both `coerce_unsized` and `dispatch_from_dyn` unstable features.
Alice Ryhl has proposed [1] the introduction of the unstable macro `SmartPointer` to reduce such dependence, along with a RFC patch [2]. Since Rust 1.81.0 this macro, later renamed to `CoercePointee` in Rust 1.84.0 [3], has been fully implemented with the naming discussion resolved.
This feature is now on track to stabilization in the language. In order to do so, we shall start using this macro in the `kernel` crate to prove the functionality and utility of the macro as the justification of its stabilization.
This patch makes this switch in such a way that the crate remains backward compatible with older Rust compiler versions, via the new Kconfig option `RUSTC_HAS_COERCE_POINTEE`.
A minimal demonstration example is added to the `samples/rust/rust_print_main.rs` module.
Link: https://rust-lang.github.io/rfcs/3621-derive-smart-pointer.html [1] Link: https://lore.kernel.org/all/[email protected]/ [2] Link: https://github.com/rust-lang/rust/pull/131284 [3] Signed-off-by: Xiangfei Ding <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Fixed version to 1.84. Renamed option to `RUSTC_HAS_COERCE_POINTEE` to match `CC_HAS_*` ones. Moved up new config option, closer to the `CC_HAS_*` ones. Simplified Kconfig line. Fixed typos and slightly reworded example and commit. Added Link to PR. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
|
Revision tags: v6.13-rc1 |
|
| #
614724e7 |
| 23-Nov-2024 |
Miguel Ojeda <[email protected]> |
rust: kernel: move `build_error` hidden function to prevent mistakes
Users were using the hidden exported `kernel::build_error` function instead of the intended `kernel::build_error!` macro, e.g. se
rust: kernel: move `build_error` hidden function to prevent mistakes
Users were using the hidden exported `kernel::build_error` function instead of the intended `kernel::build_error!` macro, e.g. see the previous commit.
To force to use the macro, move it into the `build_assert` module, thus making it a compilation error and avoiding a collision in the same "namespace". Using the function now would require typing the module name (which is hidden), not just a single character.
Now attempting to use the function will trigger this error with the right suggestion by the compiler:
error[E0423]: expected function, found macro `kernel::build_error` --> samples/rust/rust_minimal.rs:29:9 | 29 | kernel::build_error(); | ^^^^^^^^^^^^^^^^^^^ not a function | help: use `!` to invoke the macro | 29 | kernel::build_error!(); | +
An alternative would be using an alias, but it would be more complex and moving it into the module seems right since it belongs there and reduces the amount of code at the crate root.
Keep the `#[doc(hidden)]` inside `build_assert` in case the module is not hidden in the future.
Reviewed-by: Alice Ryhl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
9b880189 |
| 03-Jan-2025 |
Danilo Krummrich <[email protected]> |
rust: io: move module entry to its correct location
The module entry of `io` falsely ended up in the "use" block instead of the "mod" block, hence move it to its correct location.
Signed-off-by: Da
rust: io: move module entry to its correct location
The module entry of `io` falsely ended up in the "use" block instead of the "mod" block, hence move it to its correct location.
Signed-off-by: Danilo Krummrich <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
7e16820f |
| 03-Jan-2025 |
Danilo Krummrich <[email protected]> |
rust: pci: do not depend on CONFIG_PCI_MSI
The PCI abstractions do not actually depend on CONFIG_PCI_MSI; it also breaks drivers that only depend on CONFIG_PCI, hence drop it.
While at it, move the
rust: pci: do not depend on CONFIG_PCI_MSI
The PCI abstractions do not actually depend on CONFIG_PCI_MSI; it also breaks drivers that only depend on CONFIG_PCI, hence drop it.
While at it, move the module entry to its correct location.
Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Fixes: 1bd8b6b2c5d3 ("rust: pci: add basic PCI device / driver abstractions") Signed-off-by: Danilo Krummrich <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
683a63be |
| 19-Dec-2024 |
Danilo Krummrich <[email protected]> |
rust: platform: add basic platform device / driver abstractions
Implement the basic platform bus abstractions required to write a basic platform driver. This includes the following data structures:
rust: platform: add basic platform device / driver abstractions
Implement the basic platform bus abstractions required to write a basic platform driver. This includes the following data structures:
The `platform::Driver` trait represents the interface to the driver and provides `platform::Driver::probe` for the driver to implement.
The `platform::Device` abstraction represents a `struct platform_device`.
In order to provide the platform bus specific parts to a generic `driver::Registration` the `driver::RegistrationOps` trait is implemented by `platform::Adapter`.
Reviewed-by: Rob Herring (Arm) <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Tested-by: Dirk Behme <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
bbe3b4d1 |
| 19-Dec-2024 |
Danilo Krummrich <[email protected]> |
rust: of: add `of::DeviceId` abstraction
`of::DeviceId` is an abstraction around `struct of_device_id`.
This is used by subsequent patches, in particular the platform bus abstractions, to create OF
rust: of: add `of::DeviceId` abstraction
`of::DeviceId` is an abstraction around `struct of_device_id`.
This is used by subsequent patches, in particular the platform bus abstractions, to create OF device ID tables.
Reviewed-by: Rob Herring (Arm) <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Tested-by: Dirk Behme <[email protected]> Tested-by: Fabien Parent <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
1bd8b6b2 |
| 19-Dec-2024 |
Danilo Krummrich <[email protected]> |
rust: pci: add basic PCI device / driver abstractions
Implement the basic PCI abstractions required to write a basic PCI driver. This includes the following data structures:
The `pci::Driver` trait
rust: pci: add basic PCI device / driver abstractions
Implement the basic PCI abstractions required to write a basic PCI driver. This includes the following data structures:
The `pci::Driver` trait represents the interface to the driver and provides `pci::Driver::probe` for the driver to implement.
The `pci::Device` abstraction represents a `struct pci_dev` and provides abstractions for common functions, such as `pci::Device::set_master`.
In order to provide the PCI specific parts to a generic `driver::Registration` the `driver::RegistrationOps` trait is implemented by `pci::Adapter`.
`pci::DeviceId` implements PCI device IDs based on the generic `device_id::RawDevceId` abstraction.
Co-developed-by: FUJITA Tomonori <[email protected]> Signed-off-by: FUJITA Tomonori <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Tested-by: Dirk Behme <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
76c01ded |
| 19-Dec-2024 |
Danilo Krummrich <[email protected]> |
rust: add devres abstraction
Add a Rust abstraction for the kernel's devres (device resource management) implementation.
The Devres type acts as a container to manage the lifetime and accessibility
rust: add devres abstraction
Add a Rust abstraction for the kernel's devres (device resource management) implementation.
The Devres type acts as a container to manage the lifetime and accessibility of device bound resources. Therefore it registers a devres callback and revokes access to the resource on invocation.
Users of the Devres abstraction can simply free the corresponding resources in their Drop implementation, which is invoked when either the Devres instance goes out of scope or the devres callback leads to the resource being revoked, which implies a call to drop_in_place().
Signed-off-by: Danilo Krummrich <[email protected]> Tested-by: Dirk Behme <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
ce30d94e |
| 19-Dec-2024 |
Danilo Krummrich <[email protected]> |
rust: add `io::{Io, IoRaw}` base types
I/O memory is typically either mapped through direct calls to ioremap() or subsystem / bus specific ones such as pci_iomap().
Even though subsystem / bus spec
rust: add `io::{Io, IoRaw}` base types
I/O memory is typically either mapped through direct calls to ioremap() or subsystem / bus specific ones such as pci_iomap().
Even though subsystem / bus specific functions to map I/O memory are based on ioremap() / iounmap() it is not desirable to re-implement them in Rust.
Instead, implement a base type for I/O mapped memory, which generically provides the corresponding accessors, such as `Io::readb` or `Io:try_readb`.
`Io` supports an optional const generic, such that a driver can indicate the minimal expected and required size of the mapping at compile time. Correspondingly, calls to the 'non-try' accessors, support compile time checks of the I/O memory offset to read / write, while the 'try' accessors, provide boundary checks on runtime.
`IoRaw` is meant to be embedded into a structure (e.g. pci::Bar or io::IoMem) which creates the actual I/O memory mapping and initializes `IoRaw` accordingly.
To ensure that I/O mapped memory can't out-live the device it may be bound to, subsystems must embed the corresponding I/O memory type (e.g. pci::Bar) into a `Devres` container, such that it gets revoked once the device is unbound.
Reviewed-by: Alice Ryhl <[email protected]> Tested-by: Daniel Almeida <[email protected]> Reviewed-by: Daniel Almeida <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Tested-by: Dirk Behme <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
0494d9c8 |
| 19-Dec-2024 |
Wedson Almeida Filho <[email protected]> |
rust: add `Revocable` type
Revocable allows access to objects to be safely revoked at run time.
This is useful, for example, for resources allocated during device probe; when the device is removed,
rust: add `Revocable` type
Revocable allows access to objects to be safely revoked at run time.
This is useful, for example, for resources allocated during device probe; when the device is removed, the driver should stop accessing the device resources even if another state is kept in memory due to existing references (i.e., device context data is ref-counted and has a non-zero refcount after removal of the device).
Signed-off-by: Wedson Almeida Filho <[email protected]> Co-developed-by: Danilo Krummrich <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Tested-by: Dirk Behme <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
9b90864b |
| 19-Dec-2024 |
Danilo Krummrich <[email protected]> |
rust: implement `IdArray`, `IdTable` and `RawDeviceId`
Most subsystems use some kind of ID to match devices and drivers. Hence, we have to provide Rust drivers an abstraction to register an ID table
rust: implement `IdArray`, `IdTable` and `RawDeviceId`
Most subsystems use some kind of ID to match devices and drivers. Hence, we have to provide Rust drivers an abstraction to register an ID table for the driver to match.
Generally, those IDs are subsystem specific and hence need to be implemented by the corresponding subsystem. However, the `IdArray`, `IdTable` and `RawDeviceId` types provide a generalized implementation that makes the life of subsystems easier to do so.
Co-developed-by: Wedson Almeida Filho <[email protected]> Signed-off-by: Wedson Almeida Filho <[email protected]> Co-developed-by: Gary Guo <[email protected]> Signed-off-by: Gary Guo <[email protected]> Co-developed-by: Fabien Parent <[email protected]> Signed-off-by: Fabien Parent <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Tested-by: Dirk Behme <[email protected]> Tested-by: Fabien Parent <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
ea7e1828 |
| 19-Dec-2024 |
Danilo Krummrich <[email protected]> |
rust: implement generic driver registration
Implement the generic `Registration` type and the `RegistrationOps` trait.
The `Registration` structure is the common type that represents a driver regis
rust: implement generic driver registration
Implement the generic `Registration` type and the `RegistrationOps` trait.
The `Registration` structure is the common type that represents a driver registration and is typically bound to the lifetime of a module. However, it doesn't implement actual calls to the kernel's driver core to register drivers itself.
Instead the `RegistrationOps` trait is provided to subsystems, which have to implement `RegistrationOps::register` and `RegistrationOps::unregister`. Subsystems have to provide an implementation for both of those methods where the subsystem specific variants to register / unregister a driver have to implemented.
For instance, the PCI subsystem would call __pci_register_driver() from `RegistrationOps::register` and pci_unregister_driver() from `DrvierOps::unregister`.
Co-developed-by: Wedson Almeida Filho <[email protected]> Signed-off-by: Wedson Almeida Filho <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Tested-by: Dirk Behme <[email protected]> Tested-by: Fabien Parent <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
a790265c |
| 19-Dec-2024 |
Danilo Krummrich <[email protected]> |
rust: module: add trait `ModuleMetadata`
In order to access static metadata of a Rust kernel module, add the `ModuleMetadata` trait.
In particular, this trait provides the name of a Rust kernel mod
rust: module: add trait `ModuleMetadata`
In order to access static metadata of a Rust kernel module, add the `ModuleMetadata` trait.
In particular, this trait provides the name of a Rust kernel module as specified by the `module!` macro.
Signed-off-by: Danilo Krummrich <[email protected]> Tested-by: Dirk Behme <[email protected]> Tested-by: Fabien Parent <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.12, v6.12-rc7, v6.12-rc6, v6.12-rc5, v6.12-rc4, v6.12-rc3, v6.12-rc2, v6.12-rc1, v6.11 |
|
| #
d072acda |
| 13-Sep-2024 |
Gary Guo <[email protected]> |
rust: use custom FFI integer types
Currently FFI integer types are defined in libcore. This commit creates the `ffi` crate and asks bindgen to use that crate for FFI integer types instead of `core::
rust: use custom FFI integer types
Currently FFI integer types are defined in libcore. This commit creates the `ffi` crate and asks bindgen to use that crate for FFI integer types instead of `core::ffi`.
This commit is preparatory and no type changes are made in this commit yet.
Signed-off-by: Gary Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Added `rustdoc`, `rusttest` and KUnit tests support. Rebased on top of `rust-next` (e.g. migrated more `core::ffi` cases). Reworded crate docs slightly and formatted. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| #
7f15c46a |
| 22-Oct-2024 |
Wedson Almeida Filho <[email protected]> |
rust: introduce `InPlaceModule`
This allows modules to be initialised in-place in pinned memory, which enables the usage of pinned types (e.g., mutexes, spinlocks, driver registrations, etc.) in mod
rust: introduce `InPlaceModule`
This allows modules to be initialised in-place in pinned memory, which enables the usage of pinned types (e.g., mutexes, spinlocks, driver registrations, etc.) in modules without any extra allocations.
Signed-off-by: Wedson Almeida Filho <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Acked-by: Miguel Ojeda <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
169484ab |
| 30-Oct-2024 |
Alice Ryhl <[email protected]> |
rust: add arch_static_branch
To allow the Rust implementation of static_key_false to use runtime code patching instead of the generic implementation, pull in the relevant inline assembly from the ju
rust: add arch_static_branch
To allow the Rust implementation of static_key_false to use runtime code patching instead of the generic implementation, pull in the relevant inline assembly from the jump_label.h header by running the C preprocessor on a .rs.S file. Build rules are added for .rs.S files.
Since the relevant inline asm has been adjusted to export the inline asm via the ARCH_STATIC_BRANCH_ASM macro in a consistent way, the Rust side does not need architecture specific code to pull in the asm.
It is not possible to use the existing C implementation of arch_static_branch via a Rust helper because it passes the argument `key` to inline assembly as an 'i' parameter. Any attempt to add a C helper for this function will fail to compile because the value of `key` must be known at compile-time.
Cc: Masami Hiramatsu <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Jason Baron <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Alex Gaynor <[email protected]> Cc: Wedson Almeida Filho <[email protected]> Cc: Gary Guo <[email protected]> Cc: " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " <[email protected]> Cc: Benno Lossin <[email protected]> Cc: Andreas Hindborg <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Sean Christopherson <[email protected]> Cc: Uros Bizjak <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Oliver Upton <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Ryan Roberts <[email protected]> Cc: Fuad Tabba <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Albert Ou <[email protected]> Cc: Anup Patel <[email protected]> Cc: Andrew Jones <[email protected]> Cc: Alexandre Ghiti <[email protected]> Cc: Conor Dooley <[email protected]> Cc: Samuel Holland <[email protected]> Cc: Huacai Chen <[email protected]> Cc: WANG Xuerui <[email protected]> Cc: Bibo Mao <[email protected]> Cc: Tiezhu Yang <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Tianrui Zhao <[email protected]> Link: https://lore.kernel.org/[email protected] Suggested-by: Peter Zijlstra (Intel) <[email protected]> Co-developed-by: Miguel Ojeda <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Signed-off-by: Alice Ryhl <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
show more ...
|
| #
ad37bcd9 |
| 30-Oct-2024 |
Alice Ryhl <[email protected]> |
rust: add tracepoint support
Make it possible to have Rust code call into tracepoints defined by C code. It is still required that the tracepoint is declared in a C header, and that this header is i
rust: add tracepoint support
Make it possible to have Rust code call into tracepoints defined by C code. It is still required that the tracepoint is declared in a C header, and that this header is included in the input to bindgen.
Instead of calling __DO_TRACE directly, the exported rust_do_trace_ function calls an inline helper function. This is because the `cond` argument does not exist at the callsite of DEFINE_RUST_DO_TRACE.
__DECLARE_TRACE always emits an inline static and an extern declaration that is only used when CREATE_RUST_TRACE_POINTS is set. These should not end up in the final binary so it is not a problem that they sometimes are emitted without a user.
Cc: Masami Hiramatsu <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Jason Baron <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Alex Gaynor <[email protected]> Cc: Wedson Almeida Filho <[email protected]> Cc: " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " <[email protected]> Cc: Benno Lossin <[email protected]> Cc: Andreas Hindborg <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Sean Christopherson <[email protected]> Cc: Uros Bizjak <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Oliver Upton <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Ryan Roberts <[email protected]> Cc: Fuad Tabba <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Albert Ou <[email protected]> Cc: Anup Patel <[email protected]> Cc: Andrew Jones <[email protected]> Cc: Alexandre Ghiti <[email protected]> Cc: Conor Dooley <[email protected]> Cc: Samuel Holland <[email protected]> Cc: Huacai Chen <[email protected]> Cc: WANG Xuerui <[email protected]> Cc: Bibo Mao <[email protected]> Cc: Tiezhu Yang <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Tianrui Zhao <[email protected]> Link: https://lore.kernel.org/[email protected] Reviewed-by: Carlos Llamas <[email protected]> Reviewed-by: Gary Guo <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Signed-off-by: Alice Ryhl <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
show more ...
|
| #
6e59bcc9 |
| 30-Oct-2024 |
Alice Ryhl <[email protected]> |
rust: add static_branch_unlikely for static_key_false
Add just enough support for static key so that we can use it from tracepoints. Tracepoints rely on `static_branch_unlikely` with a `struct stati
rust: add static_branch_unlikely for static_key_false
Add just enough support for static key so that we can use it from tracepoints. Tracepoints rely on `static_branch_unlikely` with a `struct static_key_false`, so we add the same functionality to Rust.
This patch only provides a generic implementation without code patching (matching the one used when CONFIG_JUMP_LABEL is disabled). Later patches add support for inline asm implementations that use runtime patching.
When CONFIG_JUMP_LABEL is unset, `static_key_count` is a static inline function, so a Rust helper is defined for `static_key_count` in this case. If Rust is compiled with LTO, this call should get inlined. The helper can be eliminated once we have the necessary inline asm to make atomic operations from Rust.
Cc: Masami Hiramatsu <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Jason Baron <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Alex Gaynor <[email protected]> Cc: Wedson Almeida Filho <[email protected]> Cc: " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " <[email protected]> Cc: Benno Lossin <[email protected]> Cc: Andreas Hindborg <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Sean Christopherson <[email protected]> Cc: Uros Bizjak <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Oliver Upton <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Ryan Roberts <[email protected]> Cc: Fuad Tabba <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Albert Ou <[email protected]> Cc: Anup Patel <[email protected]> Cc: Andrew Jones <[email protected]> Cc: Alexandre Ghiti <[email protected]> Cc: Conor Dooley <[email protected]> Cc: Samuel Holland <[email protected]> Cc: Huacai Chen <[email protected]> Cc: WANG Xuerui <[email protected]> Cc: Bibo Mao <[email protected]> Cc: Tiezhu Yang <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Tianrui Zhao <[email protected]> Link: https://lore.kernel.org/[email protected] Reviewed-by: Boqun Feng <[email protected]> Reviewed-by: Gary Guo <[email protected]> Signed-off-by: Alice Ryhl <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
show more ...
|