From patchwork Wed Jun 19 11:35:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13703726 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B7834C2BA15 for ; Wed, 19 Jun 2024 11:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KKUTMdkQQLgdC/UdU4NF9iJxWTtqHwmgHkO28ArOUyM=; b=WXIpziLUvpvF42 C9MlKZ89lDn9MuOLXodFhCbYti1+pn7jxQz/eguaNhAPM0t2LbKZbjLVuizPwnhVC04x9NCk/KU2X hEav3VxFDYwG9AGzCILA3kxhrmYOIKu9zY+WrnvB1aXEnkkf7n5rPZ4uzdIxhQ4xBaOTLCOY3Xjcz xzZwCGm0r0Jr+FvUDA3/bW2S14GhAw203b6+u6w6kMqPN4Ia+zvmCeM9klrXMatBez1vCMZBBVQSQ bOO0fbg9LgA5yyFUW70yvHYWJwgZh9cYjRpehRcOw+TSwr9p3pesMS0MM7vYFBVocInU85XijAHmU AAyBmx0DUJwUFruj5Kxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbJ-00000000zel-2lW5; Wed, 19 Jun 2024 11:35:41 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbF-00000000zbj-3mkj for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 11:35:40 +0000 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2ec2ded8a79so5175171fa.0 for ; Wed, 19 Jun 2024 04:35:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718796936; x=1719401736; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e0PmMBKub5I32kw3OQ7yKpgs2VnUnUQFxbp3Wubvvb8=; b=g9lQv7Z61nv1xzIVZxC3trfsotnapOdrUWr8miX4eWLvYqcNSFIOW1Bz/gJSJORvnJ BPGQM9r88htIBPugid1llgfqG19T9KbvcCgwnEiXEbh6qYQZHUeO8pbGremOt0JmxINF hETfQpth1E5PyTYSL7ITTrwbWZ4X3cMMcRj4z6CSV4VZMu5qT/Xni4SUlenNMXMZuNot 1u6t5u3sba3jLH0MCH+Zm+9qMl3quMzpjIswLsYqlNPOfjYFJnWH/vN7JdsWhWnwhbU9 DzBDI+9j4GRomJ6bqNSd/29K6YZDetoAcwCErnAd5qm0N5JZfAUg6lJCaCGa2SAm0OMg dAuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718796936; x=1719401736; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e0PmMBKub5I32kw3OQ7yKpgs2VnUnUQFxbp3Wubvvb8=; b=NOvratpGPa9YxFJ85E/4NdQvmB79V5HCHsewPkFdsoRMlmjSdAwkYMNnAkxznk7xyt OCvIdi4pz5i8DzAOkeqbXtRMBU2GlVvZ+dgz9ZOXVIokrWNggSyChrme0BzeoaPrTCml 4EPIPLpfAkja85x8viv7IQwzGkRXONXgyIuo5yJqwQ7aZBs+4c3hCeJKNCahUacZ/9gp 2eh6fOo1e4Q9u4nESQFDEv+RTrNeyI+LnuelmTBH8ly1YoDHCt7wp3XBGLgrQTmcGlyB St5PG2GOF6JmJsxsg+qYUXoU+7Qxxv2msbKzT/RzIH1JXPc17vGxLxF0i6a6NbtEPXvh lWXQ== X-Forwarded-Encrypted: i=1; AJvYcCVRNtIohOk1YOiVvmYNMSOxEghV63Zf+katZKyDIYRV0Xx4nmLVALN0awK7f7uohgXrUrz4qdSAW0YvWTwfPFXUKe6N6koBMVAfSr3vKbO/ X-Gm-Message-State: AOJu0YybIW2fMo6+6yokoHITzRNjAV+IeUUMbvg8CWrxsiuM3MPzcbxN VSBPN6wPcihgjiNezDBZNR7w8mGzZIMDKx8VZY1JC+uaY4FtabhYSv5V/DyfCEo= X-Google-Smtp-Source: AGHT+IFuiQe12ySMx1uVFaLMWupgr3h/vsw4XsgpQWD0r4gVFKJnVvYpOMaUKCr84w7Jsgw+DR3BMw== X-Received: by 2002:a2e:a553:0:b0:2eb:e6fe:3092 with SMTP id 38308e7fff4ca-2ec3cfe8333mr18233921fa.4.1718796936025; Wed, 19 Jun 2024 04:35:36 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e67b:7ea9:5658:701a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9681sm266192075e9.28.2024.06.19.04.35.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 04:35:35 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, Charlie Jenkins Subject: [PATCH v7 01/16] dt-bindings: riscv: add Zimop ISA extension description Date: Wed, 19 Jun 2024 13:35:11 +0200 Message-ID: <20240619113529.676940-2-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619113529.676940-1-cleger@rivosinc.com> References: <20240619113529.676940-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_043537_972350_4AEB6396 X-CRM114-Status: UNSURE ( 8.92 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add description for the Zimop (May-Be-Operations) ISA extension which was ratified in commit 58220614a5f of the riscv-isa-manual. Signed-off-by: Clément Léger Reviewed-by: Charlie Jenkins Acked-by: Conor Dooley --- Documentation/devicetree/bindings/riscv/extensions.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index cfed80ad5540..e214679ab6da 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -363,6 +363,11 @@ properties: ratified in the 20191213 version of the unprivileged ISA specification. + - const: zimop + description: + The standard Zimop extension version 1.0, as ratified in commit + 58220614a5f ("Zimop is ratified/1.0") of the riscv-isa-manual. + - const: ztso description: The standard Ztso extension for total store ordering, as ratified From patchwork Wed Jun 19 11:35:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13703802 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D60AC27C53 for ; Wed, 19 Jun 2024 12:47:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EyIvw40nd1hGZkjWZm4afLXdPDfVuNSOlqN2P8W9KyY=; b=TJahTXhFp7iGQ1 Z5W4uKsVa+4NpQd9n7EMgg96TZEmenlT5EmpqdDBbL1DkGATPCnmtzs1dlweZiVkS98DobV2rBgDd kvTnWXgvsEtove47ZVPLSQjOUnT/U+xsICt3h+khb5XwwmA4YT0yxc9jwAOY08Pn9x8Q3uUS1Znjk akLlX9HNozCiiioAoEhImK6GNYObSGH5JVwC9/J4qZ2BaYw12RLEIBAyqdUX1ZQInbi4DA/mvRQ6I i98Xir48FYHBRFu7/Q+myw+6PW4opHTfUXR81oSNnmnlYHp3sXb2Dxlf6W2InHmtZ8tpYiCcpdoUW Yj1dmrR2/l1SpdTC2j7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJuia-00000001DtR-32hb; Wed, 19 Jun 2024 12:47:16 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbG-00000000zcF-2r7q for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 11:35:40 +0000 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-35f0d49a9ebso404578f8f.1 for ; Wed, 19 Jun 2024 04:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718796937; x=1719401737; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RMzPOWjwpPL8KAzNp1ENlyw3QUAcLnR8cmiyMor/458=; b=eNadHAdrMeUYj+U3bmCnkQ0O4MZQxCnzpYzVse/2Syu1iP6nDm/yxQPSB5cQ2aEVzb LOUrEslpLa0YRYlIPOfdvEd5PQXl6cgpFkDrXSJFyK0PsWzI+nQ+fhKv+rNcViPzJc2y uDmA55sV+11a2vYPr205Z5Jog13tJlukUefb1Kf9Lx1j0BIGUOQvWw82TunMcYLMEc0p DQRb53xi/UgvkPXoWUMmQTf4XTJOW5eLU2mJlzHFaSRgeiqXKbrd1fA8LLQchyC2+62X qqfMaEpkjGWuot2tzhNV5XTtrS1meVUFticTbbOkcna0xG9X1yn8xNmCgnDjbwFTjcAe 4L/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718796937; x=1719401737; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RMzPOWjwpPL8KAzNp1ENlyw3QUAcLnR8cmiyMor/458=; b=chjjveHgmBsjyFoFftM3nK69U9WClBGrPBc1q/nsvYSstSUd5cMhkzGt5ckwm2APjx sNRezZdoVbZ9fJrz7L1QMghucd8Ejaj1VH6iVp1ATGhMysqX7PgQNGYRFzwUFIJvv0oN NaB257lKl4h4wOYK9NTnQvMScW7q8oNjcDtfP9Hgc3qlaLb/mw0EH7z/z7ZBWt5TFlS1 xvdK84iSqClV1axo4IaussrqVvZeN4o55MWotzulfVZgN2k8lScrjywbc/AaDUSW2f70 +xOJFFZd/BspZtTI8oJFDXl+vqqo8mz4tHRs32fMQvoJmEg/7aB7GKfFdY38LGoUIP21 bBTA== X-Forwarded-Encrypted: i=1; AJvYcCW5FeSC+1uZwf+i0eZJwkW6Cp5xiQmM4GlfCpxIsjy9igpXGzYe0TaYCT9jHeyULr8hwwa7LPOETSQHsV+vTFSsnco92iJgkZyY5f7DSkHH X-Gm-Message-State: AOJu0YxTeppmFgwd14xnLWClD/xEVKJpv+ZVUYowrzRWh/41GsUqPRdH CCd83DHlHdLnjgB271B9q34DSd7pDSsqXzNRgwz6sOj31GWGwO5DWnpJKyTwYa0= X-Google-Smtp-Source: AGHT+IGvamppuiP+XAy2cUkYTFJObTDgcrliUCH+z77J/E9pGnNdQq0NV24Wvh5pkbEYQQdLEc68iA== X-Received: by 2002:a05:600c:3b9c:b0:421:de31:76 with SMTP id 5b1f17b1804b1-4247529f031mr15669885e9.3.1718796937115; Wed, 19 Jun 2024 04:35:37 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e67b:7ea9:5658:701a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9681sm266192075e9.28.2024.06.19.04.35.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 04:35:36 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, Charlie Jenkins Subject: [PATCH v7 02/16] riscv: add ISA extension parsing for Zimop Date: Wed, 19 Jun 2024 13:35:12 +0200 Message-ID: <20240619113529.676940-3-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619113529.676940-1-cleger@rivosinc.com> References: <20240619113529.676940-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_043538_745305_8AAE5A38 X-CRM114-Status: UNSURE ( 9.37 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add parsing for Zimop ISA extension which was ratified in commit 58220614a5f of the riscv-isa-manual. Signed-off-by: Clément Léger Reviewed-by: Charlie Jenkins --- arch/riscv/include/asm/hwcap.h | 1 + arch/riscv/kernel/cpufeature.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index f64d4e98e67c..18859277843a 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -86,6 +86,7 @@ #define RISCV_ISA_EXT_ZVE64X 77 #define RISCV_ISA_EXT_ZVE64F 78 #define RISCV_ISA_EXT_ZVE64D 79 +#define RISCV_ISA_EXT_ZIMOP 80 #define RISCV_ISA_EXT_XLINUXENVCFG 127 diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 1d6e4fda00f8..e5516ba14440 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -290,6 +290,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(zihintntl, RISCV_ISA_EXT_ZIHINTNTL), __RISCV_ISA_EXT_DATA(zihintpause, RISCV_ISA_EXT_ZIHINTPAUSE), __RISCV_ISA_EXT_DATA(zihpm, RISCV_ISA_EXT_ZIHPM), + __RISCV_ISA_EXT_DATA(zimop, RISCV_ISA_EXT_ZIMOP), __RISCV_ISA_EXT_DATA(zacas, RISCV_ISA_EXT_ZACAS), __RISCV_ISA_EXT_DATA(zfa, RISCV_ISA_EXT_ZFA), __RISCV_ISA_EXT_DATA(zfh, RISCV_ISA_EXT_ZFH), From patchwork Wed Jun 19 11:35:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13703727 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3E877C2BA15 for ; Wed, 19 Jun 2024 11:35:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PocqbuouJ/+JYlF58RwIXiHPq4cXAkXH+XdnHiVXsVw=; b=3mN2fA1s2JAMo5 aA6Di5XexrQ16B6+EBYJsBfYbdFJ27OICPcHuak9tR2gN4I7HU5ef2ay95MDxwhoajW0cM54chL46 ps0CjEzJ9FnyrZO5gYtn7ha2u/CGju4Khij6I/++OoGMt0vqOKTEMcX/F0m5vPU8tnTC4zzPIGR48 xNuYXzFfBjkfvEPqdbo+oTvGFlMLVZce4BWXvdVizy25F0yNq+m8bEKMg+XDfe57g1xTUEk44IdQr DJQTalTS903r9n/XCgh8tdfzTeBUgAqH0i1LIeFLT7D3HbNbXHigK8acM1HWKY0xPpdbnvS+4e9lC 3Twh7Ozj7h3XfFK0FiWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbQ-00000000zlX-2ARp; Wed, 19 Jun 2024 11:35:48 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbI-00000000zdD-1hRV for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 11:35:42 +0000 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2ebd6ae2f56so7293731fa.0 for ; Wed, 19 Jun 2024 04:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718796939; x=1719401739; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3NeIVokKZeou2DRmWwx696jQqaRNB0bo5tdjndOt75M=; b=GiBU6FtoAReXsCpA4h2GTMZVZUvSuAnGHXA2CnGN42h7LQDVAug+GoP9/800ZrE2GI gFhOMFdvXV6Sk0MeVIOQCTloE9LNNjKaepxNkR44XdhBF+x+8XnRgSZ89AZuZ5mSxcdy JU5069LMvqVPY3PedcOoFTf/+2lWrx1Qnre3IYADz2wE+LA43fi+x2JQ7QjOOQejybYW VdYetaD6xhYPaORRh4ujBMgmZRTlVXOrP8OYTe5pkpBviFdkYHxVgcCWGQmmCwUUEo4J jQPQMxeRJcXh1I7q/IxWEuTqF5A7R4NfkwPj5eR717COQPuBxKToi6NV1bAU8M2pWU+k lxKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718796939; x=1719401739; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3NeIVokKZeou2DRmWwx696jQqaRNB0bo5tdjndOt75M=; b=f7HoT3oA8wqS41jMjNVzZy78qOdBMk0h0QrgU6W9goz/MkOQwEmLYwoGpV+zCQnSfo E9yVavIzBcseqRrC+poJCcs7+mJKTn86LE/Qx42ZlH9AoHWGfEynHgO7TL2fVdU4Mlj7 eCrtX1MrcbI6F9GJxAWqiKYSqFQAXH5lltA24itwIiQiNmfyr5+vG5I3EQUKaQy3FOtm NF5mOVZXLdHW7Jw/qItvFk9QdZA8MGnfxVByelSh1fpP904hj5WrrcLTnTAX9ikyjQjI 7b6VnzB/LdYWA3gY3oR2aypxvwSGF0JYn/Bw8u+8TZ0o4A7ooEmWInF8lHX4lAOCEtoV Ih4g== X-Forwarded-Encrypted: i=1; AJvYcCXUp98lUnpYTMz7q8xPszfqtn18sCzpyjv0wwH+I5n5IwLxriSKQfzdPCJcvzdo1hdfza0MvXwiuCoImeyIQ3lSHF45JR+VAm5PXHQp0UEt X-Gm-Message-State: AOJu0YzZxOrRw1AVFrN0vHu4jGWr5/e8J6LnWDNFWdTo2g063ThbZuLi W/SBLWdUAHZK4KAAWDyvimomP2l3SiD9Uxj+6R/GN4c4TGCAUaxgDwI9az0WFLw= X-Google-Smtp-Source: AGHT+IHXMR+p5Jiwrk26C4hD41FJdRZ01s6AEWYRELMLJ9ACvKi0hM30z5n9fFC1USLH9An4IqbrFw== X-Received: by 2002:a2e:9654:0:b0:2eb:e49c:45df with SMTP id 38308e7fff4ca-2ec3d007606mr11998811fa.4.1718796938764; Wed, 19 Jun 2024 04:35:38 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e67b:7ea9:5658:701a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9681sm266192075e9.28.2024.06.19.04.35.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 04:35:37 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, Charlie Jenkins Subject: [PATCH v7 03/16] riscv: hwprobe: export Zimop ISA extension Date: Wed, 19 Jun 2024 13:35:13 +0200 Message-ID: <20240619113529.676940-4-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619113529.676940-1-cleger@rivosinc.com> References: <20240619113529.676940-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_043540_697986_EBD20AF5 X-CRM114-Status: GOOD ( 11.60 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Export Zimop ISA extension through hwprobe. Signed-off-by: Clément Léger Reviewed-by: Charlie Jenkins --- Documentation/arch/riscv/hwprobe.rst | 4 ++++ arch/riscv/include/uapi/asm/hwprobe.h | 1 + arch/riscv/kernel/sys_hwprobe.c | 1 + 3 files changed, 6 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index fc015b452ebf..2b7f1d05b2e3 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -207,6 +207,10 @@ The following keys are defined: * :c:macro:`RISCV_HWPROBE_EXT_ZVE64D`: The Vector sub-extension Zve64d is supported, as defined by version 1.0 of the RISC-V Vector extension manual. + * :c:macro:`RISCV_HWPROBE_EXT_ZIMOP`: The Zimop May-Be-Operations extension is + supported as defined in the RISC-V ISA manual starting from commit + 58220614a5f ("Zimop is ratified/1.0"). + * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: A bitmask that contains performance information about the selected set of processors. diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h index 7b95fadbea2a..538c404938e6 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -65,6 +65,7 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZVE64X (1ULL << 39) #define RISCV_HWPROBE_EXT_ZVE64F (1ULL << 40) #define RISCV_HWPROBE_EXT_ZVE64D (1ULL << 41) +#define RISCV_HWPROBE_EXT_ZIMOP (1ULL << 42) #define RISCV_HWPROBE_KEY_CPUPERF_0 5 #define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0) #define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0) diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c index 83fcc939df67..04a2ed4ee415 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -112,6 +112,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZACAS); EXT_KEY(ZICOND); EXT_KEY(ZIHINTPAUSE); + EXT_KEY(ZIMOP); /* * All the following extensions must depend on the kernel From patchwork Wed Jun 19 11:35:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13703728 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01BF3C27C53 for ; Wed, 19 Jun 2024 11:36:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PZLD1U/DDHTMATOqjWyxq7edF9FC98MhBAfzj7aevvM=; b=CTjO4K3kBimgq6 iXdJ2yhhPM6AupBgjIAaRl2FeU3uu2serjNxh+sGd7RSnZxC7m5sY6cyUteY/FjrflXv6Cq6s6+aY nZp64W2rK+FusJWhzsAFXbsaFgcdHEi3FMpVZV/C6zG9Y4VsBwBsgdVnmB0+sacg7qtYnaC+ZqNol QN3FshX2R9trfxJp9t054jxytO9/uqUAKPaIAjHAzMj2gjErl/iVoBouFbSL8GqlZJxfKQxRC3UUd BLbyAXsWQvACWPr5HHdX5RjSNSgN6pU7C0RZCru1QPdR36fJTk6WCebstOxZI3mXc9Q3q1hwYznys 6tHrhHY1OjjbjtUPQyPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbY-00000000zsI-2tm5; Wed, 19 Jun 2024 11:35:56 +0000 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbL-00000000ze8-3ldX for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 11:35:47 +0000 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2eae70fb324so7080951fa.2 for ; Wed, 19 Jun 2024 04:35:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718796940; x=1719401740; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4gKBxLDJwfEAb763w28hTKCR1YKQpEepRMlpfnF6GRk=; b=Gu5mGGgJk3Xa/yrfW6hj7RpUoWE7u7YkGTEbmChoPTA7ueJ4UxFvHhnMFvFXBS7Kil FebdTgElQA5KmLf+7vHn2epQfUnGoTY7w9cWnzllyM3ihF0CVla1hk/QnUfpjb3Z1NgE lwyBAY55Zxru7d/oDMu7Djg+rcwxzzp2dMetmZhiLcXIoo/Yw/A/AJ7MRb3dUvcAA7nj Il5NZOuOUKjLlGbp6IYvqoDIcCQCXUxVy69dWorwfDSuFUehnhazPvGcV7f/k17dpS8V W5zqxrippHowIAlKBiltjsk6BFGTdjF8PR97MY8QocIFvZnwQPeaPIP1oWccZ35WYOij izvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718796940; x=1719401740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4gKBxLDJwfEAb763w28hTKCR1YKQpEepRMlpfnF6GRk=; b=k1VIZaFEiJBazgR50cZe1zff/A4WXxdCylK9U7omfBHpedfF4EFMLUqu6CHzzv0iQa Y/DlEyiR1OblgFTjxSqK+FJCfXiEO/olTpssispsPujYwaoyHYLRwX7arv+fX+PMmOVG pPmGQaWtZVOurHh+iZfbTreC9432tnCL/Lm9ZJMv1qk4CVzW2XfLiEikp9lcXhruU8G+ GjT01hPaSkCL8hrLnlK0Phx9lczyBIX1wLhEI4qzmKW1xHkWo1/0ggZ6GdhA7RRyXewv /GDPPobBHWxBF68M+QKa5VJDkrEZfMi8dUe8GBQan6i4DtMSB21iOD0LO4we3kTVucZ1 1daw== X-Forwarded-Encrypted: i=1; AJvYcCVaf4ZWABXNtXIor1G5JdNtyPkiNjbnw8G9LguhzZI7dyXlxddf5szzpGySpyxdRKsQKBPndnpJXWEtrpWeeV0w+rEEJ5rVuOpVZdv4+l7D X-Gm-Message-State: AOJu0YyWgS3H6BH+sFh8B38IIemFist+eapTNzb1lfopo5Hwb1x4LM82 QzJdZNnRN4Q/udLFSlFHC8wBCG/BSQ9N0R3X1Wxdo8jCTdvXIBUwgxvKCujocjQ= X-Google-Smtp-Source: AGHT+IEWSbg+KZSq17hNUj/VE/5pG5Suf0xxcBkBdQ1cvXjR8IOan6tfF5P9mBZyvKmi3xNjY8V9WA== X-Received: by 2002:a2e:a98c:0:b0:2ec:4176:dcaf with SMTP id 38308e7fff4ca-2ec4176dea4mr6715961fa.3.1718796940175; Wed, 19 Jun 2024 04:35:40 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e67b:7ea9:5658:701a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9681sm266192075e9.28.2024.06.19.04.35.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 04:35:39 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: [PATCH v7 04/16] RISC-V: KVM: Allow Zimop extension for Guest/VM Date: Wed, 19 Jun 2024 13:35:14 +0200 Message-ID: <20240619113529.676940-5-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619113529.676940-1-cleger@rivosinc.com> References: <20240619113529.676940-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_043544_112347_60276C8E X-CRM114-Status: UNSURE ( 9.56 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Extend the KVM ISA extension ONE_REG interface to allow KVM user space to detect and enable Zimop extension for Guest/VM. Signed-off-by: Clément Léger Reviewed-by: Anup Patel Acked-by: Anup Patel --- arch/riscv/include/uapi/asm/kvm.h | 1 + arch/riscv/kvm/vcpu_onereg.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h index e878e7cc3978..db482ef0ae1e 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -168,6 +168,7 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZTSO, KVM_RISCV_ISA_EXT_ZACAS, KVM_RISCV_ISA_EXT_SSCOFPMF, + KVM_RISCV_ISA_EXT_ZIMOP, KVM_RISCV_ISA_EXT_MAX, }; diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c index c676275ea0a0..09f0aa92a4da 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -61,6 +61,7 @@ static const unsigned long kvm_isa_ext_arr[] = { KVM_ISA_EXT_ARR(ZIHINTNTL), KVM_ISA_EXT_ARR(ZIHINTPAUSE), KVM_ISA_EXT_ARR(ZIHPM), + KVM_ISA_EXT_ARR(ZIMOP), KVM_ISA_EXT_ARR(ZKND), KVM_ISA_EXT_ARR(ZKNE), KVM_ISA_EXT_ARR(ZKNH), @@ -143,6 +144,7 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) case KVM_RISCV_ISA_EXT_ZIHINTNTL: case KVM_RISCV_ISA_EXT_ZIHINTPAUSE: case KVM_RISCV_ISA_EXT_ZIHPM: + case KVM_RISCV_ISA_EXT_ZIMOP: case KVM_RISCV_ISA_EXT_ZKND: case KVM_RISCV_ISA_EXT_ZKNE: case KVM_RISCV_ISA_EXT_ZKNH: From patchwork Wed Jun 19 11:35:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13703729 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F2432C27C53 for ; Wed, 19 Jun 2024 11:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jJMlVXZtJBLuzJ5mTpkLSZWc488ZpHwpjrv2b1/2hmY=; b=bU2hOsNBK4X+J3 iSm0gJhSXl5QFTsGrc7hrKXcYiRwE4R+GJbeRF50xsW0FONAJjY5sF14a1q/xVMP3wj4V0TyRvBFP IP651WyR0UE7q1WTg2W9Z8qnPZRPELWScn6jN192sdAIMrYDIoxzTt/SHLIpViq3e9l9J28fiUcjD Cj4EjGRGjnULw6mIFHPBxoitZ+sqw8iINvT4SHrsd6WOPFHsAXwCPYgFPnWgpB/vrtULWL7NthC6U JE2cJ9uaJw1Oxm1mqcTO/4sJwrkLcH9Di3cBI+pxCRsWMIPLnwedapxcKWdaFsH9TaRD4rq6Rve9e f4c7WZ0xFKSRVKBbhXQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbg-0000000100O-3ND5; Wed, 19 Jun 2024 11:36:04 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbM-00000000zf9-0EBk for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 11:35:48 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-363db2f9fc5so47531f8f.1 for ; Wed, 19 Jun 2024 04:35:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718796942; x=1719401742; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=75rTjwiTigH0M5dSuDfGTD/7XLnMHNSdwJR4GKnSoMI=; b=O9qEN7C0WLUk7rSHQERK/6PPgZOD0LCuBDN9DD+y6UoXGJh3df7j30vNEL0EDfvBA5 PkBszuejb5ZM6oqmob3hNMlB7tm9N9lyrksWuonemOHugg9IfNQt0ZT74Mzdny30LHGx yRqWJpPR5qtbQ2hnMTou6IHviL30y5pfXHm98I/xQap+ibooG5cxHV66L4Nm9ge50ETA /P1G5BeeKRdc4LX+dzhdJOBdY4+PkaMJU0H5FCo5M2EYrkOL3OfM87if04f8YNVC7FTB c8AK6pzy4DC2c+k4iMJbIS638+IHN29iMisuoesgfbDGIqVPYEyTbUvzjjFaEEldnTPx JsRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718796942; x=1719401742; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=75rTjwiTigH0M5dSuDfGTD/7XLnMHNSdwJR4GKnSoMI=; b=usEbXoqpwRDUIhzsRuD7ScGQFo1nXxVQsCqCPxx4g/kL17dp21qrtcR2dw1ijg/leg re4Ybu6TcpDrj3AjzEpieK96wTjz5ZO2q8eOuMiSG86mIzcFDeF/GYVdgwB/Z5Lqh31g WJNSJrtPs27CPxMPszuVwPYAl/Ur4LyUCeRB42/+537ILplfTQlyM/WstJQxwgV04LLh x/sjBQ27RZUm556Sku1wx8ABUibjXxy0YfqEU68hKznITHa0p66PK+97JM4TkP38AI3y 1M2JaAGvdqgTbLDmYBfVHms2iJyWShXZMcge2UrfMdmTiNwORA+VfchhS4EwfNV9iZZV KQTw== X-Forwarded-Encrypted: i=1; AJvYcCWiMsbAxfjmnkXFH9fdjT7SgMMAhb8sbQoNbqNuGzdAccwPz+WdrWr/MdO3BqQJ/2lTuBHTs2MFxmGZUEfAOfMN72LGO3MegbA/fh/H9oKS X-Gm-Message-State: AOJu0YxUNgs2h5GE5s6owJ5cpKy6fTEm+wf0xMUNeXxXiUj/1+I1HuJA S+vxJGNSJexd2nHs2Jnb6oD+9W4okFMlt3fGxqk0FEfQAMpk6IeI24X1L47Vikw= X-Google-Smtp-Source: AGHT+IHnu+3U5OyaRWV2j3JU5BIwJF09UD4syTsljNxRRPi07OByw6Zovlpi+faN3PrM3kuT5uCqKA== X-Received: by 2002:a05:600c:2252:b0:424:798a:f7f3 with SMTP id 5b1f17b1804b1-424798afe49mr6215185e9.1.1718796941741; Wed, 19 Jun 2024 04:35:41 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e67b:7ea9:5658:701a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9681sm266192075e9.28.2024.06.19.04.35.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 04:35:40 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: [PATCH v7 05/16] KVM: riscv: selftests: Add Zimop extension to get-reg-list test Date: Wed, 19 Jun 2024 13:35:15 +0200 Message-ID: <20240619113529.676940-6-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619113529.676940-1-cleger@rivosinc.com> References: <20240619113529.676940-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_043544_332710_9CE25CFA X-CRM114-Status: UNSURE ( 9.55 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The KVM RISC-V allows Zimop extension for Guest/VM so add this extension to get-reg-list test. Signed-off-by: Clément Léger Reviewed-by: Anup Patel Acked-by: Anup Patel --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c index 222198dd6d04..8c8b109ce3ca 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -68,6 +68,7 @@ bool filter_reg(__u64 reg) case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZIHINTNTL: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZIHINTPAUSE: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZIHPM: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZIMOP: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZKND: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZKNE: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZKNH: @@ -434,6 +435,7 @@ static const char *isa_ext_single_id_to_str(__u64 reg_off) KVM_ISA_EXT_ARR(ZIHINTNTL), KVM_ISA_EXT_ARR(ZIHINTPAUSE), KVM_ISA_EXT_ARR(ZIHPM), + KVM_ISA_EXT_ARR(ZIMOP), KVM_ISA_EXT_ARR(ZKND), KVM_ISA_EXT_ARR(ZKNE), KVM_ISA_EXT_ARR(ZKNH), @@ -958,6 +960,7 @@ KVM_ISA_EXT_SIMPLE_CONFIG(zifencei, ZIFENCEI); KVM_ISA_EXT_SIMPLE_CONFIG(zihintntl, ZIHINTNTL); KVM_ISA_EXT_SIMPLE_CONFIG(zihintpause, ZIHINTPAUSE); KVM_ISA_EXT_SIMPLE_CONFIG(zihpm, ZIHPM); +KVM_ISA_EXT_SIMPLE_CONFIG(zimop, ZIMOP); KVM_ISA_EXT_SIMPLE_CONFIG(zknd, ZKND); KVM_ISA_EXT_SIMPLE_CONFIG(zkne, ZKNE); KVM_ISA_EXT_SIMPLE_CONFIG(zknh, ZKNH); @@ -1014,6 +1017,7 @@ struct vcpu_reg_list *vcpu_configs[] = { &config_zihintntl, &config_zihintpause, &config_zihpm, + &config_zimop, &config_zknd, &config_zkne, &config_zknh, From patchwork Wed Jun 19 11:35:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13703730 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF0F8C27C53 for ; Wed, 19 Jun 2024 11:36:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pRf87T3MXssnWdXktQZOz2nrB7k8cdBojK54EAqB94s=; b=xih6hFV2zIAsZP 6/qXGm0d0/7nm+oUNZo7KBm4Z0CEpANi6PTXEslJn9l7dCQ48irvtTAKcy0X0G+qDuUx2egxUVVmJ gHcKEslsnKKnkVMinFTSCTFEh1c4EqUbClY6LKWb0V+gZ49CibKbOITLf/LMYrJrSkot2RMlnqzl/ matdRMe4EARr8pk1K+um6wEstnA0XehqgFpaq/zzuCMQculHiHo4EuxqXfkL5CekiM7Qer9Lkq441 ORAv066zrBheXEWRKi67X2QnKeX5cvZSVvQ1BEXP/uPzWtun5wyn7GchYmAXMSwvml2ZcUi3HlQUu gzAJxinHez/syhu4spIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbm-0000000105O-3BTP; Wed, 19 Jun 2024 11:36:10 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbM-00000000zfq-2GUm for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 11:35:50 +0000 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a6ee5995549so69880366b.3 for ; Wed, 19 Jun 2024 04:35:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718796943; x=1719401743; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3zBoSU0Yq+Ugqb2C3LqSBfjcHhvTu3SXd5PthuDFsoQ=; b=SacOf5O0EtFtUweKWOcvonMUmlxETdOWAr4u87IeITfTK5aLwZ7aNaCI9IhAoRkCYj U2khotpaNs3SRvZjjY9H+tIpjrAUXXf3eLU5PP8PEcvsHFtcdjOYB8P4pqwg91rUCvz9 BryvwAnnUA49/DRfynbQn1+OLgtlY1avOE5keo9zT6vZRegVpPtLPqqfO9VhT4Tpjmc8 4D9Lb1eBKeEVyrUXYKTaDqEfUoFrB/0v5xz8j9s/GWveM/FnbuFuAWOgIVpGKpSh+avV 9pKcTk1cJ+H2cjvgnBF1w3rJy8jjFd2m8xvK/nQUwOgK7zUJ+TiFHmVxUjfIqy38Mezd YF1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718796943; x=1719401743; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3zBoSU0Yq+Ugqb2C3LqSBfjcHhvTu3SXd5PthuDFsoQ=; b=KokN8MJWyDAUO6pJnh9dnk/dJgu2vN5rC6ZfxTjbs0lkWnu5ff3T3OkBu0tuCAjqbK wz2EEhWydHADYHey3HqNbs+JwwcBSAPm3gaHWYa3YOurFxhgSE9XnqGslPGdblCOj4ck BFu3iDpif4F5RDy44CJjQBAPNdMg7BpX2CkdyO/iSpvF4bIpdVVzaS6rYXj93mSn/gua SB4qEn+drUOPL81EN9lGDGbvs+gBxQGwAj8dEyZjTFKNf0F5TCzd2bZvV0kOsJianvQe mMRCqqkoKUTb1eoDIeZyz7h0CpFOxzee365ovga+Ru76D0DupmYnulrV77shCg3V2ipN RrkQ== X-Forwarded-Encrypted: i=1; AJvYcCUJGJ1Y9cYlYncso4eK9T6NDvfq6bnQQnRwQdcxEXViax21Ujr2wTgUideTtB0KeBHX01pdErI43oAvKidt5cy0xPizndSO3bbCJKHpbMrb X-Gm-Message-State: AOJu0Yy8nHkbbV/NGOGBRA384/BQ1zyk3Sx9/nG0HYNj7pyIiqXR5Y4q aICiI0XuX4xaSX6C8LzhvbDafbT86A43+Kp6JYZmyecs9i396gXobUWarJrhTg4= X-Google-Smtp-Source: AGHT+IHoW1UfcptJKJbUfHf0FTH+sEhONquKrK5L/t4dwXUtj8o41zbe9SSO2B6QS2dtbEZsYiMHBg== X-Received: by 2002:a17:906:4fcb:b0:a6e:f419:5456 with SMTP id a640c23a62f3a-a6fab7d04e0mr124124566b.6.1718796942951; Wed, 19 Jun 2024 04:35:42 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e67b:7ea9:5658:701a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9681sm266192075e9.28.2024.06.19.04.35.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 04:35:42 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, Conor Dooley , Charlie Jenkins Subject: [PATCH v7 06/16] dt-bindings: riscv: add Zca, Zcf, Zcd and Zcb ISA extension description Date: Wed, 19 Jun 2024 13:35:16 +0200 Message-ID: <20240619113529.676940-7-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619113529.676940-1-cleger@rivosinc.com> References: <20240619113529.676940-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_043544_801178_B603F58F X-CRM114-Status: GOOD ( 10.68 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add description for Zca, Zcf, Zcd and Zcb extensions which are part the Zc* standard extensions for code size reduction. Additional validation rules are added since Zcb depends on Zca, Zcf, depends on Zca and F, Zcd depends on Zca and D and finally, Zcf can not be present on rv64. Signed-off-by: Clément Léger Reviewed-by: Conor Dooley Reviewed-by: Charlie Jenkins --- .../devicetree/bindings/riscv/extensions.yaml | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index e214679ab6da..e34d06633278 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -220,6 +220,38 @@ properties: instructions as ratified at commit 6d33919 ("Merge pull request #158 from hirooih/clmul-fix-loop-end-condition") of riscv-bitmanip. + - const: zca + description: | + The Zca extension part of Zc* standard extensions for code size + reduction, as ratified in commit 8be3419c1c0 ("Zcf doesn't exist on + RV64 as it contains no instructions") of riscv-code-size-reduction, + merged in the riscv-isa-manual by commit dbc79cf28a2 ("Initial seed + of zc.adoc to src tree."). + + - const: zcb + description: | + The Zcb extension part of Zc* standard extensions for code size + reduction, as ratified in commit 8be3419c1c0 ("Zcf doesn't exist on + RV64 as it contains no instructions") of riscv-code-size-reduction, + merged in the riscv-isa-manual by commit dbc79cf28a2 ("Initial seed + of zc.adoc to src tree."). + + - const: zcd + description: | + The Zcd extension part of Zc* standard extensions for code size + reduction, as ratified in commit 8be3419c1c0 ("Zcf doesn't exist on + RV64 as it contains no instructions") of riscv-code-size-reduction, + merged in the riscv-isa-manual by commit dbc79cf28a2 ("Initial seed + of zc.adoc to src tree."). + + - const: zcf + description: | + The Zcf extension part of Zc* standard extensions for code size + reduction, as ratified in commit 8be3419c1c0 ("Zcf doesn't exist on + RV64 as it contains no instructions") of riscv-code-size-reduction, + merged in the riscv-isa-manual by commit dbc79cf28a2 ("Initial seed + of zc.adoc to src tree."). + - const: zfa description: The standard Zfa extension for additional floating point @@ -519,5 +551,51 @@ properties: Registers in the AX45MP datasheet. https://www.andestech.com/wp-content/uploads/AX45MP-1C-Rev.-5.0.0-Datasheet.pdf + allOf: + # Zcb depends on Zca + - if: + contains: + const: zcb + then: + contains: + const: zca + # Zcd depends on Zca and D + - if: + contains: + const: zcd + then: + allOf: + - contains: + const: zca + - contains: + const: d + # Zcf depends on Zca and F + - if: + contains: + const: zcf + then: + allOf: + - contains: + const: zca + - contains: + const: f + +allOf: + # Zcf extension does not exist on rv64 + - if: + properties: + riscv,isa-extensions: + contains: + const: zcf + riscv,isa-base: + contains: + const: rv64i + then: + properties: + riscv,isa-extensions: + not: + contains: + const: zcf + additionalProperties: true ... From patchwork Wed Jun 19 11:35:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13703731 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45537C27C53 for ; Wed, 19 Jun 2024 11:36:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MftLJd00IS2yRjeYpWgTuIyIHlyI/k6+hIt/4VpODao=; b=FbcLANNV/oTg5a tTIxNQ9w5illQPc1tBQoxgiti9zFeiyUSopoLso0wQtlnu5FL7W3z0c+7XCUY1LPAKy3yF8QHJRmk 2xh7rFmnZ3j/nN8xX/grTX6j+WzXjLlPK9wESxovPJe4GzwhxdM3qaB2LE+LnXvVtAoQaiWcB4v0X OktIZU7k8H6N8C5PRMIsnVwa4jbNn5UdbNxwBHjtasdEb9KkeQnbERXnIW4hPQtg4aveO3NYvzJOx LgM+QYgBrJCgW/2Elz+pe4z6qHMFya0gSTSb3tizDzmf7TdkKOMXzHKufGpNzOF8MPBcnRHbZJyvB ZaZeY1Mg7TYiBvb4MpyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbp-0000000107k-2uZJ; Wed, 19 Jun 2024 11:36:13 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbO-00000000zhz-0OZD for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 11:35:52 +0000 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-3632e0f80e5so48980f8f.0 for ; Wed, 19 Jun 2024 04:35:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718796944; x=1719401744; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cnGfGukO8mRkvoU5UzJqQ+YrlyhRuMD5WxDieDf30Jk=; b=POvX2OPSQCHdP6ccOyDyvbGJ5DdOsm4vmW8fQKwL6MQAClbKHpc6cVg0OgTScgGZrS tbRXI94FYTYjj4076vCqCi2rkFcq4+86IIhMaDFtamPn7xMwIBl/bNWdm1hG5yEneHIX 8EnyVJ/hjAnNfo8nDzvS07cmf/ZMtNDPWjtFLps5i6ZNxVR0oskZNNCZY4yxQ58bMrdq 1j0FQ+EhqKwjFWrnt5Pu8S/LDqkIadxlVjoPy7TSTAzlW0ZyOjwprvqbDzd9Xod2crzs iX0xrw3flfTq0CCAoQjMRfpVxWpxtE9x5gwdWxXd5mxhIirJ+CZSKq2/39YT/qXVhQc8 e5TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718796944; x=1719401744; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cnGfGukO8mRkvoU5UzJqQ+YrlyhRuMD5WxDieDf30Jk=; b=W2P3nXewu1zm4hcs2Ej2ivF6yXeClc0QI1mIcmdotYA5IF90l+0gQe/qwk95k16Ulp T+zOfsV7rWVuUz83QOfMhQnmIswM+YVfYZg0Zu/oG1IuECW9ojdBTS94y7gt3sfhYs59 O7ZM8KQASboDnsQ9etLvbas42jZ2hLetUrS8zs2OmYNa1VfTAsw6jyaws6Ter5AKGvXM Zo5Jj5W1A1x1Jt1KgHM9CJB06a6ZJBsE1559joEvJ2bl6nt8qrsxa4ajBFNwGtOoZr+B lthouw+w88uQsnqxdkmG/uoYrskNZ6C+NZWTyMBRSFTR1b3jrmTzv/GXt0lnuhrseb8L 9lXw== X-Forwarded-Encrypted: i=1; AJvYcCU6pwEkY2Ee6up2c5m72DVi57kBViurXOjPSJAIpzYhZZ8wA44SrH9Ak6DhAWPWqH3upBT3uOZxDcFH99qFonE3jxHkNVmD3ZkHfC4f+o/X X-Gm-Message-State: AOJu0Yx1sekVd4rdct37n8prJtMvGfTr/TPphYLvjUGrfOx3YbfQoUMd xroKb3Qed0pqqvAQPEc8IkfQ6t7gy5UNfUbum2b1p/D+jcWdn5Y/xB7+Z0HFzoc= X-Google-Smtp-Source: AGHT+IGeDTIGhvMHXpR5f7z1r6wfKzzl0pgZUz+m4jQqMBktnIFO8WlFWqYusw9+HCL/qqCt7LQwnA== X-Received: by 2002:a05:600c:511d:b0:423:445:4aad with SMTP id 5b1f17b1804b1-42475016e88mr16019345e9.0.1718796944315; Wed, 19 Jun 2024 04:35:44 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e67b:7ea9:5658:701a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9681sm266192075e9.28.2024.06.19.04.35.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 04:35:43 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, Conor Dooley Subject: [PATCH v7 07/16] riscv: add ISA extensions validation callback Date: Wed, 19 Jun 2024 13:35:17 +0200 Message-ID: <20240619113529.676940-8-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619113529.676940-1-cleger@rivosinc.com> References: <20240619113529.676940-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_043546_344143_5AB340B5 X-CRM114-Status: GOOD ( 29.11 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Since a few extensions (Zicbom/Zicboz) already needs validation and future ones will need it as well (Zc*) add a validate() callback to struct riscv_isa_ext_data. This require to rework the way extensions are parsed and split it in two phases. First phase is isa string or isa extension list parsing and consists in enabling all the extensions in a temporary bitmask (source isa) without any validation. The second step "resolves" the final isa bitmap, handling potential missing dependencies. The mechanism is quite simple and simply validate each extension described in the source bitmap before enabling it in the resolved isa bitmap. validate() callbacks can return either 0 for success, -EPROBEDEFER if extension needs to be validated again at next loop. A previous ISA bitmap is kept to avoid looping multiple times if an extension dependencies are never satisfied until we reach a stable state. In order to avoid any potential infinite looping, allow looping a maximum of the number of extension we handle. Zicboz and Zicbom extensions are modified to use this validation mechanism. Signed-off-by: Clément Léger Reviewed-by: Conor Dooley --- arch/riscv/include/asm/cpufeature.h | 1 + arch/riscv/kernel/cpufeature.c | 220 +++++++++++++++++----------- 2 files changed, 136 insertions(+), 85 deletions(-) diff --git a/arch/riscv/include/asm/cpufeature.h b/arch/riscv/include/asm/cpufeature.h index 347805446151..000796c2d0b1 100644 --- a/arch/riscv/include/asm/cpufeature.h +++ b/arch/riscv/include/asm/cpufeature.h @@ -70,6 +70,7 @@ struct riscv_isa_ext_data { const char *property; const unsigned int *subset_ext_ids; const unsigned int subset_ext_size; + int (*validate)(const struct riscv_isa_ext_data *data, const unsigned long *isa_bitmap); }; extern const struct riscv_isa_ext_data riscv_isa_ext[]; diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index e5516ba14440..a3af976f36c9 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -72,51 +72,55 @@ bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, unsigned i } EXPORT_SYMBOL_GPL(__riscv_isa_extension_available); -static bool riscv_isa_extension_check(int id) +static int riscv_ext_zicbom_validate(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) { - switch (id) { - case RISCV_ISA_EXT_ZICBOM: - if (!riscv_cbom_block_size) { - pr_err("Zicbom detected in ISA string, disabling as no cbom-block-size found\n"); - return false; - } else if (!is_power_of_2(riscv_cbom_block_size)) { - pr_err("Zicbom disabled as cbom-block-size present, but is not a power-of-2\n"); - return false; - } - return true; - case RISCV_ISA_EXT_ZICBOZ: - if (!riscv_cboz_block_size) { - pr_err("Zicboz detected in ISA string, disabling as no cboz-block-size found\n"); - return false; - } else if (!is_power_of_2(riscv_cboz_block_size)) { - pr_err("Zicboz disabled as cboz-block-size present, but is not a power-of-2\n"); - return false; - } - return true; - case RISCV_ISA_EXT_INVALID: - return false; + if (!riscv_cbom_block_size) { + pr_err("Zicbom detected in ISA string, disabling as no cbom-block-size found\n"); + return -EINVAL; } + if (!is_power_of_2(riscv_cbom_block_size)) { + pr_err("Zicbom disabled as cbom-block-size present, but is not a power-of-2\n"); + return -EINVAL; + } + return 0; +} - return true; +static int riscv_ext_zicboz_validate(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ + if (!riscv_cboz_block_size) { + pr_err("Zicboz detected in ISA string, disabling as no cboz-block-size found\n"); + return -EINVAL; + } + if (!is_power_of_2(riscv_cboz_block_size)) { + pr_err("Zicboz disabled as cboz-block-size present, but is not a power-of-2\n"); + return -EINVAL; + } + return 0; } -#define _RISCV_ISA_EXT_DATA(_name, _id, _subset_exts, _subset_exts_size) { \ - .name = #_name, \ - .property = #_name, \ - .id = _id, \ - .subset_ext_ids = _subset_exts, \ - .subset_ext_size = _subset_exts_size \ +#define _RISCV_ISA_EXT_DATA(_name, _id, _subset_exts, _subset_exts_size, _validate) { \ + .name = #_name, \ + .property = #_name, \ + .id = _id, \ + .subset_ext_ids = _subset_exts, \ + .subset_ext_size = _subset_exts_size, \ + .validate = _validate \ } -#define __RISCV_ISA_EXT_DATA(_name, _id) _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0) +#define __RISCV_ISA_EXT_DATA(_name, _id) _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0, NULL) /* Used to declare pure "lasso" extension (Zk for instance) */ #define __RISCV_ISA_EXT_BUNDLE(_name, _bundled_exts) \ - _RISCV_ISA_EXT_DATA(_name, RISCV_ISA_EXT_INVALID, _bundled_exts, ARRAY_SIZE(_bundled_exts)) + _RISCV_ISA_EXT_DATA(_name, RISCV_ISA_EXT_INVALID, _bundled_exts, \ + ARRAY_SIZE(_bundled_exts), NULL) /* Used to declare extensions that are a superset of other extensions (Zvbb for instance) */ #define __RISCV_ISA_EXT_SUPERSET(_name, _id, _sub_exts) \ - _RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts)) + _RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), NULL) +#define __RISCV_ISA_EXT_SUPERSET_VALIDATE(_name, _id, _sub_exts, _validate) \ + _RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), _validate) static const unsigned int riscv_zk_bundled_exts[] = { RISCV_ISA_EXT_ZBKB, @@ -281,8 +285,10 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(c, RISCV_ISA_EXT_c), __RISCV_ISA_EXT_SUPERSET(v, RISCV_ISA_EXT_v, riscv_v_exts), __RISCV_ISA_EXT_DATA(h, RISCV_ISA_EXT_h), - __RISCV_ISA_EXT_SUPERSET(zicbom, RISCV_ISA_EXT_ZICBOM, riscv_xlinuxenvcfg_exts), - __RISCV_ISA_EXT_SUPERSET(zicboz, RISCV_ISA_EXT_ZICBOZ, riscv_xlinuxenvcfg_exts), + __RISCV_ISA_EXT_SUPERSET_VALIDATE(zicbom, RISCV_ISA_EXT_ZICBOM, riscv_xlinuxenvcfg_exts, + riscv_ext_zicbom_validate), + __RISCV_ISA_EXT_SUPERSET_VALIDATE(zicboz, RISCV_ISA_EXT_ZICBOZ, riscv_xlinuxenvcfg_exts, + riscv_ext_zicboz_validate), __RISCV_ISA_EXT_DATA(zicntr, RISCV_ISA_EXT_ZICNTR), __RISCV_ISA_EXT_DATA(zicond, RISCV_ISA_EXT_ZICOND), __RISCV_ISA_EXT_DATA(zicsr, RISCV_ISA_EXT_ZICSR), @@ -349,33 +355,93 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { const size_t riscv_isa_ext_count = ARRAY_SIZE(riscv_isa_ext); -static void __init match_isa_ext(const struct riscv_isa_ext_data *ext, const char *name, - const char *name_end, struct riscv_isainfo *isainfo) +static void riscv_isa_set_ext(const struct riscv_isa_ext_data *ext, unsigned long *bitmap) { - if ((name_end - name == strlen(ext->name)) && - !strncasecmp(name, ext->name, name_end - name)) { - /* - * If this is a bundle, enable all the ISA extensions that - * comprise the bundle. - */ - if (ext->subset_ext_size) { - for (int i = 0; i < ext->subset_ext_size; i++) { - if (riscv_isa_extension_check(ext->subset_ext_ids[i])) - set_bit(ext->subset_ext_ids[i], isainfo->isa); + if (ext->id != RISCV_ISA_EXT_INVALID) + set_bit(ext->id, bitmap); + + for (int i = 0; i < ext->subset_ext_size; i++) { + if (ext->subset_ext_ids[i] != RISCV_ISA_EXT_INVALID) + set_bit(ext->subset_ext_ids[i], bitmap); + } +} + +static const struct riscv_isa_ext_data *riscv_get_isa_ext_data(unsigned int ext_id) +{ + for (int i = 0; i < riscv_isa_ext_count; i++) { + if (riscv_isa_ext[i].id == ext_id) + return &riscv_isa_ext[i]; + } + + return NULL; +} + +/* + * "Resolve" a source ISA bitmap into one that matches kernel configuration as + * well as correct extension dependencies. Some extensions depends on specific + * kernel configuration to be usable (V needs CONFIG_RISCV_ISA_V for instance) + * and this function will actually validate all the extensions provided in + * source_isa into the resolved_isa based on extensions validate() callbacks. + */ +static void __init riscv_resolve_isa(unsigned long *source_isa, + unsigned long *resolved_isa, unsigned long *this_hwcap, + unsigned long *isa2hwcap) +{ + bool loop; + const struct riscv_isa_ext_data *ext; + DECLARE_BITMAP(prev_resolved_isa, RISCV_ISA_EXT_MAX); + int max_loop_count = riscv_isa_ext_count, ret; + unsigned int bit; + + do { + loop = false; + if (max_loop_count-- < 0) { + pr_err("Failed to reach a stable ISA state\n"); + return; + } + bitmap_copy(prev_resolved_isa, resolved_isa, RISCV_ISA_EXT_MAX); + for_each_set_bit(bit, source_isa, RISCV_ISA_EXT_MAX) { + ext = riscv_get_isa_ext_data(bit); + if (!ext) + continue; + + if (ext->validate) { + ret = ext->validate(ext, resolved_isa); + if (ret == -EPROBE_DEFER) { + loop = true; + continue; + } else if (ret) { + /* Disable the extension entirely */ + clear_bit(ext->id, source_isa); + continue; + } } + + set_bit(ext->id, resolved_isa); + /* No need to keep it in source isa now that it is enabled */ + clear_bit(ext->id, source_isa); + + /* Single letter extensions get set in hwcap */ + if (ext->id < RISCV_ISA_EXT_BASE) + *this_hwcap |= isa2hwcap[ext->id]; } + } while (loop && memcmp(prev_resolved_isa, resolved_isa, sizeof(prev_resolved_isa))); +} - /* - * This is valid even for bundle extensions which uses the RISCV_ISA_EXT_INVALID id - * (rejected by riscv_isa_extension_check()). - */ - if (riscv_isa_extension_check(ext->id)) - set_bit(ext->id, isainfo->isa); +static void __init match_isa_ext(const char *name, const char *name_end, unsigned long *bitmap) +{ + for (int i = 0; i < riscv_isa_ext_count; i++) { + const struct riscv_isa_ext_data *ext = &riscv_isa_ext[i]; + + if ((name_end - name == strlen(ext->name)) && + !strncasecmp(name, ext->name, name_end - name)) { + riscv_isa_set_ext(ext, bitmap); + break; + } } } -static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct riscv_isainfo *isainfo, - unsigned long *isa2hwcap, const char *isa) +static void __init riscv_parse_isa_string(const char *isa, unsigned long *bitmap) { /* * For all possible cpus, we have already validated in @@ -388,7 +454,7 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc while (*isa) { const char *ext = isa++; const char *ext_end = isa; - bool ext_long = false, ext_err = false; + bool ext_err = false; switch (*ext) { case 's': @@ -428,7 +494,6 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc * character itself while eliminating the extensions version number. * A simple re-increment solves this problem. */ - ext_long = true; for (; *isa && *isa != '_'; ++isa) if (unlikely(!isalnum(*isa))) ext_err = true; @@ -509,15 +574,7 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc if (unlikely(ext_err)) continue; - for (int i = 0; i < riscv_isa_ext_count; i++) - match_isa_ext(&riscv_isa_ext[i], ext, ext_end, isainfo); - - if (!ext_long) { - int nr = tolower(*ext) - 'a'; - - if (riscv_isa_extension_check(nr)) - *this_hwcap |= isa2hwcap[nr]; - } + match_isa_ext(ext, ext_end, bitmap); } } @@ -544,6 +601,7 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap) for_each_possible_cpu(cpu) { struct riscv_isainfo *isainfo = &hart_isa[cpu]; unsigned long this_hwcap = 0; + DECLARE_BITMAP(source_isa, RISCV_ISA_EXT_MAX) = { 0 }; if (acpi_disabled) { node = of_cpu_device_node_get(cpu); @@ -566,7 +624,7 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap) } } - riscv_parse_isa_string(&this_hwcap, isainfo, isa2hwcap, isa); + riscv_parse_isa_string(isa, source_isa); /* * These ones were as they were part of the base ISA when the @@ -574,10 +632,10 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap) * unconditionally where `i` is in riscv,isa on DT systems. */ if (acpi_disabled) { - set_bit(RISCV_ISA_EXT_ZICSR, isainfo->isa); - set_bit(RISCV_ISA_EXT_ZIFENCEI, isainfo->isa); - set_bit(RISCV_ISA_EXT_ZICNTR, isainfo->isa); - set_bit(RISCV_ISA_EXT_ZIHPM, isainfo->isa); + set_bit(RISCV_ISA_EXT_ZICSR, source_isa); + set_bit(RISCV_ISA_EXT_ZIFENCEI, source_isa); + set_bit(RISCV_ISA_EXT_ZICNTR, source_isa); + set_bit(RISCV_ISA_EXT_ZIHPM, source_isa); } /* @@ -590,9 +648,11 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap) */ if (acpi_disabled && boot_vendorid == THEAD_VENDOR_ID && boot_archid == 0x0) { this_hwcap &= ~isa2hwcap[RISCV_ISA_EXT_v]; - clear_bit(RISCV_ISA_EXT_v, isainfo->isa); + clear_bit(RISCV_ISA_EXT_v, source_isa); } + riscv_resolve_isa(source_isa, isainfo->isa, &this_hwcap, isa2hwcap); + /* * All "okay" hart should have same isa. Set HWCAP based on * common capabilities of every "okay" hart, in case they don't @@ -621,6 +681,7 @@ static int __init riscv_fill_hwcap_from_ext_list(unsigned long *isa2hwcap) unsigned long this_hwcap = 0; struct device_node *cpu_node; struct riscv_isainfo *isainfo = &hart_isa[cpu]; + DECLARE_BITMAP(source_isa, RISCV_ISA_EXT_MAX) = { 0 }; cpu_node = of_cpu_device_node_get(cpu); if (!cpu_node) { @@ -640,22 +701,11 @@ static int __init riscv_fill_hwcap_from_ext_list(unsigned long *isa2hwcap) ext->property) < 0) continue; - if (ext->subset_ext_size) { - for (int j = 0; j < ext->subset_ext_size; j++) { - if (riscv_isa_extension_check(ext->subset_ext_ids[j])) - set_bit(ext->subset_ext_ids[j], isainfo->isa); - } - } - - if (riscv_isa_extension_check(ext->id)) { - set_bit(ext->id, isainfo->isa); - - /* Only single letter extensions get set in hwcap */ - if (strnlen(riscv_isa_ext[i].name, 2) == 1) - this_hwcap |= isa2hwcap[riscv_isa_ext[i].id]; - } + riscv_isa_set_ext(ext, source_isa); } + riscv_resolve_isa(source_isa, isainfo->isa, &this_hwcap, isa2hwcap); + of_node_put(cpu_node); /* From patchwork Wed Jun 19 11:35:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13703732 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4DE00C2BA1A for ; Wed, 19 Jun 2024 11:36:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bpbC/iRFJy5ll6Mmnm7uFReg2aY76ppoHesqcyloE5A=; b=PRTq05IJR+UGUN xQemtIs6GTFn3xy564tzIWvUmK+84UL+0yNRDsbs9AEJT4xVkyF3jVVwz0w3c/EBmrxvr1N8bni+H yY/KwZUa0QJBcs+f49DD7XvOyEtg0m2budg+XdR+ldpcIIL6Kxt+1TXlwlAtliZZapyp9bDTMZm5i La1g5P80seyn8ZbixdvUQHrV8DphFW4T7x33w6+ItsWOsm41DB1Xaiqn/gwbdllvdzqwHNnB0ZBfy WSJfcJps9w5H8zIDr6R/GWllKLXSUPUfYOt06E84FYlhO2EbvFlrMESeb2odUHWaJdc1rQvJahnF3 +87Tor9tGOVpAmZIxGJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbs-000000010AR-29Yx; Wed, 19 Jun 2024 11:36:16 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbX-00000000zpY-1dRv for linux-riscv@bombadil.infradead.org; Wed, 19 Jun 2024 11:35:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=luuWYSLXcV5+8J7r5WvQusu30sDK3pgwQTMW2O5hJ3s=; b=jgyHsN2lG4cMlpe82Ejq9gPhkC uBLDRyw2BTPdzDMBwiYdEQ8yk3sl4kt+hpxKV7AnvvoEbg/wFHPKledOUPVfkgl5xNTEMmqqf7lZE J+O0EdQ9Wk9GX/zMfJUDmOZY54Df6vvIVZ8eRqNn3z5hh3gge8o6bTo8rjRWYzyxWhC2OuTcZwiki Jpj1U34wM6WA355CDQMktWHNSUL/KqdhTGbwX7bOXmi1A5G0HvIqSWVqzwyUNC+8tQic6fx5T/LrN Dk6A4XXXkL+Kb9YVBq80j5Ss64dyL/pociNEYZRX42zSzgRiZe3vfgmKVPt0lhZX0hqGywN3+NpbF EHHPdxNA==; Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbS-00000007LAt-07B6 for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 11:35:53 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4247ae93738so1135e9.2 for ; Wed, 19 Jun 2024 04:35:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718796946; x=1719401746; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=luuWYSLXcV5+8J7r5WvQusu30sDK3pgwQTMW2O5hJ3s=; b=XibpvgYevdlRzKILsD5XpA4Lw65MFZTX4QIdA+1wZUMY5O7jVv8U6vvkjQu+KmrfJi N54/WHST7qctjKtfAF8P7vuvYDisncUcXZr6z0EKWn+FO2HXc3NVFq6LoGr9T9kv28Wv SiS7W/ZN0R1f8yGu4x/MAlRvtkQw4ILvg/qx+qZ0vgPnMEYa5bozpg3T/xe6N6nbGHix ROWTLDEuTcNuJ1Nqvvz1hFrygchq//DoRav8GA3CAO+aPA+kAKmG5hMt0iri4KBmzD2o DH0Wa+5+4O2hodCqtXmpnen/a7/zfFDtDb+HQoFkgvf6WhP3TA7O3pB0hgmk6AwnxfMa kFIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718796946; x=1719401746; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=luuWYSLXcV5+8J7r5WvQusu30sDK3pgwQTMW2O5hJ3s=; b=TlOfk8Um9wsZ3RvMrAp2f1pD2OFiXIhLm+pZ3F3Ix42BdZaxQcVPaOQ2KVStcwvNmY GZnuCF26vKSscWl2SF8uWpO0/BBBPz5J0z2lHRKinYJVCMw1J3VthNCLrkZoj1n6MydB bAsVpq1Vmad1itLf2U8J+uR7/ZMh2P+u3PjWyach1VD3pqexpLBihyKuzV69ll3+EX0p GWMfGzJUPn5PRC9X2IiKUnb05EHxdnbXuWUR5xmbiuvfhBzuPBCyqJPOw9RVDD6pfVEA XeLUhpLZGLopfUZj9Pky3paYsX9PTIntKav6wLRi46w3cUDe/R4krv95fHBNNBqEymlX NPRw== X-Forwarded-Encrypted: i=1; AJvYcCXvRQVOnVQwUpsaxFCj37FYgW3r3qvFpKt/NYy0Haw5akJRIFgiwRZQ1Vv2dLVVIEh7iF342ENEe1Rjii0tFLP65Gem5bYOem5JDNT4ctpA X-Gm-Message-State: AOJu0Yz61KZ/1+xcxzPjKuQz1sC7/YoT5zK8mtpV4qPwimtr2iuDBtb1 fnZZNsjSvUH5GYl8HWJuGQSK2zkna8kYJaD4qcOMy+75Bvrh48YhudM+Wghk+3Q= X-Google-Smtp-Source: AGHT+IFzGS/p4a4mBQ/inU2s0uZu8vrDHSaWFV9V52yXQFOztuj4Wss5NZDJltC9s5gFdnIi8Cu3yA== X-Received: by 2002:a05:600c:3ba5:b0:421:f441:e804 with SMTP id 5b1f17b1804b1-42475c2138amr13486685e9.4.1718796946112; Wed, 19 Jun 2024 04:35:46 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e67b:7ea9:5658:701a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9681sm266192075e9.28.2024.06.19.04.35.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 04:35:44 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, Conor Dooley Subject: [PATCH v7 08/16] riscv: add ISA parsing for Zca, Zcf, Zcd and Zcb Date: Wed, 19 Jun 2024 13:35:18 +0200 Message-ID: <20240619113529.676940-9-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619113529.676940-1-cleger@rivosinc.com> References: <20240619113529.676940-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_123550_771337_53D76BE4 X-CRM114-Status: GOOD ( 16.22 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The Zc* standard extension for code reduction introduces new extensions. This patch adds support for Zca, Zcf, Zcd and Zcb. Zce, Zcmt and Zcmp are left out of this patch since they are targeting microcontrollers/ embedded CPUs instead of application processors. Signed-off-by: Clément Léger Reviewed-by: Conor Dooley --- arch/riscv/include/asm/hwcap.h | 4 +++ arch/riscv/kernel/cpufeature.c | 55 +++++++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index 18859277843a..b12ae3f2141c 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -87,6 +87,10 @@ #define RISCV_ISA_EXT_ZVE64F 78 #define RISCV_ISA_EXT_ZVE64D 79 #define RISCV_ISA_EXT_ZIMOP 80 +#define RISCV_ISA_EXT_ZCA 81 +#define RISCV_ISA_EXT_ZCB 82 +#define RISCV_ISA_EXT_ZCD 83 +#define RISCV_ISA_EXT_ZCF 84 #define RISCV_ISA_EXT_XLINUXENVCFG 127 diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index a3af976f36c9..aa631fe49b7c 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -111,6 +111,9 @@ static int riscv_ext_zicboz_validate(const struct riscv_isa_ext_data *data, #define __RISCV_ISA_EXT_DATA(_name, _id) _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0, NULL) +#define __RISCV_ISA_EXT_DATA_VALIDATE(_name, _id, _validate) \ + _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0, _validate) + /* Used to declare pure "lasso" extension (Zk for instance) */ #define __RISCV_ISA_EXT_BUNDLE(_name, _bundled_exts) \ _RISCV_ISA_EXT_DATA(_name, RISCV_ISA_EXT_INVALID, _bundled_exts, \ @@ -122,6 +125,37 @@ static int riscv_ext_zicboz_validate(const struct riscv_isa_ext_data *data, #define __RISCV_ISA_EXT_SUPERSET_VALIDATE(_name, _id, _sub_exts, _validate) \ _RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), _validate) +static int riscv_ext_zca_depends(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ + if (__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZCA)) + return 0; + + return -EPROBE_DEFER; +} +static int riscv_ext_zcd_validate(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ + if (__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZCA) && + __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_d)) + return 0; + + return -EPROBE_DEFER; +} + +static int riscv_ext_zcf_validate(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ + if (IS_ENABLED(CONFIG_64BIT)) + return -EINVAL; + + if (__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZCA) && + __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_f)) + return 0; + + return -EPROBE_DEFER; +} + static const unsigned int riscv_zk_bundled_exts[] = { RISCV_ISA_EXT_ZBKB, RISCV_ISA_EXT_ZBKC, @@ -236,6 +270,21 @@ static const unsigned int riscv_xlinuxenvcfg_exts[] = { RISCV_ISA_EXT_XLINUXENVCFG }; +/* + * Zc* spec states that: + * - C always implies Zca + * - C+F implies Zcf (RV32 only) + * - C+D implies Zcd + * + * These extensions will be enabled and then validated depending on the + * availability of F/D RV32. + */ +static const unsigned int riscv_c_exts[] = { + RISCV_ISA_EXT_ZCA, + RISCV_ISA_EXT_ZCF, + RISCV_ISA_EXT_ZCD, +}; + /* * The canonical order of ISA extension names in the ISA string is defined in * chapter 27 of the unprivileged specification. @@ -282,7 +331,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(f, RISCV_ISA_EXT_f), __RISCV_ISA_EXT_DATA(d, RISCV_ISA_EXT_d), __RISCV_ISA_EXT_DATA(q, RISCV_ISA_EXT_q), - __RISCV_ISA_EXT_DATA(c, RISCV_ISA_EXT_c), + __RISCV_ISA_EXT_SUPERSET(c, RISCV_ISA_EXT_c, riscv_c_exts), __RISCV_ISA_EXT_SUPERSET(v, RISCV_ISA_EXT_v, riscv_v_exts), __RISCV_ISA_EXT_DATA(h, RISCV_ISA_EXT_h), __RISCV_ISA_EXT_SUPERSET_VALIDATE(zicbom, RISCV_ISA_EXT_ZICBOM, riscv_xlinuxenvcfg_exts, @@ -301,6 +350,10 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(zfa, RISCV_ISA_EXT_ZFA), __RISCV_ISA_EXT_DATA(zfh, RISCV_ISA_EXT_ZFH), __RISCV_ISA_EXT_DATA(zfhmin, RISCV_ISA_EXT_ZFHMIN), + __RISCV_ISA_EXT_DATA(zca, RISCV_ISA_EXT_ZCA), + __RISCV_ISA_EXT_DATA_VALIDATE(zcb, RISCV_ISA_EXT_ZCB, riscv_ext_zca_depends), + __RISCV_ISA_EXT_DATA_VALIDATE(zcd, RISCV_ISA_EXT_ZCD, riscv_ext_zcd_validate), + __RISCV_ISA_EXT_DATA_VALIDATE(zcf, RISCV_ISA_EXT_ZCF, riscv_ext_zcf_validate), __RISCV_ISA_EXT_DATA(zba, RISCV_ISA_EXT_ZBA), __RISCV_ISA_EXT_DATA(zbb, RISCV_ISA_EXT_ZBB), __RISCV_ISA_EXT_DATA(zbc, RISCV_ISA_EXT_ZBC), From patchwork Wed Jun 19 11:35:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13703733 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4719FC2BA15 for ; Wed, 19 Jun 2024 11:36:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uo4cxu3j50Mt6fsLNwhj87BKnNAdXNAp3fOf/MNaiSM=; b=yHVyz3iYtV1Az4 bKtRRIWeyR7WskRL7T3GgjT5lZ9fipT1V8Z63v+iA91+9I9xr8kXKQYk2twzrCfgBIDed2G3OxwgB BYpeX7sItasNWTksEAXGutVOGgIs1q5yyFbbWjpLP+lxoYgdL59U9yLqmBXtzGEPml88mIL0q/QqQ JHDQWIKjojp+CnujxWLbje48vlt6PzoqreaFNVRQO2JbDb3ffyM8gyAVAg7iByredirQo9Ouzqcj5 vzBa6D9YXT1PtYWi3DQPRbCaQqThf7wgPInjNjPe8wSAoF8NZ++5Xp3qjTJKu3hboyk0RplqQv/DN Wf7koqhUg9iJMS6Uk5Xg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbz-000000010G3-21rc; Wed, 19 Jun 2024 11:36:23 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbR-00000000zlv-3yCE for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 11:35:55 +0000 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2ebc724e1fdso7522881fa.1 for ; Wed, 19 Jun 2024 04:35:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718796948; x=1719401748; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zNRHzoAv2tzJ98f4aZ+tvGJ/9WIogU2JNMbeWGeAmys=; b=KW7zwe8qVg3Z9zGz7/B1H8xfnpNNMC2PKWmPtgqf55dmOW2d21/4Hu3h+UqtbyLjPO IghLfgd0+N1SgQwX33mPhiT8phxvWcaTEohRL8JqB3F8lQOoeuTHTovivW+TRcg8yBaF mh3ejNEe8UcG5lrDGIYT6nms8WXGDzN0RvCQ/TGbmYmWtCXrXN5TzeLOR019up9nRADW slUL0MxmzuXt7gbn/zjDuENiTn8M9RbFoEvZ0L7GLY2ck7O/4xb2/kT2DTYDoYekvetM LEbbG/o8HCsRzcxJNBU2LPgPSHuyM3X6VwkaTsza8osUyNNaIEKECioYyTQgXtpfOzzZ Qj1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718796948; x=1719401748; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zNRHzoAv2tzJ98f4aZ+tvGJ/9WIogU2JNMbeWGeAmys=; b=IrHWPeQQtMM1WG/P/rYbq/2VDF7HfZ8weNGTjA8y7pKlVvxANYfXzt7YCnlZM+/7S+ cBG/3I7qQ168Jujbb1NyqcMA1AE/arxNt8nK4MUtYd2yG8Ahvo4olXCD7CHawkpCbbxw GbPI5S5yIwEzfcQ2Gm4Gd4kX4pHRug3FWwIaRy5FYA+MVVHiDyJ6O3lpiBzbLt62KqZc N62kznRO5U3CrnnpqTdCxf4rTHFhMy/lXePFGkM+3nq2M7y+0iPuOVnMECJGdabDxH7B PjN23uesO1QCm/EA9/d/IEUHYmfMZAh/wSBIwD0ZcY9nwFpRKt6vQ2cxejkcRbgQ32Ac DnsA== X-Forwarded-Encrypted: i=1; AJvYcCVuPucbfa/RISCPBpZfnTHxnMiK1jdWAGNm3xN4kVb3zXgu7gm9tQ6lEJElLavNfa7mkVxG3PE0Ct5KPuQTLpk3Kpuy/GzlGhK1fxmhjBdl X-Gm-Message-State: AOJu0YykOKmg/mD4+YIpDd9uvzmvQAsneFJQW/rK/QF6S8736dKQsBLI DpIv38b93DzgauS8DOpZfpXUIiZjkWK4ACSPSU3tpMeSL3JWNQGaDYJZAtN/gBE= X-Google-Smtp-Source: AGHT+IEglhe+wLVr2vUr1MIQVumBoAo5/7EbT9pjlwDp5yKvOdUU36tJ3TRsu6Nvsx4qLFShB9NrtQ== X-Received: by 2002:a2e:8511:0:b0:2ec:daf:85d2 with SMTP id 38308e7fff4ca-2ec3cff89ebmr12681911fa.5.1718796948055; Wed, 19 Jun 2024 04:35:48 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e67b:7ea9:5658:701a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9681sm266192075e9.28.2024.06.19.04.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 04:35:46 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, Charlie Jenkins Subject: [PATCH v7 09/16] riscv: hwprobe: export Zca, Zcf, Zcd and Zcb ISA extensions Date: Wed, 19 Jun 2024 13:35:19 +0200 Message-ID: <20240619113529.676940-10-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619113529.676940-1-cleger@rivosinc.com> References: <20240619113529.676940-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_043550_223886_CC535980 X-CRM114-Status: GOOD ( 11.54 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Export Zca, Zcf, Zcd and Zcb ISA extension through hwprobe. Signed-off-by: Clément Léger Reviewed-by: Charlie Jenkins --- Documentation/arch/riscv/hwprobe.rst | 20 ++++++++++++++++++++ arch/riscv/include/uapi/asm/hwprobe.h | 4 ++++ arch/riscv/kernel/sys_hwprobe.c | 4 ++++ 3 files changed, 28 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index 2b7f1d05b2e3..4d9b4ed34c96 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -211,6 +211,26 @@ The following keys are defined: supported as defined in the RISC-V ISA manual starting from commit 58220614a5f ("Zimop is ratified/1.0"). + * :c:macro:`RISCV_HWPROBE_EXT_ZCA`: The Zca extension part of Zc* standard + extensions for code size reduction, as ratified in commit 8be3419c1c0 + ("Zcf doesn't exist on RV64 as it contains no instructions") of + riscv-code-size-reduction. + + * :c:macro:`RISCV_HWPROBE_EXT_ZCB`: The Zcb extension part of Zc* standard + extensions for code size reduction, as ratified in commit 8be3419c1c0 + ("Zcf doesn't exist on RV64 as it contains no instructions") of + riscv-code-size-reduction. + + * :c:macro:`RISCV_HWPROBE_EXT_ZCD`: The Zcd extension part of Zc* standard + extensions for code size reduction, as ratified in commit 8be3419c1c0 + ("Zcf doesn't exist on RV64 as it contains no instructions") of + riscv-code-size-reduction. + + * :c:macro:`RISCV_HWPROBE_EXT_ZCF`: The Zcf extension part of Zc* standard + extensions for code size reduction, as ratified in commit 8be3419c1c0 + ("Zcf doesn't exist on RV64 as it contains no instructions") of + riscv-code-size-reduction. + * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: A bitmask that contains performance information about the selected set of processors. diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h index 538c404938e6..c38f3f2b8382 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -66,6 +66,10 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZVE64F (1ULL << 40) #define RISCV_HWPROBE_EXT_ZVE64D (1ULL << 41) #define RISCV_HWPROBE_EXT_ZIMOP (1ULL << 42) +#define RISCV_HWPROBE_EXT_ZCA (1ULL << 43) +#define RISCV_HWPROBE_EXT_ZCB (1ULL << 44) +#define RISCV_HWPROBE_EXT_ZCD (1ULL << 45) +#define RISCV_HWPROBE_EXT_ZCF (1ULL << 46) #define RISCV_HWPROBE_KEY_CPUPERF_0 5 #define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0) #define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0) diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c index 04a2ed4ee415..89e03cdf38b7 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -113,6 +113,8 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZICOND); EXT_KEY(ZIHINTPAUSE); EXT_KEY(ZIMOP); + EXT_KEY(ZCA); + EXT_KEY(ZCB); /* * All the following extensions must depend on the kernel @@ -142,6 +144,8 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZFH); EXT_KEY(ZFHMIN); EXT_KEY(ZFA); + EXT_KEY(ZCD); + EXT_KEY(ZCF); } #undef EXT_KEY } From patchwork Wed Jun 19 11:35:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13703734 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B5CAFC27C53 for ; Wed, 19 Jun 2024 11:36:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=M70YpOAQXQL5Fbjfr3Iz78D00mAUp04b3MiNxJd9POQ=; b=AppzI/py4hspvx mKojYwRuXdAI0CCq0r6A11LQ1AeIQ2X2gn00ZBI+6qFlaG27riwKZzfedHNeXo4w6M8kigE5mS9WU LbD8TF0UP/xgHOkMWYu0jWMblXHDHKuWGOOBO6emj6FiqblLjAM9DtMcywl6uPrJQHEk4bZ4btaMR d+4IBmh9lJ2O/uZbantZ+vHnt1tp0hsuBquUq+vCapcNK0fvkCmUKwLwtu8k3xhDrLurrSLn2xTHm 1lq/5C+0W2NYKFCrcK+zqE1RKzcgvn75VqBUw57x+dFVuwRN831O1/fbODLIb5h3LjEFK3FUPFRda lrYX1xXLUnMZhgpUfsyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtc6-000000010Nc-3eCK; Wed, 19 Jun 2024 11:36:30 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbW-00000000zoH-1Mmg for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 11:35:56 +0000 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2ec17f19386so3906101fa.2 for ; Wed, 19 Jun 2024 04:35:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718796951; x=1719401751; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8DCplyIcxOlnYOD05MVWPnelaWgV0jkCglAEoSEzjaM=; b=MIITlaRkK3U97eP6bTjIorJb+KM1/BSW9f0Qb83MI1BoayrC8BJbjxwWyYU5ogU7cC TACsufFu1ErIfKpNCSHL/XcIlz7kg00syLZHagjRZ08Qs0gYqMQn4ganjBi/yjG/ZSTg Piqi1cWVPo7QwuzQeCErz6ijvgdSY54XYBiHbyvPowJr+KPhqBML7ctzhNV85N+SM0SE zzJAoXIhybYux8atEhsbXu/w+govnBX8GdwQ2KRBrLh+AGe2hxyOm0cPKnj04N4Sam/S KPLd4Ek3AyS3qsmNHIC+vqCcFIcwBcRtdJsVOtryYz8zr/cuJ4v9AXaKRgOg2z8HwUR7 snCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718796951; x=1719401751; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8DCplyIcxOlnYOD05MVWPnelaWgV0jkCglAEoSEzjaM=; b=snOTddCL9ZeDjiThOTRDMeTJw4xPTaSaA7okpvNg7yUFkXR210NwIdjedXVbh5Mz2P SuYeDYrBv8H5V1me/zlQ3CNfvgK9myW9FevU2sSbIzAdvMujQIbY+i9d0L936EVU/5HS /Oal2eaAwgq1tRQ4Ym2hHwpxBEAvHmjIzo/XocMKbCfgmfZ4AzCFsos85fd0WLja5Qgo pY3++FUWDgHZnbVUynZ6Sqq7QMhSem2o3dTh7eY94pyJOAUd83720r+8fE3w9O2tVVCC 1SO6pczpoVRyX5dPmhA+KTCnSTKJqz5noWKveNeDmSLcwwtF3HZlGkNd+5nAn5KMcvCp UWzA== X-Forwarded-Encrypted: i=1; AJvYcCXQD+E2ZaUVeeLsB3qdcK+xYEGFlWuqMycQFqPsZ1oTVu8dkc26vcjS+PEdPtCS0HX8qPYM6FywcTSuEVZkHpXDNeFDllUwPI9NrOXVLqKe X-Gm-Message-State: AOJu0YzJs4n62ne68qM6Z9Ab4fWM//aOsQjbgrgF04GxZOIQVlbwdh7K +ud+ydX3xANKmfhgGdtuIs+Lp8rH/p5YuyN/I+7qrchdSZsGTmW4tHn1NU/9LCs= X-Google-Smtp-Source: AGHT+IFl03ofxCd9GRyKvjy/WzBtKYyK50aV8FZIus6pcW5Xx8qBswD4fqlYnwmmuxyZ9pdqNk8BJA== X-Received: by 2002:a05:651c:1255:b0:2ec:31d9:16e1 with SMTP id 38308e7fff4ca-2ec3cff8f63mr10405361fa.5.1718796949125; Wed, 19 Jun 2024 04:35:49 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e67b:7ea9:5658:701a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9681sm266192075e9.28.2024.06.19.04.35.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 04:35:48 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: [PATCH v7 10/16] RISC-V: KVM: Allow Zca, Zcf, Zcd and Zcb extensions for Guest/VM Date: Wed, 19 Jun 2024 13:35:20 +0200 Message-ID: <20240619113529.676940-11-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619113529.676940-1-cleger@rivosinc.com> References: <20240619113529.676940-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_043554_704578_348EE078 X-CRM114-Status: UNSURE ( 9.71 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Extend the KVM ISA extension ONE_REG interface to allow KVM user space to detect and enable Zca, Zcf, Zcd and Zcb extensions for Guest/VM. Signed-off-by: Clément Léger Reviewed-by: Anup Patel Acked-by: Anup Patel --- arch/riscv/include/uapi/asm/kvm.h | 4 ++++ arch/riscv/kvm/vcpu_onereg.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h index db482ef0ae1e..71b17a6799e6 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -169,6 +169,10 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZACAS, KVM_RISCV_ISA_EXT_SSCOFPMF, KVM_RISCV_ISA_EXT_ZIMOP, + KVM_RISCV_ISA_EXT_ZCA, + KVM_RISCV_ISA_EXT_ZCB, + KVM_RISCV_ISA_EXT_ZCD, + KVM_RISCV_ISA_EXT_ZCF, KVM_RISCV_ISA_EXT_MAX, }; diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c index 09f0aa92a4da..f68b15b15f0e 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -49,6 +49,10 @@ static const unsigned long kvm_isa_ext_arr[] = { KVM_ISA_EXT_ARR(ZBKC), KVM_ISA_EXT_ARR(ZBKX), KVM_ISA_EXT_ARR(ZBS), + KVM_ISA_EXT_ARR(ZCA), + KVM_ISA_EXT_ARR(ZCB), + KVM_ISA_EXT_ARR(ZCD), + KVM_ISA_EXT_ARR(ZCF), KVM_ISA_EXT_ARR(ZFA), KVM_ISA_EXT_ARR(ZFH), KVM_ISA_EXT_ARR(ZFHMIN), @@ -134,6 +138,10 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) case KVM_RISCV_ISA_EXT_ZBKC: case KVM_RISCV_ISA_EXT_ZBKX: case KVM_RISCV_ISA_EXT_ZBS: + case KVM_RISCV_ISA_EXT_ZCA: + case KVM_RISCV_ISA_EXT_ZCB: + case KVM_RISCV_ISA_EXT_ZCD: + case KVM_RISCV_ISA_EXT_ZCF: case KVM_RISCV_ISA_EXT_ZFA: case KVM_RISCV_ISA_EXT_ZFH: case KVM_RISCV_ISA_EXT_ZFHMIN: From patchwork Wed Jun 19 11:35:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13703735 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AE16CC2BA15 for ; Wed, 19 Jun 2024 11:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LQ+lq6Rsj7G6AWgLqqLbpRqstRpGfJkjlcWWVlHL9Zw=; b=kn5IAJCveCjs7r SXM4aaMwct8vOobvVLFSJfQK/Gm6WbMu8NbBH4nJp6mj3ZtC2HNHz60Nm9WODwy+ZixKCnszb6yKv 8KKdfMTIiJjI/w/1DoNKmAmNSkPCWtWOTampoQ0kl2IiHdg5Shy2esJfYLYRPe+gOv/QvovPDJf/z v2Yh7POUtseqpzHETYvx7W7lEM0gMpVlXjcs+UhyQIfltlnYCVY0Iw77w9mQgcGAcTclSaKwc5eTU 1U1bFH17ivoaJxI25vv6tFbUcbrbgJZ99PpOymeVyNUV0pDHGysWPrWAQzRo5eC2D/bt8ybMDga4r oiY22xf/GxKp5qtLSTPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtc9-000000010QC-1jgT; Wed, 19 Jun 2024 11:36:33 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbW-00000000zol-26NN for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 11:35:57 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2eae70fb324so7081161fa.2 for ; Wed, 19 Jun 2024 04:35:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718796952; x=1719401752; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5oE8gsBvV5fZz1ffXpMzF77ixjq/ISJJW2NOreey68Q=; b=nCMPjYKLkm+6wMU8UuYb2iLSnQEOWRCWq0/i8N71WNPcmBR0L0nVlEGWH7k3zDDOh6 m53vOiQGxJdpBsQ5dRyk+tQCY/NCvFulV17lHt68DPljv4sMjDbkmJb4FhQ4l2iKVDsB X9imQSLcLP5axznxtvKDUhziv96Cf75KUc5gyxhWYQh4bpYZHstpJvLma/Z4spflgAAw qph6M5S67eemgaDrNkO93R50PLWwketIdFFQJe6RyMZuuPGsATOW6dfrM7pFVSRP5jwh iXtgWAKQaZ002zHfQLgTQyaLdz/IjwGEEFEG/wfP12PD695gyZzw1ja8w7cFMNvKwllP jsqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718796952; x=1719401752; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5oE8gsBvV5fZz1ffXpMzF77ixjq/ISJJW2NOreey68Q=; b=UMT2NvnbrtieerJjDjP9jtb7hXZbICD5v2Rscoodh3yGVMz7yRmIjYUa9gSN1oKpLX TgeIMnmVODSkdP2JpdaW06B/mETnQP/TW46S931gvShD3VMyHI1iWOYxg4+kvM6tOIdF IInCt+t9A2imza2JIKK2EGZhxGfCIQUfwLXB/PD6bSkJy+85IuCYWMOa91Od+8F8IjN4 TXzZLzfJESTkkDjoF6e0UJtcvHvymnLgHazRcp3rk0Gmyo0ad7/0/jlC7+S0sWE/kky3 dNENxTwGGLG55H3/VabDvFr0qmKGANDaEwAnX7RqUqMzZ2G8nDdoMmzmalaDSex797G6 ut0g== X-Forwarded-Encrypted: i=1; AJvYcCVmVoo3uym0NWC93mm+cNwvuE04QF0KkLpOkVPOlIIz3UolhRZx7hd7w+AaWPXXfOf2AUPfL99SYYYhtzRfRotYlf6NMoMBgRGr9X47fZR0 X-Gm-Message-State: AOJu0YxyWS0Sssn6Db+0Buh9VJLuS9fixWLD1yucFh9/4mc/AKt8yGUD 4al+CtJoGLqmj0m36GNxOCcOzqQC3/rdAymkTtwPizv4aR515gCmYCMe+3N9Efg= X-Google-Smtp-Source: AGHT+IHTtkzZFj1rr1J3MMHIV92yO19IIimUF3KsHK4wEqSnORETlwIu0v29uuJeQFp2SthY6SPnTQ== X-Received: by 2002:a05:6512:39c4:b0:52c:a657:7e85 with SMTP id 2adb3069b0e04-52ccaa60a8bmr1738253e87.3.1718796952270; Wed, 19 Jun 2024 04:35:52 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e67b:7ea9:5658:701a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9681sm266192075e9.28.2024.06.19.04.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 04:35:51 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: [PATCH v7 11/16] KVM: riscv: selftests: Add some Zc* extensions to get-reg-list test Date: Wed, 19 Jun 2024 13:35:21 +0200 Message-ID: <20240619113529.676940-12-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619113529.676940-1-cleger@rivosinc.com> References: <20240619113529.676940-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_043554_894549_D596F2AC X-CRM114-Status: UNSURE ( 9.35 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The KVM RISC-V allows Zca, Zcf, Zcd and Zcb extensions for Guest/VM so add these extensions to get-reg-list test. Signed-off-by: Clément Léger Reviewed-by: Anup Patel Acked-by: Anup Patel --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c index 8c8b109ce3ca..864a701ef6c3 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -56,6 +56,10 @@ bool filter_reg(__u64 reg) case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBKC: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBKX: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBS: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZCA: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZCB: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZCD: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZCF: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZFA: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZFH: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZFHMIN: @@ -423,6 +427,10 @@ static const char *isa_ext_single_id_to_str(__u64 reg_off) KVM_ISA_EXT_ARR(ZBKC), KVM_ISA_EXT_ARR(ZBKX), KVM_ISA_EXT_ARR(ZBS), + KVM_ISA_EXT_ARR(ZCA), + KVM_ISA_EXT_ARR(ZCB), + KVM_ISA_EXT_ARR(ZCD), + KVM_ISA_EXT_ARR(ZCF), KVM_ISA_EXT_ARR(ZFA), KVM_ISA_EXT_ARR(ZFH), KVM_ISA_EXT_ARR(ZFHMIN), @@ -948,6 +956,10 @@ KVM_ISA_EXT_SIMPLE_CONFIG(zbkb, ZBKB); KVM_ISA_EXT_SIMPLE_CONFIG(zbkc, ZBKC); KVM_ISA_EXT_SIMPLE_CONFIG(zbkx, ZBKX); KVM_ISA_EXT_SIMPLE_CONFIG(zbs, ZBS); +KVM_ISA_EXT_SIMPLE_CONFIG(zca, ZCA), +KVM_ISA_EXT_SIMPLE_CONFIG(zcb, ZCB), +KVM_ISA_EXT_SIMPLE_CONFIG(zcd, ZCD), +KVM_ISA_EXT_SIMPLE_CONFIG(zcf, ZCF), KVM_ISA_EXT_SIMPLE_CONFIG(zfa, ZFA); KVM_ISA_EXT_SIMPLE_CONFIG(zfh, ZFH); KVM_ISA_EXT_SIMPLE_CONFIG(zfhmin, ZFHMIN); @@ -1005,6 +1017,10 @@ struct vcpu_reg_list *vcpu_configs[] = { &config_zbkc, &config_zbkx, &config_zbs, + &config_zca, + &config_zcb, + &config_zcd, + &config_zcf, &config_zfa, &config_zfh, &config_zfhmin, From patchwork Wed Jun 19 11:35:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13703736 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E1FDC27C53 for ; Wed, 19 Jun 2024 11:36:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=X7JM66TGyq11CtFo61GlMFekuvKw27YeMeH8vdu7LKU=; b=oFM2jIbdB0WuPf IUcJipgDPmTbogBy3GOLOpVtjFAljpo6i23IJ3WbVs1caNQw+atol0HG5qZtuReDvTI/RxLgiiBNC RDHrOV95gV0Fplxnlv91s1HYkDDBJ9jpuacT6Tqx4Bv/tYIcfCXXMeiaGosHxGuCjWgC9DVWSMiy9 k3jHJgIkDk0WA/cwTtmY/QCF0WzmUej1Nzm7XEqfoFpdO1uEFM9Z6rFzqPzIUH4eYIKo1BY3wlGyj kX3UpsWXno41x/Q3nGgv/kQXEd3HU6ZcAo4Msf66RT+zRTs9QAvEH7uvLrNS2N3xKoP3FUhQtBVbZ U8Kd9a8lq+SOTkO44Wrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtcG-000000010Vw-0dLS; Wed, 19 Jun 2024 11:36:40 +0000 Received: from mail-lj1-f182.google.com ([209.85.208.182]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbY-00000000zqQ-1pH6 for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 11:36:01 +0000 Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2ec3b282fedso2252951fa.3 for ; Wed, 19 Jun 2024 04:35:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718796954; x=1719401754; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/Sy3W3sT66nFUHkOIAcy9zXa+nQEQXWEM2cv9eUy8eQ=; b=pxLSaupVjRc+GjezzqIf3vygp97JA4Uwm6lm36LKxDuQEJU54Fo2hYsYQFb7bqGYwR UlENEdo549JbFiAGVHyBYg5ucg4vpEUOurJWhEFj3fiPmRNe48oah6+ndeGQQn/oU1Eg UnfNP7CaP5wvVRIrV8XveBixx7e3jVN+NEcK9dujaQ49XOIf2pq/KGd4pd2xSd99f+Oq ElXCdTZW3mWUxRRhBKherKY1O/WSER+F5hw/BQ26Mn9qVWCSdwy3odrlrlYpiTBkh2ka Xq6AsoThXyqOTPO+CCxx8o0denXNgtWlQjwAO9PZ+BzpAA+9LaXMWxeEIsT9vmOkz0xO uU+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718796954; x=1719401754; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/Sy3W3sT66nFUHkOIAcy9zXa+nQEQXWEM2cv9eUy8eQ=; b=ZkQvtAjrgO2WuVzrEzJoJ8Oe64G4O2XFTvDdhRSBOO5VjUXjCZ2fqaXb2iIUXRo3aR RsR+9fJb0beERzvCuYlAdT77kPE+AE42ZIjJYRqWRnCwojPIsIbTgveHTeQ3ybs8U/XF WuX0zY4KHh8tTVQhbmhGOMtiiwA8nBbyGWqGYwbaD9cclKeuhLtxEsmZTuHzFXMXGJve aNfrdaxDFlfgQ2PYXb6gnR0xhZy7ViCBvn26oHZSBkn8EbzLG+wq16K9CD2PtTx9Mtkz 72//x8AYjGvOZZ1Ni2TZZDe1W09D22oQpdZaYodE+I7dRC1QsWOwU7bt/6zh8R34bo2u POww== X-Forwarded-Encrypted: i=1; AJvYcCUOyry63WayOQmU3aHT7g+eeJYL4pWgBsxaO5tKpZIIT0k0ENz5gPTt6rQ+mO6/N4vCoXKxmCIkjUbCxk+5VuwUFQL1A9eVsiwU1M7NNA+Q X-Gm-Message-State: AOJu0YzX5rFt1FhdUhtw9fh3A4NzGm6ZauAxBQ6DISYdWBfaiL6k++z7 w6UK1s/usL/UxojrLirQpiQCHZeWi5PrHun5ZfLThve0NevOyKKnLOeQkIcFmjA= X-Google-Smtp-Source: AGHT+IFRciAFte3oPxe/TYNtXAvR1m3s7pGZfdqa/xJwJUVeVl2PdQBNkhgvRY1kSbpJQmQp281hYw== X-Received: by 2002:a05:6512:b22:b0:52c:cd07:37b6 with SMTP id 2adb3069b0e04-52ccd0738b3mr880416e87.1.1718796954087; Wed, 19 Jun 2024 04:35:54 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e67b:7ea9:5658:701a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9681sm266192075e9.28.2024.06.19.04.35.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 04:35:52 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, Conor Dooley Subject: [PATCH v7 12/16] dt-bindings: riscv: add Zcmop ISA extension description Date: Wed, 19 Jun 2024 13:35:22 +0200 Message-ID: <20240619113529.676940-13-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619113529.676940-1-cleger@rivosinc.com> References: <20240619113529.676940-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_043556_750096_A5403906 X-CRM114-Status: UNSURE ( 9.38 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add description for the Zcmop (Compressed May-Be-Operations) ISA extension which was ratified in commit c732a4f39a4c ("Zcmop is ratified/1.0") of the riscv-isa-manual. Signed-off-by: Clément Léger Acked-by: Conor Dooley --- .../devicetree/bindings/riscv/extensions.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index e34d06633278..33f1a86efed8 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -252,6 +252,11 @@ properties: merged in the riscv-isa-manual by commit dbc79cf28a2 ("Initial seed of zc.adoc to src tree."). + - const: zcmop + description: + The standard Zcmop extension version 1.0, as ratified in commit + c732a4f39a4 ("Zcmop is ratified/1.0") of the riscv-isa-manual. + - const: zfa description: The standard Zfa extension for additional floating point @@ -579,6 +584,13 @@ properties: const: zca - contains: const: f + # Zcmop depends on Zca + - if: + contains: + const: zcmop + then: + contains: + const: zca allOf: # Zcf extension does not exist on rv64 From patchwork Wed Jun 19 11:35:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13703737 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C00BCC2BA15 for ; Wed, 19 Jun 2024 11:36:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NxnTq9QYbW68rXv0l+ILbdEOukZn+aFW5QMo+jtz0s4=; b=ye33L67ATZ98Dn vQp6fGRYew07S7G5g7V7m1B1jMGumJLeGvj5MoEcvUGKTk/+KXBn0mptwOWA1stPgvhmuPco/F05L KJDagote9qu2BjwGYWFyN8BWgYlMUugFIMU0m3qcd/EU83fnV0e9iT5xz7Z+gPBCDdaXyDteF/OKI k4S5ynBF1EFS5bjuuJryV7WCg246bpDFEZCHRU/Y+6QJ56NEl6P8ViazPH9JG0K6RX7fRG/WzWyoV Cpz/0y/ht63TKRxePxGrY6PdjXVABSOkebKt2M96Mkac0ibiz2LP5RTXthLI2YhCwS9XBIJ4MYWFC Xu9tynvC9lhg8XzUCFAA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtcR-000000010fr-0Wqr; Wed, 19 Jun 2024 11:36:51 +0000 Received: from mail-wr1-f41.google.com ([209.85.221.41]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtba-00000000zsx-2eBR for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 11:36:03 +0000 Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-35f0d49a9ebso404614f8f.1 for ; Wed, 19 Jun 2024 04:35:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718796956; x=1719401756; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hSqXY8NQ+r1tvQyzaHIZAo9j3jx7qiAIRPgNfgAmyNo=; b=OG8ajUhS2ASqKvvT+ps2tPNbWRba6FLwelbmVJ/rY6o0ut4b5Ruvm8at+yN2LfqT10 K4Yi614jonJCf4H8/MtsdpUoqSjF9Q41Px1PJh4pA/0xKYuJTgJ4C8R4MzuB19UhhkIU OHHjFcFgvKmMFIRefavl4V0DR2XfwuaJA48e8sNSL/ybOne8eygE8EEI0W51mYPC3Qst IJg9wXmhtlSC9OJCrE+STy8jwHwBLnGvNXsS2A9uSaEV2sOAKZwdoBzWiAbLTqetk6Wr u4gk1FW0kko9GgUht0RdQOFvXeLHv4cj7vu/8CDebljdlwo4Cj8xNAC/EKtFFsMw7GkM V3lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718796956; x=1719401756; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hSqXY8NQ+r1tvQyzaHIZAo9j3jx7qiAIRPgNfgAmyNo=; b=VNTO/3uCA6O63lUltB+GWBkHRocjaGgqKV0w433ypVcvveJ/oZvFRqGDxqPMlAHvsM jaZwrkWmTT3Ay4K953nQzMbaQDeZVFvwVgnXB56+wJ6yi2Rv4cD5p5pqvCXxOVIRisMW Liiho6WUhYggVFmNkCnaJ21tKaBsgLq9yrCHPBtT+/h6OZVZ8WJtJc6aQaF+CSCvaUH9 8H9marD7yz+ry40EfldZ4vNcsrAvwUQ/JqNpuI2ZbcwYqgFHiCQKF6eFdUyI5HxjFPOM 6Y3awGmA+YuaEGlDhH1YueXjv49FnzaS+HRybNYa5cQDSK6P6QYGs7zMRZPdoYZgJmG4 sucA== X-Forwarded-Encrypted: i=1; AJvYcCUh0Uqgm08fdo8amlU/M8hdZOu4Od/KFdZ2HSVLnCjn/XOFh3KKpvbmVRu392ZjXClGlC5RQC+eGTpD7hpHj+VzScUoC22vWNDEMJnDx/wz X-Gm-Message-State: AOJu0YxQSmipeU8jnAFql7jTaDRXO9PhanuB50Le3Aj/oTvAJuoNool/ 9CDhKM2TBLYBX1brZePVEpeCzdc7DBiuSW/EGtMywzHlb8ADQ1pUnw11iS131S0= X-Google-Smtp-Source: AGHT+IFlfP3NiyvXQKFOTNdljGuXnZt3spfJFUH69VuncHuc4xx9gjHsoS5MasjNknxMee/w3CiUxQ== X-Received: by 2002:a05:600c:4fc9:b0:421:bb51:d630 with SMTP id 5b1f17b1804b1-424752981b8mr15706485e9.2.1718796955960; Wed, 19 Jun 2024 04:35:55 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e67b:7ea9:5658:701a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9681sm266192075e9.28.2024.06.19.04.35.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 04:35:54 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, Conor Dooley , Charlie Jenkins Subject: [PATCH v7 13/16] riscv: add ISA extension parsing for Zcmop Date: Wed, 19 Jun 2024 13:35:23 +0200 Message-ID: <20240619113529.676940-14-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619113529.676940-1-cleger@rivosinc.com> References: <20240619113529.676940-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_043559_264176_B78B5A55 X-CRM114-Status: UNSURE ( 9.59 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add parsing for Zcmop ISA extension which was ratified in commit c732a4f39a4c ("Zcmop is ratified/1.0") of the riscv-isa-manual. Signed-off-by: Clément Léger Reviewed-by: Conor Dooley Reviewed-by: Charlie Jenkins --- arch/riscv/include/asm/hwcap.h | 1 + arch/riscv/kernel/cpufeature.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index b12ae3f2141c..4880324a1b29 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -91,6 +91,7 @@ #define RISCV_ISA_EXT_ZCB 82 #define RISCV_ISA_EXT_ZCD 83 #define RISCV_ISA_EXT_ZCF 84 +#define RISCV_ISA_EXT_ZCMOP 85 #define RISCV_ISA_EXT_XLINUXENVCFG 127 diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index aa631fe49b7c..ec4bff7a827c 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -354,6 +354,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA_VALIDATE(zcb, RISCV_ISA_EXT_ZCB, riscv_ext_zca_depends), __RISCV_ISA_EXT_DATA_VALIDATE(zcd, RISCV_ISA_EXT_ZCD, riscv_ext_zcd_validate), __RISCV_ISA_EXT_DATA_VALIDATE(zcf, RISCV_ISA_EXT_ZCF, riscv_ext_zcf_validate), + __RISCV_ISA_EXT_DATA_VALIDATE(zcmop, RISCV_ISA_EXT_ZCMOP, riscv_ext_zca_depends), __RISCV_ISA_EXT_DATA(zba, RISCV_ISA_EXT_ZBA), __RISCV_ISA_EXT_DATA(zbb, RISCV_ISA_EXT_ZBB), __RISCV_ISA_EXT_DATA(zbc, RISCV_ISA_EXT_ZBC), From patchwork Wed Jun 19 11:35:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13703738 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36D22C27C53 for ; Wed, 19 Jun 2024 11:37:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=N5Y8RPYR35F7gLzegEJJBkifO7fCBRPrWbHGu6Va2WI=; b=0NIgQV6pNHiiwg 5M46Ipmz16Vr340SUU+ASNxGnVWaC/HmI4f9zIeD5t0Dml5VV5i9Hc6T+ybyYhEs1xNWDbRCa6veT 9iQFPo4z3Wychp0AmwcveFZUtUE9j7AZ4+YSYrkkO+exekCbnff1FJVPZbAUdxXcmXd8qsfUu+jh6 OPojpX1m0e6DplX1m26fjBJROISEvkllkmZoUOFGh4NG/1z7GQBVyDcJe5Ui8qc/kfFu+S2TgMVYN 7DfvcUQlrma0KIxbI05qLyxsbj1FyX4+z3S5/OzxahzTntiu53zQopI1PxLYgYIgYZZ/W18miz6ZG Y9+dBZyejuM8ftRt9jxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtcW-000000010lA-1BhX; Wed, 19 Jun 2024 11:36:56 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbb-00000000ztv-05og for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 11:36:03 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-35f25530406so367520f8f.3 for ; Wed, 19 Jun 2024 04:35:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718796957; x=1719401757; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QNTR87ViStRTLjbLTFramo32AnhtfCIqG+mY5nzsVhg=; b=0ZiGEn7cDhIQpqPaRg6TqvLDWY/Vb3Ii7WtLZe3zpIa3WRufQllOCP45RnNPvKo0VP sAKUWG5KKJbvllj3r+uari5wuept5OCbeao6Yn9xdgEbySOkeyfB/Ah9suMv7JtM802u TibL1LCsHZm7ddC5/j1Ide+ujxO9CouLquYc13MWogdIyLXQKimUuaTRv90BivRqTTzj hSfwNwTO0X13/QqcKZueaIbF6XI1lecfUUYqu/zwCqMH+MjHQrIFLWhizZHu9dIfK4gg MpoAxeVdztJWnijqApytUfMLXyKvhuhM1VStnwYdVP9+BcpqeahiABnL5/OmrQ6EdiPR 0aJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718796957; x=1719401757; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QNTR87ViStRTLjbLTFramo32AnhtfCIqG+mY5nzsVhg=; b=UdjnftnrbFeuCSj3Gi/85cYxnwVHMM/6fPQJm06/4Ag7nSl2QYQixykSli+RQykJEc uuHh9itnNRoOmWrXPZw8nOTiGfexKelePkOtMEtlrKDzNXhmUd9JzzSN/tEV7c1MOsai SzVdK8wh7Fx+YnQvd3nzuVtmMIhD1lP2cmMzk5eI4vw33pKd1e9hg2a1WVNGQM8OPNeJ mKreBsW+IoPW76aAJ1jWTYlZfyWFf41Jwhft2rqWl68qXUeWTyMv1rGNbKRpiLea1xOQ u7VW1i758NxG3J2/fgqXi57MOvVU3h8N8KdAMJrGqbskEhp+8MEHZOuAzV96+mWzm3aA wj1A== X-Forwarded-Encrypted: i=1; AJvYcCUfHYfbrjxvL1CC9Oe03bliVvK+jpOy92+puq71L/cvS3yCh/jweXm1YHI2zwnaCPwiF4cjaahOqlURcOciP0vrTsfSasuS+rg7Kjzhl/+m X-Gm-Message-State: AOJu0YwZ3XDoJjeaB+NMiI7oHCTsmKNMVjps4l1+0EpqQ42Dvt4AN1gX dH0aWKKOCI+I3phJpPjJSPC4QML+Y+BXzvFyiRZANInPc/PtwXNr18fgYpGGGDw= X-Google-Smtp-Source: AGHT+IGn/LpwHNx73QtNZmX0LVZG43iWR+YwELGXaE1GpTfJ5aoWVLtbw2nzaPBzkFgiYXBhTTJV0Q== X-Received: by 2002:a05:600c:511d:b0:423:445:4aad with SMTP id 5b1f17b1804b1-42475016e88mr16022565e9.0.1718796957512; Wed, 19 Jun 2024 04:35:57 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e67b:7ea9:5658:701a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9681sm266192075e9.28.2024.06.19.04.35.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 04:35:56 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: [PATCH v7 14/16] riscv: hwprobe: export Zcmop ISA extension Date: Wed, 19 Jun 2024 13:35:24 +0200 Message-ID: <20240619113529.676940-15-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619113529.676940-1-cleger@rivosinc.com> References: <20240619113529.676940-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_043559_492622_C8EDCCEC X-CRM114-Status: GOOD ( 12.47 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Export Zcmop ISA extension through hwprobe. Signed-off-by: Clément Léger Reviewed-by: Evan Green --- Documentation/arch/riscv/hwprobe.rst | 4 ++++ arch/riscv/include/uapi/asm/hwprobe.h | 1 + arch/riscv/kernel/sys_hwprobe.c | 1 + 3 files changed, 6 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index 4d9b4ed34c96..25d783be2878 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -231,6 +231,10 @@ The following keys are defined: ("Zcf doesn't exist on RV64 as it contains no instructions") of riscv-code-size-reduction. + * :c:macro:`RISCV_HWPROBE_EXT_ZCMOP`: The Zcmop May-Be-Operations extension is + supported as defined in the RISC-V ISA manual starting from commit + c732a4f39a4 ("Zcmop is ratified/1.0"). + * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: A bitmask that contains performance information about the selected set of processors. diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h index c38f3f2b8382..920fc6a586c9 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -70,6 +70,7 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZCB (1ULL << 44) #define RISCV_HWPROBE_EXT_ZCD (1ULL << 45) #define RISCV_HWPROBE_EXT_ZCF (1ULL << 46) +#define RISCV_HWPROBE_EXT_ZCMOP (1ULL << 47) #define RISCV_HWPROBE_KEY_CPUPERF_0 5 #define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0) #define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0) diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c index 89e03cdf38b7..3d1aa13a0bb2 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -115,6 +115,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZIMOP); EXT_KEY(ZCA); EXT_KEY(ZCB); + EXT_KEY(ZCMOP); /* * All the following extensions must depend on the kernel From patchwork Wed Jun 19 11:35:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13703739 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 37B2AC27C53 for ; Wed, 19 Jun 2024 11:37:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9emaZ3zmZc5O1T8wB+JQlIFhFkHrc3CoQkikq4Sbi7I=; b=yF+v1ND1LTiGfg VJMjjKNt/zbUDnIfhk/VlGZ4FzN/tZIHb2pxBTaPFn6qnozWpx8ONbNCPxwP1BqsHKHlRiNZ9tviZ kUfWxWX2feMIOPgKf6nY7jtZuX9K3QOAGyAkYmKhH2qc9QPK1jJpz+gqZ7SaM6w2dvOoTJT0av6kt RdjMV1mYkhRDP3Eu34W2GuOfPw1iZafYC6djiyNFFj1a+hMmm0+mgXUO+fIVc0rPGl2ptxruhofRu tpVwcvarYozbwx5/PKa9XY3RgnZXOpotlq0FUPjd5NKzWLV96sGS02lxPRCKbys6aVvbzNCpdPWB8 phTtu7O+ZEbEp9YNXEOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtce-000000010sb-0VDA; Wed, 19 Jun 2024 11:37:04 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbc-00000000zus-0Otn for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 11:36:06 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3632e0f80e5so49022f8f.0 for ; Wed, 19 Jun 2024 04:35:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718796958; x=1719401758; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i8Rh9bxOXlaEjkse1t0jBu0yyoIMzROFmPw8GuSuwXc=; b=wPaDGQAe3vGp2vp3H9xFcxkTg5sllDhO4VApsdnkgARcSDTuqHzB85ZwjybvCRy0wG lwNR42EIicNoobgv42gpv2T5FIhr9twiH2Y0Ypy4xat9EJBrJMVRvzdWaz3ptDWXp/DM BIJS/jOlHKiOY3pUjd5fuh5z05hyiCU7/n14XxoOCr5oOhPExUc5A6HBH6oIafVhGOot VRZ+VI59YMA1AdirqbduV1wRFQah83647Snv/U2f0IgUlf93IuxXPbHZRzqlurSGKBda pwpFHgQmH7U53kva5qDA8TDayxpZzMqjYgbXO4KPJds9A0QvmEKsZHELdCCkSgKWDEN8 xtcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718796958; x=1719401758; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i8Rh9bxOXlaEjkse1t0jBu0yyoIMzROFmPw8GuSuwXc=; b=KuLbr5MWaB3LWVM5inZB3xmzWWMjlMWg6hDyDr5Wi7mG8bd76VvITH6QpWUoauiW45 /TBQzMrCXGRXNafSP8tmFwQf9lIwzc7TtFhHKbmG/Rm4bsPzNj3euwpfrdxKdoPlb+wl EZGzzJOQ5rcaza4gBrugEqvGjQhCdlNI1HrbSE6SDAAUpcFTMSyQltVR4yIh/T+qLpuj o6ngFJYZvJmxM7D+zmmiKP4izCjuwMGbw9+l1cXLvyQDJ6knOoujMndjexE5jrbh27V0 7zJiTToHVDIGJp2xMB8lMHqr1anx5XXj3x9+59WRuxx5t/MFUiPZUQMP3lwU2lhBQqZP TmEA== X-Forwarded-Encrypted: i=1; AJvYcCUT4FP7fz6FNoYZSMoOzFLBRHoNUrn8hfC8bgHwFrOw8EJq5M7Om6SHTleikYvdwGt1iOiWYEcnqw66XIftDpBx5wkRv8ee6CXv7VWqtiXE X-Gm-Message-State: AOJu0YzhYaEhcw4FP5DYJ+GPOyn6LH/BHSBK0oacOUjv+tqNbdHMgmwl Ll72XM3H8mUNloQadLVBXEvHE9O1xm/17vWVM3aPkTDon5nnVWWgPlHColmcXVY= X-Google-Smtp-Source: AGHT+IEdIFzdiJIRJF1/XDFYO2GbdEU/OO890HU6J5fGWsC49e+py363/GxyHm/Q6iewSJjUJ7bm3A== X-Received: by 2002:a05:600c:4fc9:b0:421:bb51:d630 with SMTP id 5b1f17b1804b1-424752981b8mr15707025e9.2.1718796958528; Wed, 19 Jun 2024 04:35:58 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e67b:7ea9:5658:701a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9681sm266192075e9.28.2024.06.19.04.35.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 04:35:58 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: [PATCH v7 15/16] RISC-V: KVM: Allow Zcmop extension for Guest/VM Date: Wed, 19 Jun 2024 13:35:25 +0200 Message-ID: <20240619113529.676940-16-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619113529.676940-1-cleger@rivosinc.com> References: <20240619113529.676940-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_043600_456271_C6E57F61 X-CRM114-Status: UNSURE ( 9.66 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Extend the KVM ISA extension ONE_REG interface to allow KVM user space to detect and enable Zcmop extension for Guest/VM. Signed-off-by: Clément Léger Reviewed-by: Anup Patel Acked-by: Anup Patel --- arch/riscv/include/uapi/asm/kvm.h | 1 + arch/riscv/kvm/vcpu_onereg.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h index 71b17a6799e6..a6215634df7c 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -173,6 +173,7 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZCB, KVM_RISCV_ISA_EXT_ZCD, KVM_RISCV_ISA_EXT_ZCF, + KVM_RISCV_ISA_EXT_ZCMOP, KVM_RISCV_ISA_EXT_MAX, }; diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c index f68b15b15f0e..fa5ee544bc69 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -53,6 +53,7 @@ static const unsigned long kvm_isa_ext_arr[] = { KVM_ISA_EXT_ARR(ZCB), KVM_ISA_EXT_ARR(ZCD), KVM_ISA_EXT_ARR(ZCF), + KVM_ISA_EXT_ARR(ZCMOP), KVM_ISA_EXT_ARR(ZFA), KVM_ISA_EXT_ARR(ZFH), KVM_ISA_EXT_ARR(ZFHMIN), @@ -142,6 +143,7 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) case KVM_RISCV_ISA_EXT_ZCB: case KVM_RISCV_ISA_EXT_ZCD: case KVM_RISCV_ISA_EXT_ZCF: + case KVM_RISCV_ISA_EXT_ZCMOP: case KVM_RISCV_ISA_EXT_ZFA: case KVM_RISCV_ISA_EXT_ZFH: case KVM_RISCV_ISA_EXT_ZFHMIN: From patchwork Wed Jun 19 11:35:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13703740 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 87705C27C53 for ; Wed, 19 Jun 2024 11:37:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HE7Qo7gqsc5flUNia8cFy3loAhJA8NhlYHtbf48aLCs=; b=PmLWIbTASo3dol /1p2pPS4XWLtuePjh8i9YdNu3WrqDpMhp7RUqyW3aoqIpjjkvA7KbNPomqq/fNNqMBH35Alvgosnr kB/FPmo2lo7D/BQ6pT/U+lBiHrnsiXbXw9K8tTvRF8hFles0rVYh5RCreFHsmxqjbPtuOi82C95zi rb8Ycr5PZTrN/W9ib6O4+OteDNrUKOnAGNVEW7jlRUW6EDXQZFcg8nr9pUyA+uHWIwMqPQEs+bJjJ 5j5oeiLcR69W+KBQrmfnHRa1l7DQDV0bRV0Vj4U0A54tgWMFVixhRrDJEnzwyT6lnqCTobkzQowWF bKHTJytcaCkb0IdOQ1pQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtcg-000000010uX-1Rgj; Wed, 19 Jun 2024 11:37:06 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJtbd-00000000zwV-1zx7 for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 11:36:09 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-52cb2fca706so432805e87.3 for ; Wed, 19 Jun 2024 04:36:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718796959; x=1719401759; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TPgjZRcqRRqmI3UFgS+Cn+Zr3OcI7PEtvkIvlPP0qT0=; b=S3p/attwO+dWnpqExafBV1bUJoJmaXjD7IWumxhRYUVf5tB8GiuI7f3lCxjLXLRHgv Uto3a+E29v2wfKPH2Yx62o4n5WMfxS8v60XqK3d8NeBHevSM4ly8DXOOucgEtL2odfcN 91gn/RictJNEgmiUkb3VzOyf5GgX3N+xGKBjs4wnzmyEoPsctlf8DNFZm9Ka3Z253RFS 3qTF6eeBVMn6bYFLcaeIVIun5oHnhx7Rg/8QgVS9oZnU0TDNkeaFub2nCSv7IpwNq0QB WvRCE4+UFkKltTEhu6p7JthtHDU+nJkktnrVfTuRFhJw6gVBbfYlhJgedIYoSDLr31Ww s3OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718796959; x=1719401759; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TPgjZRcqRRqmI3UFgS+Cn+Zr3OcI7PEtvkIvlPP0qT0=; b=RKjRbhk4OVNoF4+Cd0xK7p7rJA0ING+kTqELPDVGEln2FcP2QVKwwqqWs8sPns4lbs ginMny90Wd95WmpExRTru+S3NJwMMIOW3HeXRGNacZprWjbakvEktCsVsk32S81z1SKD MvBjf8xco5TWaJ8ZVYqV9hpjxM2n00X13YHd5yvrRpGgQA1gLPtHYaAlcpriSpOaYxBl ajFb1OH0XHbjNjLYFJSI4XZ1KXTxpdb+wQksO1LgW3mP1j/oTA9iSsPpT4/qQ8zAL03k x5KilQfdNAfk8rlxP40WgHcqXNLOyvMsQxmYRt3zrjid2JuDvx3F3x6Z9GVMm4mdNOFZ V+nw== X-Forwarded-Encrypted: i=1; AJvYcCXdNr2TJ/XxDFP+jThpVXWwXPo3RdnzrFJqkt5w8ZPsSjQJknARSnqLf5NiFXzBfyO1xKJPn04tMNmHK7n1k3+WL4/aSv5SF2sSZjV/Jjq3 X-Gm-Message-State: AOJu0YwxvNlJjtc28AyXQrydlvtALxERrevUGHNAl3xxqXsCZIbycRV5 zolX7TAi8osq9dr/ydOhh5ZM/JjDd/WakrLGY8+434rETdYqrwrj9gBrYLFpmg0= X-Google-Smtp-Source: AGHT+IEEUCVgW+BCowVYPjYKYwNlCLmKSZ/5HGn2eR9JA6+OxkNbZ4kw3whUx8mTA5ZRd8MgB6kmxQ== X-Received: by 2002:a05:6512:398f:b0:52c:a7b6:bb11 with SMTP id 2adb3069b0e04-52ccaa59e2dmr1406908e87.1.1718796959602; Wed, 19 Jun 2024 04:35:59 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e67b:7ea9:5658:701a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9681sm266192075e9.28.2024.06.19.04.35.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 04:35:59 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: [PATCH v7 16/16] KVM: riscv: selftests: Add Zcmop extension to get-reg-list test Date: Wed, 19 Jun 2024 13:35:26 +0200 Message-ID: <20240619113529.676940-17-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619113529.676940-1-cleger@rivosinc.com> References: <20240619113529.676940-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_043601_938189_05B1DF5D X-CRM114-Status: UNSURE ( 9.55 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The KVM RISC-V allows Zcmop extension for Guest/VM so add this extension to get-reg-list test. Signed-off-by: Clément Léger Reviewed-by: Anup Patel Acked-by: Anup Patel --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c index 864a701ef6c3..1a5637a6ea1e 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -60,6 +60,7 @@ bool filter_reg(__u64 reg) case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZCB: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZCD: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZCF: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZCMOP: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZFA: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZFH: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZFHMIN: @@ -431,6 +432,7 @@ static const char *isa_ext_single_id_to_str(__u64 reg_off) KVM_ISA_EXT_ARR(ZCB), KVM_ISA_EXT_ARR(ZCD), KVM_ISA_EXT_ARR(ZCF), + KVM_ISA_EXT_ARR(ZCMOP), KVM_ISA_EXT_ARR(ZFA), KVM_ISA_EXT_ARR(ZFH), KVM_ISA_EXT_ARR(ZFHMIN), @@ -960,6 +962,7 @@ KVM_ISA_EXT_SIMPLE_CONFIG(zca, ZCA), KVM_ISA_EXT_SIMPLE_CONFIG(zcb, ZCB), KVM_ISA_EXT_SIMPLE_CONFIG(zcd, ZCD), KVM_ISA_EXT_SIMPLE_CONFIG(zcf, ZCF), +KVM_ISA_EXT_SIMPLE_CONFIG(zcmop, ZCMOP); KVM_ISA_EXT_SIMPLE_CONFIG(zfa, ZFA); KVM_ISA_EXT_SIMPLE_CONFIG(zfh, ZFH); KVM_ISA_EXT_SIMPLE_CONFIG(zfhmin, ZFHMIN); @@ -1021,6 +1024,7 @@ struct vcpu_reg_list *vcpu_configs[] = { &config_zcb, &config_zcd, &config_zcf, + &config_zcmop, &config_zfa, &config_zfh, &config_zfhmin,