From patchwork Tue Apr 23 12:43:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13640015 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 4FD47C4345F for ; Tue, 23 Apr 2024 12:44: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=uqjEX74ZSFcVJNMndL3tkwpvAGc4/v96nmrSiWbuBx4=; b=Lo1XpPU0SEYagz LxH/OMvB1M7Uim9VYIdzsh0KZL8Xtscxp9PZdxhcTfJxJ0KLoOIlSPrGJa4GYld/TEE6poiWlBebb BOhUH+35t8xtG9dCTCVEGQktTtqS4eAQOAMhZr8waJSd54VwijWv3OUgNLfipygSCf8PjhKmKItQg OhfamIVqoqVTOyZlOy4buB5l3wh7AzbzgJiC7Fi2AJeVGqkWef08oo89tHw9UZKvvY4NHiCqRg0Ss XjnnfcSnw9hpJe0wWLiillw761Zh7EjFRnRkGOTFbQGHXHMyQUTE6TGKsfFV51y5OFMHCp4rpzw+m 3AqRykNm/4LHgxsFgA/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFV5-0000000HSVP-1nUQ; Tue, 23 Apr 2024 12:43:56 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFUt-0000000HSLs-2qPm for linux-riscv@lists.infradead.org; Tue, 23 Apr 2024 12:43:46 +0000 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-349fd1d3723so1073674f8f.0 for ; Tue, 23 Apr 2024 05:43:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713876221; x=1714481021; 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=RY9X4nU5k+rqVQBtsNRF5VBDE3a2qL0GG+JxaikfjBk=; b=HWpTaqo010Jpjy9nMfLU+qmPE7UPL2AgN/dYowDCVikCL/Wm9u9ss/Nn34VI7oTj/H 6xV8211colBxj8J23YVvKkjJsSlaQEXj/FubhKWSN4ZOHzrAh2dHgPGdZQzF/4g1gCJI fcOK3xAF0fOcNKmjIWrq8gC1JdEjR24oGlDI1WqZvta3EFvrjFvAVhrF+y7wyFaioV+e prrBtzV56ifmkYtc6CZKbSzB/b2j/Y137S3sU3CvC40WVMr1uamJ8Nzl6RVdHpbv6UtD Za6cwsPJhPZUE6HbVNyjzPghEFodV54rV7KJGtcM2kbrCAOWrcselQXMkJts/BnPfFTv XjYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713876221; x=1714481021; 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=RY9X4nU5k+rqVQBtsNRF5VBDE3a2qL0GG+JxaikfjBk=; b=bbRxNwDfni3o+crcI3Tt4GPAiPLms3XneehkfCaFxMb/59MV59Z3yfDWNkq2iewvf6 0QyzATOrOHCuktRBHTupxFeDkoCNY1ptXdRylPeAQOOZfIaG18vSpL2i5Fzok82b8E8r tHkETxNTeljARS3kktrfLSEaQ2SDTJ0DHt7yVOWfQIkGKcvUKBZGx2sFKhHX3Q4M10Jc cvoAbw0E8AuDcQS1MxaE0Ztka6lj6tT+yBqEvalipOzieqi79A+cShYohySJO1l3IfmE Sc5BBxz/8D6DMYP1e88RoFUhvZ5vTRVBhDmJAXWvrmWQ7D8ID3YQnrAu2Eq0O8TmH7K2 RM8A== X-Forwarded-Encrypted: i=1; AJvYcCUo1Ed9gMZOWL3Kfbc/lJbfydcccEodiluaUVdqV8i4nhuZl5dRZF5jT5nfvB2IBfPrlvqu+3qZYNJxy+sKT7vo7FqjBj4Q06BLGaxov3pm X-Gm-Message-State: AOJu0YxKz03PXhSh6LriRjg/VhVOpqsolYXznr4JHvf8dI4i6cFqCWEV 1Wrw0rHzB6N63+8eKFRyftOx6xMFeXbm4aktAL8BVBBAXeu6lSPPxg4aFmnWLgY= X-Google-Smtp-Source: AGHT+IGBgbRJ8rS0V6sOY/Pp3/+7YVKywNh0XxOcXpBBLcmpeUTMJ3+uEL+uOgTO/2ehZ+OVVYWaaA== X-Received: by 2002:adf:f850:0:b0:346:408d:42e6 with SMTP id d16-20020adff850000000b00346408d42e6mr8871797wrq.2.1713876221498; Tue, 23 Apr 2024 05:43:41 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:71cb:1f75:7053:849c]) by smtp.gmail.com with ESMTPSA id v10-20020a05600c470a00b00418a386c059sm19975709wmo.42.2024.04.23.05.43.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:43:40 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, Conor Dooley Subject: [PATCH v3 01/11] dt-bindings: riscv: add Zca, Zcf, Zcd and Zcb ISA extension description Date: Tue, 23 Apr 2024 14:43:15 +0200 Message-ID: <20240423124326.2532796-2-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240423124326.2532796-1-cleger@rivosinc.com> References: <20240423124326.2532796-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_054343_800101_20FEF25A X-CRM114-Status: GOOD ( 10.52 ) 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 --- .../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 616370318a66..81bce4fa2424 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 @@ -489,5 +521,51 @@ properties: Registers in the AX45MP datasheet. https://www.andestech.com/wp-content/uploads/AX45MP-1C-Rev.-5.0.0-Datasheet.pdf + allOf: + # Zcb depends on Zca + - if: + contains: + const: zcb + then: + contains: + const: zca + # Zcd depends on Zca and D + - if: + contains: + const: zcd + then: + allOf: + - contains: + const: zca + - contains: + const: d + # Zcf depends on Zca and F + - if: + contains: + const: zcf + then: + allOf: + - contains: + const: zca + - contains: + const: f + +allOf: + # Zcf extension does not exist on rv64 + - if: + properties: + riscv,isa-extensions: + contains: + const: zcf + riscv,isa-base: + contains: + const: rv64i + then: + properties: + riscv,isa-extensions: + not: + contains: + const: zcf + additionalProperties: true ... From patchwork Tue Apr 23 12:43:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13640016 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 EA842C4345F for ; Tue, 23 Apr 2024 12:44:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cBbD2jgdPIXWHqV+WutJLGcgCLP1Eg66C2+pyo1J+7g=; b=js/Dd8fvdSYATk /AtuEwi9ArDotTh0lGDmni49GMZEzZB8YaWa5KNpFfI6aH86vgFtL0fbnANQNtFh4+wlXGkTSR+J1 MdmfqUWwzUqADwGNTS4ij9h09ASh1KoDxLc2JzBtgY7akWujo6OdeRrmbqreXl4Rg76roOmqfXRjt wTbPGUdyp0IYFmvGhZ2TjL718erXf64MxhDAsC+rlMEmByUAjRmFJzhNVU/in4wO+FC2T1rUIqHM9 +9EDms23zE0i8M9EsJUafHAScvcuBYqQLem6C4bW+gBmmtAjmQtX8vP1kCvA3yv4Xzx1JftNvzX/k HGmIUSkRrKP8+eFh65mA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFVD-0000000HSc1-0KM4; Tue, 23 Apr 2024 12:44:03 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFUu-0000000HSMO-3YBd for linux-riscv@lists.infradead.org; Tue, 23 Apr 2024 12:43:47 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-346a5dea2f4so1223471f8f.1 for ; Tue, 23 Apr 2024 05:43:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713876223; x=1714481023; 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=HsdoYA/OHWBDv08MRhgCHOKDJWz5fs7YbSsaVblu9P0=; b=btZLodgRmDom71GxsoqCjzHbEe/Zs7FlCOMYzrRhmmMmTSfxHiQlrGT/P+viHYi7P0 VSkQPOWfQa8xi5ci/yz7hqmKap4KO/UeqAZOH93iE8c+9hNtFxXPiOPuM5b6zu1Owlk/ r1XM+HVE5l0XLjccttnDyKrxXH+vL1BtT7PR0yVnxoNDBmZ44MaD3+6FF3FX5DKniRgg J2mykOA+LCPGCFP1px1TGkFmbjdve9x0RvzLJqKo6qECc25VAiycwKHfmSENxxCfp0Gj 1B0C4oPQYt2YBRG5eMVR4XsggCsDWkyrU1+jXqy4cqciFjPkIZVJuYPO8aCeXFlIMyO1 BSYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713876223; x=1714481023; 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=HsdoYA/OHWBDv08MRhgCHOKDJWz5fs7YbSsaVblu9P0=; b=KWyCdvDT7KWXNz7yIxrhOizGicS8lBpUIdA5Urm6zaMuXcLFLPt6dSj6pYDGOkwhVP Jgwcd5uk5OgZmklerrM8zbJBsfpXgYnLohRT065vohFF87HX/tgucW17tAlZC41cbhr2 FeV5xbEjPO+eFUEJLsSj5/FxL1130nqfBMI3G8ype7r1t67fL4HBojitAMv83tSQbyV7 nUDNtsZGzPqXTV3NUiz4A2ZVshMuSgmc23PUIVxMYzT763pONWJpFBZloa/2sLx9V9yW DLB9lFO+CEsxVEbJr4GvsGLwfqj5YgLGHu53UNeGVsSx5SZkEQVVkPb3L1KvBqz6oKKg 9nSQ== X-Forwarded-Encrypted: i=1; AJvYcCW9/QcxV4CcLrwwP6K3dtR/tR9k/l8qtcAWDmUyZMcwHLuD8SO6uxRADEfVM5NgC5mIzxCney+9vCTYk64xVptMSoqRnODkgo4JbdE5Ed06 X-Gm-Message-State: AOJu0YxuBeS8vrSDMbx0wPlqwgw4ec6cS2iRE3psEPH0C2EEm/OUbVtB 72ub9uivcJm33h8n3QQcKHohgQv+5ycYUn6rMUI5aeDp3QwI4thfb55LYHXI9XA= X-Google-Smtp-Source: AGHT+IGFB23sRUNbye0X+w1SWPXym1/kF/MR46maclAGdW8ndAuXPYIIGn9rsEBZcFOpIbfIEMjHmA== X-Received: by 2002:a05:600c:1c27:b0:41a:c4fe:b0a6 with SMTP id j39-20020a05600c1c2700b0041ac4feb0a6mr1112231wms.4.1713876222917; Tue, 23 Apr 2024 05:43:42 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:71cb:1f75:7053:849c]) by smtp.gmail.com with ESMTPSA id v10-20020a05600c470a00b00418a386c059sm19975709wmo.42.2024.04.23.05.43.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:43:42 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 02/11] riscv: add ISA extensions validation Date: Tue, 23 Apr 2024 14:43:16 +0200 Message-ID: <20240423124326.2532796-3-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240423124326.2532796-1-cleger@rivosinc.com> References: <20240423124326.2532796-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_054344_980687_91DFFEC5 X-CRM114-Status: GOOD ( 25.72 ) 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 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 temporary bitmap before enabling it in the final isa bitmap. This process takes place until the final isa bitmap reaches 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 --- arch/riscv/include/asm/cpufeature.h | 1 + arch/riscv/kernel/cpufeature.c | 201 ++++++++++++++++------------ 2 files changed, 118 insertions(+), 84 deletions(-) diff --git a/arch/riscv/include/asm/cpufeature.h b/arch/riscv/include/asm/cpufeature.h index 347805446151..328f895f6b8f 100644 --- a/arch/riscv/include/asm/cpufeature.h +++ b/arch/riscv/include/asm/cpufeature.h @@ -70,6 +70,7 @@ struct riscv_isa_ext_data { const char *property; const unsigned int *subset_ext_ids; const unsigned int subset_ext_size; + bool (*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 115ba001f1bc..6d238c8dbccf 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -72,51 +72,62 @@ 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 bool riscv_isa_extension_valid(int id) { - 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 id != RISCV_ISA_EXT_INVALID; +} + +static bool riscv_ext_zicbom_validate(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ + if (!riscv_cbom_block_size) { + pr_err_once("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_once("Zicbom disabled as cbom-block-size present," + "but is not a power-of-2\n"); return false; } + return true; +} +static bool riscv_ext_zicboz_validate(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ + if (!riscv_cboz_block_size) { + pr_err_once("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_once("Zicboz disabled as cboz-block-size present," + "but is not a power-of-2\n"); + return false; + } return true; } -#define _RISCV_ISA_EXT_DATA(_name, _id, _subset_exts, _subset_exts_size) { \ - .name = #_name, \ - .property = #_name, \ - .id = _id, \ - .subset_ext_ids = _subset_exts, \ - .subset_ext_size = _subset_exts_size \ +#define _RISCV_ISA_EXT_DATA(_name, _id, _subset_exts, _subset_exts_size, _validate) { \ + .name = #_name, \ + .property = #_name, \ + .id = _id, \ + .subset_ext_ids = _subset_exts, \ + .subset_ext_size = _subset_exts_size, \ + .validate = _validate \ } -#define __RISCV_ISA_EXT_DATA(_name, _id) _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0) +#define __RISCV_ISA_EXT_DATA(_name, _id) _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0, NULL) /* Used to declare pure "lasso" extension (Zk for instance) */ #define __RISCV_ISA_EXT_BUNDLE(_name, _bundled_exts) \ - _RISCV_ISA_EXT_DATA(_name, RISCV_ISA_EXT_INVALID, _bundled_exts, ARRAY_SIZE(_bundled_exts)) + _RISCV_ISA_EXT_DATA(_name, RISCV_ISA_EXT_INVALID, _bundled_exts, \ + ARRAY_SIZE(_bundled_exts), NULL) /* Used to declare extensions that are a superset of other extensions (Zvbb for instance) */ #define __RISCV_ISA_EXT_SUPERSET(_name, _id, _sub_exts) \ - _RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts)) + _RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), NULL) +#define __RISCV_ISA_EXT_SUPERSET_VALIDATE(_name, _id, _sub_exts, _validate) \ + _RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), _validate) static const unsigned int riscv_zk_bundled_exts[] = { RISCV_ISA_EXT_ZBKB, @@ -247,8 +258,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), @@ -310,33 +323,70 @@ 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); - } + /* + * This is valid even for bundle extensions which uses the RISCV_ISA_EXT_INVALID id + * (rejected by riscv_isa_extension_valid()). + */ + if (riscv_isa_extension_valid(ext->id)) + set_bit(ext->id, bitmap); + + for (int i = 0; i < ext->subset_ext_size; i++) { + if (riscv_isa_extension_valid(ext->subset_ext_ids[i])) + set_bit(ext->subset_ext_ids[i], bitmap); + } +} + +static void __init riscv_resolve_isa(const unsigned long *isa_bitmap, struct riscv_isainfo *isainfo, + unsigned long *this_hwcap, unsigned long *isa2hwcap) +{ + const struct riscv_isa_ext_data *ext; + DECLARE_BITMAP(prev_bitmap, RISCV_ISA_EXT_MAX); + int max_loop_count = riscv_isa_ext_count + 1; + + do { + if (max_loop_count-- < 0) { + pr_err("Failed to reach a stable ISA state\n"); + return; } + memcpy(prev_bitmap, isainfo->isa, sizeof(prev_bitmap)); + for (int i = 0; i < riscv_isa_ext_count; i++) { + ext = &riscv_isa_ext[i]; + + /* Bundle extensions ids are invalid*/ + if (!riscv_isa_extension_valid(ext->id)) + continue; + + if (!test_bit(ext->id, isa_bitmap) || test_bit(ext->id, isainfo->isa)) + continue; + + if (ext->validate && !ext->validate(ext, isainfo->isa)) + continue; - /* - * 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); + + /* Only single letter extensions get set in hwcap */ + if (ext->id < RISCV_ISA_EXT_BASE) + *this_hwcap |= isa2hwcap[ext->id]; + } + } while (memcmp(prev_bitmap, isainfo->isa, sizeof(prev_bitmap))); +} + +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_resolve_isa_string(const char *isa, unsigned long *bitmap) { /* * For all possible cpus, we have already validated in @@ -349,7 +399,7 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc while (*isa) { const char *ext = isa++; const char *ext_end = isa; - bool ext_long = false, ext_err = false; + bool ext_err = false; switch (*ext) { case 's': @@ -389,7 +439,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; @@ -469,17 +518,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); } } @@ -501,6 +541,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(isa_bitmap, RISCV_ISA_EXT_MAX) = { 0 }; if (acpi_disabled) { node = of_cpu_device_node_get(cpu); @@ -523,7 +564,7 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap) } } - riscv_parse_isa_string(&this_hwcap, isainfo, isa2hwcap, isa); + riscv_resolve_isa_string(isa, isa_bitmap); /* * These ones were as they were part of the base ISA when the @@ -531,10 +572,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, isa_bitmap); + set_bit(RISCV_ISA_EXT_ZIFENCEI, isa_bitmap); + set_bit(RISCV_ISA_EXT_ZICNTR, isa_bitmap); + set_bit(RISCV_ISA_EXT_ZIHPM, isa_bitmap); } /* @@ -548,9 +589,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, isa_bitmap); } + riscv_resolve_isa(isa_bitmap, isainfo, &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 @@ -579,6 +622,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(isa_bitmap, RISCV_ISA_EXT_MAX) = { 0 }; cpu_node = of_cpu_device_node_get(cpu); if (!cpu_node) { @@ -598,22 +642,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, isa_bitmap); } + riscv_resolve_isa(isa_bitmap, isainfo, &this_hwcap, isa2hwcap); + of_node_put(cpu_node); /* From patchwork Tue Apr 23 12:43:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13640017 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 2CE0EC4345F for ; Tue, 23 Apr 2024 12:44:12 +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=MPAL+0OFbs79yf5DsHPOUTB5a8K/LWqHqGVnrF+1YJQ=; b=Whf77boMjRGmOr rgXzvrKeB+eX8E3XM8f/d89//TlXCkGxTpIBaS9LVJBPqyrYCE65fPrHdFI3WNs7egHtD7+KN6GAM 9muUAB7gPr6lzIfiO9B2pTNfqEeElSrFc9sncx9DA0ajJNt/EStzLbnpx/Wl+AkdTK4Hq3DU7rc+6 4/ygq7FCnEvmNUc8ftlbAuk8F6irVzbdYzBDN5gUG2eAqfZ3cSEUTabhiPXzzb4hglIxJBbfCkgqA vvh7hRbKrKwqhYpbtDKlelXWqcNQLVhfJl0ni0n9b+IgNxexu3BKSNr7nw+nvdHrNRYzu++SsWPeG s+cxBZni+89uxD3KEacw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFVE-0000000HSeG-3M9B; Tue, 23 Apr 2024 12:44:04 +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 1rzFUw-0000000HSNC-0O49 for linux-riscv@lists.infradead.org; Tue, 23 Apr 2024 12:43:47 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-346407b8c9aso1491759f8f.0 for ; Tue, 23 Apr 2024 05:43:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713876224; x=1714481024; 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=TUZbX4he9n4q1vZFYMxp+s3nYLKyrFtBWJZsTu2EIzo=; b=afb5ExGPPUtd4RN/WylDYYDURSakeApxl/VMmx7OEqN9FckEeFrUoAgJtDPfql1LP9 JhT2IrdMdjpq6Ts1Z8RS0FeGLGHuKaW9N+oVuSXWF5AxBdBUzBRtVI45Thou8H//pPkK YGiXC2W9LbObnAwB0pK/zisgk95/7WxA/0SuSxymbk8fyQu47KVZa/eBTwuFnAmk7RGJ 4oaMqBJYhJVkConZyZkwpeXWvRmqn2CkJocnH9ZtdMZyb8hadFmZhlOXj6Z9u1dE+fhh dsCMDnYMUWjxgzMHZ2ecGsAHu2ffAEsOX9Z0IgCSV88P1tp4vtwkWXRG0KrqWaA4KrEl VEAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713876224; x=1714481024; 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=TUZbX4he9n4q1vZFYMxp+s3nYLKyrFtBWJZsTu2EIzo=; b=ejiQbkf1VO3VT3VWEqDxzghJlJItVyHX9uN6aymL7tyj0HgtB/9MaqH1b/WgrKHSry ql+4oZYwdfyS9eJanzfdzMX/V5tAlIAaIbG/qsDKcdVaiOFfExH3cKCTvD+dpQpGguAk LwZsWI50Ukp9IStsTropSoWWSMYBv0+uKWEMY12xrUhlsG2fN4mNxjXLX86K9jRH+O8n Xc3nYeFIl8ozOunzUVk78KGFjZ7I0tJl8qGvKtRDBZVQSu2XCnvbeyaaiW+QWyf6I5kE r/91bEGiP8hAtNAhaCI2vtB7V+XJqOpXCgys4yazcvguUGNCC1QQ3joYptxyZuLzOXxG vYXA== X-Forwarded-Encrypted: i=1; AJvYcCWj68R6Ab+8kwVHwivjUWJVXLAxgb9McKZUzZpkGtKK9KCp2FZva5uKQ+x0JNMJgyJ5vdcNVBKJR/mFvmf0Pz1kgj1j5hy2TlFeUtlBOqrR X-Gm-Message-State: AOJu0Yxn6Q2NNg9pTnBLvaWh2hgacScmaXByrV4zmI62E5j9MLw5hyyC KOlQ1da//Ae5WBCD2w2ERbf+NwzGKqdDIVYeFhXdOMvl2mGbUV9gLzfKkFWtu80= X-Google-Smtp-Source: AGHT+IGbIVzcAn3QLqtxJnElWT6wqDhKCqDt4jI+gjpB2p8+cPOxRO/7EwBoQJ6Mrahyga7IgRhsSA== X-Received: by 2002:a05:600c:3b8a:b0:419:f241:6336 with SMTP id n10-20020a05600c3b8a00b00419f2416336mr6604286wms.1.1713876224214; Tue, 23 Apr 2024 05:43:44 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:71cb:1f75:7053:849c]) by smtp.gmail.com with ESMTPSA id v10-20020a05600c470a00b00418a386c059sm19975709wmo.42.2024.04.23.05.43.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:43:43 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 03/11] riscv: add ISA parsing for Zca, Zcf, Zcd and Zcb Date: Tue, 23 Apr 2024 14:43:17 +0200 Message-ID: <20240423124326.2532796-4-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240423124326.2532796-1-cleger@rivosinc.com> References: <20240423124326.2532796-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_054346_258234_2F3C1BA6 X-CRM114-Status: GOOD ( 14.50 ) 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 --- arch/riscv/include/asm/hwcap.h | 4 +++ arch/riscv/kernel/cpufeature.c | 47 +++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index 543e3ea2da0e..b7551bad341b 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -82,6 +82,10 @@ #define RISCV_ISA_EXT_ZACAS 73 #define RISCV_ISA_EXT_XANDESPMU 74 #define RISCV_ISA_EXT_ZIMOP 75 +#define RISCV_ISA_EXT_ZCA 76 +#define RISCV_ISA_EXT_ZCB 77 +#define RISCV_ISA_EXT_ZCD 78 +#define RISCV_ISA_EXT_ZCF 79 #define RISCV_ISA_EXT_XLINUXENVCFG 127 diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 6d238c8dbccf..24bf3fbc0578 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -107,6 +107,29 @@ static bool riscv_ext_zicboz_validate(const struct riscv_isa_ext_data *data, return true; } +static bool 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); +} +static bool 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); +} + +static bool riscv_ext_zcf_validate(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ +#ifdef CONFIG_64BIT + return false; +#else + return __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZCA) && + __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_f); +#endif +} + #define _RISCV_ISA_EXT_DATA(_name, _id, _subset_exts, _subset_exts_size, _validate) { \ .name = #_name, \ .property = #_name, \ @@ -118,6 +141,9 @@ static bool riscv_ext_zicboz_validate(const struct riscv_isa_ext_data *data, #define __RISCV_ISA_EXT_DATA(_name, _id) _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0, NULL) +#define __RISCV_ISA_EXT_DATA_VALIDATE(_name, _id, _validate) \ + _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0, _validate) + /* Used to declare pure "lasso" extension (Zk for instance) */ #define __RISCV_ISA_EXT_BUNDLE(_name, _bundled_exts) \ _RISCV_ISA_EXT_DATA(_name, RISCV_ISA_EXT_INVALID, _bundled_exts, \ @@ -209,6 +235,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. @@ -255,7 +296,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, @@ -274,6 +315,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 Tue Apr 23 12:43:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13640018 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 92483C4345F for ; Tue, 23 Apr 2024 12:44:18 +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=Mpp8vDXHvWCNWcnO8chuwNr0iqFKl6zBeS5SpExdTM4=; b=XqI4dLpcQduBes VfSOjQBmGg4rw2HB0zZZglZdbvRh01VHCsTByihPx+bSdVKot1kZN+k3d/wcGck9gzxTHGWk5/U5z Vx86PZKb49am6lfZ5n7iTWjykd2/UiPEuMju3s7zyWGkJa9iUF34SVoav3tSU59h38/n7N8RQM6Wx DRCavLR5FG95QnWGS47AoaF4abH50tY71VNMwiEd7ePqrZqdpX1iGkj0dQ45HGAEEUJHAmrToSX7Y oFAPDNr2C10bPgul0SYQbRua7HppmKd16qd1N3DDOb1+oPqjj1ORl5dbaRej5VH5KXJ9eyFoCLK4u 2jzlgI6SD7wJ7qFluyBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFVN-0000000HSkE-1Q0j; Tue, 23 Apr 2024 12:44:13 +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 1rzFUx-0000000HSNs-2wtE for linux-riscv@lists.infradead.org; Tue, 23 Apr 2024 12:43:49 +0000 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-349fd1d3723so1073692f8f.0 for ; Tue, 23 Apr 2024 05:43:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713876225; x=1714481025; 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=t82SHWSKnQwBrCB557sYOimgSCzDvuCob+i4t0Pqx/Q=; b=ngW2B4v3rkmZ1lrA/OB7O4U46IzaIa81vbfiSnf2yGvuN3jB8pKHEGoA8ZGyK4QoFC t7tZGt3/H76pCTHuuvmBkrgvVsccc718W0xUsLHLLMFbyhrMk369WpD/yvjXblSBigy1 S/EGIQgCDLnz9iDnATFZhm9cQcyPfR0UDchyZuNOTnU0wUfarWR7/oZuDnq7ev7PrpB1 WitVZEKyR8lr/fx2kklACXdecR8ej82BrTDSJWfD+8qZqi3TTtk0Cdsz/oWvMd/EiESJ ug/q6HM9+lc2JSZ3obMMwohI1sK7E/S4MYptucMHCDSSLW/Fjae6M9DgxTQjdWRuBIFH 9eiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713876225; x=1714481025; 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=t82SHWSKnQwBrCB557sYOimgSCzDvuCob+i4t0Pqx/Q=; b=tv1RLGEkAL4PErlbPMR2Owl1MUMnKZ4pPdVmoLuS1UgkGvc+hnR2lGCyjDePKCuQqk Ectam3iQQk+J50Bx0HvX+MyaDhYlkKWkvST7RgvhVdGpEs1sVKt3wIbhMOE/IlxW2l+y w8qfIyvms05MlEYzH+j5NrzHIura3tLcaUnxvEUMO5Vk+7HQt3Oc0iVUFYtBJ4DTBvAz nhQDQPcJUWRm93YdqbyjF3vorflrnoKLXWWpls8FRZhqPdSlQzuBlGgFa2MjU6oTtUsJ n0c7ma6eRT6lMrn/sVdAkCTbHzEBtRqcCahB3JjXgNjv1xbnJ1Mu4nmsHCTlvO8ruWVn tHeg== X-Forwarded-Encrypted: i=1; AJvYcCV8W2D9UIe1JR+bL/cD/kDvw7eUJTzJ7PHfdXPOSA6/3jFcstQK89YipFkaJYXMvDWzHWGkjayMKRdnjFcCDAjFBsoER9sr8lwv7APg8SAN X-Gm-Message-State: AOJu0YwYAYi8lEHJkFX3Fkyr7j6yJKTjKmn16rDM74nSM4KFhhcrYJBk GMsr8VC0WzO7gvzUI7lr/IaN9RRaL28qdWdgnlNjQNiymmFf3SwV5yjdPevQy7A= X-Google-Smtp-Source: AGHT+IE/eueGlNPIrUduJCVDegDdMKs05ZlFrNlzlIPU89DYEz6J20JSDrHNrjRsKkBm1vefWMRNGw== X-Received: by 2002:adf:ce02:0:b0:34a:f7f8:807 with SMTP id p2-20020adfce02000000b0034af7f80807mr5046634wrn.5.1713876225582; Tue, 23 Apr 2024 05:43:45 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:71cb:1f75:7053:849c]) by smtp.gmail.com with ESMTPSA id v10-20020a05600c470a00b00418a386c059sm19975709wmo.42.2024.04.23.05.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:43:44 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 04/11] riscv: hwprobe: export Zca, Zcf, Zcd and Zcb ISA extensions Date: Tue, 23 Apr 2024 14:43:18 +0200 Message-ID: <20240423124326.2532796-5-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240423124326.2532796-1-cleger@rivosinc.com> References: <20240423124326.2532796-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_054347_897145_0964633D X-CRM114-Status: GOOD ( 10.50 ) 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 --- 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 9ca5b093b6d5..bf96b4e8ba3b 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -192,6 +192,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 ac6874ab743a..dd4ad77faf49 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -60,6 +60,10 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZACAS (1ULL << 34) #define RISCV_HWPROBE_EXT_ZICOND (1ULL << 35) #define RISCV_HWPROBE_EXT_ZIMOP (1ULL << 36) +#define RISCV_HWPROBE_EXT_ZCA (1ULL << 37) +#define RISCV_HWPROBE_EXT_ZCB (1ULL << 38) +#define RISCV_HWPROBE_EXT_ZCD (1ULL << 39) +#define RISCV_HWPROBE_EXT_ZCF (1ULL << 40) #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 c99a4cf231c5..2ffa0fe5101e 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -112,6 +112,8 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZACAS); EXT_KEY(ZICOND); EXT_KEY(ZIMOP); + EXT_KEY(ZCA); + EXT_KEY(ZCB); if (has_vector()) { EXT_KEY(ZVBB); @@ -132,6 +134,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 Tue Apr 23 12:43:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13640019 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 CA678C4345F for ; Tue, 23 Apr 2024 12:44:25 +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=jgxuhDBjxValMLNOIrh8igDwcZ2b1SSWp1ElN2Yxv0Y=; b=YiHVKRVgVYTItF mbd5Y/H/nNkGzLkRA1/kkdzgxacUGzyH6qW17HrpV+bqPLHMl2XDULUQq/JF/gilWo/H+uJ6I5FIS oWzJJd8cgKTRBKQ+qIciI1sEILXw5Udw2k2Eijmp8N15R660gZUMTikmhl8sOB8UYFB9jmRSUgci4 iPGUuaYT1Li9nQke3p5uLQ3dhrHIF4fy6tFPf6dR3pXlTShSzRaonxzquvsof+V1YGayhyKdPuF36 hqoScNOesWcwRmwQ8wBIL2c4rzfMyvf/EcVDUn0yH1FixV9ULSxuhOX5slHvCXt4bmMAPYnNzqEc7 NA/tkLJI/ssqyjEmAA4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFVW-0000000HSrd-0Aky; Tue, 23 Apr 2024 12:44:22 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFUy-0000000HSOl-04Em for linux-riscv@lists.infradead.org; Tue, 23 Apr 2024 12:43:50 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-346407b8c9aso1491771f8f.0 for ; Tue, 23 Apr 2024 05:43:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713876226; x=1714481026; 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=rKUXibPhUwjjSXA/KBDdbbKS1P63ijLLovqIt9fNrZc=; b=SvIBd1oKLjTOgIxfAJE1rWeFIInK3DjeJbpWz/gFTjXCF7H/0Ve+QKi+qvW5UZTj6Z GeMUAGJCGlh8p6P9JuTx29buR9iwcKDzTPlRSE/B/0lfa7hSU0tEg699412aEGRFM7oX ANlCGRWyNoaSNua3kS4GQYhSpF03PKhEe6RX3F6dS5njH1i2Uak68wzK1Ij07WEMzyzo fZ5EgMePGUijZF5BUVwgeAgHGBg94XmDSaGxk1xMEFe+WPOq661TaDK8Wc2Qauc69VjD TMVwplLqQARTBgocRrhtakwIGZSxlVqPnsefqt0HAmUtSRzskI+G+fVkrpiAaBdBGqDK vHig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713876226; x=1714481026; 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=rKUXibPhUwjjSXA/KBDdbbKS1P63ijLLovqIt9fNrZc=; b=xUWPzM9Uqajr7ssZj6saoa8ZwH7HenVv5nw0i+pCCF06Coj1ikLZF0KUAGZ2vSAsPg rYH8WkmFkF2JBFWeK7nEmwB9QiftGOEYETBE6POOfK0bt8y+JC9yParOlpfdot/+rtFv NlK/jViTGx+4Fu4XhJTAp+ZnNPUW8ihq1P0se2rDljJVj4tGcpChkEDw6gUJ0jDODHJ2 CMcomGOsDdyItsS1FvFXfidsQvvuTk8nc7Gca1pPSJ660whlaQh9tgRW7OD473zqB3td dh/Gt0FP/8Oyzws3dDGCTI3DG6dLxcO0bNg+s1rhM2QL8tO5FevM6bOMm317jq0oYPxa NnSw== X-Forwarded-Encrypted: i=1; AJvYcCUO52/HYtOIckT08pWLFhSpnnUG2hrxoqII/7gHc0EaWMMOCan9rl2swa3FxsOJRDCgUcs8g/CE/Rn0UqfYrqBQdljW8WbDPB+RiWoxFHof X-Gm-Message-State: AOJu0Yy+HvUg8n19bRTWElRcQzNaXm9Zlq1jf5O87o8KzO4tG7fHnJlO MIOHlO9mGigJIZKDFMcMwJ7X4bdEtLCmJU8bmO1dCY/c23CyGmZ1MGwMnsHun7Q= X-Google-Smtp-Source: AGHT+IFUqPmuRaat/0SXEHHyjTSjZr+ZQTV3TzzwWrI3rXhXB0F+LGSeuZbKVhACNb/TBD8FDVBF0w== X-Received: by 2002:a05:600c:3b8a:b0:419:f241:6336 with SMTP id n10-20020a05600c3b8a00b00419f2416336mr6604350wms.1.1713876226513; Tue, 23 Apr 2024 05:43:46 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:71cb:1f75:7053:849c]) by smtp.gmail.com with ESMTPSA id v10-20020a05600c470a00b00418a386c059sm19975709wmo.42.2024.04.23.05.43.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:43:46 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 05/11] RISC-V: KVM: Allow Zca, Zcf, Zcd and Zcb extensions for Guest/VM Date: Tue, 23 Apr 2024 14:43:19 +0200 Message-ID: <20240423124326.2532796-6-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240423124326.2532796-1-cleger@rivosinc.com> References: <20240423124326.2532796-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_054348_271417_ECADC78F X-CRM114-Status: UNSURE ( 9.42 ) 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 12436f6f0d20..a2747a6dbdb6 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 Tue Apr 23 12:43:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13640021 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 8AC3FC4345F for ; Tue, 23 Apr 2024 12:44:44 +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=HzsoDuRCZkGCNa ZT67vjFgm7OLHK+ukoVx+pAmMVjqcz4AQnwaoWYrsue4N8cck7zeR+n1NEdnaw6UvciR2zQyEjUu1 f47yr7vxK95nBz/CVlM/kjXc1MWsoEzuQNnVgHLYBd+kBxu3DnrL+M44I+Gp1qHlMBCal+vgcspMD bjrGipPQrpKNdrr5pivE5tq3frI2qOpZXGwlnMqTt4SfbCoVNK8eA9Up8MZyaIrDVaQvo6GemN3sV KixqaJ7vS5D86bj2TO7xfpRxXh5cBEfjdDRIIJLizhnLrSGgnBfceY8c6HnTK8zRCPA/aP0BLdGYr ZkeqVbX2vU0CW2X1MiSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFVn-0000000HT6x-0fBY; Tue, 23 Apr 2024 12:44:39 +0000 Received: from mail-wr1-f47.google.com ([209.85.221.47]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFV0-0000000HSQm-1xa3 for linux-riscv@lists.infradead.org; Tue, 23 Apr 2024 12:43:56 +0000 Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-349a33a9667so872001f8f.3 for ; Tue, 23 Apr 2024 05:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713876228; x=1714481028; 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=ryvBA6uVEJEjR1QnnkFB0d6vS9iMlu1Num80y7/y3wiopQkHgi9RAm7poU27xiTDJ5 SBJZiSS5/j98onwQ5RDfygpOnQ/w2uFm0xYLBBm6tvvMjpv7iV8QDT7HcX9AGX5ZYNFF zfKp3S/3ZE/aW1lOLytzr3N2X+8BSc7ys3cg7kVTRoem4PkFYARKEU1gxEC8QuDgEDYr RTTgPlNqJBBQIegf21ld42LT9A5sNz39JXEybh2AkI9qGi0bnpMLXDUYt6FKBJYliVJe hq3PKwd9iyWAWZdOwoApKnGcdw/ua48OE+I1LMoWtx+iFqPXAfmlJt1EpYzqPYY11UFO zuCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713876228; x=1714481028; 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=ta1RDn/hHltX+1CICAke8MVHpdWWSyRQlHRDmvn5GG6K7SM1VmOp23oQ1lx2esImTt oJcvBLpq6wozLdTl9gEpDbghNJ/Cqq47GYcHtU0z2SXf4Km2jp+9/MNtUM38526K1sXK 9K1kBobK+SlDMP2SU5ybehYNqeHRJz6l3HkILRqhXaW6hi0EJ31+EGRV/yfDNBJKBxAD PXDs927jWxZnPA5EPlVSCeQwftRcS7cPG3c+DMkCZGWLwJPcxDYZDp2RUcFs6Me6H4hM OEn718T/wDGFUdP58v7rTXjmwrNfwSOkx0iFJHoJ3caahhqph//xJ9bRF/L5YfGCT50K 2OMQ== X-Forwarded-Encrypted: i=1; AJvYcCWF4RePqCkkiYtzPJNqg3jEP+GHW48Mq+YQthmZGYxrLeDACuj3m2Ox27puxf3qF/G/2j7TLpBJi4bwJBpLqJTP8AwM9fVEqPssyuCmk1TE X-Gm-Message-State: AOJu0Yz/pIDqCRnHOJKxxD4gEThJDDf+U2PEwODjBHIgnh1C3WMGffOo dguL+8EQi1gLoDOZ3CpIMDYGA2U4T4hjUBvmlgBYwgOgnrLveIxvlTVV8D9tHoo= X-Google-Smtp-Source: AGHT+IFRgUnk0vEtF+hGJCYsgJqApSFxTJfbdXsIxf1B/11WOBNdkte1X7YViXtLgl4+JyLNVfZS7w== X-Received: by 2002:a05:600c:468f:b0:418:9941:ca28 with SMTP id p15-20020a05600c468f00b004189941ca28mr9046696wmo.2.1713876227919; Tue, 23 Apr 2024 05:43:47 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:71cb:1f75:7053:849c]) by smtp.gmail.com with ESMTPSA id v10-20020a05600c470a00b00418a386c059sm19975709wmo.42.2024.04.23.05.43.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:43:47 -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 v3 06/11] KVM: riscv: selftests: Add some Zc* extensions to get-reg-list test Date: Tue, 23 Apr 2024 14:43:20 +0200 Message-ID: <20240423124326.2532796-7-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240423124326.2532796-1-cleger@rivosinc.com> References: <20240423124326.2532796-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_054350_632460_A4111047 X-CRM114-Status: UNSURE ( 8.86 ) 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 Tue Apr 23 12:43:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13640024 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 011DEC4345F for ; Tue, 23 Apr 2024 12:45:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pLAjDLNSI0dZ5ZKEzLvHxvJ2j4AJMvVjP40qy4xk8NM=; b=2Ntesyuu+SNY51 EWB5FQMuwOKa8Bn4CZBxLUFjqVxRVN+yvslGvpqBW6/glHJeZmq8q8XDdwL7ALzYMmw9tYV91e+F/ bLRAANfR/6hK39ZCanT4EbTmHPhJxDniLDrwvYp/We8VDultv8noI7b4prVQqjo85RuR9b6YJep++ poyVOZcH2AYZFuYHUmRI/cPO0UPmwhqkNz6OAvdJ3YiYDLN1e6VzRSZmQwdnzUiYOE4IJBcZm9OyI em8LmfoeRIgX5jNLMBzLrSI0jEC+GAJwqvf9fQSQtMdQ3chDl4/CWumXPgdsulrhdiac14rlr2UK7 BVJjnResy3YAPED5b0TA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFWB-0000000HTSO-0XMR; Tue, 23 Apr 2024 12:45:03 +0000 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFVL-0000000HSi2-3E8B for linux-riscv@lists.infradead.org; Tue, 23 Apr 2024 12:44:13 +0000 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a469dffbdfeso125183066b.0 for ; Tue, 23 Apr 2024 05:44:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713876249; x=1714481049; 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=SqUXz3P/ILbAY/obovxuw/ulwPrEeHHfsINnJJgombQ=; b=kiauy8HdSwMUbVZWP49jiYrrqCWOlY7xQVmQInT1n34Kw51Xmac0p/BiiqB9ynCgzZ i5RBULc3fVFVS0E2yJSIb7FVwed2q67xxe/vX393dSL0tmGWXjFGMiLC11ktqfUJwv3g /jm1YWAW6Lv3eXBcXuEqH0k21vCkysJBInduQdQP60xwO1XAPrI9wUPu6aIF6TL9LtWO uHlltFaSq1iXN/iIe5tip5aJ8krD8ojFGE8uYqk9m3+lnPxg9/sWNNcki09cuR+00BID dHERKttR7ttsL41dRKlyuVCP+l/HJF3gW2duBQ0MXFyu7qqyVRtEXxgCOfAEIGWZDB1j AMrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713876249; x=1714481049; 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=SqUXz3P/ILbAY/obovxuw/ulwPrEeHHfsINnJJgombQ=; b=oFFUBA70cj85yUGK7FFNkeOuJVtnfdYf4f1bPvyINcinRwGpmPyPIqixSDvso4RvBi CWeqY8F3bnis6OU8r1MoZs5w23ZnZ5UxkF8N7ug6jiJ/GEnz1aivaj/o+/vjlpxwLz2g hQgJa3KNQ84wJhO73cok+TzzpHAp5LZmWvLqxS+ZBIEWHn/qb2pBlwIJUr9Y+LVM75Zx BrTCvn86COnT4CKxBTcZK4Yrh4adfiQIxP9zkh14lWxudrs4+C9nnrVXC/Aghfgdui8O 2f8FlvlnhrSeI7Pfn897tFPT/JPywgD62nsWku7TEQFXyggydQYrMdqJl8c8benRenvT qivg== X-Forwarded-Encrypted: i=1; AJvYcCWt8yGxi0Ovgok3QqPmfzbzPmk0xHBK777j7rw7vhJKH/kth7yRrf7bIrDKIwAyhCO18EAAvqTQJ1F5WklnpYdDBwxBff//TGtFpRai+7kv X-Gm-Message-State: AOJu0YwNN/uRW0ys/C2K6bX1M3efd/fU6oaL2vLCeRVS6eiKSyP/oZ5m X/qo3FkoNLMCiXgD7NN/Fo+UZupXERMjbWRRd6tedg+55kkN8jsMWao5n5LPJvk= X-Google-Smtp-Source: AGHT+IGYD6R7lCuFXcFn1CiEepxwRzLgpJssX7t6iPTjHzI3S73/lLM0TpTesKJAZsPqOxcquQWylg== X-Received: by 2002:a05:600c:1c27:b0:41a:c4fe:b0a6 with SMTP id j39-20020a05600c1c2700b0041ac4feb0a6mr1112456wms.4.1713876229210; Tue, 23 Apr 2024 05:43:49 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:71cb:1f75:7053:849c]) by smtp.gmail.com with ESMTPSA id v10-20020a05600c470a00b00418a386c059sm19975709wmo.42.2024.04.23.05.43.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:43:48 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, Conor Dooley Subject: [PATCH v3 07/11] dt-bindings: riscv: add Zcmop ISA extension description Date: Tue, 23 Apr 2024 14:43:21 +0200 Message-ID: <20240423124326.2532796-8-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240423124326.2532796-1-cleger@rivosinc.com> References: <20240423124326.2532796-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_054411_892942_98D07DA9 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 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 81bce4fa2424..1952d20b8996 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 @@ -549,6 +554,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 Tue Apr 23 12:43:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13640020 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 D495BC4345F for ; Tue, 23 Apr 2024 12:44:34 +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=kJjC5MSkCky5RcVksa2VLhkKHeEaHWqsT81FhGEbcLA=; b=gEV8RvQ/NZbWlo RQbSBn31ScyvvTJFB0Z1J60i2I/h5k4Uzmg9F+M9gebkfuKSD1RaIUGgNJdrbSisvKbCDc9c6TN9m j7GwD1sOUcP4RGP0/eu8k1bRt2SaQEGzB26fTQ2HVQP/8UmvNPPG+jymCFbMWsax/Z0pZSBlZB5d+ 7qyjy1Oz+8PM431uo/he+PK35nPfGd98ZXTW3JJaCiBxje6oY0+CTTvwoyMQyf34zII4urFSgoeX4 8KhCgeRNpIAMO8250zxexpSalThHZ8QLaTbb59efGRyGqn8b94XRH4YQKHmpnyDEpOS45owOtFtIw 7fnAIng5HjuFPLgum54Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFVd-0000000HSxu-3d80; Tue, 23 Apr 2024 12:44:30 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFV1-0000000HSSd-2KRW for linux-riscv@lists.infradead.org; Tue, 23 Apr 2024 12:43:54 +0000 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-34b39ecbd0dso313401f8f.2 for ; Tue, 23 Apr 2024 05:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713876230; x=1714481030; 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=qPMUP7jTPhU8KtBceS7+PJO2x6890fNpaWNWTvJnT8g=; b=M/2K/tN0FSgLDpTSzIGgs1HCgTs5H39W5n2QyV/Ge/3W+ZLSE3Dwd6mUJGsGU9fzfo yT7qAG6aZRUHKAMZqrXOnxGjfbzZ4F3EMjyucg/FM1hM380DWuyhtapgVpO+2Gwglsdt Zj2Ss7QMRqfI93R5p4ODyZ3ArlIugQ+yipGXk4rSlcYaWN94Dh8/VE9SN0gShSb6OmZF mvgMmWyN9QJ6gq6TxGaVzn+N7l6QIwjuvEC6CMnCD9onLV0DlA2cxRXXzGI4855pwYr1 Dqi02cpV0ar21H4mpVdkkiBAgLGg9Tmon45QLCVBUqJZ6I/5smC+CivHGuji4HqnZCUg Jxyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713876230; x=1714481030; 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=qPMUP7jTPhU8KtBceS7+PJO2x6890fNpaWNWTvJnT8g=; b=GDmOc5okFr5y22B+gEABYpMYpcH0qSHDmwiHYTmCX8D75Zg50MLYh6GHGTGeNtfx6f BM5JDDDtmfV7QJ9gwOut9BjNwATsss/C/1oJsS+oUzq7OMLWGvzB3gworfLPjqZTxFIH 9eFOCxuLw46wpc+riqGpPrXve3jOMIrIaTx9pcyhTERpMVcVG95K+Vrqx+2jAPHQE1uH RHlDgYnGQpHaUEGQz825e6j2kP8IM/C1DOQl5xTFWYoUS/2S1LSy5Ld8WrNcN60FqFXT LXStMC7zzNrI6vHTsAEkqO3kkUa44tHuUrLsMTq1D9Tqs4oNXn5bAxH86RbeCWJOE5JW 1tuw== X-Forwarded-Encrypted: i=1; AJvYcCXSQgl+xuyi+Mq8MQe0u1QV4RN1sEqi5/fGKEtijYBaYI5oJwARUUaQTewitbkkVcKDix7yNLMQyTU0Xm3qeLDRk6TcbGXeDSEyirsNDeJt X-Gm-Message-State: AOJu0YxQnfVx3la57Ez/uCdqpRqEJOwjF0Og0bhqKYzmw+A/TXptBTbs yINRTns9ZIt71rAsSx1N4UrQygZXqOIYk+Bk1gnycjJjK4WkCgPMYJHJReAQjxU= X-Google-Smtp-Source: AGHT+IF4Owb23uP4IaZsltc9oiRU6sq23tH0PC+Yw0dOc5/Ns9UfmjB52gYnOefx2T6o79mISwlW4w== X-Received: by 2002:a05:600c:1c9c:b0:41a:bc88:b84 with SMTP id k28-20020a05600c1c9c00b0041abc880b84mr1191832wms.1.1713876230241; Tue, 23 Apr 2024 05:43:50 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:71cb:1f75:7053:849c]) by smtp.gmail.com with ESMTPSA id v10-20020a05600c470a00b00418a386c059sm19975709wmo.42.2024.04.23.05.43.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:43:49 -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 v3 08/11] riscv: add ISA extension parsing for Zcmop Date: Tue, 23 Apr 2024 14:43:22 +0200 Message-ID: <20240423124326.2532796-9-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240423124326.2532796-1-cleger@rivosinc.com> References: <20240423124326.2532796-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_054351_789867_DEE7A714 X-CRM114-Status: UNSURE ( 9.67 ) 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 --- 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 b7551bad341b..cff7660de268 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -86,6 +86,7 @@ #define RISCV_ISA_EXT_ZCB 77 #define RISCV_ISA_EXT_ZCD 78 #define RISCV_ISA_EXT_ZCF 79 +#define RISCV_ISA_EXT_ZCMOP 80 #define RISCV_ISA_EXT_XLINUXENVCFG 127 diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 24bf3fbc0578..f59c3a5ef9db 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -319,6 +319,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 Tue Apr 23 12:43:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13640023 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 1E90BC4345F for ; Tue, 23 Apr 2024 12:44: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=7hyTpju/nnUS/DmiEf83/G7pnb9Fb55NyKWDhsatQPg=; b=bIHlcAopdIoWt4 dLxw+hSFrbFoOqLu5kDhPTd5dnYlHMqlOnJlX/RAilQ3Y/OcaIeE7Uu6u6u5k/aGAivBsqiun9dbr 1nFhcLkj0d02caYnyhAkdaLdD2dAdAIgwtTWzjZ05ul2sQzHKNflYWjzXaxkbhN8OT9/8MwImjLK8 kvM8y+TH7Yh6Kjm1WVqK3rq0dzHeK036h7qZhq+tWAVkmw5EYqexfDCYgG/IEb6fXzrR31TowGZXL nM1bu+j4sIH0cdcNqStDNEqqVQl9SrJmvMHDuHtocBlMbQ37gNnGJNz59gzVLu6ZEGvtRFO0ZLQpO BYJqETX62EeDTDP8VlYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFVx-0000000HTEL-1dp6; Tue, 23 Apr 2024 12:44:49 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFV2-0000000HSTz-3Sxe for linux-riscv@lists.infradead.org; Tue, 23 Apr 2024 12:43:58 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-34801b1bc4aso947619f8f.0 for ; Tue, 23 Apr 2024 05:43:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713876231; x=1714481031; 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=rdCfPjm06PN8DLWdVlWU7iGB8QhHqS8f5T3HQCXkkpY=; b=WPicsT9Ib3viJBRKpQUfHYoOKD30Pcvs6UJVlZxpReNfBVXZD9UIuPNJmQLSeCM/io RaFKu6794SpaI8Hh7CJH48ULYnJoVXi3EPaQPKSZmccwWsYfZ1M+VwgDrbhqvqSCCOKF 2NlMI6P2Wao8iobeol6gT+upHP+w4vl0P8/EZyi5JrUrm0MoN91jBAgLgyL9hMUNkyMc lt6hhQZlEdeXvHFC75k7qaFWVSXlSf5Vf5p8KFadkgaQB3q2P7C2e4jv0vV08GUoYCdp rEAJ0kVHPivxiFrasnrL/110eQpgYQDtNQXz0qfxY7YcTSOy5UUUXNcJZ03hK1BGN4sg Y87w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713876231; x=1714481031; 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=rdCfPjm06PN8DLWdVlWU7iGB8QhHqS8f5T3HQCXkkpY=; b=lA9nsJc8O8raRuwc8C7ojBW3YAsExc/Qp2+zH6+u9LUhaCoFIEdRkNWlhdv31zi6FH Vr6UmotGnmWfeC9Kf4yUNgFVBzeEZLdk2Q95GRpR1Dl7O66XEu23Raf5DeWBt0M3M17T imN64JFFW2Q6xe29ncVSnZVlSYcVdw9LRHzXEFGO3E3AUKSqt0JMynSxfikknpNIvBxJ 89/RqkQ0Ixagh9EMDJn7DXRJ2a5Xu0CR81kAeKurqFAdfQI6ezZ16P24srciMjxPWusW jZdi9UHN8bc/mVPmI4nL+x/KvnWL9aR3bOGZ0oLTd5AV2VNLaUVSkgWSKiCJzwfvJeWj fMwg== X-Forwarded-Encrypted: i=1; AJvYcCUS2wFQD6ZWmtwFpQyNm/zPtSLzMthEkR/Z3KTa0hamFrRmZWo7a68MgoXeULM623oVvZ94yDweayb2azVOZNYyLtXjCZi68tUBFAwlofQq X-Gm-Message-State: AOJu0Yyhf7dl7ZCWqsTdEb/FgqfIUIhh7wkqD9MRaHff2/JuG9xBCZx4 JZFAQySuXiDcjw6ROG1qWfLcVbyaWSfgQ5eQ8hqwK6UfDhre/vUEtEBwXvDHVJA= X-Google-Smtp-Source: AGHT+IEwxP4cmnlN65ejt3BUPk7jfIkLB8aRDSbaf6thvUjYkqGY2x1c1seifl/qbhrG1IVOTMxUHw== X-Received: by 2002:a05:6000:22d:b0:34a:5640:453c with SMTP id l13-20020a056000022d00b0034a5640453cmr7273001wrz.2.1713876231406; Tue, 23 Apr 2024 05:43:51 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:71cb:1f75:7053:849c]) by smtp.gmail.com with ESMTPSA id v10-20020a05600c470a00b00418a386c059sm19975709wmo.42.2024.04.23.05.43.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:43:50 -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 v3 09/11] riscv: hwprobe: export Zcmop ISA extension Date: Tue, 23 Apr 2024 14:43:23 +0200 Message-ID: <20240423124326.2532796-10-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240423124326.2532796-1-cleger@rivosinc.com> References: <20240423124326.2532796-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_054356_147793_8DD631F3 X-CRM114-Status: GOOD ( 11.06 ) 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 bf96b4e8ba3b..e3187659a077 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -212,6 +212,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 dd4ad77faf49..d97ac5436447 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -64,6 +64,7 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZCB (1ULL << 38) #define RISCV_HWPROBE_EXT_ZCD (1ULL << 39) #define RISCV_HWPROBE_EXT_ZCF (1ULL << 40) +#define RISCV_HWPROBE_EXT_ZCMOP (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 2ffa0fe5101e..9457231bd1c0 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -114,6 +114,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 Tue Apr 23 12:43:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13640025 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 D4C4FC4345F for ; Tue, 23 Apr 2024 12:45:16 +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=mrXGf4V+SUfS526+G6EVworOfyPCtDnpxG9VwyCk+a4=; b=YXfXW2QKXvyyxE yFk+hRjuaUC/MO6LdqcS9BnQcgxvoieDzRKDUE8AFsJYSNc9JU7ogorkRYUTXRFIFs3ergpCAzwbr qEvqNcZ+TlrZyqlZAAA2CCjRrABwf7fncQ2Xp6RdZ5UBQbGGqbhpYPZYa40KlKQNXVGdLDifregpF OE+3JRBE9CudMmLNxI63HK28Hf8WuGsvGyS67PWv5yujXPKdpIOevqqsark9f2ciYWPkDAz7sEaUO 7cKo0Fw6depPK55iBtmvQCwTRU0nIE3HIg1tGB4seD+Txb106KVA6CKkIAwW5Fkqg5YyTYZF2v+g7 yNEezfHlWUN9y+TWZIKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFWI-0000000HTYg-45hL; Tue, 23 Apr 2024 12:45:11 +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 1rzFVE-0000000HSct-1UHM for linux-riscv@bombadil.infradead.org; Tue, 23 Apr 2024 12:44:04 +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=GCiDEygHIpDe3Ww8uIgQjb2MclVWFXcZkaD66mBe1pc=; b=Rg65TR96fRtFaRTSfaLnCigzUn vy9jb2aj76EcUaOUJ3b3607oWudaEedPDRQrKvrD3rLk5XfsYJ1FybdD1JYq+rNuYAIykO+jyoR/U oi9T3xmX0YdZ3cwDX7uFkV4xA5v/+2Y0KI0CmtJ8Dyk0LIOWgcNJFZNFo6ngTDvmOqlhJF6d/zjSj /oJO3cR8Lgvh5C0EYPn6TWEoULgrREW4nMFC5S0tkaD64TutorQxXtRLNl7m5IFnciks9wVkKvgAr 6PCeL56WO1Xo5FxjD31vnV4BoWfX9XywoM5l2BcA2/jrQHpnYzZwTH+noOMI9MDOiuQ5ghKR9cT3u yDM8GfYQ==; Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFVA-0000000E1zt-07iL for linux-riscv@lists.infradead.org; Tue, 23 Apr 2024 12:44:02 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-346407b8c9aso1491801f8f.0 for ; Tue, 23 Apr 2024 05:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713876232; x=1714481032; 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=GCiDEygHIpDe3Ww8uIgQjb2MclVWFXcZkaD66mBe1pc=; b=X9jPqhXjrno0uqP1GCRYHmnTFpz55KWpsHWF7zqXSChsXhbuBwWuHJNbcwd2HUW7DI 54fA+wnHlL25LitdXNWLxnmdWS75OqmlGDTnE75WS7YSFLQpcnTFlGdOPVg4KoDZvNcY CJIHlxWBoA/s+dphaNOb5nGMib1ma1IYfEc7SdGq9/DSpjF7doxW+50lpiVv3IwK2pFE bVGVQDTgLCa+AydUcp8vsNe6tByRrfLoxy3+1f7xTAo6fiHu9/CY4AHfxHXJzLj06NnS hTY97NX0piKKQz1jfk2TfJ2gGj2eihxvUmfXOvlqGpN+mTGDNXCsYaw9ZoS4NKHjuiQt o7iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713876232; x=1714481032; 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=GCiDEygHIpDe3Ww8uIgQjb2MclVWFXcZkaD66mBe1pc=; b=RRhz5/Okr8s78gQBiLr2M71LmPO8Hl3g6z+XPwxBdrTGCaeSlJgpqbWyfzu5Yj0t6m TT7MRzogoLUc3YLl3Zrz/hnNfxsIG56tgNViJATYdK3MYuWsaPh3GVI279MrP54wl6Ls Tzslyq40VTTRJF8njSg8RWh6He1NpBSYVLFDZ9rdp/yawVrIs7tDZZFjCGxQlqVlaZar WwtJ7VmcCeQrBjTXapClwCqq/4dWdspeqv3MSR9BtAM6yD/M34p/ED2VxPuWuKm34470 +jOxuUeIV/6ra7MgRkfPPYjp4xeGUOL4SjiC0/lx3Vax9e3WM71USToSpjaT+3G+8p/s nT2Q== X-Forwarded-Encrypted: i=1; AJvYcCWyKW+8FQoyTulDfkRhdoNaUtIbBbwAS9DaAwPEhruYTWYMcIpNfncZSjQFg6ApWoSVqjy4sVGuMotXj+CB2sk2GEppHZUWv0nLRK8rrL89 X-Gm-Message-State: AOJu0YyJOakQb8fCNtQTjqUzcR0cqeRvDvBd7gLN5xSS+8CdRh03ozIo UV6oHHKZTVeCuaEAd5gpthWASaIBC59WqNeQhSiovwZoO62Wnu/o+2YHC5Kx3z4= X-Google-Smtp-Source: AGHT+IG8Y0QuKdCdamw6m12y/zyBhHBAXQlGn8wgQVKcyAjav27SlxD5OClQSLzPK55ylnTNKzC2Ow== X-Received: by 2002:a05:600c:3d95:b0:41a:c4fe:b0a5 with SMTP id bi21-20020a05600c3d9500b0041ac4feb0a5mr958105wmb.4.1713876232338; Tue, 23 Apr 2024 05:43:52 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:71cb:1f75:7053:849c]) by smtp.gmail.com with ESMTPSA id v10-20020a05600c470a00b00418a386c059sm19975709wmo.42.2024.04.23.05.43.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:43:51 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 10/11] RISC-V: KVM: Allow Zcmop extension for Guest/VM Date: Tue, 23 Apr 2024 14:43:24 +0200 Message-ID: <20240423124326.2532796-11-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240423124326.2532796-1-cleger@rivosinc.com> References: <20240423124326.2532796-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_134400_372856_E038EB64 X-CRM114-Status: UNSURE ( 9.42 ) 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 a2747a6dbdb6..77a0d337faeb 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 Tue Apr 23 12:43:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13640022 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 8DA9AC4345F for ; Tue, 23 Apr 2024 12:44:50 +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=bay77BzWU3fz36 X8ns1L1VVL0PbTpq6dYxvQVa9jaxgzUPj9OHOc7xxHtGN1vY6J90uoTUF7vupJRnIUkSotCArl28l 3o07RY01aLopJgu8maGSqdtKcdcRk5LiqAvCkcKjCh9t6j+M5C8pmL6tgwtsdK6RH4jzKQdBIpLmT FWre/yG/F6lSB9Ng+QyRHGmfemTWQytPoGYgDeTgiYBIxW1QWeUQ68sZA0bTU4ElaVtGWL9sDEW1k tdqlpdjeNeUXP+/JD7pOViPpxT/w47hjZMC9meavl2ewvFeylYUwvYdZFz8ob3UpITKTDwS71X14P dXFP2BjlDtxjFjvxggfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFVs-0000000HTAy-3936; Tue, 23 Apr 2024 12:44:44 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFV5-0000000HSUz-3vTc for linux-riscv@lists.infradead.org; Tue, 23 Apr 2024 12:43:57 +0000 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-349fd1d3723so1073710f8f.0 for ; Tue, 23 Apr 2024 05:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713876234; x=1714481034; 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=1qwkBz2Opy99UpvQqqTqbq2cDNBkgsyrajcoFCKQypZ31LoLHZoRTINKeXF8hOTdxW 8lv1Tq56obZm9n6VhucbQ691ttOcC5Qk2pxXUDfi0/Ui+gBrYG6TXWGp4Y8qqjxQgJzF 1Yq6jXOJVL1TzaZL8NM5suJK/nvUHVV7s09D0tzu+YBLQOBYtO2KUQFpFTYTYMp7R0Lp p/1gXdleLtNzrFpPocxYQZ7Qmb/ypIV/VGNJD96dlskDVKGjtInQwo80vfziMsnVEP1J Nkmr5sSUoDxdCU0CX94AslPYTQN21hTM2m+kZYRs/9FJXGvFxcYrZ82VO18xxqPXXJsf qKWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713876234; x=1714481034; 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=RnvPfuEJZ5zAPf8mNp04WHC5K71mK/UfhdoWw82ufH9x7fFWgqCo/7b+BFh6aMJNxA iNIWAbsu3ugpj/yKj2Jfo1K3Mmal+18yDCI0Z5U9fgyr66vWs6LlM6KC1xRSV+St3e59 t6VJ/3VOXEAhlLKuerLLksUjVgehjJljtwLG6vjuncjqAgP6+wOlAEDuFP3843R4KdeZ J6yFDC/Sv/HjTKEGk7/ZsPv4hLqgPihNRTMEIDrLSPzJY5qafC6V8hq3fnWEL2j7dmwy w796TWNI1grFb1XM6GHcOlIQ5JMOzUnVLyujp2Jqx1r+zShDTl4mPib4g/s+YicEB0Rq SQvQ== X-Forwarded-Encrypted: i=1; AJvYcCWJ00zG3k4H0VQh6Wy2sgLPEokGmI3eNkXTcJU2vn8+zGHopmC449rvygrQuUP1DQpfIDo7b2eqSTTVpT2DBQEbAX/U9HX8G232FHRp7sW+ X-Gm-Message-State: AOJu0Yxegaa3v1UPgdQgWS3tyHUK62B4pYkqktH7aQ5Yu3BZFGiHNOgx GU/ZBoi/5SNIGZtNC3HzwnH2ocKFsFaZNCq1FdN2NEoa5twhCMBs0MzK3Q7IhWg= X-Google-Smtp-Source: AGHT+IGgrmGvVTGX++7wyp505WvQlZhf5R5sMKMBgP2fuHjYmGDsg8m8hdOu/tW6hNp+KAz9yWPf8g== X-Received: by 2002:a05:600c:1c27:b0:41a:c4fe:b0a6 with SMTP id j39-20020a05600c1c2700b0041ac4feb0a6mr1112594wms.4.1713876233977; Tue, 23 Apr 2024 05:43:53 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:71cb:1f75:7053:849c]) by smtp.gmail.com with ESMTPSA id v10-20020a05600c470a00b00418a386c059sm19975709wmo.42.2024.04.23.05.43.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:43:52 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 11/11] KVM: riscv: selftests: Add Zcmop extension to get-reg-list test Date: Tue, 23 Apr 2024 14:43:25 +0200 Message-ID: <20240423124326.2532796-12-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240423124326.2532796-1-cleger@rivosinc.com> References: <20240423124326.2532796-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_054356_208123_AD44577F X-CRM114-Status: UNSURE ( 9.07 ) 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,