linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] RISC-V: Add CONFIG_{NON,}PORTABLE
@ 2022-04-14  1:40 Palmer Dabbelt
  2022-04-14 11:42 ` Arnd Bergmann
  2022-04-14 12:47 ` Niklas Cassel
  0 siblings, 2 replies; 4+ messages in thread
From: Palmer Dabbelt @ 2022-04-14  1:40 UTC (permalink / raw)
  To: Arnd Bergmann, linux-riscv
  Cc: Paul Walmsley, Palmer Dabbelt, aou, linux-riscv, linux-kernel,
	Palmer Dabbelt

From: Palmer Dabbelt <palmer@rivosinc.com>

The RISC-V port has collected a handful of options that are
fundamentally non-portable.  To prevent users from shooting themselves
in the foot, hide them all behind a config entry that explicitly calls
out that non-portable binaries may be produced.

Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>

---

Changes since v1:

* Fix a bunch of spelling mistakes.
* Move NONPORTABLE under the "Platform type" sub-heading.
* Fix the rv32i dependency.
---
 arch/riscv/Kconfig | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 5adcbd9b5e88..3d8eb44eb889 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -213,6 +213,21 @@ source "arch/riscv/Kconfig.erratas"
 
 menu "Platform type"
 
+config NONPORTABLE
+	bool "Allow configurations that result in non-portable kernels"
+	help
+	  RISC-V kernel binaries are compatible between all known systems
+	  whenever possible, but there are some use cases that can only be
+	  satisfied by configurations that result in kernel binaries that are
+	  not portable between systems.
+
+	  Selecting N does not guarantee kernels will be portable to all knows
+	  systems.  Selecting any of the options guarded by NONPORTABLE will
+	  result in kernel binaries that are unlikely to be portable between
+	  systems.
+
+	  If unsure, say N.
+
 choice
 	prompt "Base ISA"
 	default ARCH_RV64I
@@ -222,6 +237,7 @@ choice
 
 config ARCH_RV32I
 	bool "RV32I"
+	depends on NONPORTABLE
 	select 32BIT
 	select GENERIC_LIB_ASHLDI3
 	select GENERIC_LIB_ASHRDI3
@@ -485,6 +501,7 @@ config STACKPROTECTOR_PER_TASK
 
 config PHYS_RAM_BASE_FIXED
 	bool "Explicitly specified physical RAM address"
+	depends on NONPORTABLE
 	default n
 
 config PHYS_RAM_BASE
@@ -498,7 +515,7 @@ config PHYS_RAM_BASE
 
 config XIP_KERNEL
 	bool "Kernel Execute-In-Place from ROM"
-	depends on MMU && SPARSEMEM
+	depends on MMU && SPARSEMEM && NONPORTABLE
 	# This prevents XIP from being enabled by all{yes,mod}config, which
 	# fail to build since XIP doesn't support large kernels.
 	depends on !COMPILE_TEST
@@ -538,9 +555,16 @@ endmenu
 
 config BUILTIN_DTB
 	bool
-	depends on OF
+	depends on OF && NONPORTABLE
 	default y if XIP_KERNEL
 
+config PORTABLE
+	bool
+	default !NONPORTABLE
+	select EFI
+	select OF
+	select MMU
+
 menu "Power management options"
 
 source "kernel/power/Kconfig"
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] RISC-V: Add CONFIG_{NON,}PORTABLE
  2022-04-14  1:40 [PATCH v2] RISC-V: Add CONFIG_{NON,}PORTABLE Palmer Dabbelt
@ 2022-04-14 11:42 ` Arnd Bergmann
  2022-04-14 12:47 ` Niklas Cassel
  1 sibling, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2022-04-14 11:42 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: Arnd Bergmann, linux-riscv, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Linux Kernel Mailing List

