MIPS: Share generic kernel code with other architecture
authorGregory CLEMENT <gregory.clement@bootlin.com>
Fri, 16 Feb 2024 17:42:21 +0000 (18:42 +0100)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Tue, 20 Feb 2024 12:36:25 +0000 (13:36 +0100)
Some architectures might seek to utilize a significant portion of the
generic kernel code while maintaining independence from the generic
kernel due to specific peculiarities.

This patch allows for the reuse of core code, preventing unnecessary
duplication.

Suggested-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/Kbuild
arch/mips/Kconfig
arch/mips/generic/Makefile

index e2d623621a00ee69d5517cae5d4242c2640ace08..e901bf554483bd66f89139fd63d2e27eb693010a 100644 (file)
@@ -11,6 +11,7 @@ obj- := $(platform-y)
 # mips object files
 # The object files are linked as core-y files would be linked
 
+obj-y += generic/
 obj-y += kernel/
 obj-y += mm/
 obj-y += net/
index 797ae590ebdba505c313b448720c7207b29673f8..04765463980a734d755d56379ab8fa915b14e6d6 100644 (file)
@@ -109,6 +109,9 @@ config MIPS_FIXUP_BIGPHYS_ADDR
 config MIPS_GENERIC
        bool
 
+config MACH_GENERIC_CORE
+       bool
+
 config MACH_INGENIC
        bool
        select SYS_SUPPORTS_32BIT_KERNEL
@@ -145,6 +148,7 @@ config MIPS_GENERIC_KERNEL
        select DMA_NONCOHERENT
        select HAVE_PCI
        select IRQ_MIPS_CPU
+       select MACH_GENERIC_CORE
        select MIPS_AUTO_PFN_OFFSET
        select MIPS_CPU_SCACHE
        select MIPS_GIC
@@ -413,6 +417,7 @@ config MACH_INGENIC_SOC
        bool "Ingenic SoC based machines"
        select MIPS_GENERIC
        select MACH_INGENIC
+       select MACH_GENERIC_CORE
        select SYS_SUPPORTS_ZBOOT_UART16550
        select CPU_SUPPORTS_CPUFREQ
        select MIPS_EXTERNAL_TIMER
@@ -599,6 +604,7 @@ config RALINK
 config MACH_REALTEK_RTL
        bool "Realtek RTL838x/RTL839x based machines"
        select MIPS_GENERIC
+       select MACH_GENERIC_CORE
        select DMA_NONCOHERENT
        select IRQ_MIPS_CPU
        select CSRC_R4K
index e37a59bae0a62072784540e5adee4298dedb9fc1..56011d738441fc7f2bb6722e86b9edeca9584e20 100644 (file)
@@ -4,9 +4,9 @@
 # Author: Paul Burton <paul.burton@mips.com>
 #
 
-obj-y += init.o
-obj-y += irq.o
-obj-y += proc.o
+obj-$(CONFIG_MACH_GENERIC_CORE) += init.o
+obj-$(CONFIG_MACH_GENERIC_CORE) += irq.o
+obj-$(CONFIG_MACH_GENERIC_CORE) += proc.o
 
 obj-$(CONFIG_YAMON_DT_SHIM)            += yamon-dt.o
 obj-$(CONFIG_LEGACY_BOARD_SEAD3)       += board-sead3.o