From ea5f9fa169ea27b06cd8d0023c3094c19c6cacaa Mon Sep 17 00:00:00 2001 From: Jianxiong Pan Date: Thu, 18 Jan 2024 15:11:08 +0800 Subject: [PATCH] mm: move aml_smmu ko to memory_debug directory. [1/1] PD#SWPL-150034 Problem: reduce the ko number. Solution: move aml_smmu ko to memory_debug directory. Verify: local. Change-Id: If537a6a6493a9944319caa344ad8e3a73c294179 Signed-off-by: Jianxiong Pan --- drivers/memory_debug/Makefile | 2 +- drivers/memory_debug/main.c | 1 + drivers/memory_debug/main.h | 9 +++++++++ drivers/memory_debug/memory_ext/Kconfig | 8 ++++++++ drivers/memory_debug/memory_ext/Makefile | 1 + drivers/{ => memory_debug}/memory_ext/aml_smmu.c | 7 +++---- drivers/memory_ext/Kconfig | 7 ------- drivers/memory_ext/Makefile | 1 - drivers/memory_ext/slab_trace.c | 11 ++++++----- modules.bzl | 1 - scripts/amlogic/modules_sequence_list | 1 - 11 files changed, 29 insertions(+), 20 deletions(-) rename drivers/{ => memory_debug}/memory_ext/aml_smmu.c (99%) diff --git a/drivers/memory_debug/Makefile b/drivers/memory_debug/Makefile index b85e46d65..cad52f18d 100644 --- a/drivers/memory_debug/Makefile +++ b/drivers/memory_debug/Makefile @@ -4,7 +4,7 @@ MODULE_NAME = amlogic-memory-debug PR_FMT = $(subst amlogic-,,$(MODULE_NAME)) PR_FMT_DEFINE="-Dpr_fmt(fmt)= \"[$(PR_FMT)]: \" fmt" -ccflags-y += $(PR_FMT_DEFINE) +ccflags-y += $(PR_FMT_DEFINE) -I$(srctree)/drivers/iommu/arm/arm-smmu-v3 obj-$(CONFIG_AMLOGIC_MEMORY_DEBUG) = $(MODULE_NAME).o $(MODULE_NAME)-y += main.o diff --git a/drivers/memory_debug/main.c b/drivers/memory_debug/main.c index d6d1a6846..fbbd2ee47 100644 --- a/drivers/memory_debug/main.c +++ b/drivers/memory_debug/main.c @@ -94,6 +94,7 @@ static int __init memory_main_init(void) #if IS_ENABLED(CONFIG_AMLOGIC_DEBUG_IOTRACE) free_iotrace_reserved_memory(); #endif + call_sub_init(aml_smmu_init); pr_debug("### %s() end\n", __func__); return 0; diff --git a/drivers/memory_debug/main.h b/drivers/memory_debug/main.h index 5ec5c2ae3..2addd4e82 100644 --- a/drivers/memory_debug/main.h +++ b/drivers/memory_debug/main.h @@ -76,4 +76,13 @@ static inline void ramdump_uninit(void) } #endif +#if IS_ENABLED(CONFIG_AMLOGIC_FAKE_SMMU) +int __init aml_smmu_init(void); +#else +static inline int aml_smmu_init(void) +{ + return 0; +} +#endif + #endif /* _MEMORY_MAIN_H__ */ diff --git a/drivers/memory_debug/memory_ext/Kconfig b/drivers/memory_debug/memory_ext/Kconfig index 8623aa940..154238cc9 100644 --- a/drivers/memory_debug/memory_ext/Kconfig +++ b/drivers/memory_debug/memory_ext/Kconfig @@ -17,3 +17,11 @@ config AMLOGIC_WATCHPOINT This driver export a debug sysfs in order to using watch point function on ARMv8. say y to enable Amlogic watch point driver + +config AMLOGIC_FAKE_SMMU + tristate "Amlogic fake smmu" + depends on IOMMU_SUPPORT + default n + help + Register a fake smmu device to replace ops for 64bit + diff --git a/drivers/memory_debug/memory_ext/Makefile b/drivers/memory_debug/memory_ext/Makefile index edca9cd84..5e40e2c08 100644 --- a/drivers/memory_debug/memory_ext/Makefile +++ b/drivers/memory_debug/memory_ext/Makefile @@ -2,3 +2,4 @@ $(MODULE_NAME)-$(CONFIG_AMLOGIC_FILE_CACHE) += memory_ext/file_cache.o $(MODULE_NAME)-$(CONFIG_AMLOGIC_WATCHPOINT) += memory_ext/watch_point.o +$(MODULE_NAME)-$(CONFIG_AMLOGIC_FAKE_SMMU) += memory_ext/aml_smmu.o diff --git a/drivers/memory_ext/aml_smmu.c b/drivers/memory_debug/memory_ext/aml_smmu.c similarity index 99% rename from drivers/memory_ext/aml_smmu.c rename to drivers/memory_debug/memory_ext/aml_smmu.c index 473a4152e..465a46035 100644 --- a/drivers/memory_ext/aml_smmu.c +++ b/drivers/memory_debug/memory_ext/aml_smmu.c @@ -231,7 +231,6 @@ static struct iommu_domain *aml_smmu_domain_alloc(unsigned int type) static void aml_smmu_release_device(struct device *dev) { - return; } #if CONFIG_AMLOGIC_KERNEL_VERSION >= 15606 @@ -1437,11 +1436,11 @@ static struct platform_driver aml_smmu_driver = { .shutdown = aml_smmu_device_shutdown, }; -//module_platform_driver(aml_smmu_driver); -static int __init aml_smmu_init(void) +/* module_platform_driver(aml_smmu_driver); */ +int __init aml_smmu_init(void) { return platform_driver_register(&aml_smmu_driver); } -core_initcall(aml_smmu_init); +/* core_initcall(aml_smmu_init); */ MODULE_LICENSE("GPL v2"); diff --git a/drivers/memory_ext/Kconfig b/drivers/memory_ext/Kconfig index 44bb44ccf..7d1c7d6b6 100644 --- a/drivers/memory_ext/Kconfig +++ b/drivers/memory_ext/Kconfig @@ -194,13 +194,6 @@ config AMLOGIC_PCIE_DMA_OPS custom a dma_ops to limit the memory for PCIE device operations to a fixed area -config AMLOGIC_FAKE_SMMU - tristate "Amlogic fake smmu" - depends on IOMMU_SUPPORT - default n - help - Register a fake smmu device to replace ops for 64bit - config AMLOGIC_ARM_KASAN bool "support arm kasan" depends on KASAN diff --git a/drivers/memory_ext/Makefile b/drivers/memory_ext/Makefile index d8ca6b152..b0fc2bd7a 100644 --- a/drivers/memory_ext/Makefile +++ b/drivers/memory_ext/Makefile @@ -11,5 +11,4 @@ obj-$(CONFIG_AMLOGIC_MEMORY_EXTEND) += memory.o obj-$(CONFIG_AMLOGIC_USER_FAULT) += user_fault.o obj-$(CONFIG_AMLOGIC_PIN_LOCKED_FILE) += pin_file.o obj-$(CONFIG_AMLOGIC_PCIE_DMA_OPS) += dma_pcie_mapping.o -obj-$(CONFIG_AMLOGIC_FAKE_SMMU) += aml_smmu.o obj-$(CONFIG_AMLOGIC_MIX_ZRAM) += mix_zram.o diff --git a/drivers/memory_ext/slab_trace.c b/drivers/memory_ext/slab_trace.c index 8e656f5ac..15ebc071d 100644 --- a/drivers/memory_ext/slab_trace.c +++ b/drivers/memory_ext/slab_trace.c @@ -771,12 +771,13 @@ static const struct proc_ops slabtrace_proc_ops = { static int __init slab_trace_module_init(void) { - if (slab_trace_en) + if (slab_trace_en) { d_slabtrace = proc_create("slabtrace", 0444, - NULL, &slabtrace_proc_ops); - if (IS_ERR_OR_NULL(d_slabtrace)) { - pr_err("%s, create slabtrace failed\n", __func__); - return -1; + NULL, &slabtrace_proc_ops); + if (IS_ERR_OR_NULL(d_slabtrace)) { + pr_err("%s, create slabtrace failed\n", __func__); + return -1; + } } return 0; diff --git a/modules.bzl b/modules.bzl index a905f4778..e59cfc317 100644 --- a/modules.bzl +++ b/modules.bzl @@ -75,7 +75,6 @@ AMLOGIC_COMMON_MODULES = [ "common_drivers/drivers/media/aml_media.ko", "common_drivers/drivers/media/camera/amlogic-camera.ko", "common_drivers/drivers/memory_debug/amlogic-memory-debug.ko", - "common_drivers/drivers/memory_ext/aml_smmu.ko", "common_drivers/drivers/mmc/host/amlogic-mmc.ko", "common_drivers/drivers/net/ethernet/stmicro/stmmac/amlogic-phy-debug.ko", "common_drivers/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.ko", diff --git a/scripts/amlogic/modules_sequence_list b/scripts/amlogic/modules_sequence_list index 8dec3d51e..376f0d9fc 100644 --- a/scripts/amlogic/modules_sequence_list +++ b/scripts/amlogic/modules_sequence_list @@ -25,7 +25,6 @@ RAMDISK_MODULES_LOAD_LIST=( tee.ko optee.ko amlogic-tee.ko - aml_smmu.ko videobuf-core.ko dvb-core.ko amlogic-pm.ko