[v7,12/14] MIPS: Share generic kernel code with other architecture

Message ID 20240205153503.574468-13-gregory.clement@bootlin.com
State New
Headers
Series Add support for the Mobileye EyeQ5 SoC |

Commit Message

Gregory CLEMENT Feb. 5, 2024, 3:34 p.m. UTC
  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>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
---
 arch/mips/Kbuild           | 1 +
 arch/mips/Kconfig          | 3 +++
 arch/mips/generic/Makefile | 6 +++---
 3 files changed, 7 insertions(+), 3 deletions(-)
  

Comments

Jiaxun Yang Feb. 8, 2024, 9:38 a.m. UTC | #1
在 2024/2/5 15:34, Gregory CLEMENT 写道:
> 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>
> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>

Thanks!
- Jiaxun
> ---
>   arch/mips/Kbuild           | 1 +
>   arch/mips/Kconfig          | 3 +++
>   arch/mips/generic/Makefile | 6 +++---
>   3 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/arch/mips/Kbuild b/arch/mips/Kbuild
> index af2967bffb73d..d683993ed331c 100644
> --- a/arch/mips/Kbuild
> +++ b/arch/mips/Kbuild
> @@ -17,6 +17,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/
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 797ae590ebdba..5549d26448941 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -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
> diff --git a/arch/mips/generic/Makefile b/arch/mips/generic/Makefile
> index e37a59bae0a62..56011d738441f 100644
> --- a/arch/mips/generic/Makefile
> +++ b/arch/mips/generic/Makefile
> @@ -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
  

Patch

diff --git a/arch/mips/Kbuild b/arch/mips/Kbuild
index af2967bffb73d..d683993ed331c 100644
--- a/arch/mips/Kbuild
+++ b/arch/mips/Kbuild
@@ -17,6 +17,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/
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 797ae590ebdba..5549d26448941 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -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
diff --git a/arch/mips/generic/Makefile b/arch/mips/generic/Makefile
index e37a59bae0a62..56011d738441f 100644
--- a/arch/mips/generic/Makefile
+++ b/arch/mips/generic/Makefile
@@ -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