diff mbox series

ARM: fix XIP_KERNEL dependencies

Message ID 63a630b7-9068-40f9-b7f7-d9a08f74ed13@www.fastmail.com (mailing list archive)
State New, archived
Headers show
Series ARM: fix XIP_KERNEL dependencies | expand

Commit Message

Arnd Bergmann Aug. 30, 2022, 7:20 a.m. UTC
CONFIG_XIP_KERNEL does not work with any option that involves patching
the read-only kernel .text.

Since at least CONFIG_SMP_ON_UP is required in certain configurations,
flip the dependency to always allow the .text patching options but make
XIP_KERNEL have the dependency instead.

This is a prerequisite for allowing CONFIG_ARCH_MULTIPLATFORM to
be disabled.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
forgot to send this yesterday, replaces the CPU_v6 dependency patch

Comments

Geert Uytterhoeven Aug. 30, 2022, 7:41 a.m. UTC | #1
Hi Arnd,

On Tue, Aug 30, 2022 at 9:21 AM Arnd Bergmann <arnd@arndb.de> wrote:
> CONFIG_XIP_KERNEL does not work with any option that involves patching
> the read-only kernel .text.
>
> Since at least CONFIG_SMP_ON_UP is required in certain configurations,
> flip the dependency to always allow the .text patching options but make
> XIP_KERNEL have the dependency instead.
>
> This is a prerequisite for allowing CONFIG_ARCH_MULTIPLATFORM to
> be disabled.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks for your patch!

> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -1619,6 +1619,7 @@ endchoice
>  config XIP_KERNEL
>         bool "Kernel Execute-In-Place from ROM"
>         depends on !ARM_LPAE && !ARCH_MULTIPLATFORM
> +       depends on !SMP_ON_UP && !ARM_PATCH_IDIV && !ARM_PATCH_PHYS_VIRT

You may want to keep the list sorted.

>         help
>           Execute-In-Place allows the kernel to run from non-volatile storage
>           directly addressable by the CPU, such as NOR flash. This saves RAM

Regardless, LGTM, so
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Arnd Bergmann Aug. 30, 2022, 9:18 a.m. UTC | #2
On Tue, Aug 30, 2022, at 9:41 AM, Geert Uytterhoeven wrote:
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -1619,6 +1619,7 @@ endchoice
>>  config XIP_KERNEL
>>         bool "Kernel Execute-In-Place from ROM"
>>         depends on !ARM_LPAE && !ARCH_MULTIPLATFORM
>> +       depends on !SMP_ON_UP && !ARM_PATCH_IDIV && !ARM_PATCH_PHYS_VIRT
>
> You may want to keep the list sorted.

Done

> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Thanks,

       Arnd
Linus Walleij Aug. 31, 2022, 1:35 p.m. UTC | #3
On Tue, Aug 30, 2022 at 9:21 AM Arnd Bergmann <arnd@arndb.de> wrote:

> CONFIG_XIP_KERNEL does not work with any option that involves patching
> the read-only kernel .text.
>
> Since at least CONFIG_SMP_ON_UP is required in certain configurations,
> flip the dependency to always allow the .text patching options but make
> XIP_KERNEL have the dependency instead.
>
> This is a prerequisite for allowing CONFIG_ARCH_MULTIPLATFORM to
> be disabled.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

OK this should work!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3066ce82cffc..2d94e53037ec 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -246,7 +246,7 @@  config ARCH_MTD_XIP
 config ARM_PATCH_PHYS_VIRT
 	bool "Patch physical to virtual translations at runtime" if EMBEDDED
 	default y
-	depends on !XIP_KERNEL && MMU
+	depends on MMU
 	help
 	  Patch phys-to-virt and virt-to-phys translation functions at
 	  boot and module load time according to the position of the
@@ -975,7 +975,7 @@  config SMP
 
 config SMP_ON_UP
 	bool "Allow booting SMP kernel on uniprocessor systems"
-	depends on SMP && !XIP_KERNEL && MMU
+	depends on SMP && MMU
 	default y
 	help
 	  SMP kernels contain instructions which fail on non-SMP processors.
@@ -1224,7 +1224,7 @@  config THUMB2_KERNEL
 
 config ARM_PATCH_IDIV
 	bool "Runtime patch udiv/sdiv instructions into __aeabi_{u}idiv()"
-	depends on CPU_32v7 && !XIP_KERNEL
+	depends on CPU_32v7
 	default y
 	help
 	  The ARM compiler inserts calls to __aeabi_idiv() and
@@ -1619,6 +1619,7 @@  endchoice
 config XIP_KERNEL
 	bool "Kernel Execute-In-Place from ROM"
 	depends on !ARM_LPAE && !ARCH_MULTIPLATFORM
+	depends on !SMP_ON_UP && !ARM_PATCH_IDIV && !ARM_PATCH_PHYS_VIRT
 	help
 	  Execute-In-Place allows the kernel to run from non-volatile storage
 	  directly addressable by the CPU, such as NOR flash. This saves RAM