From patchwork Fri May 17 14:52:41 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: 13667105 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 B711DC04FFE for ; Fri, 17 May 2024 14:53:31 +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=qd3fq3wDaVhCGxKxT0ra7OVRvT1YNTPxtJczjvAGMYw=; b=EIbVAw7Si14ClJ Kkq3OeVUk/U127bEYTkWPqt0whdDWcOyeX6MRjnJ18ARjsjo8YhJy6GuOcf9UNRXBh0Zo1ObDawV/ pPBiWbUBygi0lL/5Be6mZU09z+awQRJIqZN39h4lircE6fYh5eYZln/B8Ztc1JG1DKikKrRhTpTAE UWNb36NyIrreM+mXdK/uxcGVp8Smy1Z8/2tQlmdSVu8W7J0T0Mow5kS4OuiENIlwT0kFCBBQ93ENR IwpChMuN4yipN96Iypdgw3EqB6ThZvWFrY06ddMvdRKOhBaJIynTNr7Uvt7D/loMfPSsTeHKEcPR0 dAz8cXn++NDJ5jQYWrgw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxb-000000088AA-2ymw; Fri, 17 May 2024 14:53:27 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxT-0000000881L-0yEP for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:22 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-351d30ade7fso38429f8f.2 for ; Fri, 17 May 2024 07:53:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957597; x=1716562397; 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=yNRN92k2/pTBN2tUswJ7wUiwcK9Vci4vULdEncJPQl0=; b=jgenbcIFKKKvutwSPa5FsaplzHQFf0ts6nxOsYgDxi6t+dTyIdKWLU33xWY0dfOboh XtHKtwhecCD1hGMWhNLqyhjeBViUjvlIFtNr54nQzmBWnpI+xqPNhKMx5kOzW2JrFbZ/ oEZleHN155mf2f5mC6mUrblCZYPAS+M2wmMofqj7QfPEl17opgi1N+Fv+SLKLO0x/F/A JwuyvtpLtScj7MEGloUz5XNluLDFB2PSDFS1RUeaTPgq+JIYs3uawy7DAGRXfFI8JkZ4 yNzNNsCB7VSUyK4YxnMfOQTaRsuD4tf06UGZTGqW9c3Qiz7YmL/tapgMwxeFZKvtn4DA ID8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957597; x=1716562397; 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=yNRN92k2/pTBN2tUswJ7wUiwcK9Vci4vULdEncJPQl0=; b=KZCLMs1qVtiXj5Ay6H6GqeCCfCkismeZqrNFrtdZndrJFL/9pbrgbVeecYKXopXZKi yfgR+hpicljM8Pagrxo+ycmH9RL/Ae9E9BBGukG50N6A+NdGc9lKqMZkWio4fIXhAs9w LAD9l7Bzjl7isJrgvmjVL8xlqkmMJ3Qa4cjXpHBYtUk9xSi1BSNgdTJBgUuyOxQyJi0o 8dFVEFfp6pTFmklCalTHyX7k1QXsii9XoutfheQzRpiBuBw4D6UcUGODcMyPR5StmbgQ S40S45PPbkfykTg13Uma2JI1RiPPeWjS1vPgbk6qWdBfmQ5To1vnCWrQtmDc4n6lEFPF /Qag== X-Forwarded-Encrypted: i=1; AJvYcCUWvrZCXIRDAxLvmHMfc6q9SDgXyzX0FcQDKT+j8G/PJzyvGiEcMkkcmpXK1QAcjno5vcoLD6KbDeCXWhasAUsaK6dGtaygDmPvQ1POSg4K X-Gm-Message-State: AOJu0Yz37ytg+adDH5Hfg0B46Gfl47fwu0SyCqYaWGC4jNZFiXREJIAS qwtD736k4ivmN4+2CObbddcUfoeoi49jRuWH72u7agKyv5UT6JzouhNbWRMjt4w= X-Google-Smtp-Source: AGHT+IHqFS5sQ6sZj4AQW5YtazfdwelSPtkcTWIW/0+cY1OBJlWJ4R/7hmqt03NZ//lb5/ssRTA5fQ== X-Received: by 2002:a05:600c:19c8:b0:419:f241:6336 with SMTP id 5b1f17b1804b1-41fea928decmr160060745e9.1.1715957597105; Fri, 17 May 2024 07:53:17 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:16 -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 v5 01/16] dt-bindings: riscv: add Zimop ISA extension description Date: Fri, 17 May 2024 16:52:41 +0200 Message-ID: <20240517145302.971019-2-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_075319_335151_A3C587F7 X-CRM114-Status: UNSURE ( 8.72 ) 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 --- 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 99d2a9e8c52d..b9100addeb90 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 Fri May 17 14:52:42 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: 13667106 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 304FDC25B79 for ; Fri, 17 May 2024 14:53: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=4WVSgQamvP5fO7tUNtHy0M6A5RkygjYKOWvpo8WT5Ow=; b=erlhDZIGN17bv1 YInF8WVKKe0xIGxc/WfrR+Nbdds55XdgaQLkn4cdFkAvqUvYGqQ9Vt0U+38vEeT6zhjsq0pL3nr5X ybexbvQLoY23LISYuldkJE7SyMmX3CRNPzUgxcHjoSlNo9BMEQkkybBWEJqH2txz9thcJxL8xIU1e ANC4OH3NsIr77LaxswmkDR1mlAtdeZMfZHgGyuUeLp25pZQSXVDQRzfdsraMXL1uJKvGi0KAQgmbf NtmDqHanyiz5rEJLSQHKEYMOfYC58EuyRRH5dgpXIXd3k/Dj7MPlPfz10SLqGlZMjts2pMRbm1sdM yQ5PkXiQMkM+mSM6a1NA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxg-000000088DL-2vw0; Fri, 17 May 2024 14:53:32 +0000 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxU-0000000881N-3xLs for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:22 +0000 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2e56372d5e2so390741fa.2 for ; Fri, 17 May 2024 07:53:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957598; x=1716562398; 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=BYWkj0uQleaCMPiVc0IX1xdL2m6WhFkCEPxGzctu0Mc=; b=0kyLSdk/ECDoM4/Z4UxST5vlzDxY3/3efj5Nrzfb/P23tEITZ2EkdHt1Ilq2pVAjWC bw9QqOlXvzaJFLLTEUz6k2C16ziidpiG8vjSAIomc7GVUGBt/2ntAi11m24TPNhxwLXa svvkeafHwWX1rzlwFRUZlNrNNXcBFyC8mC8HqMKRxptU0LCrXzHp3mCKHb0PU92Pjx6D VGHeArscFQhI80/DUK3ptKQTBSMOv9Ax7Vrt+gGui4bkRB54Lckjg2MOh9zVesa+FdG6 T03MRUMb5AXV8Var5Wdok7Ko7Aldya5l1YRKYlfDXjPMAPIF/DHyZZ7r3JV5Tv46SVKJ CQPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957598; x=1716562398; 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=BYWkj0uQleaCMPiVc0IX1xdL2m6WhFkCEPxGzctu0Mc=; b=mUiNRS3RstcBJlmQ5Pt4M8s/E5M6a0vLw3qmzSxHgCbMAavRL7eV7XxLPLLnnr7yoG lEzcaXdW/Y9zu8T6wueAsY8PZCXbR1XfIhk+T4M3csysdp4lQkRkE0TUxIl95UsJKl9j aB5VAD+THM2phT7D3Gze5fnfYY3dZucYP5ze8KPISBhxuS/UpB5D84lhI78JYzMglno7 AcHfHZtkFRwN5vU163UgCS20by3gxM1AcVqvYdsC3KP3pk33d7zf0uFafaOScXFIlbXO Jz5FRJIAeME6RpqjA/DDG4tbc/AbEeg6Jsr9hGvIgDt7nWJ+8idVfNkL/1dgZKyaSRdX pVnQ== X-Forwarded-Encrypted: i=1; AJvYcCXiEg63n6UqTzYod8Wc9ihoJ1C+FLff/g1TZ2aQOQNAVzqQ1jZCT0W0s0pNpjXq3yQgiG7/87hGdqDpC3fugFswWyJbkKEqi2CxEWj7lycw X-Gm-Message-State: AOJu0YzgaER0yk721nIe34rncO2lp3YNZU5+OHuodW/Oen1qThF5gXAu 1KfX4xOa2NPu3e2JfOtECHmLYf6njSuR0mhtXzZpS8UxwJka0P6TSsNMJGo5L5M= X-Google-Smtp-Source: AGHT+IFFIQ8bCYBTkej73vjqEl/30GkvcNdlZ/nAYriy2LKRNANi0QgdpIuaZdQ1x21X/bcvyrz8/Q== X-Received: by 2002:a2e:9094:0:b0:2df:4bad:cb7f with SMTP id 38308e7fff4ca-2e51fd4b333mr138901491fa.2.1715957598226; Fri, 17 May 2024 07:53:18 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:17 -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 v5 02/16] riscv: add ISA extension parsing for Zimop Date: Fri, 17 May 2024 16:52:42 +0200 Message-ID: <20240517145302.971019-3-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_075321_168943_FFFAFF92 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 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 1f2d2599c655..b1896dade74c 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -80,6 +80,7 @@ #define RISCV_ISA_EXT_ZFA 71 #define RISCV_ISA_EXT_ZTSO 72 #define RISCV_ISA_EXT_ZACAS 73 +#define RISCV_ISA_EXT_ZIMOP 74 #define RISCV_ISA_EXT_XLINUXENVCFG 127 diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 2993318b8ea2..41f8ae22e7a0 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -241,6 +241,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 Fri May 17 14:52:43 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: 13667108 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 AF585C25B79 for ; Fri, 17 May 2024 14:53:42 +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=AaR1YZwFFBCJ31s9x8l0QjOTdWlXNXoqJyE1cqtCfuA=; b=2kvRDG1pyJveJ/ t2tjcyKgG+Wp59lZM58krqVJZPL5PbrgWN8w/udqOt6+UfLk389radZiOY0PfaYMpEcJSrx2o/Uib 4p0+AHdueMQXzeKftyxSb44kwJLn3dAyGyqhtE3+ClPFuSYlxfVvm0HcMu1LE1oMN3K9B1esSx6IX p0bezpjesjhSzbr48eWO86BRF/LXOFamCzgr83LfJtNn6KVd37tM0E0aT9UzeSGwFh2qWUF7nJl3N 2hdZnHNBB0+uPxKFCHuDDf/0BMZhWzF/NayFnttYmcux10rtw1aiHxGitmJJPj6x7ip6eHs+Vh0EY 2KribRV0ddgiSd/Ajr3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxm-000000088LQ-2Rb9; Fri, 17 May 2024 14:53:38 +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 1s7yxW-0000000882S-0Hn1 for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:24 +0000 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-34cba0d9a3eso26911f8f.1 for ; Fri, 17 May 2024 07:53:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957599; x=1716562399; 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=mlgURxZu8fG6RfbwOGV4+VYUtdkFAEEBFMEpVJI3jww=; b=QibH2Kd7zf2eqLkAeQ+ZbDuTkfSwM4/kjcF/wZT6Frlu2ma+6M/ECrMsEZeBJIl7PF +3hueFJIqc8ysw6gCLpW64hqjUjj7rWIxldYGrqi00dGApNqnW17AhsyTt33gi5lh61h 1TQp/7eK4kngMMHI2oZk5lK+5MB8DUhw7XjXiLmjGzFLTU3DJCORJzzc9iLOZIEYYD2y S7QiTI2uRqncl9NI1O7ZGD1MnN++Qz/ostpQuMb11yaW3d24ku8FkvtyuARGk5IXb0i8 8rbrOzgTMSLXaqWAsiPHkJAhgdVfy14f8e09G58eiSLyHB0stVd+G/DO5lORaaeaxD/K Hgyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957599; x=1716562399; 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=mlgURxZu8fG6RfbwOGV4+VYUtdkFAEEBFMEpVJI3jww=; b=K1epibxv3VP6MfF6JzfChaZdYSYJEgibPhA0bNf3KnJs16/CHcR53G4vKTguiWGXRn OMdu8aQT6dkkBlpaR+f5HgYliu77qtbpTDKt7eRr5sLcoWUq0dFNK3+oDSdqrhJZ675t kCMj2l+jOZbFGNqGhWgjwZ+WqGYNpc3iWHYciZIVrcZ4pruigg4l/vjg52GhH6kbdAul MerPH8EMwaJvZWmp7RR2DJrQaOx7YizCRXV2rt7JdWupCX3qb1h8HKbmbmzn8NJSqZI+ KHcJYcKP9C21spVYdfDNLBhK1STCkrShMtW6s71LD29Bk1xQq4u3ZxJV74bPy6Qq5oNx uiwQ== X-Forwarded-Encrypted: i=1; AJvYcCXyxFVaDI7u30xFhg93X76IX97QhD1wi2Om7nznqDigFKi19CFim4qYSsmvMXjA2SMMH0cJ+xH/psY19k5rTUYnmN8ZzrNgn/tEWrg4c2cW X-Gm-Message-State: AOJu0YwG5GDbNo5gnn8Mp+uWz5E/Nt2sB3scu10aTGF2DK/v7FUMbDCP z+9nBxFWsOrALcEJvw2wecYnWfiDP3beUYyhJ1jjytc6Vya4jl9B5QHJouT6v9o= X-Google-Smtp-Source: AGHT+IF+cFq0XlN1HQdJuEHOqwM1sBxbfnwqtGyG9WotzHLFqO6Kw2Bla6mFarFdrIDutFqb9Mbfrg== X-Received: by 2002:a05:600c:3b86:b0:41a:c04a:8021 with SMTP id 5b1f17b1804b1-41fea52ed5bmr160325795e9.0.1715957599520; Fri, 17 May 2024 07:53:19 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:19 -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 v5 03/16] riscv: hwprobe: export Zimop ISA extension Date: Fri, 17 May 2024 16:52:43 +0200 Message-ID: <20240517145302.971019-4-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_075322_138420_F91F3AF2 X-CRM114-Status: GOOD ( 10.19 ) 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 204cd4433af5..48be38e0b788 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -192,6 +192,10 @@ The following keys are defined: supported as defined in the RISC-V ISA manual starting from commit d8ab5c78c207 ("Zihintpause is ratified"). + * :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 31c570cbd1c5..3b16a12204b1 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -60,6 +60,7 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZACAS (1ULL << 34) #define RISCV_HWPROBE_EXT_ZICOND (1ULL << 35) #define RISCV_HWPROBE_EXT_ZIHINTPAUSE (1ULL << 36) +#define RISCV_HWPROBE_EXT_ZIMOP (1ULL << 37) #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 969ef3d59dbe..fc6f4238f0b3 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); if (has_vector()) { EXT_KEY(ZVBB); From patchwork Fri May 17 14:52:44 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: 13667107 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 BDFF0C04FFE for ; Fri, 17 May 2024 14:53:40 +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=19QxdT4HlieBfCKkX+KwtuO9BhCphvKnky0Knu5A8ww=; b=4RqzeubF/s2SbH LxDXhEa+OByVioRytqA1iu/QkooZtR5/3KyLbAeVANCSrMRdWUa/A23r3umF/t6wy169CYjCR58nN ve2bEm3jj/L73+SUhkvk2XqHJpEhsiF0gtzYS44g/qlsZ82zY3x9k087H5I3nWfU2A4eAi1gkWHhH ocvmJsonkwsH4I98UfEKo8Xj397+VUirI5zSyvL3WVVVlpD43GeP2F0mYEUVFJK7F7R5lkq9iXBJt qoB0eKEdTNlXhRqqlmxvIzbVKwC09FlG/tCUrvknXe5gveV+MCaFntO3qJPgwsAI6RdpqzoAZb8EF feJ0tJwWVACHT+bRvQ4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxi-000000088FW-3Tp2; Fri, 17 May 2024 14:53:34 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxW-0000000883M-0ES0 for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:23 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4200e4b7bcbso327865e9.1 for ; Fri, 17 May 2024 07:53:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957601; x=1716562401; 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=p3qT2c8/AbHM1mLG3KaUUQ1VJHCZOCgVEzdfPOCGq3I=; b=NG9ze1ZGCbHKd+UEpzF4Wdr1gz35Y3Q+nVbTRlwdujGnv5fHbbDpv9ulSCguosF2nO pIctpw+LBC9MzMAz+6mBlpCpAYSni4GXDfQp1+wDyUkUb8Z1oXhxBUQKkMnqqLl6LWfP xFMHqRzWuEWn6Fv4w2TQ/9VIvJyQUIUhaDs4l1lQWJY3espTvENpSwLT4yapyrBoLmgY CMclOtDOSaU4uTPUSq0gkH2GkZ4sv6iMjxYyTOfeH3F3UeQUKWk0u6+M2H9NX66n5pw6 E/8uIJpESztOVb4BKv50wCZfbhbphG3cbWyg4JZvN0PcPeIVfTwF34W3J+aiuSILr1J6 yFfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957601; x=1716562401; 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=p3qT2c8/AbHM1mLG3KaUUQ1VJHCZOCgVEzdfPOCGq3I=; b=Xz5o+rE7pcsU0iYV5Nt8upbobjaE2G9rDsUAg6uU4QtQpkeYvNfEOQqMP3tzLkXS9c /WmjHPCO+tbyJCJmOT8y6N5k6zNUDrJVyAcVUnKmcXzTnOmE/CXoP5tQuExSiGYWihPR HOALBslvl3b49rrmYX51yPZWDxs3qAhnm5n+Sr4YXGxMEwvTMKcG2sMbc0jM5FZV34x+ MxQQweA/Zf4ummjvye1Owi7dr5JvySQd56zagAJLPul9RSMm+Fw8tls8wwzN5090C07p qHSO/te1j/At6+EOvObbQDZjxB69dVGlpocDaAUW5paCBshe4R0/mvmgog95zlFKiRs/ BhzQ== X-Forwarded-Encrypted: i=1; AJvYcCUL0+ffU1Yl6w6oxgqqIDie4yMNKLD5v7IUcSMr0SkQL6En1Hh3SkzA3y8Jct5SfHrTqhLHs1YIDIZigZWSMwLhGEDPaATbfBk4+C2e6Kea X-Gm-Message-State: AOJu0YzXFfUkWJF4YCkfHbJItp/veYdDY0JXcaH94UbivE/P2RlTATGx UeAd0oKCRsfX207QpYz4hPaeFaPQu4KmUQSDB8+IPn7kDd6jCppInnG4mRR5AcA= X-Google-Smtp-Source: AGHT+IGmFz2dCCSoIGSZgcVXd3L2iIvNLJ1n+dSnLeRekQmogP6yVON/V7TWTOPfu9vhDYg4e13TwQ== X-Received: by 2002:a05:600c:5116:b0:418:ef65:4b11 with SMTP id 5b1f17b1804b1-41feac59e8amr185538735e9.2.1715957600825; Fri, 17 May 2024 07:53:20 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:20 -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 v5 04/16] RISC-V: KVM: Allow Zimop extension for Guest/VM Date: Fri, 17 May 2024 16:52:44 +0200 Message-ID: <20240517145302.971019-5-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_075322_131187_0C44CDE7 X-CRM114-Status: UNSURE ( 8.99 ) 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 b1c503c2959c..35a12aa1953e 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -167,6 +167,7 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZFA, KVM_RISCV_ISA_EXT_ZTSO, KVM_RISCV_ISA_EXT_ZACAS, + 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 f4a6124d25c9..c6ee763422f2 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -60,6 +60,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), @@ -137,6 +138,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 Fri May 17 14:52:45 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: 13667109 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 1FC30C04FFE for ; Fri, 17 May 2024 14:53:47 +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=y7n7Oq7PW4rG3o9D7C21nZwqMjgNR6cQXHsQJ0628Yg=; b=myFVoFgavmSlDF KnrZSD+bIJRauNEoq2vLJDe3wuMoslshEIq/FdginzITTVF1x9YdPVd0isG0Rt86lmmexU81pWXil jZbn3mVbN2WkRmWy38icmIJrGVrVR2VPWCw0z2N/V7W1sgwb8Sn9bOYLEqXzxuvqZcBqiVvaNh0bI amEBnDguOLW7pEsg8g3q61E0JATsF3QG5/mobCVYgd8+eCjIt7KMB821ALzWlkhPD0HVgOANEwwBi ZqvCVSDZ/PkjYIC8/Bfvt3aEjuzWeCX0r1oxR/AbBzyWCtk0sa7zc19zUsjMRJZ2Z4xKKovDMtHdG HOEWoORpciuHjqiKfOJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxq-000000088Oh-3hO8; Fri, 17 May 2024 14:53:42 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxY-0000000884W-0dEH for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:27 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42011507a51so342205e9.0 for ; Fri, 17 May 2024 07:53:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957602; x=1716562402; 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=qrSVtGZRwZdqSUCPKBtbbPV0rvcWw4KEF79SGVRT1V0=; b=v94hy+og79RmBdUT2EAhIIs65HWxcDeKhIyEjKT3r5UaT/vUsatINmMwwqDSoNOf1v fazvzHrge6JjuVqahYcdF7r0Qs0IfBbhg6WbSrrfFbabFS8q8NyakrHgkw1OMFGxre7h p0fWAoSMrmfXCtlcPwlL8XRJhK5gwBayB/BxKtKNMdtS7dtjP/tgVEQK87pZGao7zpd4 5z/dpipMd4KhZleAwhjgct0VNjG1eWvH/RvlQyV6WerxNG9T72nxpV83+Bp0nYnxJj8W r0DSWeYt+uniWC/D+Ke0NjKh7eq5U8/pCA1N8NYg8mN5l8DKzkcborpuaRhGc034i/HS sZlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957602; x=1716562402; 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=qrSVtGZRwZdqSUCPKBtbbPV0rvcWw4KEF79SGVRT1V0=; b=myC6CJnxiuNwzcj5oHaA03+NWYCmj56etLPK/K1V9BJ+YG7M5VAf0h5BFTcrQg/Pbz 9IrJTZUVFbJ3X+IO1Ne1Ps6R2IN9BcSC9JNFzCqsytImCBVDVuLGIbxlf+IQoRlrfK7+ 8W5tHIqhXE0XNT0SAVN6r3ws1JSiOrNdwi3NxZb2yTGvVId7ZTAZMFt8/RjpjHRYJ7G7 R5v5sAfWQAJi/FfXJmM8vZmcXV8RgKt5ERcZQTmzpWf033W+Epe8PBPS/0BKti1VIv6G Ys2o4akPTpffEbBFE6OYj+z62Dll0erDiufvQCw53vihQJg7ucwPgYdzmMQkvMD5uPJD 6WrQ== X-Forwarded-Encrypted: i=1; AJvYcCVtkx2P0/hClim0RyQMjbdXY35aeBr+QEAbU1S9O1HOONBaerIsfmisCkHX5GWlBUCSfRZTzCsBT5Wu+ogG7VWLX8r6/Vnb5Ahz3qz0CaJH X-Gm-Message-State: AOJu0Yx1v9QWmRS9wsvHBEIluZs8Y9G3EXhq+B8l+mpCSh0FHxTeXcto xizDGqjzf3phxykwheYHbalBP16x1dGf+tmDJuXO5b4Sat3fx+HPPfhYdFSYhTQ= X-Google-Smtp-Source: AGHT+IGsuE5xt92dGgSdWc5RJ3a8C2oD54vDPB0hNfYCMvTglFHEtoobZF7XlkesElGq2tbCGZs/Lg== X-Received: by 2002:a05:600c:1d0a:b0:418:1303:c3d1 with SMTP id 5b1f17b1804b1-41fead6ae1bmr185460015e9.3.1715957602088; Fri, 17 May 2024 07:53:22 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:21 -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 v5 05/16] KVM: riscv: selftests: Add Zimop extension to get-reg-list test Date: Fri, 17 May 2024 16:52:45 +0200 Message-ID: <20240517145302.971019-6-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_075324_349388_88A14772 X-CRM114-Status: UNSURE ( 9.16 ) 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 b882b7b9b785..40107bb61975 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -67,6 +67,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: @@ -432,6 +433,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), @@ -955,6 +957,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); @@ -1010,6 +1013,7 @@ struct vcpu_reg_list *vcpu_configs[] = { &config_zihintntl, &config_zihintpause, &config_zihpm, + &config_zimop, &config_zknd, &config_zkne, &config_zknh, From patchwork Fri May 17 14:52:46 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: 13667110 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 A0105C25B79 for ; Fri, 17 May 2024 14:53:55 +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=chpP0TQ6Fjht7zpmpTaAEjtFgZHiI043pirJct1dm64=; b=EUC887CzpXLDUp tnHtwZIcqytA1mfsuA9mBj3Hwtqmqd89KczBB/eb2+1d8fMcf1huiLDuLkYHFczt3qXLmH6SjEut8 l5kavdta8Ltj1AcwjnGNSnZPM6xqJX22DSoInX6bMXvnqtgcZmFGfCp8oeHrBf4BmdrXOPGQa9BDs Wv92Qx8Oq5qjKoZS4hxJhDQddCBTPiLKMFc02xaxhJy1HUrWIzSuXu8ivYxtDRZAqTyIVOzZl0Hsy ovoCbIvpQksmhPEhHtc3REcQIYw7uQOSN8IzPBaJhmdDeRkIVMt8d4Ht206VweyzzJwyF+hfibcGZ hHSGlnlnOWugrFFycPfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxx-000000088UC-0CHV; Fri, 17 May 2024 14:53:49 +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 1s7yxZ-00000008867-20r2 for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:29 +0000 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-34cb2bf85easo22356f8f.3 for ; Fri, 17 May 2024 07:53:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957603; x=1716562403; 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=bxwJ7AJVWOOJH5g1C7ONAzDxOLE31aJ/GSXI4iM+BBI=; b=Hr7s2OBA5vLyhUlPt8YY8kVJZ+s0TKn3ReU05tnW7DCCrkzgxJCoXBcbYzrNK/4gbZ sPZifeYKAxUmYz9OovV9N6MzJuvtzgWqpeDkMUUdlxAfjNf8AxnyPx7mnwEBtFpmoCQ+ 5xVdjTFSolzzVjm0loJr/UGA7vFWzAMnbqGw8bACdpxdZZxIE0spWvEpe/zYi7bq1Waz q5j98qHVMaO5UzCkD4XbmUAo/cO+SZ4mQECgHFJrIz8bSYaySgyc6sfPQCndKltqBqAO 6M3neSf5aK9LWSuKJyd4Wla7lVv4422xBHBVk3yhSJseHJ+xom4C6fc/wTeJZatxptUo 2TZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957603; x=1716562403; 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=bxwJ7AJVWOOJH5g1C7ONAzDxOLE31aJ/GSXI4iM+BBI=; b=Mw+KCfoVCGfFo93svku3yvbD/hzGba7yZdCQExUuAxJbeSMspdWJWPmb1Pn+liERQM +FqgXaupo+ecFtCAm8nXh1e9sCVoOgAEwu5yvjUq/elIWv34VJADR6cuoXrYGmiYI8Tl aCV99SeJGYGpnxh0jOEUx2Ri5IFlbAtiypC9oZrojpJznLeMbdUiV3oTmwgUzUQ2rJH3 hejTNSuE0OkYlZOG4jKLSUbQTj15yAEXcEh0IIbRia1ZjJpN9e0E9YWuS3gWPyKMPQTP X2mSLvkTuZRmNN4Xrp0YzS2nDb8D3Fe2UpIYYUZHKY1QjTIjrvl0Q3WWLBIgfv7J+1KZ MuHQ== X-Forwarded-Encrypted: i=1; AJvYcCVFA74Kxudx2ykadx8AYEU1sK0Xw53/jco6fi0LueYE4LiIwaiJGqZ6KDFAauhDiD+i3wb2GVhJ25K/gqQ1KhLCcJel4N3f1c3g4rwFDlVO X-Gm-Message-State: AOJu0YxIEs1b30JvNSCnF4IhS/w9ZPf4h075JqCc8J4CUXSA2cTZfeq3 lJ0hSQ+kwSQ0VJQyH43XQkbyaUKOSYwRdXzCak4Fc19tSW8rHaICKu55L1Ekdqs= X-Google-Smtp-Source: AGHT+IGYOWCyC3A9pZiSse41lg4ejcf2nxXc2Br4ue+JRbxFNqo/gdNFsWJwlvjbngH00Jlcy96tzw== X-Received: by 2002:a05:600c:511c:b0:420:29dd:84e2 with SMTP id 5b1f17b1804b1-42029dd87camr37914505e9.2.1715957603384; Fri, 17 May 2024 07:53:23 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:22 -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 v5 06/16] dt-bindings: riscv: add Zca, Zcf, Zcd and Zcb ISA extension description Date: Fri, 17 May 2024 16:52:46 +0200 Message-ID: <20240517145302.971019-7-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_075325_977885_4C9C55BF X-CRM114-Status: GOOD ( 10.30 ) 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 b9100addeb90..39084c58d4e4 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 @@ -499,5 +531,51 @@ properties: The T-HEAD specific 0.7.1 vector implementation as written in https://github.com/T-head-Semi/thead-extension-spec/blob/95358cb2cca9489361c61d335e03d3134b14133f/xtheadvector.adoc. + 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 Fri May 17 14:52:47 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: 13667111 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 ACA22C04FFE for ; Fri, 17 May 2024 14:53:57 +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=pFp0H+ekeN9v/HVEOl3kFL82bt+3XoIe9lW8QAigLnM=; b=Tw9Gvt2KThaGn+ RmE12QQKJLaVgMfCMFA7/MjoafrXPBBzfO9kR4t6Ij8hv4zIFUpDmvpNjfN0rxMmiENDrGoVtLqJj XbBwavtyM3egjMvNk+EPN5g5ju2I6UlAECtInHe6awE1fqLlnjfetSoQhYACn3v+8yF6pz8bX9ci1 pndk4yXgjuyuC91OKCBpGWOvrrq0+VuSVygL7/zsC/c6V90sb9JeS6vAt2rJT9ICCrKkYwuNcp7Ms VgLNnrL94sMX2Q17hhysHAnLKt5hU0Y9HIQrafYVtfnDXh7nyjtK7tBzMgl/Uzxs7ZZtgIIAq0kWx ygAVxIvsttP7IOpay0Zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxz-000000088Wb-3bS5; Fri, 17 May 2024 14:53:51 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxa-0000000887M-0Zgn for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:30 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-420139ea1c4so351775e9.0 for ; Fri, 17 May 2024 07:53:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957604; x=1716562404; 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=NruMqRl+Q4rEB/nYdAHi0xTYPVFbXKC8s/hKlXiCKEs=; b=hY4ZJs+lysi7Z7xNMuuxSYTLVxkxRmK7xJAyVAOH7wEX7hi6C1Iq9QZSznZ+FENT+P eI+RabEYj3T5yE2sjk6eqHwfTBnxx03mcp/hTyaDzlMvaJXxRegXrnlYDi603PwoSxVR npn/dQFpigEuRFc9AEy/sZZeOsxGizM2p18kFMh4x39NbZYskAXcz5PiytZIl+o9LvZR y3BeUbsvDCGhrjOhCdQLJJEuhXY5Yq98xSXXiMO45F/PaFKZkZPIN96gx8C5VzVwhtrn HlITB9ueK6Wuqoc8xF6CauHcMsaayFXi1NOL8svnDayvKRmADeVv2dQhJI7XQ4G51pUs squA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957604; x=1716562404; 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=NruMqRl+Q4rEB/nYdAHi0xTYPVFbXKC8s/hKlXiCKEs=; b=JZox1tirjrSXzAmNUTnpb9SUK/G4KbEMPk67SeWAGiD1flJAvuI16tEiLn7ZbzVp2Z IwXj7/wz7SfIqgkzM5ZblSn/vOThIhEYAE9SXohdF5HHQM0VVdosh5zIvo1/KzNqbqsv WN8w7je7GPqwS/71wDiLaCPxeceMfqtiVDJMl5XNV26CsoTQr+tVbmdp89x2SGME/E+E M0jHhRqh0IlSdEe2GmjxLldWlSf5jF0XOAS+ONRWbZW4T0W5HXFBpXYauW48SRwaR9JZ 7pajPr/Klnub1oYtkL1stsAt4BioCIZS9hlAigiarRUWQH/gjbPj/QJeFP9SOZotzqIB xo+A== X-Forwarded-Encrypted: i=1; AJvYcCXBAacr22fHbP73aBHAbRx+QFWXGNLWLj7tALrSxhRaGoE9pG2Msliz38Bk5Wp9T2lk9WzyZcovb/H8b4sI4jBQALcFMwZauG1kU33Pk9yb X-Gm-Message-State: AOJu0Yy5OylXJqlr8eQmmrbxDRIltMfOwfDkATBR1eXzp/J+7I0uDQ5Q DKcZepqcOjYosspq/mwhemD4nFpxiK8w249NMzGswfemUHP4GR5TAMeiIjhxx1c= X-Google-Smtp-Source: AGHT+IGsRYLJfvkB/cEvNoQuKq7EA8YLtAY48Ayq9s2PlXtghO2NsJFvpTMxRvdVfBcG2bOWgCnypw== X-Received: by 2002:a05:600c:19c8:b0:419:f68e:118c with SMTP id 5b1f17b1804b1-41feaa2f41fmr162204825e9.1.1715957604608; Fri, 17 May 2024 07:53:24 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:24 -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 v5 07/16] riscv: add ISA extensions validation callback Date: Fri, 17 May 2024 16:52:47 +0200 Message-ID: <20240517145302.971019-8-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_075326_411371_6A3B7CD6 X-CRM114-Status: GOOD ( 28.61 ) 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 | 23 ++-- arch/riscv/kernel/cpufeature.c | 198 +++++++++++++++++----------- 2 files changed, 135 insertions(+), 86 deletions(-) diff --git a/arch/riscv/include/asm/cpufeature.h b/arch/riscv/include/asm/cpufeature.h index 88723ac2d26e..1a148cd67e0e 100644 --- a/arch/riscv/include/asm/cpufeature.h +++ b/arch/riscv/include/asm/cpufeature.h @@ -35,23 +35,27 @@ extern u32 riscv_vlenb_of; void riscv_user_isa_enable(void); -#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) #if defined(CONFIG_RISCV_MISALIGNED) bool check_unaligned_access_emulated_all_cpus(void); @@ -90,6 +94,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 41f8ae22e7a0..fa4ad73b770a 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -75,32 +75,32 @@ 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; } static const unsigned int riscv_zk_bundled_exts[] = { @@ -232,8 +232,10 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(c, RISCV_ISA_EXT_c), __RISCV_ISA_EXT_DATA(v, RISCV_ISA_EXT_v), __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), @@ -294,33 +296,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 @@ -333,7 +395,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 'x': @@ -386,7 +448,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; @@ -466,17 +527,8 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc if (unlikely(ext_err)) continue; - if (!ext_long) { - int nr = tolower(*ext) - 'a'; - if (riscv_isa_extension_check(nr)) { - *this_hwcap |= isa2hwcap[nr]; - set_bit(nr, isainfo->isa); - } - } else { - for (int i = 0; i < riscv_isa_ext_count; i++) - match_isa_ext(&riscv_isa_ext[i], ext, ext_end, isainfo); - } + match_isa_ext(ext, ext_end, bitmap); } } @@ -498,6 +550,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); @@ -520,7 +573,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 @@ -528,10 +581,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); } /* @@ -545,9 +598,11 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap) if (acpi_disabled && riscv_cached_mvendorid(cpu) == THEAD_VENDOR_ID && riscv_cached_marchid(cpu) == 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 @@ -629,6 +684,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) { @@ -648,23 +704,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[i])) - 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_fill_cpu_vendor_ext(cpu_node, cpu); + riscv_resolve_isa(source_isa, isainfo->isa, &this_hwcap, isa2hwcap); of_node_put(cpu_node); From patchwork Fri May 17 14:52:48 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: 13667116 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 A334CC04FFE for ; Fri, 17 May 2024 14:54:35 +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=YyjbLF/YgwCJTe2tIkNdi+Lmg14y5thx7FIPWhsjru4=; b=A58GIclqBJizBV f/Puzb7mlpxm/dvbC6hUXhT/XK3+zg1SmRoO0O9gtb9UGD5MohQD9iID55QLa1ysjhxtUDI9DyuOd qZv79wNepGaDLXpo0srv3EkzFhJN5N+urD/7qmy9U8bcwwNJmneDCB658xs9+nza8m1L2falDLJwu LGXmoJLNqu+y3gFApP8KrjPvh+TSPrj/GweRFSpwTp6qWfn9sISNnTnpRtaAzLA97daAYyi8XBosB DKMuakXVnkwxMsJE0qJ6nT6hg6cpmlGeDiDnExaed7/8AV9qbgHAxyp+uOUHbeRfRzavq5oomnncL alP8tCxYNmpSZhFoJ70A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yyc-0000000897q-0OFp; Fri, 17 May 2024 14:54:30 +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 1s7yxk-0000000889N-0riK for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:44 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2e20088184cso3324161fa.1 for ; Fri, 17 May 2024 07:53:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957606; x=1716562406; 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=VAqp201GVFEIbm+MBVsat6TXP4XkPRbsrzp6M2IRGJU=; b=BzelVVRSfl+/0u15rtCcalQgEn0mQSRBpCOo2Ic96cDseBTbPsfk2HX/SGYZr71bdc pj1inqLV5E9JB/0sd0TsJeRTEBc5veTV9A4FD15CWNSYdreqmtgKYPX0Gy1+UqADPkVk 7Ysua5nf/oh9Zot1LuwzQRAanV65r+Lz0t16/FRkaaEjYXCGBBRByyBIVpZ2I2Nd1iot HkZ56ggJ3/73I3szzMTCsPhI1thNhbTojf0D84IqY5IQREk5veOA63DvXe9IY6woYMxw 82zYNxGfCDuZp3y0pzlUV5gFP44Y1QZtFIhWQm2QIboVQ/hxMrr/w23eW8tvOvq7MG6h n4dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957606; x=1716562406; 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=VAqp201GVFEIbm+MBVsat6TXP4XkPRbsrzp6M2IRGJU=; b=NaRYkxkccupiiG8pAHNz80FtD4qYeBcF1rL9197/rxpd8tnAe+rJ6uRS49v1Zlm8i+ ya4gxQ4XDn5fbi9tZt7OmdOBzfH9dChJGYpnjE6fr9pusQwsyrQCGhl0SHzQA9egcDTV u7z9xcQ3S+sOcqckmXDMOlz4HycGc9lSHqFo0rwO0HGACXeRGDGqfPBF6ImEIw1AvQHA AEIqUN/VYupV9rrafDgg/Nn/YOuhINIcxiN/Tevov6cglvxUAf5uR7cMgiJ+QlyOcGF6 yh4zoMl9Jw2Q8ZTmna4aoHjWj9nfu/CeXmHgyA8TzA6el3NoHqh1Lp9c5I/lUjKhFqh3 ruSw== X-Forwarded-Encrypted: i=1; AJvYcCXCbDDjoFmRoYwWNFYdtbbYbnsGwng9gaB5/cxuhogFdMpfa7vGhTr+eWyX5jWAi8A9bUxiquFqrERpNh5ba1qxc6IjhCjQY2YpEVz1wcfI X-Gm-Message-State: AOJu0Yz0X8RtZfJHGgHLpfDvKL4LSLFYL97mLj3VFr1ZByLSklqFT73s B7pNkjVI/prNK5t8ytsj4+PplwQQ9SN2RMlsQFOeRfkN8l4nOV68m111dol4InU= X-Google-Smtp-Source: AGHT+IGbsOhS3vioDq76MfxLVdQKIggUZ1R5Mnaj+gjL7Qa12+AkX4dFvnOwn4zP83iDuEwRqKrmKA== X-Received: by 2002:a2e:a1ca:0:b0:2e5:67a7:dda7 with SMTP id 38308e7fff4ca-2e567a7df67mr139375581fa.3.1715957605840; Fri, 17 May 2024 07:53:25 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:25 -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 v5 08/16] riscv: add ISA parsing for Zca, Zcf, Zcd and Zcb Date: Fri, 17 May 2024 16:52:48 +0200 Message-ID: <20240517145302.971019-9-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_075336_793385_6A767E16 X-CRM114-Status: GOOD ( 15.02 ) 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/cpufeature.h | 3 ++ arch/riscv/include/asm/hwcap.h | 4 +++ arch/riscv/kernel/cpufeature.c | 44 ++++++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/cpufeature.h b/arch/riscv/include/asm/cpufeature.h index 1a148cd67e0e..8611e1c8ec2d 100644 --- a/arch/riscv/include/asm/cpufeature.h +++ b/arch/riscv/include/asm/cpufeature.h @@ -46,6 +46,9 @@ void riscv_user_isa_enable(void); #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, \ diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index b1896dade74c..a5836fa6b998 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -81,6 +81,10 @@ #define RISCV_ISA_EXT_ZTSO 72 #define RISCV_ISA_EXT_ZACAS 73 #define RISCV_ISA_EXT_ZIMOP 74 +#define RISCV_ISA_EXT_ZCA 75 +#define RISCV_ISA_EXT_ZCB 76 +#define RISCV_ISA_EXT_ZCD 77 +#define RISCV_ISA_EXT_ZCF 78 #define RISCV_ISA_EXT_XLINUXENVCFG 127 diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index fa4ad73b770a..3bb2ef52a38b 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -103,6 +103,29 @@ static int riscv_ext_zicboz_validate(const struct riscv_isa_ext_data *data, return 0; } +static int riscv_ext_zca_depends(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ + return __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZCA) ? 0 : -EPROBE_DEFER; +} +static int riscv_ext_zcd_validate(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ + return __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZCA) && + __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_d) ? 0 : -EPROBE_DEFER; +} + +static int riscv_ext_zcf_validate(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ +#ifdef CONFIG_64BIT + return -EINVAL; +#else + return __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZCA) && + __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_f) ? 0 : -EPROBE_DEFER; +#endif +} + static const unsigned int riscv_zk_bundled_exts[] = { RISCV_ISA_EXT_ZBKB, RISCV_ISA_EXT_ZBKC, @@ -183,6 +206,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. @@ -229,7 +267,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_DATA(v, RISCV_ISA_EXT_v), __RISCV_ISA_EXT_DATA(h, RISCV_ISA_EXT_h), __RISCV_ISA_EXT_SUPERSET_VALIDATE(zicbom, RISCV_ISA_EXT_ZICBOM, riscv_xlinuxenvcfg_exts, @@ -248,6 +286,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 Fri May 17 14:52:49 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: 13667115 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 DEC38C04FFE for ; Fri, 17 May 2024 14:54: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=y8FNUzUR6fjJoa0HnP9EGPmNxGUZhqP31Jb3mvmm1vg=; b=pTQqdAlZlc7+/l 8bATa0uZB1UlIm8ljqpQJnh+qhkqp7Abvk42aAQJBWwa5QbQ2aVgIbrKqoodsUsoALM6su4LHmhr1 xcdEL3aFTb69SKiBqNdvAl34OLJ+ksNXpG+bgkaSzJq/PXd1GzuOETk+he+lKodJ2Boy4flOd00MM 0FKGPE68UwVYcDalEgQvtJ7EEmPZdFTkc+O29EMXWCyh8ai449lC75W0KVzZE2ehAwmybynTueqlp jA6kZMPdZ4q8hlCXms91Wck4+yQAVaGEKQjlvrcK9olvwZQA4quEv4IxFGlLsmC9v1pRwbuOWnA2A IfY1AnRTzJ7QR3CdZYlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yyW-0000000892n-1U9O; Fri, 17 May 2024 14:54:24 +0000 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxk-000000088AT-0q43 for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:42 +0000 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2e20088184cso3324221fa.1 for ; Fri, 17 May 2024 07:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957607; x=1716562407; 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=6ZcvU9Yv1rOWLKDlgsJRQ29S24RYbUTnQ4T9H9DZeCs=; b=FX+vnTYnH0CGjETc/DD0BPETHQruIwmxOpnML6gUof5UwjsOYr7tX9TTZ3brc6rUAb V05goPZLJ8kMOrgrZnVPiEOxb2SbCCEaS+/02bM4tpmxdaUg2kVAIlYInCpHDhLtEp0P eaWroGDqfqnZ7nXZmrYGarHl0aBJsP7PmyAOhhSqteS/NhJ0hnvuRk4j7xNXy1cMuge3 ous1u/RlOx0utPN6bG9eZrfQOFIQVyqbto4Dze2eAzEbaL9mnjS6Lvtbdu0mH0iy2oi+ iuG5jrNEMpPPU2VCGUZSMoqVF3TBSZpA0jfpUbyM9CLOzXbDKKu8IWv9iLf2qNFWwl/O W6lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957607; x=1716562407; 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=6ZcvU9Yv1rOWLKDlgsJRQ29S24RYbUTnQ4T9H9DZeCs=; b=pNFc981irz7znNTfLBrwdXONwR7TApFalC2ciTLppu/NI5tN99oFsADy83KYTNgYX0 Pc5ne6bVbBNIcqjELhaNtP6ql+1R24fKo47mrIa91ZtFWj7PVNEw4L54Tnd2PG6+o4K8 ITH9wo0tNk9Vvqr6ZbmEkvWaZHMv/v4M4Kr1fRZmu/stWZDI/4XxjmBC6NJ5aiRK+Gpz ZnfGVKNgH5bwCqdOeZ652aP/2KGEgoUx+ShfGPq92TiwoPOJPIajJIWtEbthHzGQtM+P 8w0Ty2uuw44IFUEQGHUdWyrKEEK4PeOeH4wMXs2VjPm3N7F2E4hCb3+XkBfFuBnsPMM1 8L6w== X-Forwarded-Encrypted: i=1; AJvYcCVZ+ns4qEMDoIZJqf9AoZPow8WQ4gNccUP0RWSXEOQKAhR+cFWqtGtlstmsCZfkBPbmp5tSzTMibEboxHCbVxokfINIKkgUMCbS1HEYuhYn X-Gm-Message-State: AOJu0YyjhNfdyhz9OH0UqbH0spAUFzJXBahuUPgsVFgifqyYN3pAMRsz 1RkfOfsE/xathN2BD+a6HovWnmCj1VpuWMS6m7uz1KzmUn4+oXVZG7eUWGTeumM= X-Google-Smtp-Source: AGHT+IG0JRKQ4JGhSQKFCaG8K/egrvdoE99BfZAMCAGRo6YHIr6ZDAXQWFJBuUmfJPoMXhQY3Pg2tg== X-Received: by 2002:a2e:a211:0:b0:2e2:714c:23d2 with SMTP id 38308e7fff4ca-2e51fd3125dmr162327021fa.1.1715957607233; Fri, 17 May 2024 07:53:27 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:26 -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 v5 09/16] riscv: hwprobe: export Zca, Zcf, Zcd and Zcb ISA extensions Date: Fri, 17 May 2024 16:52:49 +0200 Message-ID: <20240517145302.971019-10-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_075336_743889_A4E4CC09 X-CRM114-Status: GOOD ( 10.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 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 48be38e0b788..cad84f51412d 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -196,6 +196,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 3b16a12204b1..652b2373729f 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -61,6 +61,10 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZICOND (1ULL << 35) #define RISCV_HWPROBE_EXT_ZIHINTPAUSE (1ULL << 36) #define RISCV_HWPROBE_EXT_ZIMOP (1ULL << 37) +#define RISCV_HWPROBE_EXT_ZCA (1ULL << 38) +#define RISCV_HWPROBE_EXT_ZCB (1ULL << 39) +#define RISCV_HWPROBE_EXT_ZCD (1ULL << 40) +#define RISCV_HWPROBE_EXT_ZCF (1ULL << 41) #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 fc6f4238f0b3..11def345a42d 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); if (has_vector()) { EXT_KEY(ZVBB); @@ -133,6 +135,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 Fri May 17 14:52:50 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: 13667113 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 B0A47C25B79 for ; Fri, 17 May 2024 14:54:09 +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=XA0p4549+6tK8TdwpDimZo4VgU7fttwadWVpjZ4BXrI=; b=kICALJgbRG04uq Qrc6RvXUbh6ZaT6D06ObfuUoFG2sUJng23JkmEn489mz3gwRJ9ilSX9n1BZ7elZZNLo4GKbHvgS6F junxDFkWYjPGvalO/UVKtN7JZgzCYIqwdr4DJyMdr+RCN+5lsF5VPoo2qfLtfLnsLPuBW1tZmCzcN xq39R/aYsA123x8bdrEUNRy3tpBEiGFsqAk3nms/oHz5mxRuMKBAKoc0BWQYgmFMVu33cg4uirBAw XUVsV6p/IQuuYDw72WyA2uzPATIqdawJoVAAIjrdWjA33AzK1Mf9rZCgtlrjT1tBtp5+ktSVcYUaZ x7LX8LtZX/+ghGLmDueA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yyD-000000088jX-0PW5; Fri, 17 May 2024 14:54:05 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxj-000000088Bd-3kbj for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:39 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-420197fba0eso337765e9.1 for ; Fri, 17 May 2024 07:53:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957609; x=1716562409; 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=Hr5In3BbQWy4/7yql16kLnv72/rLlL/nlq3+ywvvEUQ=; b=s/2NeY3QSsGPW2A0ojWHrMD1+yboUW1z1PDmXiwN30cNplBe1971bxTzWVAZ8qB0Jm OW/1KH3slThDe1LS2l/zAqLkypsCZcfAjTBLBEeWAbjpv3GL7PUfbMj4TpvC7kqLO4Ym dtnDj+BlxTg+uCbKzPRaj712X1OhmSr+a2LE34RjZFxYg9cgUPFcg/YFpcDkeMbNAv31 fubZwo3qAIksNNtuSBRhAXIAGqRG0ODdV4V89ABPGGwxRZBKbkpmZj2l+zlHaFIqq3AZ YDm5c7czKvn1FeJAE6MKalSJx1dcTCzkTWM3ptvfmel2N+qjnlBIR4kXr1ywoB4J7+uq iooQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957609; x=1716562409; 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=Hr5In3BbQWy4/7yql16kLnv72/rLlL/nlq3+ywvvEUQ=; b=uYG+BBCs/s5bVTWLK1job5+q8DQNEyAe/ihsVJlkM9BMIdXJSmweV0iIjdm9D8cxIj m0xoogKZNwXd1tV+M4ACh+9TeLW1FnooVLYR5ZBWgA67M7Y9a5QIuue8HIG1euqdDXDy NyFrfABTcviyXS3C4mWuNDqsJwS1EZF+ToAPrzJ4IvKYF2Fk0c4XszTKmlMVth8R0UTT CHLPx4GbCejfN6tQeg80IlrTG5DF/OX558y+GI6kjgU2IkjS6pG4TukW/G5E8ltGgHIU oCsKefOrltXeS/NwrMKrFa++a7hW3Yuclo1CJNHZAMrnD65QrZYzsxiPuMtkUs5U/FSq 2vwg== X-Forwarded-Encrypted: i=1; AJvYcCXaqxJ3qds4FKHTpcyx3JXRUnxwnFdBGNsZqShGnGS7O28hKJ2Jb1+OMZtQ2peQy5JeJJg3ZrPR74z542h3wFgYKAVtzpRwxyi2WwSpPqBs X-Gm-Message-State: AOJu0YyoLhIClgKNSgibXoTQ8PGBFR+QB3poJqUeQafrRKey7JdHWrwn RewVmM7iRWGEMXi/yuoxC/w5KwtNmaCp9Btfitthy4rOlPguXOEJrDNLTx5FEjw= X-Google-Smtp-Source: AGHT+IHFAZadiSe4TflYND6qRyaBCUiWEXnVUWl1b2pNoUSKbbMUpWrFBDbKvnZCinPKChpNIsrosw== X-Received: by 2002:a05:600c:1d0a:b0:41b:e58c:e007 with SMTP id 5b1f17b1804b1-41fead7a643mr161943585e9.4.1715957609019; Fri, 17 May 2024 07:53:29 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:28 -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 v5 10/16] RISC-V: KVM: Allow Zca, Zcf, Zcd and Zcb extensions for Guest/VM Date: Fri, 17 May 2024 16:52:50 +0200 Message-ID: <20240517145302.971019-11-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_075336_143336_FC1DE91E X-CRM114-Status: UNSURE ( 9.13 ) 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 35a12aa1953e..57db3fea679f 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -168,6 +168,10 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZTSO, KVM_RISCV_ISA_EXT_ZACAS, 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 c6ee763422f2..7d47fc910bd9 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -48,6 +48,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), @@ -128,6 +132,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 Fri May 17 14:52:51 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: 13667112 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 DDA84C25B79 for ; Fri, 17 May 2024 14:54:04 +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=8knsXM53V8Dif6Hy5TTpfWLzfXeHzpRQZwEV1kRbRt4=; b=ilDqLy9DEWc4tB HhbDfKUNoImzjDEAPXt0E/t6k51me/zdfaUQNvKAkBjLOYG5oBVDe1c4zlCR8Wm/xACSiUR4Arm/D XeDzz5BCjCiqdRGwBkmBdEYHo0fV41iuZHDXTa3APSAZRNnkUlD4a+UQTSro400gDSbIP4pPEySa4 BvddjYFwXxZZeC7DGzHFfPITvcYvtY2nsubClRaOLA1HsgEoQESJs4DfXqUw1wU5mWH/n/XCLIBfl EjHGXgM4dEowBxiWbAHaU2OZFePVOeq/tpG4zIXj16vfVA4P7KHCQ7UmwrmJywV+Q4n1QRcX1D1ge 5QgNYZO+wwqGvMGtZ4Iw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yy7-000000088dm-1Frn; Fri, 17 May 2024 14:53:59 +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 1s7yxf-000000088CD-2YAa for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:32 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-351d86910deso29086f8f.0 for ; Fri, 17 May 2024 07:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957610; x=1716562410; 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=HO1pUvU0QFRoXzPxVhmpQLKjzbVC9RycGYDtZgzkuNE=; b=bc3/PGuDAwGGHT9bLWtSSZ0vZ0S1a91TnVRVWINlzF3WnG9E47F16AKBhTBQzlxxtg NPuWnQQe0tgImLDU9LGz4RZshg8VieEC/2dWnR2SDDqWReoPQi5p9xFN2mp5Kiv0RvqE TKJNVYWt6rPmDoMnYHJVTgDfCSNpJJrZJDWnZxal/VF+d5TSiu7nIJkCi/EB0FhRQHuy oDxkW1Y9tJMKAFB19gtXswahBt4QdXBuy8ucWmbpNnAv0jZjUO2eSHSxx9kC5nhjFiPa Awvv5HvF0YVj6A8wTop7x5rDvT34EX/6/ecZ1sAHjkpkOVA7isetb6a3uWjj/n0oqGWL B7HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957610; x=1716562410; 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=HO1pUvU0QFRoXzPxVhmpQLKjzbVC9RycGYDtZgzkuNE=; b=fhSs+yPiJLRPlfPre7bUmqyG1V9/afi/qhcNlY7PLtuAWWfK3oba/XPtFeOxmgyPu3 sRQnixbUU6A6gqePVjwYFCmBqkree97RWeJ4VU/RgZ0h2jQeK+7d26hFKpyAtT4e/fYt 0DxXJD9HgOAFQ9vQXEZhHc06ZRyEFqg4ovhF8tpfcO3NzPFbHW+SEnHRl1Uwj/BVWhBG 3tYseP6GkLTWSBpSNmS97GoDEXlc9zmSPw5Jf/Awv8/iYdj9plMxOZ8aQNIHgd9iEow2 0hhBvB0APomqanx5QLQlDTIqoXRlLcWjzUlL+5t+8vwROs9Lf08VcgYlaRES7xj+LCs0 FjYw== X-Forwarded-Encrypted: i=1; AJvYcCWbI6c1HjI+YDKGHjnDTf26/uF0nH5qEAfceU6soxhMifunG+dJSilFAxNUFU4PDqb0feVaWdWUl00ix/PDKGM0mAvDpC0tfqNF6XgGfy6f X-Gm-Message-State: AOJu0YxX6KB7R9rYm+TmLfMHVJADRwKGrIdvWOk9aIgXSosnKI6ickiD fB/cOUabyGoR9B/cr+FMuNq7RVt/tztEAQdI/6le/M85d8A2qEV8rPR3zdzX8S3hqXTzNuMkqYh Kn6M= X-Google-Smtp-Source: AGHT+IHCcI6mTF/qG46F9/WPCDIuGLK4dSqNF1EcLBDpXdJsYapMFNR0VxcFS5FS/J/SwT2j4pYivA== X-Received: by 2002:a05:600c:3b86:b0:418:f770:ba0 with SMTP id 5b1f17b1804b1-41fea52ef14mr167164555e9.0.1715957610248; Fri, 17 May 2024 07:53:30 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:29 -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 v5 11/16] KVM: riscv: selftests: Add some Zc* extensions to get-reg-list test Date: Fri, 17 May 2024 16:52:51 +0200 Message-ID: <20240517145302.971019-12-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_075331_711407_0C6C2C4B X-CRM114-Status: UNSURE ( 8.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 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 40107bb61975..61cad4514197 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -55,6 +55,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: @@ -421,6 +425,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), @@ -945,6 +953,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); @@ -1001,6 +1013,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 Fri May 17 14:52:52 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: 13667114 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 6C1A2C04FFE for ; Fri, 17 May 2024 14:54: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=60LBiWMvluW9Kl9stvHvSuTcEUGSNNp9sdRxaZsHWKk=; b=HWQ6QkFJGtUsqN MCKWXuahWbwRxiS+oyJD2AWFjhDAEHa2uqiZZjIjTAp99mcMljVH/GBY4CRP8nA3T4Ast2L+BQhwP LVNIxRdlPErkyoDFkaMUGc/J1yW++mHCf9y4yhiKVBzbxI+GDxx4LRnCFamncqJGKk3o0xpBiVoCi TnR7sXBNwwHrcz8mFy4Yn+XO6DM7OPwF6hGkC2SvpTujJEqqCVTfyiAXe7EHvhRcLK2ibuEPJBm4u tmLGFeGDQGSnOevWSyocdtBVG4DStIHiJepo6v4x24aAIjOuTmOfQP8RkV4go8jhvsq1HzHXZECXg W1+lo3II7qa+uIEE01dQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yyM-000000088s3-00SZ; Fri, 17 May 2024 14:54:14 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxk-000000088DD-0x2x for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:41 +0000 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2e453dc8a31so2586741fa.2 for ; Fri, 17 May 2024 07:53:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957611; x=1716562411; 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=6gKduH3vm4bA8ayteF62cYLjH3IlcFCjaIqG2zMpUYA=; b=YHVNSwO6MNc1goVHTL5PL+Ifff++geSNch95s31BdPnwoKMAwg3YlAKgmKAm+pLu84 WlKCT8eTo0BUhG79Pz06I95OMRP60w9/E5y7kg32QAuDQ3gsprkKaB85TEe8/YR88DTj TApdlrjz4f/DIr5sVt8Khm1gafAYxbvFm04mDGUFRr4Q9p8mkTm3bbdfKOXeDendPQBa 6sob0xj90WXLRdSie4MeWXAYlpmUsffchx3DHHp5TQQuE2fFsWhy+M+t2PvjYpsHo3op vQ+Qr6s842+2M21sBJ5Af7O8Q7wt1SEBV+X/v3Spd6PHDwt/TSRLJeLqYU+owh2dkZdT Y2Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957611; x=1716562411; 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=6gKduH3vm4bA8ayteF62cYLjH3IlcFCjaIqG2zMpUYA=; b=T/+DjdtEycGYqqYyaOcRVpLiaOx0105sI9ig7VAK9N0i4POw1yCGaZxHSFqmqKUjvK 3ariXOLzW+8wT6voYvO501AZYZwpt1cLXX4zeonTLVjnmd1PBGacw0zHM6/SC06KLUJw IBjKPEx/yFi2qWzrEcVvAZd3alx+b6SQUYuNMX/CuGQBXW7gqmop39DAfmt9G0JDICG/ WMgIC0MbWFvcRfhG7xJiGYenZxJlsn15dl3vGkO6PEX3ZLUTR/MPPILoTxFZj6ydVUdU YqOOqP79WoukXa/vgT3HR1U7RIBxszBFhYcFGg7gPKaAdFE6YOMFwHpeYNombPPTolSr +vXQ== X-Forwarded-Encrypted: i=1; AJvYcCX1tM45Nusa4FK5vskv2mNwofc8lVdArRpDSNE4TvV91GNFL4DRgv45wg4dkwJQp8t/7DXJHT/iSr2V1DAgtlUQM/FBTi/GSkl++EE/+Ngu X-Gm-Message-State: AOJu0YwpJt4G0QqqHiD1noi+U0HthQQcR9/r/f58dIocZQGdHqEhAn5w qYy/uhKtxs4vMIb3bxCoySkAQ+9mjlup2gfloi1Hl4r2Dg9Rhz2CUDhz6eSTlL0= X-Google-Smtp-Source: AGHT+IEoTnwmla6Aw69ILKU9EfBqXp43B9e88SNG9U5yWPM6gqE1tM5+qUVkKG7xDY04SlNYRjnGNA== X-Received: by 2002:a05:651c:19ac:b0:2e2:18c2:9c8b with SMTP id 38308e7fff4ca-2e51f262c65mr155101901fa.0.1715957611714; Fri, 17 May 2024 07:53:31 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:31 -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 v5 12/16] dt-bindings: riscv: add Zcmop ISA extension description Date: Fri, 17 May 2024 16:52:52 +0200 Message-ID: <20240517145302.971019-13-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_075336_701108_897BA538 X-CRM114-Status: UNSURE ( 8.78 ) 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 c732a4f39a4 ("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 39084c58d4e4..acad4d9d96ab 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 @@ -559,6 +564,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 Fri May 17 14:52:53 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: 13667117 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 AE2F3C25B79 for ; Fri, 17 May 2024 14:54:38 +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=FyI0p7hvEejSMGyWe3vKNPXN0522uUpzjPUA8/2O6HY=; b=rf9TdHGXdBS79r L/Kpd/XLYK92P4vdXuGgp0v74VfvLiAoW9uMk5HRlDRIkOLOjTpnVHuyBfF0calzV5Ej7I6hQ5U4A JbPNq6eOa1nDZoS4Y3dMwKqJyI/xXLF1iLlnuI+V1Ht0mjuTGDupkKiXqCJmxSDQFFR3wpI4BOPCG jVWFdnWGNuOEmXmZ5x/nibjHLMUSwFc1fX5gomeyqepl2COh9L3M//j5N/zTmJPYMrda4Wnaw8NT4 42EVr6qCPao2OWDOhQtR1t9Rg+K4cM79u5myLsyVO3Z4iuNe6qL92OPlucjZq2O9cY99ML+ZZyueU 23ts4Lx+b9CCcr4xBnNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yyg-000000089BT-2GFm; Fri, 17 May 2024 14:54:34 +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 1s7yxk-000000088EM-44z2 for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:44 +0000 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2e2554b8cdfso717231fa.0 for ; Fri, 17 May 2024 07:53:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957613; x=1716562413; 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=aKs6nP2IvbAkKOrGa5+RoTJoO1OEnrEjZ7TnjWCI1Y4=; b=h976FLe6pDg3T5K5ibeXW9zwoZDD6l5X7H9/0J7ix1Hjsj3uRJ8O2/ENFJOD/4RPpK YnNaWflSMr4ECKx0M89AU5fJjR6cvrWeLl99Be7qd0UPam92i4JnbbmRGV4K6i22xFs8 RqYgQhfjNICr4hKRnZjxgYxgByaIqoDUcRL9mCzEzRzlDoDY0UX2MzuzrLhmkFYdMpAB MDXLmnzip+5m4gNhjccXYedbO6pBe75dnbFekHTTy0iDqBSb1YTPMSmH1t6VfmZnruTt ldzVbFTDOU/BBrQk9lbtJAdVluHZTCWV776D9kL5WSkx2YS/BIHpBeOel6qyPbQJ52dR fkxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957613; x=1716562413; 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=aKs6nP2IvbAkKOrGa5+RoTJoO1OEnrEjZ7TnjWCI1Y4=; b=oiDBHmQ6M9aJxb8HeN4sbUqXurnSJ6m7LWTc1dFPR5BBjYU6v3/YIEUdUkHjwfD3CQ MWLFqzmLpuzYDvSGrilb6AeDrZ9rP26ZWWJTS7NxfZI7BD8t+L3IkmSwXR2cKvcdARlj 4bfwegu4SCcB2/p+rkUuOSTr3kGuhnDcMg9nn+5Nkiz9bGiSHbEDg1EBzuFBuF9ashJE Qx8jYovdRKv3oS2c4CdCMCcwFoelX0d0mu710J8srtsRPCiabHcDGLJHuQcXhuEabWzu P37EWdXyWNncqqh3ty5tYMVJaGU8bq50j91PbGHDkqNmgE0A5iwnS6DtKOSSyg17Hu7Q yMOw== X-Forwarded-Encrypted: i=1; AJvYcCVziH/cOdOQxfTFetRHCt9TC0XrapsnsYxOnOnL4p0fgI5cF4TMeaHTox7iRvz31owvBbElNn6BEVh7Mx8f97vDhkcC03l7HaTZcAV19f0j X-Gm-Message-State: AOJu0YzR+U9UYf6FpLH8+4q0ld1ynltdx6cSQC3EFjmXYqU2Kp3iFe/x Ig2qrNk8H3iGZuJjK571CDopWgBblI/Yk+vmQLuO8AfwV8QQsZoZuA73OqiCqZ4= X-Google-Smtp-Source: AGHT+IHR6zTwRG0jWxIyCMSq5u4kvH12lVHrxENgcXG9CeU/DaflTem7ntPab7y54mPzIbQdgLeTIw== X-Received: by 2002:a2e:a4d9:0:b0:2e7:14a4:1f75 with SMTP id 38308e7fff4ca-2e714a42f3dmr2240021fa.3.1715957612950; Fri, 17 May 2024 07:53:32 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:32 -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 v5 13/16] riscv: add ISA extension parsing for Zcmop Date: Fri, 17 May 2024 16:52:53 +0200 Message-ID: <20240517145302.971019-14-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_075337_296797_E01A586E X-CRM114-Status: UNSURE ( 9.19 ) 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 b854a709c00 ("Zcmop is ratified/1.0") 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 a5836fa6b998..aaaf23f204ac 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -85,6 +85,7 @@ #define RISCV_ISA_EXT_ZCB 76 #define RISCV_ISA_EXT_ZCD 77 #define RISCV_ISA_EXT_ZCF 78 +#define RISCV_ISA_EXT_ZCMOP 79 #define RISCV_ISA_EXT_XLINUXENVCFG 127 diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 3bb2ef52a38b..0a40fa1faa04 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_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 Fri May 17 14:52:54 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: 13667118 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 D861EC04FFE for ; Fri, 17 May 2024 14:54:48 +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=AWK4lKil0tXLM2qI9ELJ27SLzhLY4yxYmj8Wg4Y5Ymw=; b=WS9CY+uLKNhvgI pUrhyFEaLbN9Du5E2q7xVhoy74cpgDeIUo6j4HMpfC3dzkcvuWzmNo6iWBgU+xI/wEh4FOJ1ygsvP vpfZcM8LsnSpRiwWFjal/fcYocsH+073wALYrIbhStVklAAnqSTW5JV9rdmrxOJz73DsaRrONQyiM s/Pnylyg3PXVhjLOYO7omKOUhVezpMkkDKQDGmw4SF3LS2eBPNEWg/9ufULITn2i+i6oURkkyrcZq 6Z60TIVkcFoLi2rs43EOlHN2tTGxM+T4xcwG2nC8Rq9CQOufm6fu9hxeM0Cv5jkuRK2zI795Oq5SS 1hInIHv7JGXScOUJOXJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yyo-000000089Jh-2EzB; Fri, 17 May 2024 14:54:42 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxl-000000088Fv-36Yd for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:47 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4200e4b7bcbso328285e9.1 for ; Fri, 17 May 2024 07:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957614; x=1716562414; 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=Y+iPbn/khpTsPchyu8Yai3JeJ+A6vpdXRb3hYqL1yvk=; b=a3cKR7MaVPKvJTnwIp0v16HmUuqxz72PH3UZ/5vGGO5ALeDdThM7TxxGVWQzMFrCrf 6/6cN/HxbSoZTYbx/Mf40i/bWAgvn2HwSStK9KXLu+FoGPY+9ZYmCyXKkYqcbtn1fEI8 XgL7b9EYLBeKfvv5kw4RpfPh4+fTUcpIGntWmYYm7dWky3Ctp9015TG1wuA0x0XesU9R oQCicEqdGg6soFTYRqk4b+hABLYe1nXE9kswkcaImRjNqhQV0Ao9QUMiRGzJzlHGUiN0 TKJ4Uc1A/v6iVxKsMIKak+gnIQITFTU9QRapb8smr1wxYwQNtVf4m/18XPLjp8BGQJJ9 OONw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957614; x=1716562414; 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=Y+iPbn/khpTsPchyu8Yai3JeJ+A6vpdXRb3hYqL1yvk=; b=qlg/vq71YQ1gbdhLEkBhjjdx2beo4oSdvt3Oe4N79Ct4C28jEYdjn5S13VZFJfsPHi Oa0m2iFbzMz+kqGj7DDMZ5PInD1BLwav+teJtSzaBitW2cdqI9mMcqiLFym+TvQW6xK8 Nb/ZZ+mXswNxghcl7hPkokJdsAa7Xi80Tyc6MCbhpSKGJ8h3iZk2b3eFeXe1sJB+vnxi F6jHxWOafkx/+JzMl9Jy+busNZRQukvarz9AtpkxDuxS45+giys9dutIrju+MFGJmZJG LWZhm7IPjsqnOiT9pZ3Uk2760T8/a0ZR1YwBR0UenUg+s74slnqT2wlfTDEBXTdLP/Qn AZog== X-Forwarded-Encrypted: i=1; AJvYcCWnjJGw0HogUM0vV/RU1bBzUBDw3xiw2e4cFM9WRYHeAGpiDdy7iRea9+bsDoiZah+Vhk+ExazPGvmocF33CKxkEZFygbCS24ua9af7fWqx X-Gm-Message-State: AOJu0YxqWQSNil9GmFmxq7FLVcdkB0d3ogsklEalr804/fijR5uZZKmU GE2Ilj9XqBbKPa72oldCVonnw9R4U38S8Vmot6ySAJGOYYIhBlykPpL04+7lots= X-Google-Smtp-Source: AGHT+IHjUwKmyIg0UAgVmQU28600dC6ckmqz/WfhRm2n8JkhKzwA+sGdKVNHqMrH9cFck9sYzow7Nw== X-Received: by 2002:a05:600c:3b0a:b0:419:f0a8:9801 with SMTP id 5b1f17b1804b1-41fea539b4cmr186010615e9.0.1715957614634; Fri, 17 May 2024 07:53:34 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:33 -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 v5 14/16] riscv: hwprobe: export Zcmop ISA extension Date: Fri, 17 May 2024 16:52:54 +0200 Message-ID: <20240517145302.971019-15-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_075338_056303_62DD90E2 X-CRM114-Status: GOOD ( 10.62 ) 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 --- 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 cad84f51412d..9a77b7d14539 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -216,6 +216,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 652b2373729f..3a3d6a2b4f48 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_ZCB (1ULL << 39) #define RISCV_HWPROBE_EXT_ZCD (1ULL << 40) #define RISCV_HWPROBE_EXT_ZCF (1ULL << 41) +#define RISCV_HWPROBE_EXT_ZCMOP (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 11def345a42d..34c95eaf8cd1 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); if (has_vector()) { EXT_KEY(ZVBB); From patchwork Fri May 17 14:52:55 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: 13667120 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 A116EC04FFE for ; Fri, 17 May 2024 14:55: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=p3AiBWCzY4/t7CioJan7pbc6H/joeMtFyb2SR6tW1iY=; b=dtp/xlkTUc2gHS NbDg2b+JygKA0NwRwMH47uKWTEzh/PZp1rjmGV9u+54s9sWBggpaqp5w0r1Cq93vL8Lix8t+U/tlD aPMzfjI0BfwyToz5NsTxe2bu/WVlGOetntS0oDCOCAYwlf1iUBHmDHjDt8i2DV4bBOy+W6Z5AxbdS UvMPswiY7SYEcG1+SQhKknVRcP8jy8iFZzlJau0GlXXMT/G3M0Ir55fh+jPinYZYrsU3DjaLwNQzd iwRTdZe2PJj55ohWXBL1IOCDAiRI6KA8OA5qL62pcfS/E5z4CTFsKnNkm+EhiW2l563rDcoc9hdoW M7bUadGSJid6FrjeO8Mw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yz2-000000089VO-01pn; Fri, 17 May 2024 14:54:56 +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 1s7yy5-000000088b6-2KSy for linux-riscv@bombadil.infradead.org; Fri, 17 May 2024 14:53:57 +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=e9KC0tuSdit7TUVEzTpSp24//kOo0UeQXa0Z7JvTEow=; b=PY/9f4+CycnlTFE/tnIpLtLg3Z gXhq16ECVkFKOrLBz3Lo1jLVZc4vVPpt6PYe+9KUcDUMw4mokk05JUpjU+W6slOswQow2L1abi/Sv WJWqO0OBlX0QAhqT/nBqRrtWs2FNdoHvL0xrU+lPADW1icAGcuKZKH8j6R6XJtBITk31wO8uAemT5 dg07l2vBx1Zi1/M6Xtv78wABqgJqnDsWLsAkpTd/GlufNYLEZOFalo4I2zKD7BnkganSnzJqnN2Ao f7MVUa7ZkoecSMTs78cB71oAHSvfI/lhYbaWsxwUAA2bTh0vh3KbJRqId9UfTWJSfT7uREGS+PGXR ExQaz0LQ==; Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxz-00000005itE-0XRI for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:55 +0000 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-351d30ade7fso38487f8f.2 for ; Fri, 17 May 2024 07:53:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957616; x=1716562416; 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=e9KC0tuSdit7TUVEzTpSp24//kOo0UeQXa0Z7JvTEow=; b=anu3PWqUuKhXAkKNqvGhwE/q0B8jCDMJX/0uOsvfpRUZImnyzBqV+4TgqD9egj6FJe Cay1Vlysh2lvxfNWupf8gvmBk5286thPUXUJmgL/b7t/7pxrcODOOEPWz82fsttRaEgC UStT8QsevhV6py1s/fsKNJIeofXB3VHTAKMJlCq73hFl9FjxmfpYJos4BInTojIbfvKQ DmsoPxwNy4gOgoLz43niYXMqShcxLiR9jhEaYf1w2Xs0pI0Mpd7uBmC0cjytkHn3DUBQ zL9x/57stN3yDMk777moLpN7eYRpm/XF+IqvKFbuUuVcw3zQ/X1Ix8yDRfuVQjiTWRds 0YWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957616; x=1716562416; 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=e9KC0tuSdit7TUVEzTpSp24//kOo0UeQXa0Z7JvTEow=; b=uuqEhjS5x+tyXSDAs04dN1T3/iLYX0lYOaEx9vsAZgT0bGIARffloCLCMy4qxCkbSQ 4wjDtyeXYCINjFc8UtIXOuD7LuEmvIp6w6SjCUdZBcp1RZmScxhqApSj4wR01H/76Qem l0XKkFIm80oo8vMJCKVnpY+9vmeabBCYykAdfCdK22lbeuTyC3R4H78XbvKuGx1qYnLb Xh/rRbG0dPhrmuiG1VmRJH//MMSqRC7yxY4BSUAsboB6mEWnRwr9QmJjphycxRH2y4Cx usrATYkwAJ0rPCZkUwxCRJTni50EmJSwQPH203i0SXgP4Cf3LGJR/eaf8KbSNyxsFugx XYwQ== X-Forwarded-Encrypted: i=1; AJvYcCVtpgsSPfccG0mHcwmV0sofCc26s4z/yfw+kHP50XS/JKDjKfoRrvp51D/wjcWReqLFQcGsJGy92A8NLchjoqMFk2mJFBHA75JxhnW5BQ6M X-Gm-Message-State: AOJu0YwQl1olNdve9J1NxOs0cWWgOERNz7sm2p5SsqSPHFCTubwvdGGv AhBIulBF5dIky7ogHB5qbIwG+5qs2Fa7OVV6dBnWcNRGysRNke/Xyha27dzgI44= X-Google-Smtp-Source: AGHT+IHzMauOaObmH6bJHd+GEHQtwrBkXzklFT3v/zPDqrR2YcC6kkpEK8DoADrBqc2G886rfeUyUA== X-Received: by 2002:a05:600c:3b26:b0:41f:cfe6:3646 with SMTP id 5b1f17b1804b1-41fead6b0f6mr159820025e9.4.1715957615814; Fri, 17 May 2024 07:53:35 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53: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 Subject: [PATCH v5 15/16] RISC-V: KVM: Allow Zcmop extension for Guest/VM Date: Fri, 17 May 2024 16:52:55 +0200 Message-ID: <20240517145302.971019-16-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_155351_578389_58F80940 X-CRM114-Status: UNSURE ( 9.02 ) 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 57db3fea679f..0366389a0bae 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -172,6 +172,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 7d47fc910bd9..af4fefa189af 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -52,6 +52,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), @@ -136,6 +137,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 Fri May 17 14:52:56 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: 13667119 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 90D3FC04FFE for ; Fri, 17 May 2024 14:54:52 +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=4sbVC5b2OfLezEntV47BYWWf8g1NXb13n9j5CToTFq8=; b=Hj5agSzYyhB/u3 lq1aFQK3m89ip/8PUbW/hfmEWFpoeC8p/bthQNIR2abpf7LbX2LO5MFShMvl9qb3E71U4QLRO8PJi mRMfuCqhocW1vQ1EUVKjHe3H5VeQDM/bK6cmNJLeZ15xdQMzPlKpI3Z7FdAFVWwERb7hAFikirAoh /JQAC5p721QpRbs82Yk+EoADi/MqVh4jS2swnPE083/TbsAn22lScAu3FpIdi5TuGDnCeEum6pPWn +keecFCmLPGlC8xfHChNIYK3c/WVF5dVrwSlN1Us2Om4Llm8do44j0UNWIcUdB4PD8vAtTS33Axkc j4pmauTmembH1r5vfhKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yys-000000089NZ-2bLW; Fri, 17 May 2024 14:54:46 +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 1s7yy3-000000088Ym-1h56 for linux-riscv@bombadil.infradead.org; Fri, 17 May 2024 14:53: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=OClMR/8Jm3sCmLbe455uZIaBUTeeLegIVNx5rAADYDc=; b=rbe+rgUluf+s0e/l0V5X/s8nWW DFfzLN3rEH8Df1ChElBKvuArjeNU+HdukMEuO5ugQfwFySWSYQa5u3Z7/SxIBe7VJNbQ95I+FT23u l2oMx8gVD6inIjz9wvK/+mtiC9fa2Ks8kbNRaPsDVjOxP/aGbaIdMY4ZRcw/32mpLh8ZjYvMYftxR ZIg09lW0Tn8J4Btu3/KyicXMJXmQXKSVaTwlWPSfHUN2VB2tf+0m7fc+DvtoYLk1ESElit8zs9WK1 mZP2l5DFtjwchX+kM/QdUbbOmLhdkxm1gnFuD/EyGHlQlXR6wTVrm0cgKRSAjUTH0uLABRci/y9cS gZGrEfnw==; Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7yxz-00000005itF-0DQN for linux-riscv@lists.infradead.org; Fri, 17 May 2024 14:53:53 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-351d86910deso29097f8f.0 for ; Fri, 17 May 2024 07:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957617; x=1716562417; 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=OClMR/8Jm3sCmLbe455uZIaBUTeeLegIVNx5rAADYDc=; b=NCSgGXKy22VAjFgNx/qI9aoKAIeL7ScpYTFS2tgpJ/taJk41wjdOQuCKVXuBVU+5f0 CBOjpRdlE2oYYps1w61whAStVoiSn6eS5cmumKhAH2pJ7I1SacqLLcTM3fcHVfyJb0UK CWF9swsbZt1Al7b23cD1WrhezUW8H7GnXSR9a2lv3KbQiuwn/2z/sHijTyU8H//8KiG8 /IJdwK5thZPclRZKwUCSftCLZZhPONCbImvHhb+x7dk/xJb+q1yUiPpDAO2y1pvJrqM3 A51O8CdBfxD7c4AlYoHnXsVCmnZ5HEHiZ+XtehSFHl9dFcXVidoVyFOJdo0OOaS7VJvb LyBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957617; x=1716562417; 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=OClMR/8Jm3sCmLbe455uZIaBUTeeLegIVNx5rAADYDc=; b=VpHw95KbveEzOeBEaMQzfRk698YQo2YVSUSvxXqWL8eLceXcCvCgPAoF9nAXCDAbLT UaDFDG3xE5KW2+qgzbYrExmFK0PASgrfdJz3rCMqNB4uv7MPyMs+i9y+jaGmAQ2Tphg/ psrcNBv+2BU8b2IkOij/gsQimJUVWANYtjq2SOUsL8/q/qIBGEi22tBOIIUDh/FspFyI eA/C0DYBv8qFmsK9thaepPzfNDwESX2rKTOMENo9+hhFleZXT1isJgBhK9BHOS3FMdai TZ4ed8qDUXc3P3stsvZxuwwtjKNV7rA5FTjj/Ct4q0AV+YdUOWcvPlSBCXIVzB/cZfpm bfWg== X-Forwarded-Encrypted: i=1; AJvYcCXWD4drPeobaJ3PemUrcJDa8sdcrdifsUAxLRCZpT8qCgSAal69tTDW+mp6XGLv9pMqNE20vtqen4ykLKV3+MnLu6+BzF1Dm3Gye/FiGBUH X-Gm-Message-State: AOJu0Yx25fMXQ7/OqREnaeW1eiCm42Ge+2FohqCs8XDZ9JL49DR/+yJw SpTZ9pDrK3swkBbiN4pfR5e7xMWCut+97XjhpkVnJ0e7B1/1QzKraKe/fHrv36E= X-Google-Smtp-Source: AGHT+IFOQbqpkXAFZ+YravAaGBjZr48UyjitjGy6UF5iu6XOF0ZSxSlCzpVIUM9l+O9Eld2jghPS1w== X-Received: by 2002:a05:600c:3b86:b0:418:f770:ba0 with SMTP id 5b1f17b1804b1-41fea52ef14mr167166955e9.0.1715957617104; Fri, 17 May 2024 07:53:37 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53: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 Subject: [PATCH v5 16/16] KVM: riscv: selftests: Add Zcmop extension to get-reg-list test Date: Fri, 17 May 2024 16:52:56 +0200 Message-ID: <20240517145302.971019-17-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240517_155351_533610_BF42A7B1 X-CRM114-Status: UNSURE ( 8.98 ) 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 61cad4514197..9604c8ece787 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -59,6 +59,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: @@ -429,6 +430,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), @@ -957,6 +959,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); @@ -1017,6 +1020,7 @@ struct vcpu_reg_list *vcpu_configs[] = { &config_zcb, &config_zcd, &config_zcf, + &config_zcmop, &config_zfa, &config_zfh, &config_zfhmin,