From patchwork Tue Oct 3 03:52:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13406726 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 E75D5E776FC for ; Tue, 3 Oct 2023 03:53: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=NQLFfe+EM7Rkc3GQ13F0uSLomiECLeGbiatHlz/4w3o=; b=ond3+8m6kTu5ZM w5pM2Ft7HkDRkUhH6r71Z1JNLl8XGyT8i7WAcKysMMBTL0P/G4VfldU/h0XSEdwQtYnk+n4z1J26n 7j1NpehLDAVMhoOSkh3BetUqmqP0GuirU9QafEGNl3/50csRBK5nv/jz/eSHhYITh7WQ5xDUGQnBx aYQbcy/NjyuG6U5tgjWC0734DCJBJU2X4Bwxf8dg0P14x6qgcKCT8VArEUErFkmEKloYPbEREDTW2 sWNWrNvBmWlUnXyYaZHjJP0I2obU6NmCuE3mFDB70ht/6/xH44P1LxFYNu27X3rYU3XERQnyZ11P+ yA6Qy8vSGMOuVQCHht1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qnWSp-00Dk13-1k; Tue, 03 Oct 2023 03:52:51 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qnWSk-00DjyI-2l for linux-riscv@lists.infradead.org; Tue, 03 Oct 2023 03:52:48 +0000 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-69335ddbe16so339719b3a.1 for ; Mon, 02 Oct 2023 20:52:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1696305165; x=1696909965; 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=FNMR0z51QCYQRxm83f6KHDy6IPGxun19enYMfTcEza0=; b=XPp5WX/3qpExKz9jDhtPbep8PV3QR80sOUZKJnGAExNTKjNY3yuEIzq4xd6WITXXxO TZ0zpPnxVkBn14UFEuoNJavnRCKu62xLKQMQkepwj/gv3Jx98BS29h1+pqsb3+Vox6QM VIeMvEWrLXX6nUv8Nru+RHzLjw7F52MFy3HHHkzulCKBgAsD0V3DARaSFkkkYkFD4lHV 0/mfG3KOiVK9dQbk7datqSkQDZ/960/LC6OXZK6KfVTiZi01rqLwAbdjhJrHWXjGXkad ylj6rYcxUQd9vI283Cajj2KZEyR3GCwQimp5NLVwuLcxCCuwHtteUJSW3zld3rPMDUGz bJYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696305165; x=1696909965; 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=FNMR0z51QCYQRxm83f6KHDy6IPGxun19enYMfTcEza0=; b=XxSBUvkGV6J9GZXZUQmoc+Jq7zf/ObM70z/q7O8NqZd1LG1YRdioSlyUm3IJKyLgdQ fH01zBjtn1WpT5E2Kvh9nXVqFYhsm5dCTTxmq24uiBAjZV7L7XQyCI53CdymIo0sB/Z4 kT+UczeiY9M9c1Qbc0zm2NHgouFjDZ5zux5eox6lKswVE9tCFzwgEfWuHzxKqLX7Mqgs tJ9heVmwCItru9dM4byAVPlH5aL2VV3bsgg/y8qLNNqe/3fG1/5e8SfD2CFfpZgJVZ8b 0MOSfjKNOF/ZjABZzf0mCckIr5zmojHVv3C4Su0RpzIENRYdrlvfwsfIMsrKHoHxmohp hNVA== X-Gm-Message-State: AOJu0YzwcaxPCy9abeFwYTP42qs/3ezRQk/8b6L9cXrCegotnipc6RLP QKmpbnznovRsAsB2E8lWW4cIcA== X-Google-Smtp-Source: AGHT+IEXaDcHzxAlzMbKUPrZP+5G33t2w1p3iqVmidYV0CelUUVsWLM8+GU6BDI/ydkZJPXQ8ve69w== X-Received: by 2002:a05:6a21:99a8:b0:161:76a4:4f79 with SMTP id ve40-20020a056a2199a800b0016176a44f79mr13310303pzb.23.1696305165279; Mon, 02 Oct 2023 20:52:45 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.84.132]) by smtp.gmail.com with ESMTPSA id ja7-20020a170902efc700b001bf846dd2d0sm277381plb.13.2023.10.02.20.52.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 20:52:44 -0700 (PDT) From: Anup Patel To: Paolo Bonzini , Atish Patra , Palmer Dabbelt , Paul Walmsley , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Shuah Khan Cc: Andrew Jones , Mayuresh Chitale , devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Anup Patel , Conor Dooley Subject: [PATCH v3 1/6] dt-bindings: riscv: Add Zicond extension entry Date: Tue, 3 Oct 2023 09:22:21 +0530 Message-Id: <20231003035226.1945725-2-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003035226.1945725-1-apatel@ventanamicro.com> References: <20231003035226.1945725-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231002_205246_891629_FA0E517D X-CRM114-Status: UNSURE ( 8.12 ) 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 an entry for the Zicond extension to the riscv,isa-extensions property. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones Reviewed-by: Conor Dooley --- Documentation/devicetree/bindings/riscv/extensions.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index 36ff6749fbba..c91ab0e46648 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -218,6 +218,12 @@ properties: ratified in the 20191213 version of the unprivileged ISA specification. + - const: zicond + description: + The standard Zicond extension for conditional arithmetic and + conditional-select/move operations as ratified in commit 95cf1f9 + ("Add changes requested by Ved during signoff") of riscv-zicond. + - const: zicsr description: | The standard Zicsr extension for control and status register From patchwork Tue Oct 3 03:52:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13406727 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 68BD7E776FD for ; Tue, 3 Oct 2023 03:53: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=qTP1KMidGrk6m8y9IE87zkCQExGSsRH9BfZ35D2suOk=; b=CcwbtCw2EQHFbY CmuehDHrt9wisRceQ9MIru0/8hlCtHHIaq5FeRIAQ6tENVtzuJH6A2hlnUXip+dIf6WvPsNXhA7iG Ex2bHnkdDykgrZ4A/yK5fpzeHxUJFX94P0gRleV5HWY0JYSCVeOIe7rd7BcXG0+R8AMS2jOBFi9LZ mS5a01u3Y+1RKtPNW0htquDeaqi2DY6/HDwM68klAf64nQzTVq23s7VxqIrCsQ40Us5DiGbqn6Nk0 PtRdV6S4Qz25IP0k+3nuXg/6M/Nl/sptqQ3+JYt7S3NXMwgZEjCR4EwQPIZyArskrZdH7cBKammGj csjF0td8Hr4B2oeFqZIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qnWSs-00Dk2m-1d; Tue, 03 Oct 2023 03:52:54 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qnWSp-00Dk0W-3A for linux-riscv@lists.infradead.org; Tue, 03 Oct 2023 03:52:53 +0000 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1c723f1c80fso3542445ad.1 for ; Mon, 02 Oct 2023 20:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1696305170; x=1696909970; 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=yycPMI9rC/acogS1vs0h8BRUvc4a6Kod+MRuzLqJ/0g=; b=SXoG5LfOwOb1PQsqmnxBlav9h981y0VjqM69MDUc4+6El5NPG4kg8KI5a7fZoaXhv8 kB8M1/ym7mis+Ay6g2RMOcyAVC9DcNW/TeJJK/0fKpuSAUu7vt1WoYMoTrFkr+oH1f81 ibmm8k7csLMAxKFnvkSo/+22QB6YqP5JXhdJq9FVHH2gsoV8F5h0DlWZG2f4i+gqWmv9 /kPjIFds/OkoGYzOHghodNXaujL5q3koSRNgkoWPOLogIBoVnkykEvCydRSfuOVuGGQo yIS9bm+/gX4ftTtq0ZRDpePS/Qx+1/m6VJkPhSUWeqR9vzZI5BLBGAoST6oSekCM7j8F mI1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696305170; x=1696909970; 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=yycPMI9rC/acogS1vs0h8BRUvc4a6Kod+MRuzLqJ/0g=; b=Z7mWKEgYYT3HMJv/iuXVdK6G8wCac66PxG2ukywh0MpQoBwaKUU64j7vScPoeLFBTe ntnZNw2a0S7KrakCyLg4I2skWWdAEm9hxFdVveEIeneESR2S4BuQVzZAAQANFmg6L0Vd 4A0PFWmcl0t83SqMmeybagJsmvh5MFHT9n3hDdbbRGRIdIfoYNsZtZqAZwP3BfAxp6ZY xDjFeQKuIGP+T79U4mVNdBYFfFU8dyOsPRxmyRHalUjQZOI3fXfUuVaPCKPr9YJ0O35a toRcTqcRyWmvc7G7lf8gFGw+AxdIfLn3H0ND8bYSRqJbz7XUsiJD2SOSztaooXl3PuCh De1g== X-Gm-Message-State: AOJu0YyUb/EmETV2MYsm7fOeYbpf+REBQpbRoRbA8Dw90oReEpSCta1F n7wJsiQRHRBu1Xmlj8kbaUXlTQ== X-Google-Smtp-Source: AGHT+IFTxF070rx7YJkcoy2/BdnPUrtJEvwz7nDRRqveimSHvcZ4nNWjTlHA1gEQmD/xbZ6UMOx4KQ== X-Received: by 2002:a17:902:f7d1:b0:1bc:10cf:50d8 with SMTP id h17-20020a170902f7d100b001bc10cf50d8mr10607315plw.23.1696305170384; Mon, 02 Oct 2023 20:52:50 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.84.132]) by smtp.gmail.com with ESMTPSA id ja7-20020a170902efc700b001bf846dd2d0sm277381plb.13.2023.10.02.20.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 20:52:49 -0700 (PDT) From: Anup Patel To: Paolo Bonzini , Atish Patra , Palmer Dabbelt , Paul Walmsley , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Shuah Khan Cc: Andrew Jones , Mayuresh Chitale , devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Anup Patel , Conor Dooley Subject: [PATCH v3 2/6] RISC-V: Detect Zicond from ISA string Date: Tue, 3 Oct 2023 09:22:22 +0530 Message-Id: <20231003035226.1945725-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003035226.1945725-1-apatel@ventanamicro.com> References: <20231003035226.1945725-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231002_205252_020203_F8FDE066 X-CRM114-Status: UNSURE ( 9.89 ) 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 RISC-V integer conditional (Zicond) operation extension defines standard conditional arithmetic and conditional-select/move operations which are inspired from the XVentanaCondOps extension. In fact, QEMU RISC-V also has support for emulating Zicond extension. Let us detect Zicond extension from ISA string available through DT or ACPI. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones Reviewed-by: Conor Dooley Acked-by: Palmer Dabbelt --- 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 0f520f7d058a..6fc51c1b34cf 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -59,6 +59,7 @@ #define RISCV_ISA_EXT_ZIFENCEI 41 #define RISCV_ISA_EXT_ZIHPM 42 #define RISCV_ISA_EXT_SMSTATEEN 43 +#define RISCV_ISA_EXT_ZICOND 44 #define RISCV_ISA_EXT_MAX 64 diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 3755a8c2a9de..e3803822ab5a 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -167,6 +167,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(zicbom, RISCV_ISA_EXT_ZICBOM), __RISCV_ISA_EXT_DATA(zicboz, RISCV_ISA_EXT_ZICBOZ), __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), __RISCV_ISA_EXT_DATA(zifencei, RISCV_ISA_EXT_ZIFENCEI), __RISCV_ISA_EXT_DATA(zihintpause, RISCV_ISA_EXT_ZIHINTPAUSE), From patchwork Tue Oct 3 03:52:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13406728 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 1842CE784A8 for ; Tue, 3 Oct 2023 03:53:05 +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=QGtJ5jGR3ZgjpGy+zPalzXx+Ft9cPks5Ix6BGvIvM90=; b=CEYC7FhWmUuLtw LORsKm5k6EpwV9OpXeISmS5Z7I7QICUR72ykSxaHtOsjjNPT9vCBRavu1s9vwahwwUiCtF/a9Zo6S j06bQ7SvPXF0qLkc4ylaUr4J0n9zRQXYTf8i8zeD1qS/pG/JUp7e7hPk+hSCr7rigcxUBKu1wGTma nBgRocyDeI0mDjYzp7oSPgI5TzfKHTFywYKsZAdPBAAR8IRY0epH9fbHexsqtPT0KpAVaZuwpfCwu PcmO7jxbphktD9CuT9twW5Skxezab4DNL0uAMen//uFyf6AKRjwPCp74ZVQYDovF1h1L2D3tWOCUu o4qlM0MZzsE4tl7XWgSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qnWSx-00Dk5T-2v; Tue, 03 Oct 2023 03:52:59 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qnWSu-00Dk3L-1w for linux-riscv@lists.infradead.org; Tue, 03 Oct 2023 03:52:58 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c760b34d25so3338725ad.3 for ; Mon, 02 Oct 2023 20:52:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1696305175; x=1696909975; 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=PR9YD+pr7hv0tmO2NOz2gpQmVbaE/cJ/IAsO/LYC7Pc=; b=oIDuP1nihATFH968C21a93XFu8TAro5JTD6iJl4y7abCzPHIM8XCvZI5Ow4bSb0QnK ZDhuQ30lJeDeRg8mh4SqE6RJypzt4JhWeMOwRWyJEW047wkqn1NKavL5XmBgNG6QG/jE +GQjiKQIC2/EQVfxijskqktFluL5XLXWCiYou5docZ1PPC9AXMWNMblf1MATL7BtoCTD IZiojaVkROd/AAyW1+U3R/UFekQiXrGHcfimEsYSUKzeSMLHy6hXt2CtgLhGOuDcM+pb EXp/9D+2kUI6aGARxml8wEllWJ6FSitbAxBPmzEtYnt4nG7x9kK45qYdnX/b7+1nkbBB jVhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696305175; x=1696909975; 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=PR9YD+pr7hv0tmO2NOz2gpQmVbaE/cJ/IAsO/LYC7Pc=; b=gX1+jf+h2c3FDVZuRljgctsv+AsggZJ/XqtA9ixhUJZnMd4ZVQp7zerMjd6OqTtqkV 6SSI9i3KAE2BOJ99kN+KZaR489359EFOBQ6F8jelZDLOJd3F680fka/QyKPHwMS0ZnQc 5gCZiCVlmNLt08VZLVJRMksr2cVfc/BN2hwCNI05j4fibZb1Ne7u1cg/RiDfjmnC1RHy Q1V0n4d3yYd2IY9zKcDWG8umMiB3Q4V0LPtaJqk30MYmMVDzm/lUUrTJeDjMZoMLID9S XkPtsZGeHbGy+pZYvMbV3rQC4Vvy6kxG8tEP9DPTS7vVk9s73mSZSYSOvFcdlWFWxdAx sLOw== X-Gm-Message-State: AOJu0YzklhZPI9e5d78JrmTJJAHngp52i/5vDbFB05DN0bc/tMC8hali QIZEQ5YI/6Y5L7Hsi7qEq7X6vw== X-Google-Smtp-Source: AGHT+IHVWdwg/sK94Dq4Rgb1USUh5bXBpGZ0ZnKGbSP+03oAaRBZUxn2NXa8Zq60ZS2d7KJ4sbaXhg== X-Received: by 2002:a17:903:244d:b0:1c3:2ee6:3802 with SMTP id l13-20020a170903244d00b001c32ee63802mr13278709pls.47.1696305175387; Mon, 02 Oct 2023 20:52:55 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.84.132]) by smtp.gmail.com with ESMTPSA id ja7-20020a170902efc700b001bf846dd2d0sm277381plb.13.2023.10.02.20.52.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 20:52:54 -0700 (PDT) From: Anup Patel To: Paolo Bonzini , Atish Patra , Palmer Dabbelt , Paul Walmsley , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Shuah Khan Cc: Andrew Jones , Mayuresh Chitale , devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Anup Patel Subject: [PATCH v3 3/6] RISC-V: KVM: Allow Zicond extension for Guest/VM Date: Tue, 3 Oct 2023 09:22:23 +0530 Message-Id: <20231003035226.1945725-4-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003035226.1945725-1-apatel@ventanamicro.com> References: <20231003035226.1945725-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231002_205256_639662_C12CBF1F X-CRM114-Status: UNSURE ( 9.54 ) 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 We extend the KVM ISA extension ONE_REG interface to allow KVM user space to detect and enable Zicond extension for Guest/VM. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- 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 b1baf6f096a3..917d8cc2489e 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -138,6 +138,7 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZIFENCEI, KVM_RISCV_ISA_EXT_ZIHPM, KVM_RISCV_ISA_EXT_SMSTATEEN, + KVM_RISCV_ISA_EXT_ZICOND, KVM_RISCV_ISA_EXT_MAX, }; diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c index 388599fcf684..c6ebce6126b5 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -46,6 +46,7 @@ static const unsigned long kvm_isa_ext_arr[] = { KVM_ISA_EXT_ARR(ZICBOM), KVM_ISA_EXT_ARR(ZICBOZ), KVM_ISA_EXT_ARR(ZICNTR), + KVM_ISA_EXT_ARR(ZICOND), KVM_ISA_EXT_ARR(ZICSR), KVM_ISA_EXT_ARR(ZIFENCEI), KVM_ISA_EXT_ARR(ZIHINTPAUSE), @@ -93,6 +94,7 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) case KVM_RISCV_ISA_EXT_ZBB: case KVM_RISCV_ISA_EXT_ZBS: case KVM_RISCV_ISA_EXT_ZICNTR: + case KVM_RISCV_ISA_EXT_ZICOND: case KVM_RISCV_ISA_EXT_ZICSR: case KVM_RISCV_ISA_EXT_ZIFENCEI: case KVM_RISCV_ISA_EXT_ZIHINTPAUSE: From patchwork Tue Oct 3 03:52:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13406730 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 A51C9E776FC for ; Tue, 3 Oct 2023 03:53:11 +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=uxlXid/RWKEb9iwU10mylFGwqwsu/fJwmMOdUETDl6A=; b=ITax9LjWCpUhRP TYrZB/pQ2n0R7A/5I5amQvlWb5lo63e5K+Da2ybRC5CRqxAurhKiRS4EEn2WYmTencEr+p2js+geT 0b31A8qtzjF61Iw+1cMUsuzG3lRs+zoHPaMUE9bBKC83XCKKmvviHzAJCDv+7QbrWiTxvrzDGyTV3 UjZ2dCGEibxulYnS1lpJZux2nFFHibSy8L2/5huB44kvwP9rUHvjOL0epU93gj0dF6cmVBFWLUD7L VRaojublINKZ7qWk8xXC7HXVR++MVnTGN6voLEM1gQKRYVYjbjPmqiP7VMJOCM7jWscdAHbrJQmIC XA2VC3YdPEcDETro7PTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qnWT5-00DkA8-0p; Tue, 03 Oct 2023 03:53:07 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qnWT1-00Dk69-1a for linux-riscv@lists.infradead.org; Tue, 03 Oct 2023 03:53:04 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c736b00639so3340975ad.2 for ; Mon, 02 Oct 2023 20:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1696305180; x=1696909980; 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=qPmuiSFVvpuLv2dpw8j40AU0MURCdJR8iWnmtgcJS7I=; b=ilUJG+eUoqB2UGTNvv2T13Xwi4uUvdpXLrLPOcZNkNWr0Xdq04S7U+ss6KDykWdQus 50vLTcF0LiV7Rah8SABr4bziVVSib/Lyhjx0wF2Vm2zCA59xsP9g7XomGtFGYhXY9jD4 gNujVNlR7/tAZWOD6ayWbyDJhmiPk+AaTnbvM3XkBlwQCRzl2kLxcqZevujmMW1K4OCj fTe+3LRVa4t4bhr6d9m3Z5DZXr7oUxdz9qrukPixPabh4YekqnUTadvNvAv5KrGcnEEU DWfTgt2Q+Nm0OxHIfCuvYTmNqqx4HgaKP39cEfztBvGS37cigg6XKRBCU+U6JOacpqdc vjYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696305180; x=1696909980; 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=qPmuiSFVvpuLv2dpw8j40AU0MURCdJR8iWnmtgcJS7I=; b=BI+xMHb4xAfx/BAB+AMJQSqoaSRvpjJc64HzD8T3nxm/Dbh/wtesIeY4ORttoxDRLz Jsi1H3hm/dSwtD7zYO3sS1kAnZ3QgSbrRVAjin9aw3q1p9HnDWqacsyWEaMEg7U8AvIF Psk87zedx6OyIXTbxh1/U/i3tXslSXPE6KSeezPx63K8by266hLAheO/1d+Q1hShL2Av +w+OhVnBMOyxEHIJiPXfcaho3D/JuYMzjl+FS9C4RQvqwmWSdxgZoQlf0dJNnIrW2FIr CA6RXrF8gH3GV3Npzk8whsx7CM9fsvnZaS+IsR2n8rpmmUJz2Px6FN1l7zBtoIj6cPga 04RQ== X-Gm-Message-State: AOJu0YxHOSTBFvMgQykdmEA5u9gUnSquoZ9Ux/Irp0rMtdZfOVl2w6oa aHZ1Y9edS2pEhICW5/3hyMZvNA== X-Google-Smtp-Source: AGHT+IHam7uEpuZxRNzndfsTMEK/VL2fjCzPC87o5phTd4UvXj5ySMEaSTGduC8zgkkya1ayeGrlQQ== X-Received: by 2002:a17:903:2305:b0:1c6:e4b:bbeb with SMTP id d5-20020a170903230500b001c60e4bbbebmr13020119plh.56.1696305180186; Mon, 02 Oct 2023 20:53:00 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.84.132]) by smtp.gmail.com with ESMTPSA id ja7-20020a170902efc700b001bf846dd2d0sm277381plb.13.2023.10.02.20.52.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 20:52:59 -0700 (PDT) From: Anup Patel To: Paolo Bonzini , Atish Patra , Palmer Dabbelt , Paul Walmsley , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Shuah Khan Cc: Andrew Jones , Mayuresh Chitale , devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Anup Patel Subject: [PATCH v3 4/6] KVM: riscv: selftests: Add senvcfg register to get-reg-list test Date: Tue, 3 Oct 2023 09:22:24 +0530 Message-Id: <20231003035226.1945725-5-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003035226.1945725-1-apatel@ventanamicro.com> References: <20231003035226.1945725-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231002_205303_535928_B73E7769 X-CRM114-Status: UNSURE ( 9.89 ) 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 We have a new senvcfg register in the general CSR ONE_REG interface so let us add it to get-reg-list test. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c index a61b706a8778..6cec0ef75cc7 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -211,6 +211,8 @@ static const char *general_csr_id_to_str(__u64 reg_off) return RISCV_CSR_GENERAL(satp); case KVM_REG_RISCV_CSR_REG(scounteren): return RISCV_CSR_GENERAL(scounteren); + case KVM_REG_RISCV_CSR_REG(senvcfg): + return RISCV_CSR_GENERAL(senvcfg); } TEST_FAIL("Unknown general csr reg: 0x%llx", reg_off); @@ -540,6 +542,7 @@ static __u64 base_regs[] = { KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_CSR | KVM_REG_RISCV_CSR_GENERAL | KVM_REG_RISCV_CSR_REG(sip), KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_CSR | KVM_REG_RISCV_CSR_GENERAL | KVM_REG_RISCV_CSR_REG(satp), KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_CSR | KVM_REG_RISCV_CSR_GENERAL | KVM_REG_RISCV_CSR_REG(scounteren), + KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_CSR | KVM_REG_RISCV_CSR_GENERAL | KVM_REG_RISCV_CSR_REG(senvcfg), KVM_REG_RISCV | KVM_REG_SIZE_U64 | KVM_REG_RISCV_TIMER | KVM_REG_RISCV_TIMER_REG(frequency), KVM_REG_RISCV | KVM_REG_SIZE_U64 | KVM_REG_RISCV_TIMER | KVM_REG_RISCV_TIMER_REG(time), KVM_REG_RISCV | KVM_REG_SIZE_U64 | KVM_REG_RISCV_TIMER | KVM_REG_RISCV_TIMER_REG(compare), From patchwork Tue Oct 3 03:52:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13406731 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 4D9C2E776FC for ; Tue, 3 Oct 2023 03:53:15 +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=u3YE5uLDWCEHnULrJIV2S61Lyll10Ny4W2v/bNXng0k=; b=Bagq2pWmt14Yhm h0wPa6B1DX3vda7qfWeFUrZagMICjONi/n5Uwji9RKGHvSDBgGQx3hmvKwIQuLEIrSznA1vcEumqq YAbcn6vGG1X4qQ4McTSBuVk2uaC6J3eBma/HZaRk6vLgY+7LLp3B3qmnp/uI/WTArV2/Wx4xVc7GJ xP8C95V5CitytWEiEX136SFh//S6U+ulEyjZdvGcQ8z31gF+VE3uNL6wLdPrleOUj4oy3FFGryd2O BiwXDyBNQtSftxBaiaCDm5/H8GKJ5ddaH+bheeBZKWbjzyCLgmXhPoltfkw7QJ3U3wd/wF9gV/TQ7 HRey2abN7MHWJ31//5Bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qnWT7-00DkCN-2s; Tue, 03 Oct 2023 03:53:09 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qnWT4-00Dk90-0f for linux-riscv@lists.infradead.org; Tue, 03 Oct 2023 03:53:08 +0000 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1c3f97f2239so3767455ad.0 for ; Mon, 02 Oct 2023 20:53:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1696305185; x=1696909985; 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=uNHkjMM9HHYX8X83JcKOMwoHgKf/W4d95vsynq44CKo=; b=Om689eErAVSI/MNiqZ+OVtAELdSWt2Lj44UP2XQlw6SHzB1eTcrz2+Y2Z2wJdMxYkZ 6PZMzf6qXpXbnl50//KtFy4w3Qekulfn1rsFyDamb/iltSQkiIVBHv/7KFxlqSMbMyLN CEPUjNbYTDlbVgj4FtD40r9qGwTl+yX4m0NqbuXuz7XA3X+9dBcQXWLZEBM5lSzEXwYS 2qK7hcMQfnIdp/ebm76bo3WEabA1JiFRrNrnmAaSVVJJNer2NAZJIm0DxirdVnemWJoE 3OiUpoE2f6zSota9HhFnUlWCyafDyys7YyphJU5SiSF7FYOYPYhhKZ9KiIGyRA5vkSMi jqYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696305185; x=1696909985; 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=uNHkjMM9HHYX8X83JcKOMwoHgKf/W4d95vsynq44CKo=; b=xP7IOgFLJzHicG7Kg5bh1fCOyAWbsIhkNBKgpFjfWvsxqgtEMLkf0tv/ILMlv++cbf GNHyjW2kfq4X3PZhHjTP3Lso7OObHZETTDmR1rQKlV7ozZNCv3Qv9+HJy4u227ygeyrx scFqJttMyaszcudgyGRo0SREw9A4kFb481V5mIP+pyInTM/vY/N7xN085+h8jIxP416m 3R4ns9yuMTG3BnxREORrSI4PXsTja2/POxlND4zd+5/OSq0q4PFlAWdW08B6E8bw8a3S 2GcUCK5AhGti73Xb9tVV0Zf0Rey73CV8rTU345xgpizEy84CIS9lgrs/T44Dp38GOu3F bYBA== X-Gm-Message-State: AOJu0YxwF8XHwFEXTxdHFh/dGe4yUJYu9w0hgxQoEuVia3xg4OgoCZRl DNN7ANathV8zCuyGf63V4Q3HQA== X-Google-Smtp-Source: AGHT+IH9oz/kuIZIp/ZgruyeZ4AtQo9yUx4+ANVBCHNlKxlrjpKUWGdvAqvEer5x/ZfYlM6knxcDrg== X-Received: by 2002:a17:903:2309:b0:1bd:d911:2a85 with SMTP id d9-20020a170903230900b001bdd9112a85mr16292011plh.12.1696305185046; Mon, 02 Oct 2023 20:53:05 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.84.132]) by smtp.gmail.com with ESMTPSA id ja7-20020a170902efc700b001bf846dd2d0sm277381plb.13.2023.10.02.20.53.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 20:53:04 -0700 (PDT) From: Anup Patel To: Paolo Bonzini , Atish Patra , Palmer Dabbelt , Paul Walmsley , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Shuah Khan Cc: Andrew Jones , Mayuresh Chitale , devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Anup Patel Subject: [PATCH v3 5/6] KVM: riscv: selftests: Add smstateen registers to get-reg-list test Date: Tue, 3 Oct 2023 09:22:25 +0530 Message-Id: <20231003035226.1945725-6-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003035226.1945725-1-apatel@ventanamicro.com> References: <20231003035226.1945725-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231002_205306_242871_1AFECC68 X-CRM114-Status: GOOD ( 12.12 ) 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 We have a new smstateen registers as separate sub-type of CSR ONE_REG interface so let us add these registers to get-reg-list test. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- .../selftests/kvm/riscv/get-reg-list.c | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c index 6cec0ef75cc7..625118d53b74 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -36,6 +36,7 @@ bool filter_reg(__u64 reg) case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_I: case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_M: case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_V: + case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_SMSTATEEN: case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_SSAIA: case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_SSTC: case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_SVINVAL: @@ -186,6 +187,8 @@ static const char *core_id_to_str(const char *prefix, __u64 id) "KVM_REG_RISCV_CSR_GENERAL | KVM_REG_RISCV_CSR_REG(" #csr ")" #define RISCV_CSR_AIA(csr) \ "KVM_REG_RISCV_CSR_AIA | KVM_REG_RISCV_CSR_REG(" #csr ")" +#define RISCV_CSR_SMSTATEEN(csr) \ + "KVM_REG_RISCV_CSR_SMSTATEEN | KVM_REG_RISCV_CSR_REG(" #csr ")" static const char *general_csr_id_to_str(__u64 reg_off) { @@ -243,6 +246,18 @@ static const char *aia_csr_id_to_str(__u64 reg_off) return NULL; } +static const char *smstateen_csr_id_to_str(__u64 reg_off) +{ + /* reg_off is the offset into struct kvm_riscv_smstateen_csr */ + switch (reg_off) { + case KVM_REG_RISCV_CSR_SMSTATEEN_REG(sstateen0): + return RISCV_CSR_SMSTATEEN(sstateen0); + } + + TEST_FAIL("Unknown smstateen csr reg: 0x%llx", reg_off); + return NULL; +} + static const char *csr_id_to_str(const char *prefix, __u64 id) { __u64 reg_off = id & ~(REG_MASK | KVM_REG_RISCV_CSR); @@ -255,6 +270,8 @@ static const char *csr_id_to_str(const char *prefix, __u64 id) return general_csr_id_to_str(reg_off); case KVM_REG_RISCV_CSR_AIA: return aia_csr_id_to_str(reg_off); + case KVM_REG_RISCV_CSR_SMSTATEEN: + return smstateen_csr_id_to_str(reg_off); } TEST_FAIL("%s: Unknown csr subtype: 0x%llx", prefix, reg_subtype); @@ -332,6 +349,7 @@ static const char *isa_ext_id_to_str(__u64 id) KVM_ISA_EXT_ARR(I), KVM_ISA_EXT_ARR(M), KVM_ISA_EXT_ARR(V), + KVM_ISA_EXT_ARR(SMSTATEEN), KVM_ISA_EXT_ARR(SSAIA), KVM_ISA_EXT_ARR(SSTC), KVM_ISA_EXT_ARR(SVINVAL), @@ -637,6 +655,11 @@ static __u64 aia_regs[] = { KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_SSAIA, }; +static __u64 smstateen_regs[] = { + KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_CSR | KVM_REG_RISCV_CSR_SMSTATEEN | KVM_REG_RISCV_CSR_SMSTATEEN_REG(sstateen0), + KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_SMSTATEEN, +}; + static __u64 fp_f_regs[] = { KVM_REG_RISCV | KVM_REG_SIZE_U32 | KVM_REG_RISCV_FP_F | KVM_REG_RISCV_FP_F_REG(f[0]), KVM_REG_RISCV | KVM_REG_SIZE_U32 | KVM_REG_RISCV_FP_F | KVM_REG_RISCV_FP_F_REG(f[1]), @@ -744,6 +767,8 @@ static __u64 fp_d_regs[] = { {"zihpm", .feature = KVM_RISCV_ISA_EXT_ZIHPM, .regs = zihpm_regs, .regs_n = ARRAY_SIZE(zihpm_regs),} #define AIA_REGS_SUBLIST \ {"aia", .feature = KVM_RISCV_ISA_EXT_SSAIA, .regs = aia_regs, .regs_n = ARRAY_SIZE(aia_regs),} +#define SMSTATEEN_REGS_SUBLIST \ + {"smstateen", .feature = KVM_RISCV_ISA_EXT_SMSTATEEN, .regs = smstateen_regs, .regs_n = ARRAY_SIZE(smstateen_regs),} #define FP_F_REGS_SUBLIST \ {"fp_f", .feature = KVM_RISCV_ISA_EXT_F, .regs = fp_f_regs, \ .regs_n = ARRAY_SIZE(fp_f_regs),} @@ -871,6 +896,14 @@ static struct vcpu_reg_list aia_config = { }, }; +static struct vcpu_reg_list smstateen_config = { + .sublists = { + BASE_SUBLIST, + SMSTATEEN_REGS_SUBLIST, + {0}, + }, +}; + static struct vcpu_reg_list fp_f_config = { .sublists = { BASE_SUBLIST, @@ -903,6 +936,7 @@ struct vcpu_reg_list *vcpu_configs[] = { &zifencei_config, &zihpm_config, &aia_config, + &smstateen_config, &fp_f_config, &fp_d_config, }; From patchwork Tue Oct 3 03:52:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13406732 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 4D16CE776FC for ; Tue, 3 Oct 2023 03:53: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=vvWHO6e4qTaclJLtfnRgLErjIqon4IyJ4Jpr7WaMtGo=; b=v6mN0aT3jOHVWL Rx3+7L7qAl8Jp1zvi+PNHt0QYI2FgX8+UV9Cx9LVZ8OH74gWLuoZYarfg1PSzAekFfIA8gX6sqtWC e9spZ4KvVry+spXIyGQ+7IbKkjwAUwWD8YJEc4Jy7zPfo1yXkxC8cMCimHUa1JuCreQ+MnLtIRROL ODYpIq9euWRqfQ14l/kUP6C03X5tDlArRLVyBuPBc3pE0OgX1Shvr1QlOd8tT1ILX2LuPFB3NOdGW GiH1RpOYS2FsIdW9i0GXfzneeD1TQ8cZf2YZGqpniPJMJLE0bPeI9PX0I4RJoRTuHNqGOZMqCq7tM eiGwWMZPmC0ys3K2RgTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qnWTC-00DkFu-11; Tue, 03 Oct 2023 03:53:14 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qnWT9-00DkCl-0Y for linux-riscv@lists.infradead.org; Tue, 03 Oct 2023 03:53:13 +0000 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5855333fbadso272450a12.1 for ; Mon, 02 Oct 2023 20:53:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1696305190; x=1696909990; 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=wscE/VATjNkVY1Hz8a3BGt+QWcAqJYfhFG+cRpEMwCY=; b=ExfpOmG72ZMeCRxZWozN/JIEgSxP+/Ba2aqBMGqNhgzIsJKaQaZXZN4Q8E5YbMD8/5 tq4jhi/0wBFo6JNwWaS4NNd/oTt7KZWj5KNAoaSV3Otv38bE4bbYnrCUkoeajaRMHprE 0nNVtD0KHrNgDyLH6xydpGSeEzn4zCQLNknPEV/n+JoY4A7VNaKD3w1c9Us5AIGTCNvF mfgoi3ztvVHMOVtGHrkpYvwltIL17lRPGC7m+yicOlXPL8azZz2JTJyLHsEJgFqW6Lxf j4NkFcei0qOyF6AU4QFFzUi9Ki0TU1dBPrWxZmmgWMY7/EHCFNjhDeFY5n1ZJpi3ishK mshA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696305190; x=1696909990; 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=wscE/VATjNkVY1Hz8a3BGt+QWcAqJYfhFG+cRpEMwCY=; b=jmNj0TC9FZJXQEONumdeTtQ4UX/yCuxIRCZyAlaESk/I+YqKfgZot+eSxMl4kryjR2 HQV5elEDK53GGcjJVsd1voiY5gApuGC0eULbOys7RPr6mvYsqiEzLLjHVcYgZR4KhDIG 0NxhIf2zrbD6z0rdZY9Qn4UjpGfZOvNISOEvYz5He/2dM2MEups5i2Pge65+TJeYN//w 6GEtcxdwCCxBHhCZbnAO6WyEOwmSJZRYoOQ+wsArRBW7M37LrzPctzH+nq34c9es/ycG lGUfSydd7MGzJAX05DH7YTTRnuTAPPCGUdQWVVv1V/wnGAsXiBtiLB3HQFmumW4K/895 xyqg== X-Gm-Message-State: AOJu0Yw31adz6crt9FE4HD8iSEgKL2FXAKcPFtegd7oRkTBPNI/T68mB MfVvW/GOuOIVAh47AV4793MPvK5SLNMTpgzwC+8= X-Google-Smtp-Source: AGHT+IGkzr82JWDhLVFUCV6JSAUgaCxQMIRqm/FYTV446+qx3qJIHp1jBs7+mM31fhfiKw48k352OQ== X-Received: by 2002:a17:902:c40a:b0:1c7:5a63:43bb with SMTP id k10-20020a170902c40a00b001c75a6343bbmr7861019plk.8.1696305190011; Mon, 02 Oct 2023 20:53:10 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.84.132]) by smtp.gmail.com with ESMTPSA id ja7-20020a170902efc700b001bf846dd2d0sm277381plb.13.2023.10.02.20.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 20:53:09 -0700 (PDT) From: Anup Patel To: Paolo Bonzini , Atish Patra , Palmer Dabbelt , Paul Walmsley , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Shuah Khan Cc: Andrew Jones , Mayuresh Chitale , devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Anup Patel Subject: [PATCH v3 6/6] KVM: riscv: selftests: Add condops extensions to get-reg-list test Date: Tue, 3 Oct 2023 09:22:26 +0530 Message-Id: <20231003035226.1945725-7-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003035226.1945725-1-apatel@ventanamicro.com> References: <20231003035226.1945725-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231002_205311_223257_24DFCA48 X-CRM114-Status: GOOD ( 11.03 ) 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 We have a new conditional operations related ISA extensions so let us add these extensions to get-reg-list test. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- .../testing/selftests/kvm/riscv/get-reg-list.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c index 625118d53b74..77dc5221c465 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -48,6 +48,7 @@ bool filter_reg(__u64 reg) case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZICBOM: case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZICBOZ: case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZICNTR: + case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZICOND: case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZICSR: case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZIFENCEI: case KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZIHINTPAUSE: @@ -361,6 +362,7 @@ static const char *isa_ext_id_to_str(__u64 id) KVM_ISA_EXT_ARR(ZICBOM), KVM_ISA_EXT_ARR(ZICBOZ), KVM_ISA_EXT_ARR(ZICNTR), + KVM_ISA_EXT_ARR(ZICOND), KVM_ISA_EXT_ARR(ZICSR), KVM_ISA_EXT_ARR(ZIFENCEI), KVM_ISA_EXT_ARR(ZIHINTPAUSE), @@ -632,6 +634,10 @@ static __u64 zicntr_regs[] = { KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZICNTR, }; +static __u64 zicond_regs[] = { + KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZICOND, +}; + static __u64 zicsr_regs[] = { KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_ISA_EXT | KVM_RISCV_ISA_EXT_ZICSR, }; @@ -759,6 +765,8 @@ static __u64 fp_d_regs[] = { {"zbs", .feature = KVM_RISCV_ISA_EXT_ZBS, .regs = zbs_regs, .regs_n = ARRAY_SIZE(zbs_regs),} #define ZICNTR_REGS_SUBLIST \ {"zicntr", .feature = KVM_RISCV_ISA_EXT_ZICNTR, .regs = zicntr_regs, .regs_n = ARRAY_SIZE(zicntr_regs),} +#define ZICOND_REGS_SUBLIST \ + {"zicond", .feature = KVM_RISCV_ISA_EXT_ZICOND, .regs = zicond_regs, .regs_n = ARRAY_SIZE(zicond_regs),} #define ZICSR_REGS_SUBLIST \ {"zicsr", .feature = KVM_RISCV_ISA_EXT_ZICSR, .regs = zicsr_regs, .regs_n = ARRAY_SIZE(zicsr_regs),} #define ZIFENCEI_REGS_SUBLIST \ @@ -864,6 +872,14 @@ static struct vcpu_reg_list zicntr_config = { }, }; +static struct vcpu_reg_list zicond_config = { + .sublists = { + BASE_SUBLIST, + ZICOND_REGS_SUBLIST, + {0}, + }, +}; + static struct vcpu_reg_list zicsr_config = { .sublists = { BASE_SUBLIST, @@ -932,6 +948,7 @@ struct vcpu_reg_list *vcpu_configs[] = { &zbb_config, &zbs_config, &zicntr_config, + &zicond_config, &zicsr_config, &zifencei_config, &zihpm_config,