diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig index c5e063b723dd..f87475aebeed 100644 --- a/drivers/android/Kconfig +++ b/drivers/android/Kconfig @@ -37,6 +37,18 @@ config ANDROID_BINDER_DEVICES created. Each binder device has its own context manager, and is therefore logically separated from the other devices. +config ANDROID_BINDER_IPC_RUST + tristate "Rust version of Android Binder IPC Driver" + depends on RUST && ANDROID_BINDER_IPC && ANDROID_BINDERFS + help + This enables the Rust implementation of the Binder driver. At this + time, the Rust implementation can only be built as an alternative to + the C implementation. By default, the C implementation is used, but + if the binder.impl=rust kernel command-line parameter is provided, + then the Rust implementation is used instead. + + To build this as a GKI module, choose m. + config ANDROID_BINDER_IPC_SELFTEST bool "Android Binder IPC Driver Selftest" depends on ANDROID_BINDER_IPC diff --git a/drivers/android/Makefile b/drivers/android/Makefile index 9b89e4ba00a1..0b876f863e02 100644 --- a/drivers/android/Makefile +++ b/drivers/android/Makefile @@ -6,3 +6,7 @@ obj-$(CONFIG_ANDROID_BINDER_IPC) += binder.o binder_alloc.o obj-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o obj-$(CONFIG_ANDROID_VENDOR_HOOKS) += vendor_hooks.o obj-$(CONFIG_ANDROID_DEBUG_KINFO) += debug_kinfo.o + +obj-$(CONFIG_ANDROID_BINDER_IPC_RUST) += rust_binder.o +rust_binder-objs := binder/rust_binder.o binder/rust_binderfs.o binder/rust_binder_events.o +rust_binder-objs += binder/rust_binder_hooks.o binder/page_range_helper.o diff --git a/drivers/android/binder/rust_binder.rs b/drivers/android/binder/rust_binder.rs index 67c401a67551..2a8aa474fea7 100644 --- a/drivers/android/binder/rust_binder.rs +++ b/drivers/android/binder/rust_binder.rs @@ -314,6 +314,8 @@ impl kernel::Module for BinderModule { } } + pr_warn!("Loaded Rust Binder."); + BINDER_SHRINKER.register(kernel::c_str!("android-binder"))?; // SAFETY: The module is being loaded, so we can initialize binderfs.