From nobody Tue Dec 16 20:30:01 2025 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 335B32C2349 for ; Wed, 10 Dec 2025 16:14:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765383259; cv=none; b=C5rEBZMYdXh7A3tiordMNQSxeQRKvy8ZDJL/gjzZJvBg/jijmR7UWm7SypnqTO+M/UHegAxob4HHMejngu3V0Q6NFLTgmYWjXSnrQRW8NwkhdbwhqUM14ud1v2NDjX9Oh+NGCEF7JQpB0RxPPMII5lEX7VuBYaJRx0Guyl+j13I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765383259; c=relaxed/simple; bh=RdRZS0aP9TmGcChwbptIjsJMmOhoTpCnwW+G44c9f0A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bnXbiIKrt+QdsNmDWRC3ERyRPqQkqRHgxKoBnxac5VIeEpBxMOldDIOod9dnA23bzT4jsT+YMpT371ixVgxpFnm5wrFDp0magG7MR3aC1DB3UOG2UfvbmG1/koJzhJ+xzOX28Ypw9Nc5QfcndH23pfNwkYTXpp6HAqoQ8UzIN4c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc.com header.i=@rivosinc.com header.b=Ar9le/Jn; arc=none smtp.client-ip=209.85.215.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc.com header.i=@rivosinc.com header.b="Ar9le/Jn" Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-bc8ceb76c04so4880558a12.1 for ; Wed, 10 Dec 2025 08:14:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc.com; s=google; t=1765383253; x=1765988053; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=nNEHWk4wJomnqXvsrqKRlJFX82RphkNF3SDwqZxDTNU=; b=Ar9le/JnuCWaJfV9ldQA/JIYowO3x05v9fu6sQhB7yuNvRPkHnealJ882nxIA7IJkq QH6HD97yQMPCSanJIcYcKtwEe/2tinCzPpGngi6LfY80WftnzqotEnAtKUquziIkKHLI aAjzMlVOu0X+z5ASGeTHe7ZdaDE47yC3o5PA2o9Iy8Pp5nYnyoFVB+djnHsixYQnUz0O zaF7JqRof4hWVONhHYRXGwDH3JWyovThzOWKze/W7V7ZLwBiAgf5SNu8NzPX27oqG5zE U6hkhmpJA+vHCwaCq1PL7kEK0JXrLZHZ6+M2MLIXxU0GtXeRxtIXXM5fqhVSADCxlYa2 02wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765383253; x=1765988053; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=nNEHWk4wJomnqXvsrqKRlJFX82RphkNF3SDwqZxDTNU=; b=ptWwM1ZlQwP5awY3BbzNGl7awCZaXhw8MPxnXBZSzbbhKgVOfwtEb5dS4qBTdlXM4g tu34m5YjZPXjnSCj57YuizSUgdRUQEBRpKSxgcf1ZOdix4eRs9Axt2r2X95zNH0bImGH 4E3jtLKnrnjfgreVY2IhBhvS7wU20dAVlpWsCisd4ticlzET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05:7300:e6c6:b0:2a4:3593:c7d3 with SMTP id 5a478bee46e88-2ac054ac50bmr3374223eec.19.1765383252963; Wed, 10 Dec 2025 08:14:12 -0800 (PST) Received: from [127.0.1.1] (p7838222-ipoefx.ipoe.ocn.ne.jp. [123.225.39.221]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11f283d4733sm10364600c88.17.2025.12.10.08.14.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Dec 2025 08:14:12 -0800 (PST) From: Charlie Jenkins X-Google-Original-From: Charlie Jenkins Date: Wed, 10 Dec 2025 08:13:46 -0800 Subject: [PATCH RFC 09/10] riscv: kconfig: Add rva23 config Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251210-profiles-v1-9-315a6ff2ca5a@gmail.com> References: <20251210-profiles-v1-0-315a6ff2ca5a@gmail.com> In-Reply-To: <20251210-profiles-v1-0-315a6ff2ca5a@gmail.com> To: Paul Walmsley , Palmer Dabbelt , Alexandre Ghiti , Anup Patel , Atish Patra , Samuel Holland , =?utf-8?q?Bj=C3=B6rn_T=C3=B6pel?= , Luke Nelson , Xi Wang , Eric Biggers , Conor Dooley Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Charlie Jenkins X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1765383226; l=11094; i=thecharlesjenkins@gmail.com; s=20240124; h=from:subject:message-id; bh=RdRZS0aP9TmGcChwbptIjsJMmOhoTpCnwW+G44c9f0A=; b=IxfntaSVfKQG8mLj1Qg1BmULOJOUaqqxjrNfFM7iWIebYybkydjxxDeZvtPVrQlWiqqf6BwNa oJXKJHlMZP6ASp0Is8JSk4m5EzcUU0w1LDBYaWNWOEZnvxntHRQJn13 X-Developer-Key: i=thecharlesjenkins@gmail.com; a=ed25519; pk=eVndo3OHViAjwuqHqbJB4ZtzJzzvk/r6fUf84tZ3rw4= Add CONFIG_RISCV_ISA_RVA23 to select all rva23 mandatory extensions. This also introduces a new class of kernel binaries, portable rva23 compatible binaries. This option does not require NONPORTABLE because profiles are expected to be portable between systems. Signed-off-by: Charlie Jenkins --- arch/riscv/Kconfig.extensions | 99 ++++++++++++++++++++++++++++++---------= ---- 1 file changed, 70 insertions(+), 29 deletions(-) diff --git a/arch/riscv/Kconfig.extensions b/arch/riscv/Kconfig.extensions index e400fd5574f7..38b655e480a8 100644 --- a/arch/riscv/Kconfig.extensions +++ b/arch/riscv/Kconfig.extensions @@ -4,6 +4,33 @@ # see Documentation/kbuild/kconfig-language.rst. # =20 +# Profiles + +config RISCV_ISA_RVA23 + bool "Enable rva23 extensions" + default n + select RISCV_ISA_SUPM + select RISCV_ISA_SVNAPOT + select RISCV_ISA_SVPBMT + select RISCV_ISA_ZAWRS + select RISCV_ISA_ZBA + select RISCV_ISA_ZBB + select RISCV_ISA_ZBC + select RISCV_ISA_ZBKB + select RISCV_ISA_ZICBOM + select RISCV_ISA_ZICBOZ + select RISCV_ISA_ZICBOP + select RISCV_ISA_V + help + The RVA23 profile is a grouping of extensions that are expected to be + available on server and application CPUs. + + Enabling this config will cause the kernel to fail to boot on platforms + that are not rva23 compliant. + + Say "y" here to optimize the kernel for rva23 compliant platforms. + + If you don't know what to do here, say "n". =20 # Base extensions =20 @@ -64,7 +91,7 @@ config RISCV_ISA_D config RISCV_ISA_SUPM tristate "Supm extension for userspace pointer masking" depends on 64BIT - depends on NONPORTABLE || m + depends on NONPORTABLE || RISCV_ISA_RVA23 || m default m help Add support for pointer masking in userspace (Supm) when the @@ -75,14 +102,15 @@ config RISCV_ISA_SUPM =20 Select "m" for boot-time detection for portability. =20 - Select "y" for compile-time optimization. Only available with NONPORTAB= LE. + Select "y" for compile-time optimization. Only available with NONPORTAB= LE + or CONFIG_RISCV_ISA_RVA23. =20 If you don't know what to do here, say m. =20 config RISCV_ISA_SVNAPOT tristate "Svnapot extension support for supervisor mode NAPOT pages" depends on 64BIT && MMU - depends on NONPORTABLE || m + depends on NONPORTABLE || RISCV_ISA_RVA23 || m default m help The Svnapot extension is used to mark contiguous PTEs as a range @@ -95,14 +123,15 @@ config RISCV_ISA_SVNAPOT =20 Select "m" for boot-time detection for portability. =20 - Select "y" for compile-time optimization. Only available with NONPORTAB= LE. + Select "y" for compile-time optimization. Only available with NONPORTAB= LE + or CONFIG_RISCV_ISA_RVA23. =20 If you don't know what to do here, say m. =20 config RISCV_ISA_SVPBMT tristate "Svpbmt extension support for supervisor mode page-based memory = types" depends on 64BIT && MMU - depends on NONPORTABLE || m + depends on NONPORTABLE || RISCV_ISA_RVA23 || m default m help The memory type for a page contains a combination of attributes @@ -113,14 +142,15 @@ config RISCV_ISA_SVPBMT =20 Select "m" for boot-time detection for portability. =20 - Select "y" for compile-time optimization. Only available with NONPORTAB= LE. + Select "y" for compile-time optimization. Only available with NONPORTAB= LE + or CONFIG_RISCV_ISA_RVA23. =20 If you don't know what to do here, say m. =20 =20 config RISCV_ISA_ZAWRS tristate "Zawrs extension support for more efficient busy waiting" - depends on NONPORTABLE || m + depends on NONPORTABLE || RISCV_ISA_RVA23 || m default m help The Zawrs extension defines instructions to be used in polling loops @@ -139,7 +169,7 @@ config TOOLCHAIN_HAS_ZABHA config RISCV_ISA_ZABHA tristate "Zabha extension support for atomic byte/halfword operations" depends on TOOLCHAIN_HAS_ZABHA - depends on NONPORTABLE || m + depends on NONPORTABLE || RISCV_ISA_RVA23 || m default m help Enable the use of the Zabha ISA-extension to implement kernel @@ -147,7 +177,8 @@ config RISCV_ISA_ZABHA =20 Select "m" for boot-time detection for portability. =20 - Select "y" for compile-time optimization. Only available with NONPORTAB= LE. + Select "y" for compile-time optimization. Only available with NONPORTAB= LE + or CONFIG_RISCV_ISA_RVA23. =20 If you don't know what to do here, say m. =20 @@ -161,7 +192,7 @@ config TOOLCHAIN_HAS_ZACAS config RISCV_ISA_ZACAS tristate "Zacas extension support for atomic CAS" depends on TOOLCHAIN_HAS_ZACAS - depends on NONPORTABLE || m + depends on NONPORTABLE || RISCV_ISA_RVA23 || m default m help Enable the use of the Zacas ISA-extension to implement kernel atomic @@ -169,7 +200,8 @@ config RISCV_ISA_ZACAS =20 Select "m" for boot-time detection for portability. =20 - Select "y" for compile-time optimization. Only available with NONPORTAB= LE. + Select "y" for compile-time optimization. Only available with NONPORTAB= LE + or CONFIG_RISCV_ISA_RVA23. =20 If you don't know what to do here, say m. =20 @@ -183,7 +215,7 @@ config TOOLCHAIN_HAS_ZBA =20 config RISCV_ISA_ZBA tristate "Zba extension support for bit manipulation instructions" - depends on NONPORTABLE || m + depends on NONPORTABLE || RISCV_ISA_RVA23 || m default m help The Zba extension provides instructions to accelerate the generation @@ -191,7 +223,8 @@ config RISCV_ISA_ZBA =20 Select "m" for boot-time detection for portability. =20 - Select "y" for compile-time detection for optimization. Only available = with NONPORTABLE. + Select "y" for compile-time detection for optimization. Only available = with NONPORTABLE + or CONFIG_RISCV_ISA_RVA23. =20 If you don't know what to do here, say m. =20 @@ -205,7 +238,7 @@ config TOOLCHAIN_HAS_ZBB =20 config RISCV_ISA_ZBB tristate "Zbb extension support for bit manipulation instructions" - depends on NONPORTABLE || m + depends on NONPORTABLE || RISCV_ISA_RVA23 || m default m help The Zbb extension provides instructions to accelerate a number @@ -214,7 +247,8 @@ config RISCV_ISA_ZBB =20 Select "m" for boot-time detection for portability. =20 - Select "y" for compile-time optimization. Only available with NONPORTAB= LE. + Select "y" for compile-time optimization. Only available with NONPORTAB= LE + or CONFIG_RISCV_ISA_RVA23. =20 If you don't know what to do here, say m. =20 @@ -228,7 +262,7 @@ config TOOLCHAIN_HAS_ZBC =20 config RISCV_ISA_ZBC tristate "Zbc extension support for carry-less multiplication instruction= s" - depends on NONPORTABLE || m + depends on NONPORTABLE || RISCV_ISA_RVA23 || m default m help The Zbc extension could accelerate CRC (cyclic redundancy check) @@ -236,7 +270,8 @@ config RISCV_ISA_ZBC =20 Select "m" for boot-time detection for portability. =20 - Select "y" for compile-time detection for optimization. Only available = with NONPORTABLE. + Select "y" for compile-time detection for optimization. Only available = with NONPORTABLE + or CONFIG_RISCV_ISA_RVA23. =20 If you don't know what to do here, say m. =20 @@ -250,7 +285,7 @@ config TOOLCHAIN_HAS_ZBKB =20 config RISCV_ISA_ZBKB tristate "Zbkb extension support for bit manipulation instructions" - depends on NONPORTABLE || m + depends on NONPORTABLE || RISCV_ISA_RVA23 || m default m help The Zbkb extension provides instructions to accelerate a number @@ -258,14 +293,15 @@ config RISCV_ISA_ZBKB =20 Select "m" for boot-time detection for portability. =20 - Select "y" for compile-time detection for optimization. Only available = with NONPORTABLE. + Select "y" for compile-time detection for optimization. Only available = with NONPORTABLE + or CONFIG_RISCV_ISA_RVA23. =20 If you don't know what to do here, say m. =20 config RISCV_ISA_ZICBOM bool "Zicbom extension support for non-coherent DMA operation" depends on MMU - depends on NONPORTABLE || m + depends on NONPORTABLE || RISCV_ISA_RVA23 || m default m select RISCV_DMA_NONCOHERENT select DMA_DIRECT_REMAP @@ -275,13 +311,14 @@ config RISCV_ISA_ZICBOM =20 Select "m" for boot-time detection for portability. =20 - Select "y" for compile-time optimization. Only available with NONPORTAB= LE. + Select "y" for compile-time optimization. Only available with NONPORTAB= LE + or CONFIG_RISCV_ISA_RVA23. =20 If you don't know what to do here, say m. =20 config RISCV_ISA_ZICBOZ bool "Zicboz extension support for faster zeroing of memory" - depends on NONPORTABLE || m + depends on NONPORTABLE || RISCV_ISA_RVA23 || m default m help Enable the use of the Zicboz extension (cbo.zero instruction) @@ -291,14 +328,15 @@ config RISCV_ISA_ZICBOZ =20 Select "m" for boot-time detection for portability. =20 - Select "y" for compile-time detection for optimization. Only available = with NONPORTABLE. + Select "y" for compile-time detection for optimization. Only available = with NONPORTABLE + or CONFIG_RISCV_ISA_RVA23. =20 If you don't know what to do here, say m. =20 config RISCV_ISA_ZICBOP bool "Zicbop extension support for cache block prefetch" depends on MMU - depends on NONPORTABLE || m + depends on NONPORTABLE || RISCV_ISA_RVA23 || m default m help The Zicbop extension can be used to prefetch cache blocks for @@ -306,7 +344,8 @@ config RISCV_ISA_ZICBOP =20 Select "m" for boot-time detection for portability. =20 - Select "y" for compile-time detection for optimization. Only available = with NONPORTABLE. + Select "y" for compile-time detection for optimization. Only available = with NONPORTABLE + or CONFIG_RISCV_ISA_RVA23. =20 If you don't know what to do here, say m. =20 @@ -348,7 +387,7 @@ config RISCV_ISA_V depends on FPU select DYNAMIC_SIGFRAME select RISCV_ISA_ZVE32X - depends on NONPORTABLE || m + depends on NONPORTABLE || RISCV_ISA_RVA23 || m default m help Say N here if you want to disable all vector related procedure @@ -356,20 +395,22 @@ config RISCV_ISA_V =20 Select "m" for boot-time detection for portability. =20 - Select "y" for compile-time detection for optimization. Only available = with NONPORTABLE. + Select "y" for compile-time detection for optimization. Only available = with NONPORTABLE + or CONFIG_RISCV_ISA_RVA23. =20 If you don't know what to do here, say m. =20 config RISCV_ISA_ZVE32X tristate "zve32x extension support" - depends on NONPORTABLE || m + depends on NONPORTABLE || RISCV_ISA_RVA23 || m default m help zve23x is a subset of the vector extension. Can be enabled for minimal = vector support. =20 Select "m" for boot-time detection for portability. =20 - Select "y" for compile-time detection for optimization. Only available = with NONPORTABLE. + Select "y" for compile-time detection for optimization. Only available = with NONPORTABLE + or CONFIG_RISCV_ISA_RVA23. =20 If you don't know what to do here, say m. =20 --=20 2.43.0