Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1393240pxb; Thu, 14 Apr 2022 05:20:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbvrlb8txKQVns9QJApYSjP0LUBN1rUwmue/wzAVONBvefpqAWQaLfexvojbiWprycVPl4 X-Received: by 2002:aa7:920d:0:b0:505:c9d4:5819 with SMTP id 13-20020aa7920d000000b00505c9d45819mr3663412pfo.15.1649938818184; Thu, 14 Apr 2022 05:20:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649938818; cv=none; d=google.com; s=arc-20160816; b=AcHy9gv0JySZGrIUrfFfee1igOsYMXoF6vfTkpT3i35thNnpOecXeLqlxreEKprykH 7ybtgkTiUa+Z7UsRJEwerteBhmZiVLRUd5FCkPXrF4R1/N9RawbFYihn9oa4qS8MfpAT akuceYlWW1p3SOywc1xxr6oBdKQhHFxe8voZ2H+wJ+6xdAxtbjz5IJp6P/oiqiSRAmsh zauaHg9egk+Qcm/Gkn7wyBdNpkZwKS3WeSt8JQ4TW4NbhrmH6yd02HRcvdQOZ7MW0ns1 mNQE8CyZGvX6P4lOGUrkQmY/0o4zJK6V/3ohObKOx9LucOWztjDMpeTkznb6P3dQzsAb dJ3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:cc:content-transfer-encoding :mime-version:message-id:date:subject:dkim-signature; bh=RdayCDxEwJD59KqBdusCEOpxaJASjBt83sSueeG1AHo=; b=tge5/VsNmzq+yUDXEd2gQ0AsCHKV0JKVQxZ5nCQ5ZD/ExxFvGSpx2tBKde8WTF9Tty 02LKcXj0WuPbeCD7Dyo+UjyOExR1XkFL8jzgjiBMi+jOOfHEhV8hIyW9+enxwVdzlrfW FWmCL98QcZ6Q6TbPKGZIatkivY8BtAvPWTh9CxTmxlF8Y0rvp+i8zAUFylZb8eMs8RYk e0MqtnMn+820PIiGcvAwjnWa3zA27bqHw3FmE/DWOJ8FIVHfk8ZaxD1cCWBsc8xe9c4C 6V2WXy4x4itIyCSsogBbqzWlo7Wj39B+wFS95tS/NEacMX63OTWW01Jcsas5gpf8VWYR 2tyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b="ycMC/7bY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l21-20020a63f315000000b003816043f0e0si8186709pgh.725.2022.04.14.05.20.02; Thu, 14 Apr 2022 05:20:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b="ycMC/7bY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239455AbiDNBmv (ORCPT + 99 others); Wed, 13 Apr 2022 21:42:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232083AbiDNBmq (ORCPT ); Wed, 13 Apr 2022 21:42:46 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E189E20F70 for ; Wed, 13 Apr 2022 18:40:23 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id t4so3458460pgc.1 for ; Wed, 13 Apr 2022 18:40:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=subject:date:message-id:mime-version:content-transfer-encoding:cc :from:to; bh=RdayCDxEwJD59KqBdusCEOpxaJASjBt83sSueeG1AHo=; b=ycMC/7bYjbOcLcEX2Tt8VKIilnYKeWYE2bx96R/lFO0m6rchL4vLEVtbx4DIHM3ORk UBDoEhJBvmkZ1TigC5xaY+u+GfFf+KjYS1ZNKjjfcj2SGDdkH3LMRQjQpTd2QexjnxFN tiicpxYwhRWaqtFUTgMbq7IG+Gtk4bo5ggk+L2LbhgUNmU4gFkofLgn07fI7ltWhQZm2 CHPxSxMUyO+Z6yE8Nyhyq5/jerzahPX/ibsw4W/GWHCi8BeZg/ET8xiatEvsvv8GYWb/ xDTA5AkCl+Rba/02rycJF0AWURAb834y4CuWXOSXPZLrej6FrILXK5HxFb6eMIm4CcF0 WcQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:date:message-id:mime-version :content-transfer-encoding:cc:from:to; bh=RdayCDxEwJD59KqBdusCEOpxaJASjBt83sSueeG1AHo=; b=Yv/N7geduT5nXPIe0G7TUQZcsNdta+FiFggX8OvEJDrSnXOoJS4ewAxM/zrGvwoCVT xG+TzFbKFSFO8IyRaXzds6XU8yXO/3Oe2zgtHi6USDJSDTkJlUySFObh2qD5nCR+VOhs gPQCb5ZU55YAr4Kl5C4IzX7gZnantyam5oRB4CLCUAmUbOXhvAfOiNmZKl5onRX1+kiH 2aeZX1xTsHOjW6zWEIXyggD5aP6Yru1SBpRR3dqi2Bhc542EIWd7ACLxwk9yXJFKVbxY 9hJGhgYam6+g0032tZUkH9zli7jrxQ6ObuwwFb109t5qZTGX9zNls2z4buVMqvPt19u5 kvWQ== X-Gm-Message-State: AOAM5308dkI11PQN/wQPXpZ0Kq4xThYgP+41eyjxuNiTcy0jS4Ai5mWm cohCJ//Ef+SG4AhGaN7fHS0QkQ== X-Received: by 2002:a63:e442:0:b0:398:c06b:169c with SMTP id i2-20020a63e442000000b00398c06b169cmr380503pgk.170.1649900423449; Wed, 13 Apr 2022 18:40:23 -0700 (PDT) Received: from localhost ([12.3.194.138]) by smtp.gmail.com with ESMTPSA id w14-20020a17090a4f4e00b001cb510021ecsm4203901pjl.49.2022.04.13.18.40.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Apr 2022 18:40:23 -0700 (PDT) Subject: [PATCH v2] RISC-V: Add CONFIG_{NON,}PORTABLE Date: Wed, 13 Apr 2022 18:40:10 -0700 Message-Id: <20220414014010.28110-1-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Paul Walmsley , Palmer Dabbelt , aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Palmer Dabbelt From: Palmer Dabbelt To: Arnd Bergmann , linux-riscv@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Palmer Dabbelt 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 --- 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