From: Zheng Zengkai zhengzengkai@huawei.com
Rust for openEuler
Boqun Feng (1): kallsyms: avoid hardcoding the buffer size
Gary Guo (2): rust: add `build_error` crate vsprintf: add new `%pA` format specifier
Miguel Ojeda (17): kallsyms: support "big" kernel symbols kallsyms: increase maximum kernel symbol length to 512 rust: add C helpers rust: add `compiler_builtins` crate rust: import upstream `alloc` crate rust: adapt `alloc` crate to the kernel rust: add `macros` crate rust: export generated symbols scripts: checkpatch: diagnose uses of `%pA` in the C side scripts: checkpatch: enable language-independent checks for Rust scripts: add `rustdoc_test_{builder,gen}.py` scripts scripts: add `generate_rust_analyzer.py` scripts scripts: decode_stacktrace: demangle Rust symbols docs: add Rust documentation Kbuild: add Rust support samples: add Rust examples MAINTAINERS: Rust
Wedson Almeida Filho (3): rust: add `kernel` crate's `sync` module rust: add `kernel` crate drivers: gpio: PrimeCell PL061 in Rust
Weilong Chen (1): Adaptation of rust for openEuler
.gitignore | 5 + .rustfmt.toml | 12 + Documentation/core-api/printk-formats.rst | 10 + Documentation/doc-guide/kernel-doc.rst | 3 + Documentation/index.rst | 1 + Documentation/kbuild/kbuild.rst | 17 + Documentation/kbuild/makefiles.rst | 50 +- Documentation/process/changes.rst | 41 + Documentation/rust/arch-support.rst | 25 + Documentation/rust/coding-guidelines.rst | 216 ++ Documentation/rust/general-information.rst | 79 + Documentation/rust/index.rst | 22 + Documentation/rust/quick-start.rst | 232 ++ MAINTAINERS | 15 + Makefile | 176 +- arch/Kconfig | 6 + arch/arm/Kconfig | 1 + arch/arm64/Kconfig | 1 + arch/powerpc/Kconfig | 1 + arch/riscv/Kconfig | 1 + arch/riscv/Makefile | 5 + arch/um/Kconfig | 1 + arch/x86/Kconfig | 1 + arch/x86/Makefile | 13 + drivers/gpio/Kconfig | 8 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio_pl061_rust.rs | 370 ++ include/linux/kallsyms.h | 2 +- include/linux/spinlock.h | 25 +- init/Kconfig | 42 + kernel/kallsyms.c | 26 +- kernel/livepatch/core.c | 4 +- lib/Kconfig.debug | 155 + lib/vsprintf.c | 13 + rust/.gitignore | 10 + rust/Makefile | 398 +++ rust/alloc/README.md | 33 + rust/alloc/alloc.rs | 440 +++ rust/alloc/borrow.rs | 498 +++ rust/alloc/boxed.rs | 2026 +++++++++++ rust/alloc/boxed/thin.rs | 217 ++ rust/alloc/collections/mod.rs | 156 + rust/alloc/fmt.rs | 614 ++++ rust/alloc/lib.rs | 239 ++ rust/alloc/macros.rs | 128 + rust/alloc/raw_vec.rs | 567 +++ rust/alloc/slice.rs | 1295 +++++++ rust/alloc/str.rs | 641 ++++ rust/alloc/string.rs | 2944 +++++++++++++++ rust/alloc/vec/drain.rs | 186 + rust/alloc/vec/drain_filter.rs | 145 + rust/alloc/vec/into_iter.rs | 356 ++ rust/alloc/vec/is_zero.rs | 106 + rust/alloc/vec/mod.rs | 3362 ++++++++++++++++++ rust/alloc/vec/partial_eq.rs | 49 + rust/alloc/vec/set_len_on_drop.rs | 30 + rust/alloc/vec/spec_extend.rs | 174 + rust/bindgen_parameters | 17 + rust/build_error.rs | 29 + rust/compiler_builtins.rs | 79 + rust/exports.c | 20 + rust/helpers.c | 644 ++++ rust/kernel/allocator.rs | 65 + rust/kernel/amba.rs | 258 ++ rust/kernel/bindings.rs | 47 + rust/kernel/bindings_helper.h | 46 + rust/kernel/build_assert.rs | 82 + rust/kernel/c_types.rs | 119 + rust/kernel/chrdev.rs | 207 ++ rust/kernel/clk.rs | 79 + rust/kernel/cred.rs | 46 + rust/kernel/device.rs | 546 +++ rust/kernel/driver.rs | 442 +++ rust/kernel/error.rs | 565 +++ rust/kernel/file.rs | 864 +++++ rust/kernel/gpio.rs | 478 +++ rust/kernel/hwrng.rs | 242 ++ rust/kernel/io_buffer.rs | 153 + rust/kernel/io_mem.rs | 275 ++ rust/kernel/iov_iter.rs | 81 + rust/kernel/irq.rs | 411 +++ rust/kernel/kasync.rs | 6 + rust/kernel/kasync/net.rs | 322 ++ rust/kernel/kunit.rs | 91 + rust/kernel/lib.rs | 261 ++ rust/kernel/linked_list.rs | 247 ++ rust/kernel/miscdev.rs | 291 ++ rust/kernel/mm.rs | 149 + rust/kernel/module_param.rs | 498 +++ rust/kernel/net.rs | 391 ++ rust/kernel/net/filter.rs | 447 +++ rust/kernel/of.rs | 63 + rust/kernel/pages.rs | 144 + rust/kernel/platform.rs | 223 ++ rust/kernel/power.rs | 118 + rust/kernel/prelude.rs | 36 + rust/kernel/print.rs | 405 +++ rust/kernel/random.rs | 42 + rust/kernel/raw_list.rs | 361 ++ rust/kernel/rbtree.rs | 563 +++ rust/kernel/revocable.rs | 161 + rust/kernel/security.rs | 38 + rust/kernel/static_assert.rs | 38 + rust/kernel/std_vendor.rs | 160 + rust/kernel/str.rs | 597 ++++ rust/kernel/sync.rs | 161 + rust/kernel/sync/arc.rs | 503 +++ rust/kernel/sync/condvar.rs | 138 + rust/kernel/sync/guard.rs | 169 + rust/kernel/sync/locked_by.rs | 111 + rust/kernel/sync/mutex.rs | 153 + rust/kernel/sync/nowait.rs | 188 + rust/kernel/sync/revocable.rs | 250 ++ rust/kernel/sync/rwsem.rs | 197 + rust/kernel/sync/seqlock.rs | 202 ++ rust/kernel/sync/smutex.rs | 295 ++ rust/kernel/sync/spinlock.rs | 360 ++ rust/kernel/sysctl.rs | 199 ++ rust/kernel/task.rs | 175 + rust/kernel/types.rs | 679 ++++ rust/kernel/user_ptr.rs | 175 + rust/macros/helpers.rs | 79 + rust/macros/lib.rs | 94 + rust/macros/module.rs | 631 ++++ samples/Kconfig | 2 + samples/Makefile | 1 + samples/rust/Kconfig | 140 + samples/rust/Makefile | 15 + samples/rust/hostprogs/.gitignore | 3 + samples/rust/hostprogs/Makefile | 5 + samples/rust/hostprogs/a.rs | 7 + samples/rust/hostprogs/b.rs | 5 + samples/rust/hostprogs/single.rs | 12 + samples/rust/rust_chrdev.rs | 50 + samples/rust/rust_minimal.rs | 35 + samples/rust/rust_miscdev.rs | 143 + samples/rust/rust_module_parameters.rs | 69 + samples/rust/rust_netfilter.rs | 54 + samples/rust/rust_platform.rs | 22 + samples/rust/rust_print.rs | 54 + samples/rust/rust_random.rs | 60 + samples/rust/rust_semaphore.rs | 171 + samples/rust/rust_semaphore_c.c | 212 ++ samples/rust/rust_stack_probing.rs | 36 + samples/rust/rust_sync.rs | 93 + scripts/Kconfig.include | 2 +- scripts/Makefile | 3 + scripts/Makefile.build | 60 + scripts/Makefile.host | 34 +- scripts/Makefile.lib | 12 + scripts/cc-version.sh | 72 + scripts/checkpatch.pl | 8 +- scripts/decode_stacktrace.sh | 14 + scripts/generate_rust_analyzer.py | 134 + scripts/generate_rust_target.rs | 227 ++ scripts/is_rust_module.sh | 13 + scripts/kallsyms.c | 47 +- scripts/kconfig/confdata.c | 156 +- scripts/min-tool-version.sh | 43 + scripts/rust-is-available-bindgen-libclang.h | 2 + scripts/rust-is-available.sh | 158 + scripts/rustdoc_test_builder.py | 59 + scripts/rustdoc_test_gen.py | 164 + tools/include/linux/kallsyms.h | 2 +- tools/lib/perf/include/perf/event.h | 2 +- tools/lib/symbol/kallsyms.h | 2 +- 166 files changed, 34760 insertions(+), 43 deletions(-) create mode 100644 .rustfmt.toml create mode 100644 Documentation/rust/arch-support.rst create mode 100644 Documentation/rust/coding-guidelines.rst create mode 100644 Documentation/rust/general-information.rst create mode 100644 Documentation/rust/index.rst create mode 100644 Documentation/rust/quick-start.rst create mode 100644 drivers/gpio/gpio_pl061_rust.rs create mode 100644 rust/.gitignore create mode 100644 rust/Makefile create mode 100644 rust/alloc/README.md create mode 100644 rust/alloc/alloc.rs create mode 100644 rust/alloc/borrow.rs create mode 100644 rust/alloc/boxed.rs create mode 100644 rust/alloc/boxed/thin.rs create mode 100644 rust/alloc/collections/mod.rs create mode 100644 rust/alloc/fmt.rs create mode 100644 rust/alloc/lib.rs create mode 100644 rust/alloc/macros.rs create mode 100644 rust/alloc/raw_vec.rs create mode 100644 rust/alloc/slice.rs create mode 100644 rust/alloc/str.rs create mode 100644 rust/alloc/string.rs create mode 100644 rust/alloc/vec/drain.rs create mode 100644 rust/alloc/vec/drain_filter.rs create mode 100644 rust/alloc/vec/into_iter.rs create mode 100644 rust/alloc/vec/is_zero.rs create mode 100644 rust/alloc/vec/mod.rs create mode 100644 rust/alloc/vec/partial_eq.rs create mode 100644 rust/alloc/vec/set_len_on_drop.rs create mode 100644 rust/alloc/vec/spec_extend.rs create mode 100644 rust/bindgen_parameters create mode 100644 rust/build_error.rs create mode 100644 rust/compiler_builtins.rs create mode 100644 rust/exports.c create mode 100644 rust/helpers.c create mode 100644 rust/kernel/allocator.rs create mode 100644 rust/kernel/amba.rs create mode 100644 rust/kernel/bindings.rs create mode 100644 rust/kernel/bindings_helper.h create mode 100644 rust/kernel/build_assert.rs create mode 100644 rust/kernel/c_types.rs create mode 100644 rust/kernel/chrdev.rs create mode 100644 rust/kernel/clk.rs create mode 100644 rust/kernel/cred.rs create mode 100644 rust/kernel/device.rs create mode 100644 rust/kernel/driver.rs create mode 100644 rust/kernel/error.rs create mode 100644 rust/kernel/file.rs create mode 100644 rust/kernel/gpio.rs create mode 100644 rust/kernel/hwrng.rs create mode 100644 rust/kernel/io_buffer.rs create mode 100644 rust/kernel/io_mem.rs create mode 100644 rust/kernel/iov_iter.rs create mode 100644 rust/kernel/irq.rs create mode 100644 rust/kernel/kasync.rs create mode 100644 rust/kernel/kasync/net.rs create mode 100644 rust/kernel/kunit.rs create mode 100644 rust/kernel/lib.rs create mode 100644 rust/kernel/linked_list.rs create mode 100644 rust/kernel/miscdev.rs create mode 100644 rust/kernel/mm.rs create mode 100644 rust/kernel/module_param.rs create mode 100644 rust/kernel/net.rs create mode 100644 rust/kernel/net/filter.rs create mode 100644 rust/kernel/of.rs create mode 100644 rust/kernel/pages.rs create mode 100644 rust/kernel/platform.rs create mode 100644 rust/kernel/power.rs create mode 100644 rust/kernel/prelude.rs create mode 100644 rust/kernel/print.rs create mode 100644 rust/kernel/random.rs create mode 100644 rust/kernel/raw_list.rs create mode 100644 rust/kernel/rbtree.rs create mode 100644 rust/kernel/revocable.rs create mode 100644 rust/kernel/security.rs create mode 100644 rust/kernel/static_assert.rs create mode 100644 rust/kernel/std_vendor.rs create mode 100644 rust/kernel/str.rs create mode 100644 rust/kernel/sync.rs create mode 100644 rust/kernel/sync/arc.rs create mode 100644 rust/kernel/sync/condvar.rs create mode 100644 rust/kernel/sync/guard.rs create mode 100644 rust/kernel/sync/locked_by.rs create mode 100644 rust/kernel/sync/mutex.rs create mode 100644 rust/kernel/sync/nowait.rs create mode 100644 rust/kernel/sync/revocable.rs create mode 100644 rust/kernel/sync/rwsem.rs create mode 100644 rust/kernel/sync/seqlock.rs create mode 100644 rust/kernel/sync/smutex.rs create mode 100644 rust/kernel/sync/spinlock.rs create mode 100644 rust/kernel/sysctl.rs create mode 100644 rust/kernel/task.rs create mode 100644 rust/kernel/types.rs create mode 100644 rust/kernel/user_ptr.rs create mode 100644 rust/macros/helpers.rs create mode 100644 rust/macros/lib.rs create mode 100644 rust/macros/module.rs create mode 100644 samples/rust/Kconfig create mode 100644 samples/rust/Makefile create mode 100644 samples/rust/hostprogs/.gitignore create mode 100644 samples/rust/hostprogs/Makefile create mode 100644 samples/rust/hostprogs/a.rs create mode 100644 samples/rust/hostprogs/b.rs create mode 100644 samples/rust/hostprogs/single.rs create mode 100644 samples/rust/rust_chrdev.rs create mode 100644 samples/rust/rust_minimal.rs create mode 100644 samples/rust/rust_miscdev.rs create mode 100644 samples/rust/rust_module_parameters.rs create mode 100644 samples/rust/rust_netfilter.rs create mode 100644 samples/rust/rust_platform.rs create mode 100644 samples/rust/rust_print.rs create mode 100644 samples/rust/rust_random.rs create mode 100644 samples/rust/rust_semaphore.rs create mode 100644 samples/rust/rust_semaphore_c.c create mode 100644 samples/rust/rust_stack_probing.rs create mode 100644 samples/rust/rust_sync.rs create mode 100755 scripts/cc-version.sh create mode 100755 scripts/generate_rust_analyzer.py create mode 100644 scripts/generate_rust_target.rs create mode 100755 scripts/is_rust_module.sh create mode 100755 scripts/min-tool-version.sh create mode 100644 scripts/rust-is-available-bindgen-libclang.h create mode 100755 scripts/rust-is-available.sh create mode 100755 scripts/rustdoc_test_builder.py create mode 100755 scripts/rustdoc_test_gen.py