Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1768313rda; Tue, 24 Oct 2023 02:41:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHoanAOQNV0xDDV//kBMkj5H6ANVpQ/d03sOyi3fVLiFN7T/ofWT4use9BvoHzWU+wQcJVy X-Received: by 2002:a05:6830:4407:b0:6ce:30ce:3c94 with SMTP id q7-20020a056830440700b006ce30ce3c94mr15170539otv.4.1698140482562; Tue, 24 Oct 2023 02:41:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698140482; cv=none; d=google.com; s=arc-20160816; b=dTb9vPccKAbJeXq1YMRracZjVuR2Bl6SjJ2rIQUHQ736h+2841wh2OzTo75cK9ihHO ayRg3WloTAX2LlAJPJH1ACpfRHgkKOyskS9BaTBSLLn+jrylQZUZclz9ZrUxg7OttFCK 8mZbS2dpfXgOTgFEFCAB2GcftwzUuKsRNxJdTfA/rr5m7k8ktCPHsCo/ZOtvYprjxm6f mjHyr+kGWGCM7Dh95/BLYJMDBtpquzNNXikyeb/mNvIuvemmhMkwVRmhWWoB2q+lDtNR 7+GDiZP05sLdyR2xIl6o8CM2WTA+/hg2mpew7NMtaJ3DGTA3Ino0xUjMjO1XmuKv3dFx OZIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=epBSW7d/Y73fuCPm0yJqVjtBNeGFhQxq0MaplKN63vg=; fh=MZraISKRGtn7mfZE8jYb/9iK+fB7exE1eGpWnJ3LLzc=; b=eL/PqlrnVhu8SLniv05z4SdQPazg8KEkxnpxuaLxSr6GeZcjagUE1NYE+s6tyhztc5 Ak9TirIRvNYm3o1iHCiTuONpr5wc7l8+n7XdX4bJ04R22rXaC7Umf6Ak2bB2L+pVSOYo aj0eCUJorMaGwC6M5ne4/UmUbyBCKcbeOBG0fti+ovyVF0GClpUscJDk0hX16t49jxhC Vfy3KVzolxg0U05bWTmtQVgx1NY6awn3wT6sUd4TQhMA+YdEMJ3zZ5zqDULOIv3zIwXn 4BjvtDt5QAbOk1wTN543Q7QX9/V/iV9BmsxnUoo3BmMiCYWzQi53n2HJ987UIbeipqSB OoeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="AMiqT/jw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id t4-20020a63f344000000b00563de199314si8247625pgj.896.2023.10.24.02.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 02:41:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="AMiqT/jw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id DA6B280ACFE7; Tue, 24 Oct 2023 02:41:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234315AbjJXJlM (ORCPT + 99 others); Tue, 24 Oct 2023 05:41:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234320AbjJXJkz (ORCPT ); Tue, 24 Oct 2023 05:40:55 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C40C41713 for ; Tue, 24 Oct 2023 02:30:11 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-32da4180ca2so892430f8f.1 for ; Tue, 24 Oct 2023 02:30:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1698139810; x=1698744610; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=epBSW7d/Y73fuCPm0yJqVjtBNeGFhQxq0MaplKN63vg=; b=AMiqT/jwK00ssjVuB21Y1vsh4Z8x0hMaB49VaHC9aXjss7zFtjX5jUszFo4EsDX9+U 3QE9XlAxOfHHCd3/FBjIwKR20W434JL4MXLvmwW2i3ts6NbAvUQrv33CRhNZdzRnGAsu gslbGhzqrfouddAU2bPrRuxL3UMf0JtEUkGmFKEOjTbeOayV/QutH4Xsp5yJGS9jXat+ 5y/pGgy4py1/A1Me1qTzSg5/sWAL7caH/e6179AyoJMu8/MXYnm8LY3aP27WqLvs5lCk pxrFFNPhw12uT4xmur0Vvzi+WU5sTClp5f8KgdiUZCstD6ikiWE7CkXkyCjL3LdY9O7N 2jKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698139810; x=1698744610; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=epBSW7d/Y73fuCPm0yJqVjtBNeGFhQxq0MaplKN63vg=; b=m0aiqiYElw3ixyiohIU7ISlGoQw5yz/Y2Id0I4B7p9gCzbqbGNKvD+eIkEfNEu5lfJ copf8jm+ozFuQobVDoAvyzz4/vAofIKsS5bLOAcEAOoaygfA6JkbDYEavGtSAoEClmP6 b/HonEw2+B2US3iI3q6fvmzn98p3Wbv0VbEm67eOiz41zghY6ffDlwZE0qJRqqt1Wqh8 Hza4hAgtg+QEf+tAOTeegBEQhZhfUNk+7+4e1u6l3OFiTU+GWYrFlE+zgS3him6tBLRg MYwHQp8mrfGRyy2aC1/gv9fpTV5CQcrNwbmR/fGRlvXnB2iEcJ8F8WllhsQdg24QQRFl 5ryg== X-Gm-Message-State: AOJu0Yy1cUgbukZMBtRwILGCRO8ArWhZnkZnDD6dqkvIdL3TxNNBiuJi wrzQlFP3zJKhsDbCqslwk+/yOA== X-Received: by 2002:adf:a48f:0:b0:32d:d9a8:53df with SMTP id g15-20020adfa48f000000b0032dd9a853dfmr8334091wrb.3.1698139809733; Tue, 24 Oct 2023 02:30:09 -0700 (PDT) Received: from ?IPV6:2a01:e0a:999:a3a0:597d:e2c5:6741:bac9? ([2a01:e0a:999:a3a0:597d:e2c5:6741:bac9]) by smtp.gmail.com with ESMTPSA id dj18-20020a0560000b1200b0032d96dd703bsm9574187wrb.70.2023.10.24.02.30.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Oct 2023 02:30:09 -0700 (PDT) Message-ID: <56f6af04-bdf4-4b85-99dc-9eb4f391d7ad@rivosinc.com> Date: Tue, 24 Oct 2023 11:30:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 02/19] riscv: add ISA extension parsing for scalar crypto Content-Language: en-US From: =?UTF-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= To: Evan Green Cc: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Conor Dooley , Samuel Ortiz , Conor Dooley References: <20231017131456.2053396-1-cleger@rivosinc.com> <20231017131456.2053396-3-cleger@rivosinc.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 24 Oct 2023 02:41:20 -0700 (PDT) On 24/10/2023 09:18, Clément Léger wrote: > > > On 23/10/2023 18:21, Evan Green wrote: >> On Tue, Oct 17, 2023 at 6:15 AM Clément Léger wrote: >>> >>> From: Evan Green >>> >>> The Scalar Crypto specification defines Zk as a shorthand for the >>> Zkn, Zkr and Zkt extensions. The same follows for both Zkn, Zks and Zbk, >>> which are all shorthands for various other extensions. The detailed >>> breakdown can be found in their dt-binding entries. >>> >>> Since Zkn also implies the Zbkb, Zbkc and Zbkx extensions, simply passing >>> "zk" through a DT should enable all of Zbkb, Zbkc, Zbkx, Zkn, Zkr and Zkt. >>> For example, setting the "riscv,isa" DT property to "rv64imafdc_zk" >>> should generate the following cpuinfo output: >>> "rv64imafdc_zicntr_zicsr_zifencei_zihpm_zbkb_zbkc_zbkx_zknd_zkne_zknh_zkr_zkt" >>> >>> riscv_isa_ext_data grows a pair of new members, to permit setting the >>> relevant bits for "bundled" extensions, both while parsing the ISA string >>> and the new dedicated extension properties >>> >>> Co-developed-by: Conor Dooley >>> Signed-off-by: Conor Dooley >>> Signed-off-by: Evan Green >>> Signed-off-by: Clément Léger >> >> My tree might be out of sync, but in my search for riscv_isa_ext, I >> also found a use in print_isa() (cpu.c) where we're reaching into >> riscv_isa_ext[].id and assuming it's always valid. If that's still in >> there we'll want to fix up that spot too, since now with bundles .id >> may or may not be valid. > > Oh indeed, the array is visible outside of this compilation unit :/. > I'll check that before sending V3. After looking a bit more at that, it actually seems that id is used in cpuinfo to determine which extensions are present which means you are right, bundle_size needs to be accounted for. Looking at it also raises the question (again) of exposing the "bundles" extensions themselves or not in cpuinfo output. With the current setup, the bundles extensions won't be visible in cpuinfo output. For instance if Zk was in the isa string, then it will not be visible in the cpuinfo output, only the child extensions. One solution would be to always have a valid id for each extension. So we would have one for Zk for instance. We would then have a similar setup for all "bundles" or "subset" extensions, they would have a id for all of them. For instance, Zk would become: __RISCV_ISA_EXT_DATA_BUNDLE(zk, RISCV_ISA_EXT_ZK, riscv_zk_bundled_exts) Same would go for zvbb (riscv_zvbb_subset_exts would only contain Zvkb): __RISCV_ISA_EXT_DATA_BUNDLE(zk, RISCV_ISA_EXT_ZVBB, riscv_zvbb_subset_exts) For the sake of completeness, I feel like it would be good to have all the extensions (bundles or not) visible in the riscv_isa_ext. Any objection ? Clément > > Clément > >> >> -Evan