On Thu, Apr 14, 2022 at 3:40 AM Palmer Dabbelt <palmer@rivosinc.com> wrote:
>
> From: Palmer Dabbelt <palmer@rivosinc.com>
>
> The RISC-V port has collected a handful of options that are
> fundamentally non-portable.  To prevent users from shooting themselves
> in the foot, hide them all behind a config entry that explicitly calls
> out that non-portable binaries may be produced.
>
> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] RISC-V: Add CONFIG_{NON,}PORTABLE
  2022-04-14  1:40 [PATCH v2] RISC-V: Add CONFIG_{NON,}PORTABLE Palmer Dabbelt
  2022-04-14 11:42 ` Arnd Bergmann
@ 2022-04-14 12:47 ` Niklas Cassel
  2022-05-21 20:46   ` Palmer Dabbelt
  1 sibling, 1 reply; 4+ messages in thread
From: Niklas Cassel @ 2022-04-14 12:47 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: Arnd Bergmann, linux-riscv, Paul Walmsley, Palmer Dabbelt, aou,
	linux-kernel

On Wed, Apr 13, 2022 at 06:40:10PM -0700, Palmer Dabbelt wrote:
> From: Palmer Dabbelt <palmer@rivosinc.com>
> 
> The RISC-V port has collected a handful of options that are
> fundamentally non-portable.  To prevent users from shooting themselves
> in the foot, hide them all behind a config entry that explicitly calls
> out that non-portable binaries may be produced.
> 
> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
> 
> ---
> 
> Changes since v1:
> 
> * Fix a bunch of spelling mistakes.
> * Move NONPORTABLE under the "Platform type" sub-heading.
> * Fix the rv32i dependency.
> ---
>  arch/riscv/Kconfig | 28 ++++++++++++++++++++++++++--
>  1 file changed, 26 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 5adcbd9b5e88..3d8eb44eb889 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -213,6 +213,21 @@ source "arch/riscv/Kconfig.erratas"
>  
>  menu "Platform type"
>  
> +config NONPORTABLE
> +	bool "Allow configurations that result in non-portable kernels"
> +	help
> +	  RISC-V kernel binaries are compatible between all known systems
> +	  whenever possible, but there are some use cases that can only be
> +	  satisfied by configurations that result in kernel binaries that are
> +	  not portable between systems.
> +
> +	  Selecting N does not guarantee kernels will be portable to all knows

nit: s/knows/known ?


Kind regards,
Niklas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] RISC-V: Add CONFIG_{NON,}PORTABLE
  2022-04-14 12:47 ` Niklas Cassel
@ 2022-05-21 20:46   ` Palmer Dabbelt
  0 siblings, 0 replies; 4+ messages in thread
From: Palmer Dabbelt @ 2022-05-21 20:46 UTC (permalink / raw)
  To: Niklas.Cassel
  Cc: Arnd Bergmann, linux-riscv, Paul Walmsley, aou, linux-kernel

On Thu, 14 Apr 2022 05:47:33 PDT (-0700), Niklas.Cassel@wdc.com wrote:
> On Wed, Apr 13, 2022 at 06:40:10PM -0700, Palmer Dabbelt wrote:
>> From: Palmer Dabbelt <palmer@rivosinc.com>
>> 
>> The RISC-V port has collected a handful of options that are
>> fundamentally non-portable.  To prevent users from shooting themselves
>> in the foot, hide them all behind a config entry that explicitly calls
>> out that non-portable binaries may be produced.
>> 
>> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
>> 
>> ---
>> 
>> Changes since v1:
>> 
>> * Fix a bunch of spelling mistakes.
>> * Move NONPORTABLE under the "Platform type" sub-heading.
>> * Fix the rv32i dependency.
>> ---
>>  arch/riscv/Kconfig | 28 ++++++++++++++++++++++++++--
>>  1 file changed, 26 insertions(+), 2 deletions(-)
>> 
>> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
>> index 5adcbd9b5e88..3d8eb44eb889 100644
>> --- a/arch/riscv/Kconfig
>> +++ b/arch/riscv/Kconfig
>> @@ -213,6 +213,21 @@ source "arch/riscv/Kconfig.erratas"
>>  
>>  menu "Platform type"
>>  
>> +config NONPORTABLE
>> +	bool "Allow configurations that result in non-portable kernels"
>> +	help
>> +	  RISC-V kernel binaries are compatible between all known systems
>> +	  whenever possible, but there are some use cases that can only be
>> +	  satisfied by configurations that result in kernel binaries that are
>> +	  not portable between systems.
>> +
>> +	  Selecting N does not guarantee kernels will be portable to all knows
>
> nit: s/knows/known ?

Thanks.  Turns out I've got a bit of an issue here and this results in the
defconfigs breaking, so I've got ahead and sent a v3 that includes the
necessary bits to make those work along with this fixed up.

> Kind regards,
> Niklas

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-21 20:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14  1:40 [PATCH v2] RISC-V: Add CONFIG_{NON,}PORTABLE Palmer Dabbelt
2022-04-14 11:42 ` Arnd Bergmann
2022-04-14 12:47 ` Niklas Cassel
2022-05-21 20:46   ` Palmer Dabbelt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).