From: Jialin Zhang zhangjialin11@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4RCS8 CVE: NA
Reference: https://android.googlesource.com/kernel/common/
---------------------------
Make android vendor hooks feature generic.
Signed-off-by: Jialin Zhang zhangjialin11@huawei.com Reviewed-by: Wei Li liwei391@huawei.com Reviewed-by: Xie XiuQi xiexiuqi@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/Kconfig | 2 ++ drivers/Makefile | 1 + drivers/android/Kconfig | 9 --------- drivers/android/Makefile | 1 - drivers/hooks/Kconfig | 13 +++++++++++++ drivers/hooks/Makefile | 4 ++++ drivers/{android => hooks}/vendor_hooks.c | 2 +- include/trace/hooks/vendor_hooks.h | 4 ++-- 8 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 drivers/hooks/Kconfig create mode 100644 drivers/hooks/Makefile rename drivers/{android => hooks}/vendor_hooks.c (91%)
diff --git a/drivers/Kconfig b/drivers/Kconfig index dcecc9f6e33f..9310808ee385 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -204,6 +204,8 @@ source "drivers/thunderbolt/Kconfig"
source "drivers/android/Kconfig"
+source "drivers/hooks/Kconfig" + source "drivers/gpu/trace/Kconfig"
source "drivers/nvdimm/Kconfig" diff --git a/drivers/Makefile b/drivers/Makefile index 576228037718..9d67932a5037 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -178,6 +178,7 @@ obj-$(CONFIG_CORESIGHT) += hwtracing/coresight/ obj-y += hwtracing/intel_th/ obj-$(CONFIG_STM) += hwtracing/stm/ obj-$(CONFIG_ANDROID) += android/ +obj-$(CONFIG_VENDOR_HOOKS) += hooks/ obj-$(CONFIG_NVMEM) += nvmem/ obj-$(CONFIG_FPGA) += fpga/ obj-$(CONFIG_FSI) += fsi/ diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig index 32fb9e5b6195..53b22e26266c 100644 --- a/drivers/android/Kconfig +++ b/drivers/android/Kconfig @@ -54,15 +54,6 @@ config ANDROID_BINDER_IPC_SELFTEST exhaustively with combinations of various buffer sizes and alignments.
-config ANDROID_VENDOR_HOOKS - bool "Android Vendor Hooks" - depends on TRACEPOINTS - help - Enable vendor hooks implemented as tracepoints - - Allow vendor modules to attach to tracepoint "hooks" defined via - DECLARE_HOOK or DECLARE_RESTRICTED_HOOK. - endif # if ANDROID
endmenu diff --git a/drivers/android/Makefile b/drivers/android/Makefile index d488047415a0..c9d3d0c99c25 100644 --- a/drivers/android/Makefile +++ b/drivers/android/Makefile @@ -4,4 +4,3 @@ ccflags-y += -I$(src) # needed for trace events obj-$(CONFIG_ANDROID_BINDERFS) += binderfs.o 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 diff --git a/drivers/hooks/Kconfig b/drivers/hooks/Kconfig new file mode 100644 index 000000000000..1c0e33ef9a56 --- /dev/null +++ b/drivers/hooks/Kconfig @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0 +menu "Vendor Hooks" + +config VENDOR_HOOKS + bool "Vendor Hooks" + depends on TRACEPOINTS + help + Enable vendor hooks implemented as tracepoints + + Allow vendor modules to attach to tracepoint "hooks" defined via + DECLARE_HOOK or DECLARE_RESTRICTED_HOOK. + +endmenu diff --git a/drivers/hooks/Makefile b/drivers/hooks/Makefile new file mode 100644 index 000000000000..159230826966 --- /dev/null +++ b/drivers/hooks/Makefile @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only +ccflags-y += -I$(src) # needed for trace events + +obj-$(CONFIG_VENDOR_HOOKS) += vendor_hooks.o diff --git a/drivers/android/vendor_hooks.c b/drivers/hooks/vendor_hooks.c similarity index 91% rename from drivers/android/vendor_hooks.c rename to drivers/hooks/vendor_hooks.c index 4a403a81eed3..359989d1bb32 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/hooks/vendor_hooks.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* vendor_hook.c * - * Android Vendor Hook Support + * Vendor Hook Support * * Copyright (C) 2020 Google, Inc. */ diff --git a/include/trace/hooks/vendor_hooks.h b/include/trace/hooks/vendor_hooks.h index 3661e5056519..ab8864da66d8 100644 --- a/include/trace/hooks/vendor_hooks.h +++ b/include/trace/hooks/vendor_hooks.h @@ -9,7 +9,7 @@
#include <linux/tracepoint.h>
-#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS) +#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_VENDOR_HOOKS)
#define DECLARE_HOOK DECLARE_TRACE
@@ -111,7 +111,7 @@
#endif /* TRACE_HEADER_MULTI_READ */
-#else /* !CONFIG_TRACEPOINTS || !CONFIG_ANDROID_VENDOR_HOOKS */ +#else /* !CONFIG_TRACEPOINTS || !CONFIG_VENDOR_HOOKS */ /* suppress trace hooks */ #define DECLARE_HOOK DECLARE_EVENT_NOP #define DECLARE_RESTRICTED_HOOK(name, proto, args, cond) \