From 8835ca02a3a4043fa100dacb8243899a58186ce0 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Tue, 25 Feb 2025 11:41:11 +0000 Subject: [PATCH] ANDROID: ashmem: adjust Kconfig so CONFIG_ASHMEM=y is set with Rust There are tests in Android that perform feature detection by checking whether CONFIG_ASHMEM=y is set in the config file. Thus, adjust the Kconfig file so that CONFIG_ASHMEM=y determines whether either Ashmem driver is available, and so that CONFIG_ASHMEM_RUST=y determines whether the Rust driver is used or not. This also avoids duplication of the help message for ashmem. The CONFIG_ASHMEM_C boolean is introduced for use in the Makefile. It is not possible to directly set this option as it has no description. Bug: 398956719 Bug: 370906207 Change-Id: I2930eb8e02ef2ab61edde8f9b74083ec5abc3557 Signed-off-by: Alice Ryhl --- arch/arm64/configs/gki_defconfig | 1 + arch/x86/configs/gki_defconfig | 1 + drivers/staging/android/Kconfig | 13 ++++--------- drivers/staging/android/Makefile | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/arch/arm64/configs/gki_defconfig b/arch/arm64/configs/gki_defconfig index 48873ed90b7c..174a63cb3c56 100644 --- a/arch/arm64/configs/gki_defconfig +++ b/arch/arm64/configs/gki_defconfig @@ -589,6 +589,7 @@ CONFIG_VIRTIO_PCI=m CONFIG_VIRTIO_BALLOON=m CONFIG_VHOST_VSOCK=y CONFIG_STAGING=y +CONFIG_ASHMEM=y CONFIG_ASHMEM_RUST=y CONFIG_COMMON_CLK_SCPI=y # CONFIG_SUNXI_CCU is not set diff --git a/arch/x86/configs/gki_defconfig b/arch/x86/configs/gki_defconfig index ef6dc675b11b..79920144a5db 100644 --- a/arch/x86/configs/gki_defconfig +++ b/arch/x86/configs/gki_defconfig @@ -537,6 +537,7 @@ CONFIG_VIRTIO_PCI=m CONFIG_VIRTIO_BALLOON=m CONFIG_VHOST_VSOCK=y CONFIG_STAGING=y +CONFIG_ASHMEM=y CONFIG_ASHMEM_RUST=y CONFIG_REMOTEPROC=y CONFIG_REMOTEPROC_CDEV=y diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig index 19d8416e484e..9bfef6599e6d 100644 --- a/drivers/staging/android/Kconfig +++ b/drivers/staging/android/Kconfig @@ -17,15 +17,10 @@ config ASHMEM because it can discard shared memory units when under memory pressure. config ASHMEM_RUST - bool "Enable the Anonymous Shared Memory Subsystem in Rust" - depends on SHMEM && RUST && !ASHMEM - select ANDROID_STAGING - help - The ashmem subsystem is a new shared memory allocator, similar to - POSIX SHM but with different behavior and sporting a simpler - file-based API. + bool "Use the Rust implementation of Ashmem" + depends on ASHMEM && RUST - It is, in theory, a good memory allocator for low-memory devices, - because it can discard shared memory units when under memory pressure. +config ASHMEM_C + def_bool ASHMEM && !ASHMEM_RUST endmenu diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile index 39121ac44581..55a4320bbf8e 100644 --- a/drivers/staging/android/Makefile +++ b/drivers/staging/android/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 ccflags-y += -I$(src) # needed for trace events -obj-$(CONFIG_ASHMEM) += ashmem.o +obj-$(CONFIG_ASHMEM_C) += ashmem.o obj-$(CONFIG_ASHMEM_RUST) += ashmem_rust.o