From patchwork Tue Nov 7 10:55:37 2023 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: 13448503 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 CED66C4332F for ; Tue, 7 Nov 2023 10:56:21 +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=bpv0xQ33BXt++08AXX/aBg6gsJ/I9d7xsB2AQvOkT9g=; b=4ErTpCNXhuHT8V G/batjZYq+L+Z/vhqJK8IXT+SAhoihbZeKeLSQGzf8x9rkHUsuVi7rvCYCncnX8eUANz3Ex5YWMxp g0W4SQU92zEzXFABxvQiAEugxS0XFzb0aJ/2p8EWC5u27eAV2qb9Jno6An7f1RC1q/95u6FsjMDiA zw6McMq1LpvSwcXU/Z8suoR59fRNcAd0p9MHX8osvWinLeH0wI3T25ixOuGtq3IdRF+fJafLwzoB0 mrAFfrMPDufPgh2Z6RLmqqKHjvLIM5Wc2wLEUyeMjhkdrvW7xwLUPHZqd9RwnAt2xdi/x2O52JbRk kJxAvh97hQ4O4LJsoc3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkc-00197W-2Y; Tue, 07 Nov 2023 10:56:06 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0JkZ-00195q-3A for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:05 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-32f8246103cso1245160f8f.1 for ; Tue, 07 Nov 2023 02:56:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354561; x=1699959361; 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=yWXszjrW0mqtPT5ge0XuiGQJ6aaCxrPofMKEXjPvYnQ=; b=xJSABzs6oJEQAH7Jzpr0F2T9a8FphyxO8kRU8392181+LlRCSXC/0nPVrchmtbQtpO lkhPGnQQKIZdlGyliRA6476yzWGIx+0w6oNJWCtX68zBY46j75OV3SdX4wtD9VSQPhoJ wApOLhyOfgur6njsRfC5NE+01wD9x8quOlThRZa6kT7b2uk+JV/RzmEd7btc3t9+2ZET qIHgIgl2GPrfrLA4/k0oo1ZCrim9yfOIawz1+XRpH/BlijMR6Ct7FLkqeOWNaQEhqqyT /TsWe/9ZCV0EOA48hk93l6enqrEOTMTKCTd9PTtBoLZ1X+19Rzjz90L24DXakWF+xIjh kQ0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354561; x=1699959361; 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=yWXszjrW0mqtPT5ge0XuiGQJ6aaCxrPofMKEXjPvYnQ=; b=ep7XQtbu0m0AtYORNwhqiCzqKAeF5YRdj+ZSq8c7pnwsbNRroWP8IWiiVEPKNz78NL RkeBUcgXcWNSu1/Z+B7rWMmQpVdYTgT0arc8Y/FynzRZIm81LT8hB0SqGLNldhFjRGNa k2Y83W8sgL2UvgKXWXsXpS7ITUKs5AgYilrooLACtDuZ++6LObloMF/W28tcoz6fkbno FMGypX4HVr7YF41Jln3svAqhn0cKOGxADcc59sTR7q9PbDaxag+F8p7rvqAs5sMdUlED WATFgBeTEqJoHF18b2yoKTSy0/Py4VQtUwpjYJu9f0o9GBZV6PLIkGKkbW5hoCAtZa0Q ebzw== X-Gm-Message-State: AOJu0YyVre/zVLZ/7RRlMoxOFpOrtliXoZYZEOqHb9gkVZSqPRW9TFsP WuHP6Unx5j0lHQy5YSXmucsIxwpG1+2x5rz8BirXJg== X-Google-Smtp-Source: AGHT+IGuavTtsmwxI8/q0+XaTOH3JqZmAYfCgV3LA6iUJWNnV+0tLfzziM9Sx1y+OIsrf624uUG+Gg== X-Received: by 2002:a05:600c:418a:b0:3fe:d637:7b25 with SMTP id p10-20020a05600c418a00b003fed6377b25mr25010147wmh.0.1699354561462; Tue, 07 Nov 2023 02:56:01 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:00 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz Subject: [PATCH v3 01/20] riscv: hwprobe: factorize hwprobe ISA extension reporting Date: Tue, 7 Nov 2023 11:55:37 +0100 Message-ID: <20231107105556.517187-2-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025604_024667_F933E384 X-CRM114-Status: GOOD ( 12.61 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Factorize ISA extension reporting by using a macro rather than copy/pasting extension names. This will allow adding new extensions more easily. Signed-off-by: Clément Léger Reviewed-by: Evan Green --- arch/riscv/kernel/sys_riscv.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/arch/riscv/kernel/sys_riscv.c b/arch/riscv/kernel/sys_riscv.c index b651ec698a91..49aa4e82797c 100644 --- a/arch/riscv/kernel/sys_riscv.c +++ b/arch/riscv/kernel/sys_riscv.c @@ -145,20 +145,24 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, for_each_cpu(cpu, cpus) { struct riscv_isainfo *isainfo = &hart_isa[cpu]; - if (riscv_isa_extension_available(isainfo->isa, ZBA)) - pair->value |= RISCV_HWPROBE_EXT_ZBA; - else - missing |= RISCV_HWPROBE_EXT_ZBA; - - if (riscv_isa_extension_available(isainfo->isa, ZBB)) - pair->value |= RISCV_HWPROBE_EXT_ZBB; - else - missing |= RISCV_HWPROBE_EXT_ZBB; - - if (riscv_isa_extension_available(isainfo->isa, ZBS)) - pair->value |= RISCV_HWPROBE_EXT_ZBS; - else - missing |= RISCV_HWPROBE_EXT_ZBS; +#define CHECK_ISA_EXT(__ext) \ + do { \ + if (riscv_isa_extension_available(isainfo->isa, __ext)) \ + pair->value |= RISCV_HWPROBE_EXT_##__ext; \ + else \ + missing |= RISCV_HWPROBE_EXT_##__ext; \ + } while (false) + + /* + * Only use CHECK_ISA_EXT() for extensions which are usable by + * userspace with respect to the kernel current configuration. + * For instance, ISA extensions that use float operations + * should not be exposed when CONFIG_FPU is not enabled. + */ + CHECK_ISA_EXT(ZBA); + CHECK_ISA_EXT(ZBB); + CHECK_ISA_EXT(ZBS); +#undef CHECK_ISA_EXT } /* Now turn off reporting features if any CPU is missing it. */ From patchwork Tue Nov 7 10:55:38 2023 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: 13448498 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 354DEC4167B for ; Tue, 7 Nov 2023 10:56:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lk/UY6WFvFwUnGu7twt/774xxUBIOMlKW049Ct01MlM=; b=nnaJQ+4hsZnN6G f5RpqYwwiQo4E6GTLBOhpp7zjl5f+HSSSsvicVwV1FZjhBRgQI1GymSkeGWa/XUmbmtFjmXGQ7uC1 qgvnmSmYILG0j3cSamR2gk1444Q+qKFPwmzqOzi54bHAGfD+mN7Ofd4lKLWbxMw8FIIdJ4sYjKGg2 CdDVFt7Yc0DplwDJje0MAsunk6Q2dCbULtfLZ+w36mB8KuZv8xvRN9ifr0pjbTtMOn69FKE9iSZwo p7gAv2atM/AoO8Fq6K7cAu/IluTUfWmrvjqwAFutwQZLADYamJb76zrOBWXW3xm5XYfAeFUR9uxX9 fFx5laEGgwhetbubPPWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkg-00198p-0G; Tue, 07 Nov 2023 10:56:10 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkb-00196k-2Y for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:07 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-408434ce195so10593135e9.0 for ; Tue, 07 Nov 2023 02:56:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354563; x=1699959363; 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=UA6TaO+YV3P6uG5ehiL6SbNfsZ4OUqVSTDbxUXfxm5E=; b=xsdIZj7OwJ4BAbv/sYCYAaq++DX5IZuktPJ+tpIT1GHbUIpMyQhApvKIpIrtMfFUqK E+HO8YZEszIjG3qGdB2AmFMW6xsRG1+O1OY9QSwoNHXLQ8bpXWPUv+rnktQ7YopclrH2 X67SVi7PZ/lUQVngwuo/5L+BrwRbNFa/m1nhywbFUMH8hoLYIiesCVhzOwYHD7CjbzVN 7cUWAoKJD/R8fWZKt+jHzWIenQG9kLK7ehfQh6nCzmKRafDi5bWXQb7lo42gZEVNAisf /2hFsDjhIbZu1wQu/lrPxTYqeNVqV1C1mXGDww2PyHC8S5Hwpa3uLAMs6KofHW41fUCX VUvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354563; x=1699959363; 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=UA6TaO+YV3P6uG5ehiL6SbNfsZ4OUqVSTDbxUXfxm5E=; b=c+k6mNGUUMz63TEXOyEG8ZFt/m77tBK7zAawPdi+A1jx4qNfGUgdOHILM2COt7n4Mz EsbiwvDuK7X1krhR4EiDNOARuB4tpsjG9gKJHIHaW562nJyPr9Jnon5CnQL7hTDTIrRQ qVe74LjYtw9lBDICQD4QjLLl/7FgCzAh7QDihW+mekdL9bNFfxiLmwk7RMFee9bcVSBW 4AuUifagDt3kYTTowa+rnNJFnK8r/T8JcQJuKBK7AfZ5mL7VCh7qdzACWHnWx1YG862M Y+p1H+6UND7U2GLHDkCPKD6nXLUuSl/TPwIDdwe4OJ76JYN61vbtqiv3oqRylZEx7xvo hwkA== X-Gm-Message-State: AOJu0YzjqTWFrC2iz3Co0soff4AljTtf5b2nCNt0K8EeipR4Kab5oSin GEZD8c/cM/Y49uxZ5uiQWgVI7gWLBFB5Oq3VVA0gPQ== X-Google-Smtp-Source: AGHT+IEDB5qlOk6FgrKsa3qj9SE6v/Kfu6peNUysoGxbasqez5sPqF/BIOxq9sfcbgB58kS3oj4koA== X-Received: by 2002:a05:600c:3b93:b0:405:3cc1:e115 with SMTP id n19-20020a05600c3b9300b004053cc1e115mr25948840wms.3.1699354562728; Tue, 07 Nov 2023 02:56:02 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:01 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz Subject: [PATCH v3 02/20] riscv: hwprobe: export missing Zbc ISA extension Date: Tue, 7 Nov 2023 11:55:38 +0100 Message-ID: <20231107105556.517187-3-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025605_830739_0744ABA7 X-CRM114-Status: GOOD ( 11.71 ) 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 While ISA string parsing has been added, Zbc was not export through hwprobe interface. Export and document this extension. Signed-off-by: Clément Léger --- Documentation/arch/riscv/hwprobe.rst | 3 +++ arch/riscv/include/uapi/asm/hwprobe.h | 1 + arch/riscv/kernel/sys_riscv.c | 1 + 3 files changed, 5 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index a52996b22f75..ecc0307c107e 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -77,6 +77,9 @@ The following keys are defined: * :c:macro:`RISCV_HWPROBE_EXT_ZBS`: The Zbs extension is supported, as defined in version 1.0 of the Bit-Manipulation ISA extensions. + * :c:macro:`RISCV_HWPROBE_EXT_ZBC` The Zbc extension is supported, as defined + in version 1.0 of the Bit-Manipulation ISA extensions. + * :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 d43e306ce2f9..dcef5c33c009 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -29,6 +29,7 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZBA (1 << 3) #define RISCV_HWPROBE_EXT_ZBB (1 << 4) #define RISCV_HWPROBE_EXT_ZBS (1 << 5) +#define RISCV_HWPROBE_EXT_ZBC (1 << 6) #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_riscv.c b/arch/riscv/kernel/sys_riscv.c index 49aa4e82797c..382cd71129c6 100644 --- a/arch/riscv/kernel/sys_riscv.c +++ b/arch/riscv/kernel/sys_riscv.c @@ -162,6 +162,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, CHECK_ISA_EXT(ZBA); CHECK_ISA_EXT(ZBB); CHECK_ISA_EXT(ZBS); + CHECK_ISA_EXT(ZBC); #undef CHECK_ISA_EXT } From patchwork Tue Nov 7 10:55:39 2023 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: 13448499 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 335F6C4167D for ; Tue, 7 Nov 2023 10:56:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0EC27xNSACkGOPT77PkZXzYarW6bctF6ZV5oOPHaTS8=; b=IfbzAkSxYE+uRR ydsNPdjNunkCqsw350JFeYNpFF2MjCBAZvjS96xxfLGGgRZZMr/lyiPwglv/ViTsEn4FaWSSpcfie pkNB8qAQg1wnoRfntVItq1EaMpjYJrKmIcjn3/XRxF3N10qi+dYZ4v/4uxfwOlIcZMyWx1jI6f8sS 8m/IEnZhrRVKRhBmEfExSaqg7JnQelilbYoVs9XzBxeWSPERLljW+PbVLFF3wIdor6q6hDSqWKufF SRX9GY78+h7H00NNloZOWLPjrh0YVrVRzfThz7eITKmSb9aDXbDMI9xu1gj5KoigkHcOVxzOW6zWf h7BxSzuHnHuP31kQwFcw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkg-00199G-28; Tue, 07 Nov 2023 10:56:10 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkc-00196r-29 for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:08 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2c508e76eb4so10239551fa.0 for ; Tue, 07 Nov 2023 02:56:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354564; x=1699959364; 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=884mjVBUf/B5xVe7Mn+vWmHn9PLqi2rVnCfcoQ9sUfs=; b=G6/JC/QB/U7dxWcuV6kYL+tTMBYhMYtglyIh9ncYH2PUlwL+O2GEbfhlRNc8Zrft+3 ue5uMM1kfoVGUhdrtnhbXWZkKbFVoeCsWipmNVmVMfGhHIFulQunUpURUpkVcpmjQy6l l4UstwNhkXMZA6an6EdcBMXQ5HQ9Y39DpeJUnKCLF3NypaUIB5yZI442QRpFW9fmEnF3 DlAfZlselySJlGavEv0QgvOBRH980R1cnFOY2tpffTYe7j9Z/bxGmMbtdMsVtZixLlar mqj9WiNod8PFDgtUIKhoiURjCawdmJcmYvwfsOUoqghFL0Ngl7Xx8LRW27L49L5ffNhZ 0mSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354564; x=1699959364; 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=884mjVBUf/B5xVe7Mn+vWmHn9PLqi2rVnCfcoQ9sUfs=; b=rMEYmuVxBHJ31R9JYFoeVeKEWWpQkRgX/xeeh8bK2R1Lnr2jEHRwZz3lJbJ6RWQCbR 9jgeq7pREkTeRAcPjcEPqfduWPSpIxPlINkjPFPIh+0juKe211kjqh7M0w/KTam4ADMQ n4YHwtKrqfdK+Cwu2DwerKg9WuvLME5bJ2Lr9wmbks/NE/LxQ6geVxfh75JRHLHykMnP jBn4pPC1OBb01EenVjdJFQ1o51ifQpPp4ALnnBfIBSCXFNxpAa9PTD0L3yOAcqrZJ4mq DgI5Q+xYlgt9PeFDsf6vewg1cUdiruGFXJUz/KNi8OWhcZrcDp6k8So+nRqKVzk53W2u KSLg== X-Gm-Message-State: AOJu0YwzG7zMnsBA7q+Nrv+bLLxMLuIJokEalmYaEnhgecMcnJfPeWeh SGyCn028PAPRmsHv5KFjfBcj6Afx2mWLX7BV7V0eow== X-Google-Smtp-Source: AGHT+IHXvy/dIISU7g85YMpjpEsVNYZwgjK7rpkPblu9B0vYp48kVxXXr9Iu/Jk+bQRG62RXowl+sg== X-Received: by 2002:a2e:7a19:0:b0:2c0:196c:e38f with SMTP id v25-20020a2e7a19000000b002c0196ce38fmr23575551ljc.1.1699354564263; Tue, 07 Nov 2023 02:56:04 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:03 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz , Conor Dooley Subject: [PATCH v3 03/20] riscv: add ISA extension parsing for scalar crypto Date: Tue, 7 Nov 2023 11:55:39 +0100 Message-ID: <20231107105556.517187-4-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025606_706023_0475916A X-CRM114-Status: GOOD ( 20.99 ) 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 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 Acked-by: Conor Dooley --- arch/riscv/include/asm/hwcap.h | 16 ++++- arch/riscv/kernel/cpufeature.c | 115 ++++++++++++++++++++++++++------- 2 files changed, 107 insertions(+), 24 deletions(-) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index 6fc51c1b34cf..69cc659cf65e 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -60,8 +60,20 @@ #define RISCV_ISA_EXT_ZIHPM 42 #define RISCV_ISA_EXT_SMSTATEEN 43 #define RISCV_ISA_EXT_ZICOND 44 +#define RISCV_ISA_EXT_ZBC 45 +#define RISCV_ISA_EXT_ZBKB 46 +#define RISCV_ISA_EXT_ZBKC 47 +#define RISCV_ISA_EXT_ZBKX 48 +#define RISCV_ISA_EXT_ZKND 49 +#define RISCV_ISA_EXT_ZKNE 50 +#define RISCV_ISA_EXT_ZKNH 51 +#define RISCV_ISA_EXT_ZKR 52 +#define RISCV_ISA_EXT_ZKSED 53 +#define RISCV_ISA_EXT_ZKSH 54 +#define RISCV_ISA_EXT_ZKT 55 #define RISCV_ISA_EXT_MAX 64 +#define RISCV_ISA_EXT_INVALID U32_MAX #ifdef CONFIG_RISCV_M_MODE #define RISCV_ISA_EXT_SxAIA RISCV_ISA_EXT_SMAIA @@ -79,6 +91,8 @@ struct riscv_isa_ext_data { const unsigned int id; const char *name; const char *property; + const unsigned int *subset_ext_ids; + const unsigned int subset_ext_size; }; extern const struct riscv_isa_ext_data riscv_isa_ext[]; @@ -89,7 +103,7 @@ unsigned long riscv_isa_extension_base(const unsigned long *isa_bitmap); #define riscv_isa_extension_mask(ext) BIT_MASK(RISCV_ISA_EXT_##ext) -bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, int bit); +bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, unsigned int bit); #define riscv_isa_extension_available(isa_bitmap, ext) \ __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_##ext) diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index e3803822ab5a..0d78791288da 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -68,7 +68,7 @@ EXPORT_SYMBOL_GPL(riscv_isa_extension_base); * * NOTE: If isa_bitmap is NULL then Host ISA bitmap will be used. */ -bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, int bit) +bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, unsigned int bit) { const unsigned long *bmap = (isa_bitmap) ? isa_bitmap : riscv_isa; @@ -100,17 +100,53 @@ static bool riscv_isa_extension_check(int id) return false; } return true; + case RISCV_ISA_EXT_INVALID: + return false; } return true; } -#define __RISCV_ISA_EXT_DATA(_name, _id) { \ - .name = #_name, \ - .property = #_name, \ - .id = _id, \ +#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) _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0) + +/* 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)) + +static const unsigned int riscv_zk_bundled_exts[] = { + RISCV_ISA_EXT_ZBKB, + RISCV_ISA_EXT_ZBKC, + RISCV_ISA_EXT_ZBKX, + RISCV_ISA_EXT_ZKND, + RISCV_ISA_EXT_ZKNE, + RISCV_ISA_EXT_ZKR, + RISCV_ISA_EXT_ZKT, +}; + +static const unsigned int riscv_zkn_bundled_exts[] = { + RISCV_ISA_EXT_ZBKB, + RISCV_ISA_EXT_ZBKC, + RISCV_ISA_EXT_ZBKX, + RISCV_ISA_EXT_ZKND, + RISCV_ISA_EXT_ZKNE, + RISCV_ISA_EXT_ZKNH, +}; + +static const unsigned int riscv_zks_bundled_exts[] = { + RISCV_ISA_EXT_ZBKB, + RISCV_ISA_EXT_ZBKC, + RISCV_ISA_EXT_ZKSED, + RISCV_ISA_EXT_ZKSH +}; + /* * The canonical order of ISA extension names in the ISA string is defined in * chapter 27 of the unprivileged specification. @@ -174,7 +210,21 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(zihpm, RISCV_ISA_EXT_ZIHPM), __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), + __RISCV_ISA_EXT_DATA(zbkb, RISCV_ISA_EXT_ZBKB), + __RISCV_ISA_EXT_DATA(zbkc, RISCV_ISA_EXT_ZBKC), + __RISCV_ISA_EXT_DATA(zbkx, RISCV_ISA_EXT_ZBKX), __RISCV_ISA_EXT_DATA(zbs, RISCV_ISA_EXT_ZBS), + __RISCV_ISA_EXT_BUNDLE(zk, riscv_zk_bundled_exts), + __RISCV_ISA_EXT_BUNDLE(zkn, riscv_zkn_bundled_exts), + __RISCV_ISA_EXT_DATA(zknd, RISCV_ISA_EXT_ZKND), + __RISCV_ISA_EXT_DATA(zkne, RISCV_ISA_EXT_ZKNE), + __RISCV_ISA_EXT_DATA(zknh, RISCV_ISA_EXT_ZKNH), + __RISCV_ISA_EXT_DATA(zkr, RISCV_ISA_EXT_ZKR), + __RISCV_ISA_EXT_BUNDLE(zks, riscv_zks_bundled_exts), + __RISCV_ISA_EXT_DATA(zkt, RISCV_ISA_EXT_ZKT), + __RISCV_ISA_EXT_DATA(zksed, RISCV_ISA_EXT_ZKSED), + __RISCV_ISA_EXT_DATA(zksh, RISCV_ISA_EXT_ZKSH), __RISCV_ISA_EXT_DATA(smaia, RISCV_ISA_EXT_SMAIA), __RISCV_ISA_EXT_DATA(smstateen, RISCV_ISA_EXT_SMSTATEEN), __RISCV_ISA_EXT_DATA(ssaia, RISCV_ISA_EXT_SSAIA), @@ -187,6 +237,27 @@ 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) +{ + if ((name_end - name == strlen(ext->name)) && + !strncasecmp(name, ext->name, name_end - name)) { + /* + * If this is a bundle, enable all the ISA extensions that + * comprise the bundle. + */ + if (ext->subset_ext_size) { + for (int i = 0; i < ext->subset_ext_size; i++) { + if (riscv_isa_extension_check(ext->subset_ext_ids[i])) + set_bit(ext->subset_ext_ids[i], isainfo->isa); + } + } + + if (riscv_isa_extension_check(ext->id)) + set_bit(ext->id, isainfo->isa); + } +} + static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct riscv_isainfo *isainfo, unsigned long *isa2hwcap, const char *isa) { @@ -318,14 +389,6 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc if (*isa == '_') ++isa; -#define SET_ISA_EXT_MAP(name, bit) \ - do { \ - if ((ext_end - ext == strlen(name)) && \ - !strncasecmp(ext, name, strlen(name)) && \ - riscv_isa_extension_check(bit)) \ - set_bit(bit, isainfo->isa); \ - } while (false) \ - if (unlikely(ext_err)) continue; if (!ext_long) { @@ -337,10 +400,8 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc } } else { for (int i = 0; i < riscv_isa_ext_count; i++) - SET_ISA_EXT_MAP(riscv_isa_ext[i].name, - riscv_isa_ext[i].id); + match_isa_ext(&riscv_isa_ext[i], ext, ext_end, isainfo); } -#undef SET_ISA_EXT_MAP } } @@ -439,18 +500,26 @@ static int __init riscv_fill_hwcap_from_ext_list(unsigned long *isa2hwcap) } for (int i = 0; i < riscv_isa_ext_count; i++) { + const struct riscv_isa_ext_data ext = riscv_isa_ext[i]; + if (of_property_match_string(cpu_node, "riscv,isa-extensions", - riscv_isa_ext[i].property) < 0) + ext.property) < 0) continue; - if (!riscv_isa_extension_check(riscv_isa_ext[i].id)) - 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); + } + } - /* 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]; + if (riscv_isa_extension_check(ext.id)) { + set_bit(ext.id, isainfo->isa); - set_bit(riscv_isa_ext[i].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]; + } } of_node_put(cpu_node); From patchwork Tue Nov 7 10:55:40 2023 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: 13448500 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 245FAC4332F for ; Tue, 7 Nov 2023 10:56:17 +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=4YJ6VFaXAKtjegHmXxPODu4t01gYcUxRzB2mo3j1/XE=; b=BmlP/0TNxfKa/l PS0RR/GByz5wvn+2AQoYQMu9/gWD33FBYtFbZ/f0lzLRy3iXtGig/ejFPkGh1T2MZ57/KCcwV/2rC d37d8xhqxIEYHquQhASP/XuEpNGaiQE7FMe7Obr54U1as0ekTIk4qnP28VzFbhHzKY7FMEib6XoXR /ScwidmocPx6P3OO3fkVDM+erBATAvpTD74NtNPWGO9EjsPNt0OvHrHRO3UTdNJ0nJbIOJO/jjhQd xj+2M6p/esDGm2noWc6cwq3hJfIA3c+p8pbw8q7JCFNwg/4ykndnxg+o7cs8nbjXPJH6OQqRxBLtP D+8np3oHDG3mFB8bes6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jki-0019A3-17; Tue, 07 Nov 2023 10:56:12 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkd-00197H-2s for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:09 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-32f831087c6so1250701f8f.0 for ; Tue, 07 Nov 2023 02:56:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354565; x=1699959365; 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=n2QJAM1NTLzbssZcNNT+NMVix19aOXjDu6owokPhRTA=; b=exqZH4voBmVOwWJcO9pnwb68F77ysnxc/fO5JbGH1mD11sdilPY3E7XNmU1+6DPsSA egRe79EZMmERf9pR71AfSJ+yY8zOJvk7RdP+gz2IFou97LjtsHmO9vHEPlzzu/mfsX/V JgH7Y23dJ255kTYCgciH8ofAuoHAhtjZukiG4ibBcLlSAM55TVFD7TOSCDgMOdroCM2p QyozhUH1O3Q+6EYP4us5GZ74Sfn3ZUetn3uoo0F3jaGA4wL4aTwy0d7KlmZHNmOfyIiK 5BI1h8LB65LZeb5V/Czxx5MPX4Mql1hpnf/1O6NfxMK51B6/ag8OPfGt3oinBKXEVM3a nWeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354565; x=1699959365; 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=n2QJAM1NTLzbssZcNNT+NMVix19aOXjDu6owokPhRTA=; b=mAT5NgYRc9JcSzgdpTEiDmJitRrCydVbDeF2HL/C99fptRkWjoN38sC2liECFa2/pS 50M6oyY9hb4nef3Gqm4kkI2nmeosZRgQV5D4dd00i/rUxGmDMsW5SgsB3dnhz4Tk+7rl wpU7hm7cr0pU5M8XUtKOxrBFcr8ecZJIbX9WnckTHAX+/e82oe6CyVG193VK77Wxtv0b 1FYVA1fn0rFZQXMi1ah/dVkLeXkpsqh5muViqfnvf5QExtjFewSRIXot5beyupmPIp3H WXjQo2f7usnm+1k7ucP8Tw8bGTRwyUbV8sK1O+UYD2S/CMniN51lN0hmBAXU0eXoP9Zf lqxA== X-Gm-Message-State: AOJu0YzV5iYdfqisI9H+akcYxwfap6lbndQobVTZvt/3psTVC88EdBou 4CZK5Vqe60R7fbysnM5ZJLdk9+J3yr15dS3FCBewng== X-Google-Smtp-Source: AGHT+IEvK4516vk3XLxXezj4Z/70DNzO/HNov8XwzTHQc2CtYhog8FQf/viaaqr3v8HfCYx/WX8PeA== X-Received: by 2002:a05:600c:418a:b0:3fe:d637:7b25 with SMTP id p10-20020a05600c418a00b003fed6377b25mr25010263wmh.0.1699354565264; Tue, 07 Nov 2023 02:56:05 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:04 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz Subject: [PATCH v3 04/20] riscv: hwprobe: add support for scalar crypto ISA extensions Date: Tue, 7 Nov 2023 11:55:40 +0100 Message-ID: <20231107105556.517187-5-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025607_929409_EED4F319 X-CRM114-Status: GOOD ( 10.79 ) 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 the following scalar crypto extensions through hwprobe: - Zbkb - Zbkc - Zbkx - Zknd - Zkne - Zknh - Zksed - Zksh - Zkt Signed-off-by: Clément Léger --- Documentation/arch/riscv/hwprobe.rst | 27 +++++++++++++++++++++++++++ arch/riscv/include/uapi/asm/hwprobe.h | 9 +++++++++ arch/riscv/kernel/sys_riscv.c | 9 +++++++++ 3 files changed, 45 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index ecc0307c107e..b020b2d35a99 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -80,6 +80,33 @@ The following keys are defined: * :c:macro:`RISCV_HWPROBE_EXT_ZBC` The Zbc extension is supported, as defined in version 1.0 of the Bit-Manipulation ISA extensions. + * :c:macro:`RISCV_HWPROBE_EXT_ZBKB` The Zbkb extension is supported, as + defined in version 1.0 of the Scalar Crypto ISA extensions. + + * :c:macro:`RISCV_HWPROBE_EXT_ZBKC` The Zbkc extension is supported, as + defined in version 1.0 of the Scalar Crypto ISA extensions. + + * :c:macro:`RISCV_HWPROBE_EXT_ZBKX` The Zbkx extension is supported, as + defined in version 1.0 of the Scalar Crypto ISA extensions. + + * :c:macro:`RISCV_HWPROBE_EXT_ZKND` The Zknd extension is supported, as + defined in version 1.0 of the Scalar Crypto ISA extensions. + + * :c:macro:`RISCV_HWPROBE_EXT_ZKNE` The Zkne extension is supported, as + defined in version 1.0 of the Scalar Crypto ISA extensions. + + * :c:macro:`RISCV_HWPROBE_EXT_ZKNH` The Zknh extension is supported, as + defined in version 1.0 of the Scalar Crypto ISA extensions. + + * :c:macro:`RISCV_HWPROBE_EXT_ZKSED` The Zksed extension is supported, as + defined in version 1.0 of the Scalar Crypto ISA extensions. + + * :c:macro:`RISCV_HWPROBE_EXT_ZKSH` The Zksh extension is supported, as + defined in version 1.0 of the Scalar Crypto ISA extensions. + + * :c:macro:`RISCV_HWPROBE_EXT_ZKT` The Zkt extension is supported, as defined + in version 1.0 of the Scalar Crypto ISA extensions. + * :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 dcef5c33c009..10bf543de3ce 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -30,6 +30,15 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZBB (1 << 4) #define RISCV_HWPROBE_EXT_ZBS (1 << 5) #define RISCV_HWPROBE_EXT_ZBC (1 << 6) +#define RISCV_HWPROBE_EXT_ZBKB (1 << 7) +#define RISCV_HWPROBE_EXT_ZBKC (1 << 8) +#define RISCV_HWPROBE_EXT_ZBKX (1 << 9) +#define RISCV_HWPROBE_EXT_ZKND (1 << 10) +#define RISCV_HWPROBE_EXT_ZKNE (1 << 11) +#define RISCV_HWPROBE_EXT_ZKNH (1 << 12) +#define RISCV_HWPROBE_EXT_ZKSED (1 << 13) +#define RISCV_HWPROBE_EXT_ZKSH (1 << 14) +#define RISCV_HWPROBE_EXT_ZKT (1 << 15) #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_riscv.c b/arch/riscv/kernel/sys_riscv.c index 382cd71129c6..bb44592707a5 100644 --- a/arch/riscv/kernel/sys_riscv.c +++ b/arch/riscv/kernel/sys_riscv.c @@ -163,6 +163,15 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, CHECK_ISA_EXT(ZBB); CHECK_ISA_EXT(ZBS); CHECK_ISA_EXT(ZBC); + CHECK_ISA_EXT(ZBKB); + CHECK_ISA_EXT(ZBKC); + CHECK_ISA_EXT(ZBKX); + CHECK_ISA_EXT(ZKND); + CHECK_ISA_EXT(ZKNE); + CHECK_ISA_EXT(ZKNH); + CHECK_ISA_EXT(ZKSED); + CHECK_ISA_EXT(ZKSH); + CHECK_ISA_EXT(ZKT); #undef CHECK_ISA_EXT } From patchwork Tue Nov 7 10:55:41 2023 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: 13448501 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 0BA73C4167B for ; Tue, 7 Nov 2023 10:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=99tcZfHq8b/F4yaGKZRYsZzZrAtc2MBVq0vlIxGAknI=; b=YWqA5hvNsouQr9 nmbWLxt45atoo4gwdeVi4OOTmpD+wk5sn5ooQkbuMuAsEYzPlF+C5esICyfQpzzxngRa8Re+mbWxt g5YudP5VAUnostJtAU8fwMFCpE6NE1czvx6u5auhSOaG+e32sCJOiZq+oT2BzliUisIhBV+4J21Ej pgP2/K791STyVt3kMSqLS+ojrhn1yDi2MX0KmoX/mfApPWKW0Hp1BtLmalDIMnAlMO6nj8KMR1Hbe 4B7+6LAykHvFhybktQ8SWEwqOxi93UNdKL1+cLv9W8XpMnxiONdItKpzqtiy04ddR4wOd+mZufkVK 0Pcv1/BKEx0M0iZXGLaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkj-0019Ac-05; Tue, 07 Nov 2023 10:56:13 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jke-00197m-22 for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:10 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-32fa4183535so811424f8f.1 for ; Tue, 07 Nov 2023 02:56:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354566; x=1699959366; 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=sMnpi79X7SvPehiPmk4gRm0VBHL4POtxgFx0CajIeKI=; b=YRbQqnQB+/o9r35Y2Q+etkEKWG5B19rvDwXwJO3Vl4AycRl4RkV7v36xJCl4NL9G+N SbCWZ8luDX7zmoHCmhWmga4H1ZgROQi4wlv29HWJV0WzMyYPxr3KYO1xV2CNXU1IB6qE RvjVvfUZ8FWz347pa61GW68JO4pvcLHJOLyjXPfU4rlzL5WYrZ64PVhB1lFqXjs7tcVC 6ZFiAOxhJ6zIwFgINi3Y6d1ygTqJzznGnq1VvUpzR1zG2uMdOWRtZZV6Fs5h0IG7NXdo CfpBlZxWnEYzaOnz0tXCDVHiG6TfsG6PQoI05KOg+N143AcF8cRArGgW0Yu2Gox9KnMe GTXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354566; x=1699959366; 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=sMnpi79X7SvPehiPmk4gRm0VBHL4POtxgFx0CajIeKI=; b=PsJvFYjdlZxPoSeR2gGo61oEsMiua6q+krg9A0iWMt+s+TmgI+gXturfDgWozXLDMH DSS62H2gS0x5TbkXsIfA0p6tJFM9l9AENiJ4o7ZVrf0m4Y6iwMgCF6nRBe0xGmsVFDB1 v0xM07+p9LnV/eCxfLT7dV6yGPcC84tv6ciDABzaY0KqShLTO1fICUtGXWLFvi7bFj8s DuECm0Txut1KIj/L3DYMU7Tm0g0wjX7/Nginu8jazxjiqlAZGnIjmwHX4D8Z20j1b08e zPP5vuOMgw77odi9LPe4RwzB/eEuWDvlYBcv3n16KpeUSa22ZlEm8NNDbheGxNjfaCBh k/lA== X-Gm-Message-State: AOJu0Yz3YUnUQZYoolgwOee/B1OSAltQ05hhDe28HaRsTOBn3vEuYy30 cdmMifNetg6vwzXx8PX5cNYZ3PG3K/eNh3AfQMPidQ== X-Google-Smtp-Source: AGHT+IFTaUb/5dQv+OZXaV1szaLrFMm+/+NNM4GP2T1RF5zEOMF3p1Mp4sxm0kbHOX9zra49UOac4w== X-Received: by 2002:a05:600c:3b91:b0:407:52f0:b01a with SMTP id n17-20020a05600c3b9100b0040752f0b01amr26054397wms.2.1699354566602; Tue, 07 Nov 2023 02:56:06 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:05 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz Subject: [PATCH v3 05/20] dt-bindings: riscv: add scalar crypto ISA extensions description Date: Tue, 7 Nov 2023 11:55:41 +0100 Message-ID: <20231107105556.517187-6-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025608_677034_78819D45 X-CRM114-Status: UNSURE ( 9.95 ) 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 scalar crypto ISA extensions which can now be reported through hwprobe for userspace usage. These extensions are the following: - Zbkb - Zbkc - Zbkx - Zknd - Zkne - Zknh - Zkr - Zksed - Zksh - Zkt Signed-off-by: Clément Léger --- .../devicetree/bindings/riscv/extensions.yaml | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index c91ab0e46648..a89363ad653a 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -190,12 +190,89 @@ properties: multiplication as ratified at commit 6d33919 ("Merge pull request #158 from hirooih/clmul-fix-loop-end-condition") of riscv-bitmanip. + - const: zbkb + description: + The standard Zbkb bitmanip instructions for cryptography as ratified + in version 1.0 of RISC-V Cryptography Extensions Volume I + specification. + + - const: zbkc + description: + The standard Zbkc carry-less multiply instructions as ratified + in version 1.0 of RISC-V Cryptography Extensions Volume I + specification. + + - const: zbkx + description: + The standard Zbkx crossbar permutation instructions as ratified + in version 1.0 of RISC-V Cryptography Extensions Volume I + specification. + - const: zbs description: | The standard Zbs bit-manipulation extension for single-bit instructions as ratified at commit 6d33919 ("Merge pull request #158 from hirooih/clmul-fix-loop-end-condition") of riscv-bitmanip. + - const: zk + description: + The standard Zk Standard Scalar cryptography extension as ratified + in version 1.0 of RISC-V Cryptography Extensions Volume I + specification. + + - const: zkn + description: + The standard Zkn NIST algorithm suite extensions as ratified in + version 1.0 of RISC-V Cryptography Extensions Volume I + specification. + + - const: zknd + description: | + The standard Zknd for NIST suite: AES decryption instructions as + ratified in version 1.0 of RISC-V Cryptography Extensions Volume I + specification. + + - const: zkne + description: | + The standard Zkne for NIST suite: AES encryption instructions as + ratified in version 1.0 of RISC-V Cryptography Extensions Volume I + specification. + + - const: zknh + description: | + The standard Zknh for NIST suite: hash function instructions as + ratified in version 1.0 of RISC-V Cryptography Extensions Volume I + specification. + + - const: zkr + description: + The standard Zkr entropy source extension as ratified in version + 1.0 of RISC-V Cryptography Extensions Volume I specification. + + - const: zks + description: + The standard Zks ShangMi algorithm suite extensions as ratified in + version 1.0 of RISC-V Cryptography Extensions Volume I + specification. + + - const: zksed + description: | + The standard Zksed for ShangMi suite: SM4 block cipher instructions + as ratified in version 1.0 of RISC-V Cryptography Extensions + Volume I specification. + + - const: zksh + description: | + The standard Zksh for ShangMi suite: SM3 hash function instructions + as ratified in version 1.0 of RISC-V Cryptography Extensions + Volume I specification. + + - const: zkt + description: + The standard Zkt for data independent execution latency as ratified + in version 1.0 of RISC-V Cryptography Extensions Volume I + specification. + - const: zicbom description: The standard Zicbom extension for base cache management operations as From patchwork Tue Nov 7 10:55:42 2023 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: 13448502 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 B1B02C00A5A for ; Tue, 7 Nov 2023 10:56: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=Fa6fIZssWWAXk86UtJ9as1sQ/07F0Xtglcz1vLAZic0=; b=iznU+1Na+tAnr2 t9XPfbAVTp2EDkAzw6N++xs/c882FrX0tEy9mbIc3TNWRCmFItLQ95IjaR8mfhoKHCp6MQ7t99ykk YEODppm9SJbBFv98ILtwkLBQj1iRoYJs/nnYg91qo9+o55A46XmOLVqcy9Z7+aZ1tOxoMGUIsvBBz AdcOp/GaWl7g5P5G6F+dEB27zZ/BWqvzkrjfTegkOt7ls36YUJihjNZZW/aLEmbxU8nd9WvXATEve Lhu+by50ZbN+UFS93l0a6l97pHa/XnFBzYuT0fa5sDOf201xNLvBoqcCqE2uEr70myxLczWtQg+4K s7Y3d3LlD7PgDRRpeYBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkj-0019BC-2m; Tue, 07 Nov 2023 10:56:13 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkh-00198o-0x for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:12 +0000 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-32fa4183535so811442f8f.1 for ; Tue, 07 Nov 2023 02:56:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354568; x=1699959368; 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=wyYMJgRzMjwrKO5L5hSYe/4Gc/T+AURoIx9X2Um34ac=; b=Op5gsU3erY+gcRL4MSpDErtdAmeo0XJk/Ff1LaV98wTn/1+z8+i3lL/kurra7yzTW5 AQsG1eQ/nSPh+nWbOgnewmxch6cw7GKsamMQg3LhCgiWmfr5J9pa3EBvOmcD0r/mcyJc T7pRoNXG60B6maVWh9ivds/6q6ivBq8+3H5AimORa38LDHE8RY7rKBwW+U6X1zr+mbBN ddMVgieVKgJlbiquYiZxAprcbDNgiRwdIwYOL1c+dsX5zLpTIL2FxxwXAsGLCoF0DCXM Ovl1bjEGmrB8Grn4pHjzh5LJhUWSJ7k+agXrA6fBdQv1wS1uoUQ1y2dfmY6JxbUpyX6v Fjeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354568; x=1699959368; 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=wyYMJgRzMjwrKO5L5hSYe/4Gc/T+AURoIx9X2Um34ac=; b=IYtpTY7FuD1SiNF3q0LgOM4RLZqXbvrP9pKmU7Yv0eFqMGyZAze09+loJhgVrhg8Ul 0wut+kUaqwalXDsFCWy5MMFdgiRq49McLOD1JjMtZkOzxn7fuJhbhDi7uUGkvC74bhKZ 8QSwMc+IAn7iEbA5E4ooIbm5pUK+st5+v2kv6ilvaE1ZxDcp9QeFyyeXUOZIEjkTCS1u Pjx9DwwwG9S4NoEk6WEzyTXJioLotJphleP78GysILk8uSDzdO6GGvGP7bXEF58mmUDJ xvQhmnSLXxghj/KkrcVhLhdfvdylmu7n1XqpHyX27uHhFFV0UkIVOuJAcnAoZG9vyJDp rl/w== X-Gm-Message-State: AOJu0YyL8y1DJv67BCb7tWIeTp5094Lh1Sn8wQF7dfSDpKCjO0TB+x5q abfJO/ix/pnbH87X0Zx7cjzJlonab3wHxDj/15wdvQ== X-Google-Smtp-Source: AGHT+IFyFFeGXMuHqpYj47DkgB8JLp7nUxjM9lX3FEcMg/41/OmRaYpLLNof5//xRHlJ5upcdLIHaQ== X-Received: by 2002:a05:600c:4fcc:b0:405:4721:800 with SMTP id o12-20020a05600c4fcc00b0040547210800mr26080850wmq.1.1699354567943; Tue, 07 Nov 2023 02:56:07 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:07 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz Subject: [PATCH v3 06/20] riscv: add ISA extension parsing for vector crypto Date: Tue, 7 Nov 2023 11:55:42 +0100 Message-ID: <20231107105556.517187-7-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025611_337775_584873BF X-CRM114-Status: GOOD ( 12.91 ) 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 of some Zv* vector crypto ISA extensions that are mentioned in "RISC-V Cryptography Extensions Volume II" [1]. These ISA extensions are the following: - Zvbb: Vector Basic Bit-manipulation - Zvbc: Vector Carryless Multiplication - Zvkb: Vector Cryptography Bit-manipulation - Zvkg: Vector GCM/GMAC. - Zvkned: NIST Suite: Vector AES Block Cipher - Zvknh[ab]: NIST Suite: Vector SHA-2 Secure Hash - Zvksed: ShangMi Suite: SM4 Block Cipher - Zvksh: ShangMi Suite: SM3 Secure Hash - Zvkn: NIST Algorithm Suite - Zvknc: NIST Algorithm Suite with carryless multiply - Zvkng: NIST Algorithm Suite with GCM. - Zvks: ShangMi Algorithm Suite - Zvksc: ShangMi Algorithm Suite with carryless multiplication - Zvksg: ShangMi Algorithm Suite with GCM. - Zvkt: Vector Data-Independent Execution Latency. Link: https://drive.google.com/file/d/1gb9OLH-DhbCgWp7VwpPOVrrY6f3oSJLL/view [1] Signed-off-by: Clément Léger --- arch/riscv/include/asm/hwcap.h | 14 ++++++- arch/riscv/kernel/cpufeature.c | 68 ++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index 69cc659cf65e..556d1da02877 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -71,8 +71,18 @@ #define RISCV_ISA_EXT_ZKSED 53 #define RISCV_ISA_EXT_ZKSH 54 #define RISCV_ISA_EXT_ZKT 55 - -#define RISCV_ISA_EXT_MAX 64 +#define RISCV_ISA_EXT_ZVBB 56 +#define RISCV_ISA_EXT_ZVBC 57 +#define RISCV_ISA_EXT_ZVKB 58 +#define RISCV_ISA_EXT_ZVKG 59 +#define RISCV_ISA_EXT_ZVKNED 60 +#define RISCV_ISA_EXT_ZVKNHA 61 +#define RISCV_ISA_EXT_ZVKNHB 62 +#define RISCV_ISA_EXT_ZVKSED 63 +#define RISCV_ISA_EXT_ZVKSH 64 +#define RISCV_ISA_EXT_ZVKT 65 + +#define RISCV_ISA_EXT_MAX 128 #define RISCV_ISA_EXT_INVALID U32_MAX #ifdef CONFIG_RISCV_M_MODE diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 0d78791288da..56570b838910 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -121,6 +121,10 @@ static bool riscv_isa_extension_check(int id) #define __RISCV_ISA_EXT_BUNDLE(_name, _bundled_exts) \ _RISCV_ISA_EXT_DATA(_name, RISCV_ISA_EXT_INVALID, _bundled_exts, ARRAY_SIZE(_bundled_exts)) +/* 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)) + static const unsigned int riscv_zk_bundled_exts[] = { RISCV_ISA_EXT_ZBKB, RISCV_ISA_EXT_ZBKC, @@ -147,6 +151,54 @@ static const unsigned int riscv_zks_bundled_exts[] = { RISCV_ISA_EXT_ZKSH }; +#define RISCV_ISA_EXT_ZVKN \ + RISCV_ISA_EXT_ZVKNED, \ + RISCV_ISA_EXT_ZVKNHB, \ + RISCV_ISA_EXT_ZVKB, \ + RISCV_ISA_EXT_ZVKT + +static const unsigned int riscv_zvkn_bundled_exts[] = { + RISCV_ISA_EXT_ZVKN +}; + +static const unsigned int riscv_zvknc_bundled_exts[] = { + RISCV_ISA_EXT_ZVKN, + RISCV_ISA_EXT_ZVBC +}; + +static const unsigned int riscv_zvkng_bundled_exts[] = { + RISCV_ISA_EXT_ZVKN, + RISCV_ISA_EXT_ZVKG +}; + +#define RISCV_ISA_EXT_ZVKS \ + RISCV_ISA_EXT_ZVKSED, \ + RISCV_ISA_EXT_ZVKSH, \ + RISCV_ISA_EXT_ZVKB, \ + RISCV_ISA_EXT_ZVKT + +static const unsigned int riscv_zvks_bundled_exts[] = { + RISCV_ISA_EXT_ZVKS +}; + +static const unsigned int riscv_zvksc_bundled_exts[] = { + RISCV_ISA_EXT_ZVKS, + RISCV_ISA_EXT_ZVBC +}; + +static const unsigned int riscv_zvksg_bundled_exts[] = { + RISCV_ISA_EXT_ZVKS, + RISCV_ISA_EXT_ZVKG +}; + +static const unsigned int riscv_zvbb_exts[] = { + RISCV_ISA_EXT_ZVKB +}; + +static const unsigned int riscv_zvknhb_exts[] = { + RISCV_ISA_EXT_ZVKNHA +}; + /* * The canonical order of ISA extension names in the ISA string is defined in * chapter 27 of the unprivileged specification. @@ -225,6 +277,22 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(zkt, RISCV_ISA_EXT_ZKT), __RISCV_ISA_EXT_DATA(zksed, RISCV_ISA_EXT_ZKSED), __RISCV_ISA_EXT_DATA(zksh, RISCV_ISA_EXT_ZKSH), + __RISCV_ISA_EXT_SUPERSET(zvbb, RISCV_ISA_EXT_ZVBB, riscv_zvbb_exts), + __RISCV_ISA_EXT_DATA(zvbc, RISCV_ISA_EXT_ZVBC), + __RISCV_ISA_EXT_DATA(zvkb, RISCV_ISA_EXT_ZVKB), + __RISCV_ISA_EXT_DATA(zvkg, RISCV_ISA_EXT_ZVKG), + __RISCV_ISA_EXT_BUNDLE(zvkn, riscv_zvkn_bundled_exts), + __RISCV_ISA_EXT_BUNDLE(zvknc, riscv_zvknc_bundled_exts), + __RISCV_ISA_EXT_DATA(zvkned, RISCV_ISA_EXT_ZVKNED), + __RISCV_ISA_EXT_BUNDLE(zvkng, riscv_zvkng_bundled_exts), + __RISCV_ISA_EXT_DATA(zvknha, RISCV_ISA_EXT_ZVKNHA), + __RISCV_ISA_EXT_SUPERSET(zvknhb, RISCV_ISA_EXT_ZVKNHB, riscv_zvknhb_exts), + __RISCV_ISA_EXT_BUNDLE(zvks, riscv_zvks_bundled_exts), + __RISCV_ISA_EXT_BUNDLE(zvksc, riscv_zvksc_bundled_exts), + __RISCV_ISA_EXT_DATA(zvksed, RISCV_ISA_EXT_ZVKSED), + __RISCV_ISA_EXT_DATA(zvksh, RISCV_ISA_EXT_ZVKSH), + __RISCV_ISA_EXT_BUNDLE(zvksg, riscv_zvksg_bundled_exts), + __RISCV_ISA_EXT_DATA(zvkt, RISCV_ISA_EXT_ZVKT), __RISCV_ISA_EXT_DATA(smaia, RISCV_ISA_EXT_SMAIA), __RISCV_ISA_EXT_DATA(smstateen, RISCV_ISA_EXT_SMSTATEEN), __RISCV_ISA_EXT_DATA(ssaia, RISCV_ISA_EXT_SSAIA), From patchwork Tue Nov 7 10:55:43 2023 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: 13448504 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 35A87C4167B for ; Tue, 7 Nov 2023 10:56:23 +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=rsGFSuJg5NGge8pRo72xvfsF1c7GHbOzM0tAq1cTxSk=; b=PuIVYF05POM3zD S6UWgiZ4mg+Vs8b44UcZOSWqg/zoqMQAV9S2XHVJ8IDu7zoOVt8blTZYrC/U8++04GnRUoF9NE6/J CUrSjnD3oIkjUSuj+o5k+o0WRMoFGdsqPjn2zuNyeN4pNoeGSPPJZfYCb8+n1XjgxI+RBe9woRSvV TuW5h2viwVkbIdYGvkprDe2E0X4GNXrJNr4uRRSp0z00kK0qsBopEC1pL6ufLm3332+OOKMJQhpqV nzA5zlrokIQadPHc+DIGnYVW/cN9f7vKZeWvNZX5Vr4pMq/uYGL3qKdOADwvPvaBZWigCgopQnbbH RvlWwM39xCMHUtfbPTBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkn-0019EV-0I; Tue, 07 Nov 2023 10:56:17 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkh-00199I-2m for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:13 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-408ffb55b35so3564995e9.1 for ; Tue, 07 Nov 2023 02:56:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354569; x=1699959369; 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=D3TrfnxPBusbuENWlTFkbo4q1loDmWY4mGc5/+ZWfWU=; b=Gpht2uZ4XdYacoaf1p8hoamILABsAs3kuEZKg0dzpMXyA2l3xN6+apnXBgv733MkQh hZhnwTcd/gVdqwf9ZXpFFJGevsjy4qOW95PCwqz7zCWhZi+uFcSFqnxdXvKUwtVKyQ1k dEVT0+462O0LeALSuGLkwTYCOeLqrXit8lCWpVTcrAyPeyl353pBigx+gArnfDQonVIx XdrbRPVKpObFaKqhPzsr61MlkXytJnMD1u+tDneRpKk7ceQo7DB4vSnZmvB15ePH4y8N WXVqbNe/m9KazZSyHNVPVDrE1975/715AMAN3WPzL2MIIrVfmPk8RrpvFM8mJ7CFfx0o IzpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354569; x=1699959369; 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=D3TrfnxPBusbuENWlTFkbo4q1loDmWY4mGc5/+ZWfWU=; b=Yebm5B6D5lQjw9D+VMASHU5dfUOzcernr6e5o4Lt7tCuNEVdqk1RVmRdKu10jh3IyO bt5qBbASob/vusVWgXPd3Q9DAPECGybMSSkoG0lLhLTRz841zKn4XKeTOunaQ+g4dVlF LMOGlyyrfZg6S9Wg+SGlF4MnYxnznT1gsJ6kjLBuJB6Q18XSjO5kZAvs7fHSb05+maeJ VNoWnnwx/zGGqeIrgnFnihqlofLkkqR33Mt8INrL0hZ0bLxF/I6dLrh6wvpcE6d73h+i YxVfJA0w1NM9zdWRQVPOW7NpU9ngnhLl90T2F558d2cPfRO5ARRwnZM48ZZYEq0vfDpT mbsw== X-Gm-Message-State: AOJu0YyLloD4xUaSbMjFgFXlGoCLk5l0WS/EMvlOFGOhPV6bno0/gK/d sC4dDdW+9CdqLfQfzSQgkZaVUl0YclJ/MboiPXkUfg== X-Google-Smtp-Source: AGHT+IHnxDz0Lcs+nSF4fhyZmX4N1apZiK61SiS26CL6G/o5AoZ2KehCJD/kPki3vD5ZYO3oxb3qIw== X-Received: by 2002:a05:600c:3d95:b0:408:3ea2:1220 with SMTP id bi21-20020a05600c3d9500b004083ea21220mr25869592wmb.1.1699354568713; Tue, 07 Nov 2023 02:56:08 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:08 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz Subject: [PATCH v3 07/20] riscv: hwprobe: export vector crypto ISA extensions Date: Tue, 7 Nov 2023 11:55:43 +0100 Message-ID: <20231107105556.517187-8-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025611_901387_FD95FD55 X-CRM114-Status: GOOD ( 11.69 ) 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 Zv* vector crypto ISA extensions that were added in "RISC-V Cryptography Extensions Volume II" specification[1] through hwprobe. This adds support for the following instructions: - Zvbb: Vector Basic Bit-manipulation - Zvbc: Vector Carryless Multiplication - Zvkb: Vector Cryptography Bit-manipulation - Zvkg: Vector GCM/GMAC. - Zvkned: NIST Suite: Vector AES Block Cipher - Zvknh[ab]: NIST Suite: Vector SHA-2 Secure Hash - Zvksed: ShangMi Suite: SM4 Block Cipher - Zvksh: ShangMi Suite: SM3 Secure Hash - Zvknc: NIST Algorithm Suite with carryless multiply - Zvkng: NIST Algorithm Suite with GCM. - Zvksc: ShangMi Algorithm Suite with carryless multiplication - Zvksg: ShangMi Algorithm Suite with GCM. - Zvkt: Vector Data-Independent Execution Latency. Zvkn and Zvks are ommited since they are a superset of other extensions. Link: https://drive.google.com/file/d/1gb9OLH-DhbCgWp7VwpPOVrrY6f3oSJLL/view [1] Signed-off-by: Clément Léger Reviewed-by: Evan Green --- Documentation/arch/riscv/hwprobe.rst | 30 +++++++++++++++++++++++++++ arch/riscv/include/uapi/asm/hwprobe.h | 10 +++++++++ arch/riscv/kernel/sys_riscv.c | 13 ++++++++++++ 3 files changed, 53 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index b020b2d35a99..2183fa6d2fc1 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -107,6 +107,36 @@ The following keys are defined: * :c:macro:`RISCV_HWPROBE_EXT_ZKT` The Zkt extension is supported, as defined in version 1.0 of the Scalar Crypto ISA extensions. + * :c:macro:`RISCV_HWPROBE_EXT_ZVBB`: The Zvbb extension is supported as + defined in version 1.0 of the RISC-V Cryptography Extensions Volume II. + + * :c:macro:`RISCV_HWPROBE_EXT_ZVBC`: The Zvbc extension is supported as + defined in version 1.0 of the RISC-V Cryptography Extensions Volume II. + + * :c:macro:`RISCV_HWPROBE_EXT_ZVKB`: The Zvkb extension is supported as + defined in version 1.0 of the RISC-V Cryptography Extensions Volume II. + + * :c:macro:`RISCV_HWPROBE_EXT_ZVKG`: The Zvkg extension is supported as + defined in version 1.0 of the RISC-V Cryptography Extensions Volume II. + + * :c:macro:`RISCV_HWPROBE_EXT_ZVKNED`: The Zvkned extension is supported as + defined in version 1.0 of the RISC-V Cryptography Extensions Volume II. + + * :c:macro:`RISCV_HWPROBE_EXT_ZVKNHA`: The Zvknha extension is supported as + defined in version 1.0 of the RISC-V Cryptography Extensions Volume II. + + * :c:macro:`RISCV_HWPROBE_EXT_ZVKNHB`: The Zvknhb extension is supported as + defined in version 1.0 of the RISC-V Cryptography Extensions Volume II. + + * :c:macro:`RISCV_HWPROBE_EXT_ZVKSED`: The Zvksed extension is supported as + defined in version 1.0 of the RISC-V Cryptography Extensions Volume II. + + * :c:macro:`RISCV_HWPROBE_EXT_ZVKSH`: The Zvksh extension is supported as + defined in version 1.0 of the RISC-V Cryptography Extensions Volume II. + + * :c:macro:`RISCV_HWPROBE_EXT_ZVKT`: The Zvkt extension is supported as + defined in version 1.0 of the RISC-V Cryptography Extensions Volume II. + * :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 10bf543de3ce..1b85386f276b 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -39,6 +39,16 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZKSED (1 << 13) #define RISCV_HWPROBE_EXT_ZKSH (1 << 14) #define RISCV_HWPROBE_EXT_ZKT (1 << 15) +#define RISCV_HWPROBE_EXT_ZVBB (1 << 16) +#define RISCV_HWPROBE_EXT_ZVBC (1 << 17) +#define RISCV_HWPROBE_EXT_ZVKB (1 << 18) +#define RISCV_HWPROBE_EXT_ZVKG (1 << 19) +#define RISCV_HWPROBE_EXT_ZVKNED (1 << 20) +#define RISCV_HWPROBE_EXT_ZVKNHA (1 << 21) +#define RISCV_HWPROBE_EXT_ZVKNHB (1 << 22) +#define RISCV_HWPROBE_EXT_ZVKSED (1 << 23) +#define RISCV_HWPROBE_EXT_ZVKSH (1 << 24) +#define RISCV_HWPROBE_EXT_ZVKT (1 << 25) #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_riscv.c b/arch/riscv/kernel/sys_riscv.c index bb44592707a5..8e1d26659e14 100644 --- a/arch/riscv/kernel/sys_riscv.c +++ b/arch/riscv/kernel/sys_riscv.c @@ -172,6 +172,19 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, CHECK_ISA_EXT(ZKSED); CHECK_ISA_EXT(ZKSH); CHECK_ISA_EXT(ZKT); + + if (has_vector()) { + CHECK_ISA_EXT(ZVBB); + CHECK_ISA_EXT(ZVBC); + CHECK_ISA_EXT(ZVKB); + CHECK_ISA_EXT(ZVKG); + CHECK_ISA_EXT(ZVKNED); + CHECK_ISA_EXT(ZVKNHA); + CHECK_ISA_EXT(ZVKNHB); + CHECK_ISA_EXT(ZVKSED); + CHECK_ISA_EXT(ZVKSH); + CHECK_ISA_EXT(ZVKT); + } #undef CHECK_ISA_EXT } From patchwork Tue Nov 7 10:55:44 2023 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: 13448506 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 1EF9CC0018C for ; Tue, 7 Nov 2023 10:56:27 +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=lL8Wcnb6AktB0RuaUqFsoOMecr17UngrS6r+c/yWjzE=; b=b9Pbc3h682t28r J/51okcGtzGoYJ373hjzDAMyD4uRRChuJPQKKUDAbd/NDq85tOXYFs2UKXRMTMGhBNlaTYYAHNGag ljBBxuZeWn1MD0taUt2FIJTpr1vSpypRSQ6yVxWF/L0cNBfJAZFNETSjN6e4/elpwzRWLcFjCkBxG BZySRpCd6E8EnAFLKGrGbai9bbiyTlZpRtiIfsFBRAcIkmHpusRkL3fR/UJaZ3BsqtYswDn2B/xLF koKoAbczPna9oew/6TsPQH6256MeeDnuQ+McJ03znVKuMeepgaouf1TagvwL+EvQUt3UScIRokEz1 Xek2ZCpogyAAkzxw9e6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkq-0019JO-2r; Tue, 07 Nov 2023 10:56:20 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkk-0019A4-0A for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:15 +0000 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2c519eab81fso10207911fa.1 for ; Tue, 07 Nov 2023 02:56:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354571; x=1699959371; 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=+VmOC9mW+tWP1B7Ug7oPglT1GAFiZ9zi/wMFmqi0HIg=; b=vVq0CDm2XSk8oZj9WwsHGQ3ROhdv0/etvxuITfTp+vbTT3GTYEwzzcjILF2euv/Bcq hZMNiD86Z85pyKwPDimvZu2elbiLoATj9/m9Gw22VQxhEdLWr4m8ihNxxZjxjnXY+9gQ sQOv9/QKKepIsf5fGuuGrJ6xdrNspQhDUl+VgAZ/jj17NJAgsrmSTQtTUxRrdjzJeBQg VDWJUqnNFP4ckcu9B5CUX81QpXrqfEoNaOCt9SzDc6QCnO0qpingx/EA2T6FJDe0ppR1 DB1GjtEYT8TqYuRND0mYc1+YJBiRXVTsDsIN1GMDMxiyYqlK33XpCui2RK1lurctD+N/ KuTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354571; x=1699959371; 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=+VmOC9mW+tWP1B7Ug7oPglT1GAFiZ9zi/wMFmqi0HIg=; b=pq0A6rbw1uBnroTtfCcxV5D77lm4bXIJMi/Jssect6gMZR4GGUy9MGP2dadGaRvWsg mXYU+O7DjJwV1NgeqLzlRajoqMgPEleCI0+AFasA/JCx6Rk1ermnHunP9Jfl/YV5Fnm0 DGK6nHICu8hRbOGfQLkKNHtI2JnMzyh/Hc9/yHa1qXQ9yJPCVPPghl0mN+NCVFpjBt7r U1EBo46sLEQSajEYzt74pxfUOE3Q5uO9HdPgRoZIgUKRXhcbGjVkz1l4l86kqBm+fB0f ixb1RPtSleSRpgnlLsXhYoUorL2+dlpmLFsnsAc3vf52A7AojcL2tqAtaTArcRNt0xQc q3CA== X-Gm-Message-State: AOJu0Yx/ZJHo6wFpoDMPjWmRPUgOE6M95Ivch7Ej5b1k1pvpClYgMoDy XejTt35MajUFIHtMoR8WxA/AC4P+gAxd3usDrwQwbA== X-Google-Smtp-Source: AGHT+IFp+PQUOKEcVqhD5XemOxadAfc64JRTQk5yBVjO/4RkMQWsKCxkkjglvJOkecV+XYWET7qC7A== X-Received: by 2002:a2e:9695:0:b0:2c4:ff24:b02e with SMTP id q21-20020a2e9695000000b002c4ff24b02emr24737599lji.3.1699354570780; Tue, 07 Nov 2023 02:56:10 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:09 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz , Conor Dooley Subject: [PATCH v3 08/20] dt-bindings: riscv: add vector crypto ISA extensions description Date: Tue, 7 Nov 2023 11:55:44 +0100 Message-ID: <20231107105556.517187-9-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025614_095327_A77A870D X-CRM114-Status: UNSURE ( 9.52 ) 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 Zv* vector crypto extensions that were added in "RISC-V Cryptography Extensions Volume II" specificationi[1]: - Zvbb: Vector Basic Bit-manipulation - Zvbc: Vector Carryless Multiplication - Zvkb: Vector Cryptography Bit-manipulation - Zvkg: Vector GCM/GMAC. - Zvkned: NIST Suite: Vector AES Block Cipher - Zvknh[ab]: NIST Suite: Vector SHA-2 Secure Hash - Zvksed: ShangMi Suite: SM4 Block Cipher - Zvksh: ShangMi Suite: SM3 Secure Hash - Zvkn: NIST Algorithm Suite - Zvknc: NIST Algorithm Suite with carryless multiply - Zvkng: NIST Algorithm Suite with GCM. - Zvks: ShangMi Algorithm Suite - Zvksc: ShangMi Algorithm Suite with carryless multiplication - Zvksg: ShangMi Algorithm Suite with GCM. - Zvkt: Vector Data-Independent Execution Latency. Link: https://drive.google.com/file/d/1gb9OLH-DhbCgWp7VwpPOVrrY6f3oSJLL/view [1] Signed-off-by: Clément Léger Acked-by: Conor Dooley --- .../devicetree/bindings/riscv/extensions.yaml | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index a89363ad653a..b68edfd1fb43 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -335,5 +335,101 @@ properties: in commit 2e5236 ("Ztso is now ratified.") of the riscv-isa-manual. + - const: zvbb + description: + The standard Zvbb extension for vectored basic bit-manipulation + instructions, as ratified in commit 56ed795 ("Update + riscv-crypto-spec-vector.adoc") of riscv-crypto. + + - const: zvbc + description: + The standard Zvbc extension for vectored carryless multiplication + instructions, as ratified in commit 56ed795 ("Update + riscv-crypto-spec-vector.adoc") of riscv-crypto. + + - const: zvkb + description: + The standard Zvkb extension for vector cryptography bit-manipulation + instructions, as ratified in commit 56ed795 ("Update + riscv-crypto-spec-vector.adoc") of riscv-crypto. + + - const: zvkg + description: + The standard Zvkg extension for vector GCM/GMAC instructions, as + ratified in commit 56ed795 ("Update riscv-crypto-spec-vector.adoc") + of riscv-crypto. + + - const: zvkn + description: + The standard Zvkn extension for NIST algorithm suite instructions, as + ratified in commit 56ed795 ("Update riscv-crypto-spec-vector.adoc") + of riscv-crypto. + + - const: zvknc + description: + The standard Zvknc extension for NIST algorithm suite with carryless + multiply instructions, as ratified in commit 56ed795 ("Update + riscv-crypto-spec-vector.adoc") of riscv-crypto. + + - const: zvkned + description: + The standard Zvkned extension for Vector AES block cipher + instructions, as ratified in commit 56ed795 ("Update + riscv-crypto-spec-vector.adoc") of riscv-crypto. + + - const: zvkng + description: + The standard Zvkng extension for NIST algorithm suite with GCM + instructions, as ratified in commit 56ed795 ("Update + riscv-crypto-spec-vector.adoc") of riscv-crypto. + + - const: zvknha + description: | + The standard Zvknha extension for NIST suite: vector SHA-2 secure, + hash (SHA-256 only) instructions, as ratified in commit + 56ed795 ("Update riscv-crypto-spec-vector.adoc") of riscv-crypto. + + - const: zvknhb + description: | + The standard Zvknhb extension for NIST suite: vector SHA-2 secure, + hash (SHA-256 and SHA-512) instructions, as ratified in commit + 56ed795 ("Update riscv-crypto-spec-vector.adoc") of riscv-crypto. + + - const: zvks + description: + The standard Zvks extension for ShangMi algorithm suite + instructions, as ratified in commit 56ed795 ("Update + riscv-crypto-spec-vector.adoc") of riscv-crypto. + + - const: zvksc + description: + The standard Zvksc extension for ShangMi algorithm suite with + carryless multiplication instructions, as ratified in commit 56ed795 + ("Update riscv-crypto-spec-vector.adoc") of riscv-crypto. + + - const: zvksed + description: | + The standard Zvksed extension for ShangMi suite: SM4 block cipher + instructions, as ratified in commit 56ed795 ("Update + riscv-crypto-spec-vector.adoc") of riscv-crypto. + + - const: zvksh + description: | + The standard Zvksh extension for ShangMi suite: SM3 secure hash + instructions, as ratified in commit 56ed795 ("Update + riscv-crypto-spec-vector.adoc") of riscv-crypto. + + - const: zvksg + description: + The standard Zvksg extension for ShangMi algorithm suite with GCM + instructions, as ratified in commit 56ed795 ("Update + riscv-crypto-spec-vector.adoc") of riscv-crypto. + + - const: zvkt + description: + The standard Zvkt extension for vector data-independent execution + latency, as ratified in commit 56ed795 ("Update + riscv-crypto-spec-vector.adoc") of riscv-crypto. + additionalProperties: true ... From patchwork Tue Nov 7 10:55:45 2023 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: 13448505 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 797FEC4332F for ; Tue, 7 Nov 2023 10:56: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=+B2eSRMxsHHhwZ27jQjNPiQpdodqdxoowe3LcqC11pU=; b=GpWIWvVI+vaMoa QVFJVMx/emSyHRcCpnaoXNAUfimFp1VTDxyhTLeGc7yqqAV0IlD/SzWRk6FQ617lzU3wVY43Sq7AG wSs2momYg/dAg+sYiEf7S6Pm2NEBZxfTJKmD+0+ziW5vBqR30fBr5HXdx3jo2zMbiMYT/HBnFPf3T PDHIRA+PjJFGQBMtV1HcJvTOCsgS5pas1636LHEDcEd1CmXr0FXzTCC8xDcgXjRv1qqAdGSuZSE7L iAZa+i2+YSJ0MSWqrBdqF6NhKTbzhR+aJVIw4Bv7BFxCwZwy/nwbreBiux0TP5rn3Q3l3RvrokJ46 ftBgwBVQQUqRlmLGOPYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkp-0019IY-1T; Tue, 07 Nov 2023 10:56:19 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkk-0019AP-0G for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:15 +0000 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-32f9baca5bcso817419f8f.0 for ; Tue, 07 Nov 2023 02:56:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354572; x=1699959372; 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=bP/Xz2BZ0CN3QwJs26MNtdiNNK8TyKjqE/jUpDPgkTo=; b=2VKYJQRt9+PWHreFfEKSLEeov9jQye2sXW43eb+fehR7zm547cBE+Bxs6Ni4jWycC0 fi4Ejoxl0hN5HkVfLbQAOGUNBfo/TgXQhCR7F0M0b9cpm6A2gmoydZPBJpVV+y77BNeu 4aiCaugdydkng2IACKnVUlLOnDKns8VkLfm4gE0OyGggORNEjlfPHC1u2FyjlVuWDt9a l0q2ogR+f+FNvX4NOnjr766nwDAZKem2uFAzC5HT6WdhJBJmLwxzmkGwjHNRviO+w3lP 5K4i7AJasvTk7oVQtZ8RLdcCnzAQwAxQGhoM23mCrfnNMOsZLEN+CxeOQnXpBBdNmZ6M saAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354572; x=1699959372; 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=bP/Xz2BZ0CN3QwJs26MNtdiNNK8TyKjqE/jUpDPgkTo=; b=XfX84PQGsatdW4sPizmjCrNIR6MEamlJ/YnnsEOS8I/CmpAKnp45I09TXRQar/L6dd GoDtDUgcSyYoPgx3Mxm7B7KDyOSQH/Aw/Dbz2a5ZXN2ufMlDgtM1R7VLIBbxBAbWEGz3 WAhf8BLa/JNHna0Op8Ek+LKhMWegk3sPirvjzkFoj5kqe8RGpWirGXLSvoDiZ2M/aSxR DovXQYTQxcaGx8/N8h7QUKvijcx2OtA6mMBwWhNWKYi06yTXEX1jOF55nshxB5nV1wpv S9gPWHxh+L7bO66g4Ev8Vw3n1gIhpOAuhzw2QUdej3JtCXY03mUY4Jge3g3NgL9Ji9dG TKTg== X-Gm-Message-State: AOJu0Ywe48mlE24tHE6IWZuyHiTdsoecqhnN4zGOjqMXZSgzDxOKxQw4 2LqhUr5VaTVNRRLnQiT3v1laxBmdwdbxQsRe1UTN3A== X-Google-Smtp-Source: AGHT+IE6VYSHRuwoE2N98xFWFeww3WuAv2d6RelnI44p7pd6PDNb8XsMUCdLyux86n2WxtMje6eQ5g== X-Received: by 2002:a05:600c:3b91:b0:407:52f0:b01a with SMTP id n17-20020a05600c3b9100b0040752f0b01amr26054544wms.2.1699354571542; Tue, 07 Nov 2023 02:56:11 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:11 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz Subject: [PATCH v3 09/20] riscv: add ISA extension parsing for Zfh/Zfh[min] Date: Tue, 7 Nov 2023 11:55:45 +0100 Message-ID: <20231107105556.517187-10-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025614_124638_5BBA1C3A X-CRM114-Status: UNSURE ( 9.20 ) 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 Zfh[min] ISA extensions[1]. Link: https://drive.google.com/file/d/1z3tQQLm5ALsAD77PM0l0CHnapxWCeVzP/view [1] Signed-off-by: Clément Léger Reviewed-by: Evan Green --- arch/riscv/include/asm/hwcap.h | 2 ++ arch/riscv/kernel/cpufeature.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index 556d1da02877..10ebd36f67e0 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -81,6 +81,8 @@ #define RISCV_ISA_EXT_ZVKSED 63 #define RISCV_ISA_EXT_ZVKSH 64 #define RISCV_ISA_EXT_ZVKT 65 +#define RISCV_ISA_EXT_ZFH 66 +#define RISCV_ISA_EXT_ZFHMIN 67 #define RISCV_ISA_EXT_MAX 128 #define RISCV_ISA_EXT_INVALID U32_MAX diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 56570b838910..7c04c03e435f 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -260,6 +260,8 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(zifencei, RISCV_ISA_EXT_ZIFENCEI), __RISCV_ISA_EXT_DATA(zihintpause, RISCV_ISA_EXT_ZIHINTPAUSE), __RISCV_ISA_EXT_DATA(zihpm, RISCV_ISA_EXT_ZIHPM), + __RISCV_ISA_EXT_DATA(zfh, RISCV_ISA_EXT_ZFH), + __RISCV_ISA_EXT_DATA(zfhmin, RISCV_ISA_EXT_ZFHMIN), __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 Nov 7 10:55:46 2023 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: 13448508 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 31DD9C41535 for ; Tue, 7 Nov 2023 10:56:30 +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=VP7b6K3gKTsgSMnQsXXEfeixwCBtV9uHftnwQ7DY6m4=; b=SS6nMQEd3rHOtZ M6lGuoOUtAeu3ZviHLBs4gq6VvsZTmZVkploebOv/nPOGM/DBRWZi5R8/aK3y3TmUvXtld5vj45jE 44HGa3iB5uKaeKadbI84bIYCQ++eTPZKUKOTRQ8Gc1DuddlL7GUDMhLbQLbe9Zlwwsk5DJuD6EuoC AXA1est9FwvIJNJyo+KOrp4WAJlJyZhroQqDRBCQWxKPLp+bFOFhjEEtAq+CrE7A+487uGPvShY1G kDGJ/mmpM2JRHt8kMTPVVCW5YR/m6pJGsqvT3O5aycVZKSmxQ+4H8qIoXDMQkkWaMqIWBhFTC9r/H zk9w2C2AF6P69Omkb6+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jks-0019Lo-1J; Tue, 07 Nov 2023 10:56:22 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkl-0019BB-1b for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:17 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-408423fc784so3094525e9.0 for ; Tue, 07 Nov 2023 02:56:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354572; x=1699959372; 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=mpUSLH3BYgf/ktV7Sl3gBxkxzBrg1sZ+k5tb8/h2R/w=; b=c4Lx6MPd6Q2rMnVIwOs88j1FVf+9Qpz8OjfXR+XrF+fOSJzrUWH3E1EweAOBB6Z2LI Fa7gz+6Ljg+F9B8lFFPBtB+xZHbww9MtjWVaiZqjtYQ3+JcA8hgxU279G51eUeD8XoyF IZXv1pXlMe9gI461Dd6gytOSyF+SRF/fXdDEv1nEaGNGBjalGkK6REpOyTbZMp1slod7 pnF6CRdSotyHkY7MVVL3iL/UYz2GnWZm0NQ9QC2mW2Hsc5FqjZa/aOptBQ7xDZ8l5b1+ bJ3QURdmxB++EXUAEPzUKwwrlzldkhvdoVOBi/bpiUZ4TcpAwZQeap9gxHCUcEZ4Nmpw t0DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354572; x=1699959372; 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=mpUSLH3BYgf/ktV7Sl3gBxkxzBrg1sZ+k5tb8/h2R/w=; b=LvY6oF+sGQI/5nFpB91lNbEoKjrpEkuMyLgF6MSsNo2bBuinjRnCtxd9U5a6RMe/TX WbhdB9rmSFZX6UGz8W8xRpF8BVlu15MhcqhiTGHkaAmcy64Mh9jeT5EjVuzG9v6UE6Rg etH0WNvlTsfaw0qb+9RNDUwtNPTkkxPReC0bo1+UDPXaWzdVVX6YCkYji1kEcZIrhfZH /Bls+QGXvvgF/2MNfR8YnqY2q6xqxm6j37Yh/uQhWHkEurtROs3Vx3VSRQoSf4zR7RVR UlRuIHWUXlrVOd57rhlAJIUnW4cVombx9aP3hzNds2v5WTyWDz8uuBzSfSmoEZ5Api8d 8Qlg== X-Gm-Message-State: AOJu0YwjthrsBzdPGrN/9mYBt0Z5K+Jovy5l0fxv9Lw6ShFtmF8gsN0Q 28OyyShL0JYG6+Nk7bttt8GuFWJqF00iYdsjnwQCyg== X-Google-Smtp-Source: AGHT+IGHgM8P/GBImCVbhEYbBPs1ObGpHO7TgPjk8/ukbJajiGwUzvQhgmr/xEO8DsJ21Emp1pseuw== X-Received: by 2002:a05:600c:1c17:b0:405:4280:341d with SMTP id j23-20020a05600c1c1700b004054280341dmr24929672wms.4.1699354572285; Tue, 07 Nov 2023 02:56:12 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:12 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz Subject: [PATCH v3 10/20] riscv: hwprobe: export Zfh[min] ISA extensions Date: Tue, 7 Nov 2023 11:55:46 +0100 Message-ID: <20231107105556.517187-11-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025615_531879_001C32C1 X-CRM114-Status: GOOD ( 11.67 ) 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 Zfh[min] ISA extensions[1] through hwprobe only if FPU support is available. Link: https://drive.google.com/file/d/1z3tQQLm5ALsAD77PM0l0CHnapxWCeVzP/view [1] Signed-off-by: Clément Léger Reviewed-by: Evan Green --- Documentation/arch/riscv/hwprobe.rst | 6 ++++++ arch/riscv/include/uapi/asm/hwprobe.h | 2 ++ arch/riscv/kernel/sys_riscv.c | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index 2183fa6d2fc1..ce0490e3130c 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -137,6 +137,12 @@ The following keys are defined: * :c:macro:`RISCV_HWPROBE_EXT_ZVKT`: The Zvkt extension is supported as defined in version 1.0 of the RISC-V Cryptography Extensions Volume II. + * :c:macro:`RISCV_HWPROBE_EXT_ZFH`: The Zfh extension version 1.0 is supported + as defined in the RISC-V ISA manual. + + * :c:macro:`RISCV_HWPROBE_EXT_ZFHMIN`: The Zfhmin extension version 1.0 is + supported as defined in the RISC-V ISA manual. + * :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 1b85386f276b..12680081c602 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -49,6 +49,8 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZVKSED (1 << 23) #define RISCV_HWPROBE_EXT_ZVKSH (1 << 24) #define RISCV_HWPROBE_EXT_ZVKT (1 << 25) +#define RISCV_HWPROBE_EXT_ZFH (1 << 26) +#define RISCV_HWPROBE_EXT_ZFHMIN (1 << 27) #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_riscv.c b/arch/riscv/kernel/sys_riscv.c index 8e1d26659e14..486e053a0797 100644 --- a/arch/riscv/kernel/sys_riscv.c +++ b/arch/riscv/kernel/sys_riscv.c @@ -185,6 +185,11 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, CHECK_ISA_EXT(ZVKSH); CHECK_ISA_EXT(ZVKT); } + + if (has_fpu()) { + CHECK_ISA_EXT(ZFH); + CHECK_ISA_EXT(ZFHMIN); + } #undef CHECK_ISA_EXT } From patchwork Tue Nov 7 10:55:47 2023 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: 13448507 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 186D5C00A5A for ; Tue, 7 Nov 2023 10:56:30 +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=Fb6uBNgNG2h3AAN6vi1qQLpzMW9yxCW0jPctXgdwv74=; b=Bt7mgt1ETRUn0b J9/yPBa4ooziRS6reFPd2aYNNSd9NoR7RImPEpsYbwpFJf4T6S9Vl5lXmsre70UNS+kCLRtRTLbPf Ye+Vi1/+fA8Ypjz3nVzu5j8liKEOsOpbdlVlUQ7Hblt3XHSYzkhz4GBIQhJ935bAsYlA/HjKx1yFZ D2HY9fka/r0vmE2f+HpHeb/GTyDo6/IqlgQyGS44KUuCgxmi8nAX8BcwWMIfF6RwjH5vj0tPg9bKO xKfDL4wMwnDa1QXJ43fD6wEVoWps4c3VGJxKbY4zs43TdiPMfDkfSAxhQNSA8qoxW+04zJIhtRgXF OToEPyEt3BINpm/Jurmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jku-0019P9-0J; Tue, 07 Nov 2023 10:56:24 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkm-0019D5-3B for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:19 +0000 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-9bf60bba6f8so165968566b.0 for ; Tue, 07 Nov 2023 02:56:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354574; x=1699959374; 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=K+noeIiO0ZzRdCBLgjz9J+sy56GBx1867ixAgWMD4Wc=; b=h3Y4ooXTocGS5A7m8kPcQ3IISI5uboeFVCPAju4JgClxfCULP7L75wlQB/wcCnowrj thLiPsQcJ693LG9HPdWePop9eNn6/867RK0E+c7snSPTpazVXI6JT/MIitj2xiu/fwon 9dj2JIB9ggC3DkqE12UdBbZ9+R6CEzhY4NyxefZUartv+AvCgVKgzL1qQGgoocwKHQCQ mBfdxQ23pu0IJnCAA54+GIcmDHm+BX1lHNoDFR8yUwAor5No5UBw5oJPS90iEq6/AERi Cmr3It4xPcPK2t9SFOMaxwdsyUfmJqYbW8p44nMyKshEQr1PZvrAC1a5u9ta1DgiklUe P9mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354574; x=1699959374; 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=K+noeIiO0ZzRdCBLgjz9J+sy56GBx1867ixAgWMD4Wc=; b=klGi7iKPnhMk/g55HAIPWTh9iIyEOGfOd5fc6MkOR8YzjqSiv8R2xSqUjuvf3zyjoT gvmnWUiRIB0cStoGUU//eXMwzeFGQwx4W1i6pwVEX+orX0c975bSjYy8jQNILyP7TslZ b3OHZXm3OIDklRFFcF+aASVLFG8eona8BJsloHQVBG6Vw+Z7wB9e9f3GNcufF8qawKRx HJTaazUwLF9tuSluF8CJiVMcJLQ+s1KGQ5Ihn9m+bhy2WB2WF7LGxDnzuO8OzaxuXlq1 3wcPYvg+nOXz2h2bOnob5uj7e07UP3SBmJaDIAZCaB3ZzeKJujtlBDOibbXQPFw9i0fl RORw== X-Gm-Message-State: AOJu0YyICaS4Z9f5g0cAjKmZTK+nyitzBTsJ0sbQq8UnM0yvwXw2Ik5x H3xDK8iMrlYLWK53K5HZMdJrUQzjhiUXaa67SKMSpg== X-Google-Smtp-Source: AGHT+IGQ52RAx3C3PSFQKflfCCfN+v4u5QXrEdDEyMd6Gzx8ZtOWMB3t8ixpUgsMGHhCAPNhRGbMJA== X-Received: by 2002:a17:907:6d02:b0:9c9:603c:407e with SMTP id sa2-20020a1709076d0200b009c9603c407emr28520448ejc.0.1699354573974; Tue, 07 Nov 2023 02:56:13 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:12 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz , Conor Dooley Subject: [PATCH v3 11/20] dt-bindings: riscv: add Zfh[min] ISA extensions description Date: Tue, 7 Nov 2023 11:55:47 +0100 Message-ID: <20231107105556.517187-12-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025617_048473_27D896D6 X-CRM114-Status: UNSURE ( 9.30 ) 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 of Zfh[min] ISA extensions[1] which can now be reported through hwprobe for userspace usage. Link: https://drive.google.com/file/d/1z3tQQLm5ALsAD77PM0l0CHnapxWCeVzP/view [1] Signed-off-by: Clément Léger Acked-by: Conor Dooley --- .../devicetree/bindings/riscv/extensions.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index b68edfd1fb43..62b5fe40b4a3 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -214,6 +214,19 @@ properties: instructions as ratified at commit 6d33919 ("Merge pull request #158 from hirooih/clmul-fix-loop-end-condition") of riscv-bitmanip. + - const: zfh + description: + The standard Zfh extension for 16-bit half-precision binary + floating-point instructions, as ratified in commit 64074bc ("Update + version numbers for Zfh/Zfinx") of riscv-isa-manual. + + - const: zfhmin + description: + The standard Zfhmin extension which provides minimal support for + 16-bit half-precision binary floating-point instructions, as ratified + in commit 64074bc ("Update version numbers for Zfh/Zfinx") of + riscv-isa-manual. + - const: zk description: The standard Zk Standard Scalar cryptography extension as ratified From patchwork Tue Nov 7 10:55:48 2023 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: 13448509 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 3339BC4332F for ; Tue, 7 Nov 2023 10:56:33 +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=XriHi/rc7q6NxisWG8V73VMcvGDvo28qbKo0NpV7hlQ=; b=dBKWjFZm6IhLdo 5VomiCwi9AOaKem+gg4zq654UL+Sfe34PXagLCaZQw5Sd0cE7QNDofQE3tZCcU4fJkYa2KuEEJ9e2 SxCIAapM3W7InptjL/cdvcESanPsecOdwiJT+nPfb/J02v7NP604OigyoYRxmxGGaxAsGincAeL1S D+54EbnZuimZVQCuT0zReRkCYkz6IvfDBmTC9tKiCVfVdjwxL7kvExKCcP0HSfZSG0hpRXiSyfZ8I 4Pi3TTVqQBheTpUrd0kmvkqGske7KGJXJvaE1eQv0UIEe85NiwEi63ce8dY/56NtkuwM0UKCccjUu eaN91d7p3Sp9WQmkh91g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkx-0019Sp-1p; Tue, 07 Nov 2023 10:56:27 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jko-0019Dj-0F for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:22 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-32f831087c6so1250718f8f.0 for ; Tue, 07 Nov 2023 02:56:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354575; x=1699959375; 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=aJyd1YBcb+U2PBneGSdwCeFg8Fe7xoja8XAVvgGr8QM=; b=Ct+8iY+ilorh0EPiZIZ6kUcpfaNuPK0zbYNtOwm9zgYEMzsot2Rd/mbiQHi1Nworgr VdH49F3GL1oxVV5fvMlW+3DUBzh8IJTyAFWLlr0TOtXj+kHaqney4J50wvSBmoMHFoXz HFnx6HD6iBKmBLZA/RnNtDHooPG1xIWN2XwzltJ9Xyvoue7E5z2dqABEOa5N8U6hJMDm WknFlaibzIA1r26QaT5BuKJegKKWuDLUVYh4H7Cl9ecoM7ikFyye3hK84WRfl7Jp/Op/ AJSq1iqnUp1HRjj3u7n5JEr4YTFYvox8LGS4fK2F75qqkw693NQoVbWfcm40biOpFRoy 3yAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354575; x=1699959375; 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=aJyd1YBcb+U2PBneGSdwCeFg8Fe7xoja8XAVvgGr8QM=; b=sw+uIWaJuw9RJIP7SdR9fgtx/qM6SVLBuYIAKCvGBjlPE77yq73Vqq4BOalVBgybCm 1CRt84iWkI6jFH66U2n8CEG8J3AXfWsfY2NosBKUO4CYJbIj34PhYy4BsmqpDIXHkbPx C+05nlKp+JWBbSZgzdCWAhX7ZOdXF0Q/BjyhdEaEOe6JZ4Gk/m1Ckwm04qI+9/LZ8ymg 3LQeQg1g5NJIBjIQpQAuZfB+08QeZaFvcp/xnOJ9jp1+qo9O+FANn2X3MpYNODe+WF0v c/oCWJLERepO8A/Uy7O0chrndtj5pkiMdrGwTs0efds8J14izxzhJDIcGfsAIj9eY7lG rNdA== X-Gm-Message-State: AOJu0Ywea+ySexzMUGCjHuGhJl3VhbsmnwawiF8KAYfDNZwmbk0zK9vx 03fjTxSPmUNiwIHgZCGte+1aoAYcfnKlKs346FnIEg== X-Google-Smtp-Source: AGHT+IFwqzEm1CRJc3Tvln28fqzLrx5PcA3gU0DPHRFsH47EQLrWlkSUXHW5cbEtNQ1KO6g6dWi35Q== X-Received: by 2002:a05:600c:35d6:b0:404:7606:a871 with SMTP id r22-20020a05600c35d600b004047606a871mr24942179wmq.2.1699354574695; Tue, 07 Nov 2023 02:56:14 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:14 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz Subject: [PATCH v3 12/20] riscv: add ISA extension parsing for Zihintntl Date: Tue, 7 Nov 2023 11:55:48 +0100 Message-ID: <20231107105556.517187-13-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025618_158372_41C85F07 X-CRM114-Status: UNSURE ( 9.75 ) 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 Zihintntl ISA extension[1] that was ratified in commit 0dc91f5 ("Zihintntl is ratified") of riscv-isa-manual[2]. Link: https://drive.google.com/file/d/13_wsN8YmRfH8YWysFyTX-DjTkCnBd9hj/view [1] Link: https://github.com/riscv/riscv-isa-manual/commit/0dc91f505e6d [2] Signed-off-by: Clément Léger Reviewed-by: Evan Green --- 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 10ebd36f67e0..5b57b24db60c 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -83,6 +83,7 @@ #define RISCV_ISA_EXT_ZVKT 65 #define RISCV_ISA_EXT_ZFH 66 #define RISCV_ISA_EXT_ZFHMIN 67 +#define RISCV_ISA_EXT_ZIHINTNTL 68 #define RISCV_ISA_EXT_MAX 128 #define RISCV_ISA_EXT_INVALID U32_MAX diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 7c04c03e435f..baa8edfb0e6a 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -258,6 +258,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(zicond, RISCV_ISA_EXT_ZICOND), __RISCV_ISA_EXT_DATA(zicsr, RISCV_ISA_EXT_ZICSR), __RISCV_ISA_EXT_DATA(zifencei, RISCV_ISA_EXT_ZIFENCEI), + __RISCV_ISA_EXT_DATA(zihintntl, RISCV_ISA_EXT_ZIHINTNTL), __RISCV_ISA_EXT_DATA(zihintpause, RISCV_ISA_EXT_ZIHINTPAUSE), __RISCV_ISA_EXT_DATA(zihpm, RISCV_ISA_EXT_ZIHPM), __RISCV_ISA_EXT_DATA(zfh, RISCV_ISA_EXT_ZFH), From patchwork Tue Nov 7 10:55:49 2023 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: 13448546 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 79A5CC4167B for ; Tue, 7 Nov 2023 12:00: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=Z4QAhn70e+I6tzR+Y4aFdbN4AG29WHk9cNTzyz268WI=; b=kgQeMvqGo61wl9 rI1Wzy+6v5JytYvVvW4SsSSq4QUbmmN5yhOIBPsgOWzmnroKbY797fRLWICAA7NHJlq4FIwtXXWLy WMG9gjLmpFAHLlqNjq2njJFojRlsyeLi3rvyDIdzh6IEfuzYpjOKM+11mLj178FHZa7ajNcX56l0i 9TFLpVFtz/V2Lyy8DNhqWWj0LxQWuwpVbOaWtTRbMuFCQ+JXPbny3LRoaqgYnOsqq5Coc1w54REpI QT24J0iwFlSlKB3O2D2w68IG9yJGN+qLxE60t6+5OmXXBXBAjXsyBhYFdEpcG5uncKC3DGvGrsAqG MYjmZasFmGsLIA/mqkRA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Kkr-001O7W-2C; Tue, 07 Nov 2023 12:00:25 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkp-0019G5-0g for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:24 +0000 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2c6f4bc7738so11205241fa.0 for ; Tue, 07 Nov 2023 02:56:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354577; x=1699959377; 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=S4s/6qoHBJWx8IDkipxLTMx5qIdSuDP9Fhxnx/OaR4U=; b=KqvmKMFIq7eG4EbDNva9VUtWcyzo2joqPue5v8+DwMOiArlv/PMB3c2DeNBRgpcKE4 /KfGGYV8LVv7TykZibMgHARd05DAdv0jiZ7dS0b0W3+kALckFEeMtz4IcQdF9hzFmeH9 8tf3TliBtTYgUrub5RE+XdIOj5B1O2fKZVVuyMSyo9ZaJv0II9V/zbU9VxWs8SWh+PVT PQ9ju7GEXCJISuBlOnn8Sp3u8UX1RLjb2bzFddc3p+wKirVDLyajwRn1HiBGCLe6mRO+ J54QybRveaIZOwzaeLrHwwouFeEzQ5bufpl6fW4Sj7Ef7dWEXhbUwJPa+o0vnZJjGESJ eeHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354577; x=1699959377; 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=S4s/6qoHBJWx8IDkipxLTMx5qIdSuDP9Fhxnx/OaR4U=; b=wzkp8B7RgvqFqzVGJiQGw4eOxaPua0nPn2ygGJZMW+ACniINXCbdatHGkt9GXAhmQi 2UgxK6fY6EfIskx4EjoZjD2GQTPxW4gghML14sGVHt+HtlOngCgLcXfMSnZZGSFp68u7 +2UKpkHl5eEGZWSEIjPuQXThDyQbs0Q4o64SvikuGyWdlOpKaN4SqPv3KLYzAh7cbss8 ZR8gi3roFkqqyqjgH8ervy2FIsZ31yGWIbHH1l9XCRqhs5mpr9jueEGGB1gWVKQTJ2IH rJdzzbC00EWPIzHqwllcH/91Vmi28Es7YAfFHc00HtJ6ceWTUWGg6Mv0fiPHFVh7+wVD XhEw== X-Gm-Message-State: AOJu0YyPN7QymXJ4FjfNi9pe7JdfW3/bfwUtRC3K6gvA1FdMbn8HLJZl o6usCFb3BsjWbGbSKa3ypLGMON7AWT63lEF1SGCpmQ== X-Google-Smtp-Source: AGHT+IHavrKs5gCTfWWE/t+GviSN/fOuRjyg21bPxGHplb1KOZPOkEuhUgKCY8nRPYJZqATj3n1jgw== X-Received: by 2002:a2e:9f10:0:b0:2c5:6ab:b817 with SMTP id u16-20020a2e9f10000000b002c506abb817mr22837219ljk.5.1699354576498; Tue, 07 Nov 2023 02:56:16 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:15 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz Subject: [PATCH v3 13/20] riscv: hwprobe: export Zhintntl ISA extension Date: Tue, 7 Nov 2023 11:55:49 +0100 Message-ID: <20231107105556.517187-14-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025619_300555_AB2C4385 X-CRM114-Status: GOOD ( 11.67 ) 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 Zihintntl extension[1] through hwprobe. Link: https://drive.google.com/file/d/13_wsN8YmRfH8YWysFyTX-DjTkCnBd9hj/view [1] Signed-off-by: Clément Léger Reviewed-by: Evan Green --- Documentation/arch/riscv/hwprobe.rst | 3 +++ arch/riscv/include/uapi/asm/hwprobe.h | 1 + arch/riscv/kernel/sys_riscv.c | 1 + 3 files changed, 5 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index ce0490e3130c..2f37b26d27da 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -143,6 +143,9 @@ The following keys are defined: * :c:macro:`RISCV_HWPROBE_EXT_ZFHMIN`: The Zfhmin extension version 1.0 is supported as defined in the RISC-V ISA manual. + * :c:macro:`RISCV_HWPROBE_EXT_ZIHINTNTL`: The Zihintntl extension version 1.0 + is supported as defined in the RISC-V ISA manual. + * :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 12680081c602..36c8d073c987 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -51,6 +51,7 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZVKT (1 << 25) #define RISCV_HWPROBE_EXT_ZFH (1 << 26) #define RISCV_HWPROBE_EXT_ZFHMIN (1 << 27) +#define RISCV_HWPROBE_EXT_ZIHINTNTL (1 << 28) #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_riscv.c b/arch/riscv/kernel/sys_riscv.c index 486e053a0797..af2b01b0a5b6 100644 --- a/arch/riscv/kernel/sys_riscv.c +++ b/arch/riscv/kernel/sys_riscv.c @@ -172,6 +172,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, CHECK_ISA_EXT(ZKSED); CHECK_ISA_EXT(ZKSH); CHECK_ISA_EXT(ZKT); + CHECK_ISA_EXT(ZIHINTNTL); if (has_vector()) { CHECK_ISA_EXT(ZVBB); From patchwork Tue Nov 7 10:55:50 2023 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: 13448510 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 7CAFDC4167D for ; Tue, 7 Nov 2023 10:56:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pleRxe7ywnAmE+NgqrqnigSU6dj9NHBYCXrjB2wQdCk=; b=rar/8l9xTTyaTH UwBF8tvIuhgVi3zYlaIquMJXs5N5jbLuBHIsR6/OHGV5LtoZo7tip7OhMHBZiO2L58d6QgsJpnwOC N8STihET5DR7irjfDusrKlsY91moYOsg0kSSr+/Yz/rtTre+3plwXr30iq/xELSAoJlenOudwRa5N hx+I/+8BEvAgfkUmcYkJz0yqJ0tIOu8OSBJemUq9JcTLH0ptUdwlgRm8gv+we3iMo/my4VbxSULOd XE1c8EyU7mCR03m6nO39XGYkohmUAUePyp011PCS2bMY4LMHuxLXdO4E78mNKZehYksNuh+ajXXrY KWlRXxngOhAih0R4xs+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jl0-0019Vu-10; Tue, 07 Nov 2023 10:56:30 +0000 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkr-0019It-1c for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:24 +0000 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2c504a51a18so11222401fa.1 for ; Tue, 07 Nov 2023 02:56:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354578; x=1699959378; 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=c7aEHK12fdFG0G9p5Ar5H42P12VBS+xQqa4RJxPd+e8=; b=WGxGZJpCb9tyRUSk4W8fvbg57XecX6+0dz6sBMjC6F4YQm4ZJmP66mP0y7Oi2S9zp5 C9ErXaEjFFsJaqpJjbRTAx85MefPyW33NT3Ox2XDpgodAghR1ZGIJrILywANPM4FkKcF fW0tKvyV8uXw2y+9ixIX3kr/NlwMqb2wAkwkc6UeSdASCWGNKbh+JzgSwzjgI0sOMrjc XTyP9NYaDBNR5K2XxW9Oz/VZUE5Svux5jKZ1nKqYnaTds5smtGodve43oPJxhce54r1j vHuS4oHE/ew6i0gKh8WJrrz8nHTKQsDfRBVVjay4HWGdvjPBcWFW6wJbKbgzmHmMAeAs r9lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354578; x=1699959378; 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=c7aEHK12fdFG0G9p5Ar5H42P12VBS+xQqa4RJxPd+e8=; b=X2qHoNHju12ob8zM4DihvapMAVwHUq6MYrWETwV0RxeTVZXMdpmltMXf7sjbLvB3hz pHZQE4kyoUp1GiHKYepAzzJxkD/G4ZzLUmElcSbOxvYpB4mx6xiwnxBiUoMdcoy919oa ewEvIyhwvlkLv6JFybvqrdjEkPpN2oT1IiNiBH1YcfoUK7D/pMDDD/hSBT+/o1OxZce6 U6xivLOizKqyyqH5zo/Omc9avt6+gWEv5sj2s+P7oDNVKYln9Fjibi+1g/l/btEaQNxk r/vHSGWRlmWYOcBv4xEKkNX/6xMkcK5bGzqPs2ar7ZLzMh2TMiIoMi5Rf02Bn75SEKVk kQuw== X-Gm-Message-State: AOJu0Yz7+0TGq4z7UhPzsg/S1xqzRMuCinkbgFHJ3GgLNoQ4hjphb/P5 SyxoUdocv7dcJja18IbZfCIpmeP7pWQTuHojOnLySA== X-Google-Smtp-Source: AGHT+IG6riKUjiH4caHBP0UY8y2QJ6HnExEb8OSRHzEi1uOV2r19/bcFPMSaXYWd+67hvhTH5Nkmjw== X-Received: by 2002:a05:651c:1317:b0:2c5:36e:31ef with SMTP id u23-20020a05651c131700b002c5036e31efmr23580871lja.5.1699354578058; Tue, 07 Nov 2023 02:56:18 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:17 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz , Conor Dooley Subject: [PATCH v3 14/20] dt-bindings: riscv: add Zihintntl ISA extension description Date: Tue, 7 Nov 2023 11:55:50 +0100 Message-ID: <20231107105556.517187-15-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025621_558939_B19A66C5 X-CRM114-Status: UNSURE ( 9.01 ) 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 Zihintntl ISA extension[1] which can now be reported through hwprobe for userspace usage. Link: https://drive.google.com/file/d/13_wsN8YmRfH8YWysFyTX-DjTkCnBd9hj/view [1] Signed-off-by: Clément Léger Acked-by: Conor Dooley --- Documentation/devicetree/bindings/riscv/extensions.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index 62b5fe40b4a3..c80774b518c9 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -336,6 +336,12 @@ properties: The standard Zihintpause extension for pause hints, as ratified in commit d8ab5c7 ("Zihintpause is ratified") of the riscv-isa-manual. + - const: zihintntl + description: + The standard Zihintntl extension for non-temporal locality hints, as + ratified in commit 0dc91f5 ("Zihintntl is ratified") of the + riscv-isa-manual. + - const: zihpm description: The standard Zihpm extension for hardware performance counters, as From patchwork Tue Nov 7 10:55:51 2023 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: 13448511 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 6BD75C4332F for ; Tue, 7 Nov 2023 10:56:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8smYV6ra1HxRjI+0UI7H1NNNI8jYPhH3Ca/O4iYO1MA=; b=LST0ARx8g1k+sq wpdSbWO8IiOu0FD4ZKgSzVSp+BlrxakaKOWXYFSFuAjfcOhAIf5C1Ce1aUU4lqtf5vD03u1YhLaoi JV/siT6WFsLlWG9MxISFUG1BWG75YPY5DR284+e1nwAAPADc6ogtyN2oCHBap2Ti7ZYtIu+KBWrMD VO02P5yNa9whHUZWwsA3CBxYVEaiHigA3zW9iT/exTEM5qQiivFqsYJjTBr/kPOkibbcrIusWs1r3 /RnxQ7wigMCigp4fRJ7olsOo+4r/jBxdzfipvYA2X4z0AwBcAgVRtdUrbuwoF635cRDhVGJC2UV1g xON7xfvR4yqzBkzsqr4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jl1-0019Ys-1q; Tue, 07 Nov 2023 10:56:31 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jks-0019Kr-32 for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:26 +0000 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2c504a51a18so11222541fa.1 for ; Tue, 07 Nov 2023 02:56:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354580; x=1699959380; 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=VpHOk3VsdqfpPenBw33m97LFdLmT8/1+lQVgF+3Qq2k=; b=wPwCXXyUaSbE8p3LLbCxWaZabVYenT2tI7DAQzPTGyx8dVet1YZ9EB/JpI0X5pzs7C aL+PgLCyL0gBBjH2c6N89WaMXW3bkdfOEJeWPL7Ad3sdKqj4hhhm9hahntSEGswWkBQR B0lciMKuZgNrcES3sG2EX881ppH9YZhfZwmh+LM2c80uARV+jxj7kdGxaxXVjp7DgPR+ MDW2tMTMJg6mPg94DEvQxLi3hrLq1kbW25wTF8rj6c9mK7vp31UePk7lPCtxvZ/hojKY 1eY8R+jDDE+tuFKbvp4pC//iEFuswWPn+cXH2vECmxAqFcZgV2wCHFlJh5nBs5ODw8MD apKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354580; x=1699959380; 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=VpHOk3VsdqfpPenBw33m97LFdLmT8/1+lQVgF+3Qq2k=; b=Kj+833ZbCsg6lJeNhxwGveW2P17gTcLUiG6UxJV030mVmiRwrQMX+XsscaOAf1xMlq wJB43llTYwi1phmf5ZaELOXkSsqaDz7KIjhbu/0/NDpDUlPs76gmWKKwKlr/fUTWcszT uty0QW8VP1twijBjaJ81pnE3jZILXi42UxiATg0weOneq4EzB12eIpWH8NtOgnU+4UV8 gSHQS4vf9WSA94YtPgoLr5DRWf53Jo5Br4W5AP/f4aoW/kOFQrbEQEzCZlHkDUq+2YsH C7QaSjiy5VXyhmZ2xDIBVJ3INLFrniNgdd6QQJOVYLfkW2rUtY2MyzHDxmZJ7mEhEM/P fOVQ== X-Gm-Message-State: AOJu0YxARuLs4TmjTvBPtUwMCJHAA6P/Q5ye6VOK+z9zo/PYHuoYjBLC NOphskBIC/MddN/OR4Z0mjwW4dQHVmTqKPO8HRUuVQ== X-Google-Smtp-Source: AGHT+IE+q2UlEWc6Qe9yztVIb0UfK9b3Z8SW8kIF2An9w1ZlDSwjmA5V2PrJhbGY+LL9yCEavwTs1A== X-Received: by 2002:a2e:980e:0:b0:2bc:d505:2bf3 with SMTP id a14-20020a2e980e000000b002bcd5052bf3mr22410080ljj.1.1699354579680; Tue, 07 Nov 2023 02:56:19 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:18 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz Subject: [PATCH v3 15/20] riscv: add ISA extension parsing for Zvfh[min] Date: Tue, 7 Nov 2023 11:55:51 +0100 Message-ID: <20231107105556.517187-16-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025623_019703_9315B419 X-CRM114-Status: UNSURE ( 9.14 ) 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 Zvfh[min] ISA extension[1] which were ratified in june 2023 around commit e2ccd0548d6c ("Remove draft warnings from Zvfh[min]") in riscv-v-spec[2]. Link: https://drive.google.com/file/d/1_Yt60HGAf1r1hx7JnsIptw0sqkBd9BQ8/view [1] Link: https://github.com/riscv/riscv-v-spec/commits/e2ccd0548d6c [2] Signed-off-by: Clément Léger Reviewed-by: Evan Green --- arch/riscv/include/asm/hwcap.h | 2 ++ arch/riscv/kernel/cpufeature.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index 5b57b24db60c..752be910e7c3 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -84,6 +84,8 @@ #define RISCV_ISA_EXT_ZFH 66 #define RISCV_ISA_EXT_ZFHMIN 67 #define RISCV_ISA_EXT_ZIHINTNTL 68 +#define RISCV_ISA_EXT_ZVFH 69 +#define RISCV_ISA_EXT_ZVFHMIN 70 #define RISCV_ISA_EXT_MAX 128 #define RISCV_ISA_EXT_INVALID U32_MAX diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index baa8edfb0e6a..0b9d16ea71f1 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -282,6 +282,8 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(zksh, RISCV_ISA_EXT_ZKSH), __RISCV_ISA_EXT_SUPERSET(zvbb, RISCV_ISA_EXT_ZVBB, riscv_zvbb_exts), __RISCV_ISA_EXT_DATA(zvbc, RISCV_ISA_EXT_ZVBC), + __RISCV_ISA_EXT_DATA(zvfh, RISCV_ISA_EXT_ZVFH), + __RISCV_ISA_EXT_DATA(zvfhmin, RISCV_ISA_EXT_ZVFHMIN), __RISCV_ISA_EXT_DATA(zvkb, RISCV_ISA_EXT_ZVKB), __RISCV_ISA_EXT_DATA(zvkg, RISCV_ISA_EXT_ZVKG), __RISCV_ISA_EXT_BUNDLE(zvkn, riscv_zvkn_bundled_exts), From patchwork Tue Nov 7 10:55:52 2023 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: 13448513 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 E129DC4167D for ; Tue, 7 Nov 2023 10:56:41 +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=rypsQKPYeOxodILI/ksLJil92Y5F4CKVtaja6tEbU3s=; b=aPRA6Wa0A2rwUn /QRxiAPMXeJPIMIbaI66EXx9InKAAMU3NPy4ugpWTlbwhIoqiA31P+KYsMHjuaUH796gwkAFPz1vo Jmi0GCYmaBpFof/z4zUlxuVfnutQxxhsiT+71yAr9+Z04YVm3/aQdZd3k3wMJSTgKJe9m/KQ+nFUy PvTtcD0AV7yxBfDerm94QDlJ7sb/3G/BlqJ0JbIJbgzKxKsBQy+6n/sIXTqA1z+hnwDcAv9xHs5qV J+Mdt2yEK5GpdLqu1eHoJQhCXZVpu0xYr2o1eN4vuRkNV61zilcXiDrimuh4+UfPDHuu30wbHkMzo gC58c+L46ATishy3qohQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jl7-0019gq-1c; Tue, 07 Nov 2023 10:56:37 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jl1-0019Wu-0A for linux-riscv@bombadil.infradead.org; Tue, 07 Nov 2023 10:56:31 +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=V5SlhQ+MFK/oE1hG84P6kssLtuGPrTemJS5B/ituwJs=; b=ZoS3TJtN8VmEnpoqmKgXHC9yzz 6s3o5RByOmhmNz5z3RU2vNQtpayAckwL2CPKu/TFTMtN4gBtAwa+9iAw532yWStbVgwPSwzO9zCH5 2ZISrrnaklHTVs19GbPwP/8Qqp34j/xTbc9lemrtmc79XPu/aq7q41uQ3z1k0CJCV2LJFREEVPcEB QW/yb8K3Ek4Am/zpMMIPs/rJOk/7X8STGj1KqOf50I848rpZFQ8XPc1o61aNTZa9r2QHP0quBgFO4 gfiEqtawE2ZXODi7I8rk3lnBNL4rF30CIxqkT19quCGSznEb3cv7sNvjP4v7te+QrzOWt6OxFsRiL eb5mv4Nw==; Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkv-00Bx2i-2K for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:29 +0000 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-32f9baca5bcso817470f8f.0 for ; Tue, 07 Nov 2023 02:56:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354581; x=1699959381; 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=V5SlhQ+MFK/oE1hG84P6kssLtuGPrTemJS5B/ituwJs=; b=QZOzx/sqNFkCabeazkax5P55fY2+Iv95Rdzl7UyyilvDVj7l8yCsAKN4LPrGjYedCX e9ZbxqllT+C4CRwPmOk1zKNRZXqnNaolwMG0hPl2QJaiTWnu0XOwJAbdGrTDS88zqLyq z+IdZWO3QouDMQ34toJf+wSzZacSGl6Cye6B82B+bOZH4SW6lRtbQ8NtOaaZAYNjFTI+ 7Jd5DHERcNu587RewXP93Xst58lWk4tcsXq/Qsy95W7eVKJyl8niRMD1eFGFPnurm6j3 CIYLP4bWjU2hmHP9aCX9Ln4+er7y+o4A7FwOxY4oR5rw21dTTlkd4kSlEq2Ok0Iubrnn bPdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354581; x=1699959381; 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=V5SlhQ+MFK/oE1hG84P6kssLtuGPrTemJS5B/ituwJs=; b=BeCX5s7uzpm9QIXTZp7nsevHebQm8K08B5eNiUA6Jg8+BARBWJWFsyWJR8YmLYNVsj vQSrzCkMzrF7qXAVHs5UQ9cDlctyEanTOhmWwDgcH9HXk5dTQgbWHkg04hYvUCyBzNtR g7do8TpmldQKRW/cDsd/CXRBuP+WJIf86F15YGC2WaYJR/xaL8K5KVXnV5u1ohTHbtsH 3FY+9XAYi8jxhVd2FKjPsdJshvNshCkmuWrtnpgIdMxneXLLjL48uP6GYVt+/qbojDeN Cma70YT3drVHXVaiOz7kvJMcmTS/mJVqqwp//IQd5+9JipQ79olE4+9gw/zQx/2ek8u5 2L/Q== X-Gm-Message-State: AOJu0YxyAQrn1qcUIKNflyZRlVhLUuwp43up/hW9gRz6vbbMIi2vNIV7 lyB4qXC/2/iFa+oeHBmJP1TImSWBI1Fs0Qjmtt7mRg== X-Google-Smtp-Source: AGHT+IFQS7qfkMNRtAKpq/tiaOzmGYA+PKb/n54XAFPfjBLLUBdHDw7kelXyOwVBWWtsxlUnnASLNQ== X-Received: by 2002:a05:600c:ac3:b0:404:72f9:d59a with SMTP id c3-20020a05600c0ac300b0040472f9d59amr26109516wmr.0.1699354580425; Tue, 07 Nov 2023 02:56:20 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:20 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz Subject: [PATCH v3 16/20] riscv: hwprobe: export Zvfh[min] ISA extensions Date: Tue, 7 Nov 2023 11:55:52 +0100 Message-ID: <20231107105556.517187-17-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_105625_881809_6BF79651 X-CRM114-Status: GOOD ( 10.60 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Export Zvfh[min] ISA extension[1] through hwprobe. Link: https://drive.google.com/file/d/1_Yt60HGAf1r1hx7JnsIptw0sqkBd9BQ8/view [1] Signed-off-by: Clément Léger Reviewed-by: Evan Green --- Documentation/arch/riscv/hwprobe.rst | 8 ++++++++ arch/riscv/include/uapi/asm/hwprobe.h | 2 ++ arch/riscv/kernel/sys_riscv.c | 2 ++ 3 files changed, 12 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index 2f37b26d27da..2a2fe4b026e7 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -146,6 +146,14 @@ The following keys are defined: * :c:macro:`RISCV_HWPROBE_EXT_ZIHINTNTL`: The Zihintntl extension version 1.0 is supported as defined in the RISC-V ISA manual. + * :c:macro:`RISCV_HWPROBE_EXT_ZVFH`: The Zvfh extension is supported as + defined in the RISC-V Vector manual starting from commit e2ccd0548d6c + ("Remove draft warnings from Zvfh[min]"). + + * :c:macro:`RISCV_HWPROBE_EXT_ZVFHMIN`: The Zvfhmin extension is supported as + defined in the RISC-V Vector manual starting from commit e2ccd0548d6c + ("Remove draft warnings from Zvfh[min]"). + * :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 36c8d073c987..5124327b70ff 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -52,6 +52,8 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZFH (1 << 26) #define RISCV_HWPROBE_EXT_ZFHMIN (1 << 27) #define RISCV_HWPROBE_EXT_ZIHINTNTL (1 << 28) +#define RISCV_HWPROBE_EXT_ZVFH (1 << 29) +#define RISCV_HWPROBE_EXT_ZVFHMIN (1 << 30) #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_riscv.c b/arch/riscv/kernel/sys_riscv.c index af2b01b0a5b6..3cd5d42ae01f 100644 --- a/arch/riscv/kernel/sys_riscv.c +++ b/arch/riscv/kernel/sys_riscv.c @@ -185,6 +185,8 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, CHECK_ISA_EXT(ZVKSED); CHECK_ISA_EXT(ZVKSH); CHECK_ISA_EXT(ZVKT); + CHECK_ISA_EXT(ZVFH); + CHECK_ISA_EXT(ZVFHMIN); } if (has_fpu()) { From patchwork Tue Nov 7 10:55:53 2023 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: 13448516 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 BA417C4167D for ; Tue, 7 Nov 2023 10:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=R37jiUWlFe7flMnzewEz1U0LysYPYmcozCR38gmL+co=; b=4F4rDeBbu/2tNX hy72k86FJhblURzrxVLBMa25l6Um9vgruV0EUdMNXaVOMj69OTqeI6o1fAntgg6jhrcqpUnRIuLsW wWKYCk4dkBbeT0U15QZxBe/HLEfHpYSVDF6qh0EY2qBVzhAkZ21jypP6SHatNCTjI783DIx3l9WyD G7q/18JIkSTETwqv4UUHgWsgT5suJ9V9lC7ZZwgCez4Osi0XW1LpBygkhIDNwUZw31pOQEZJwIqJT iwttDJ6OlRjCu44RY4MCPX4qtyID639ZsOOmJ71h7WUxeiBGeVpd+lz9Ab1b+zmEQ462JxxU6qqOa cJCRgKlkGcNLGs6Rgqag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0JlD-0019rA-1a; Tue, 07 Nov 2023 10:56:43 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0JlC-0019ny-1S for linux-riscv@bombadil.infradead.org; Tue, 07 Nov 2023 10:56:42 +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=/uOByuhC3t5IOOn5XXUVJDYNM9V7BqpeySL2m3Y9NXo=; b=hnsnPya9pC2rv+9kcch4k19G4C qwL1+OYpsdk7NQe1JYEXylUQY17IJ8NSYV1iB4MDTb48+ugBRRBdNw3px62G46AiMNpJZoS+dbvaz V0r5YyJ3F+exZGm7+i53ASBjd6S1yJf6TlxNocZKvqS/Arh8xnj5BIM2JErE0+HDdKPB3ojQvH1n6 IQN+KtZbrjiwF2/3c56lo4e7vBvC0XYcF2LakZGeQUTePaKxpi5/gYe+J2CMSm1WY8yBR9SBLpBl6 Coq4MYfsisE8QaCxHuOX70nm6MNwsqVx4enWQ3Ik+CVXFiUPsHsnnoU5nGEsSXGp4RFavY79p83As daOqGjRQ==; Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkz-00Bx8U-13 for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:39 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-408434ce195so10593845e9.0 for ; Tue, 07 Nov 2023 02:56:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354582; x=1699959382; 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=/uOByuhC3t5IOOn5XXUVJDYNM9V7BqpeySL2m3Y9NXo=; b=aKy4hT4qbHUpLQKEvH9R2w5mrIk9qNFqAaaTVdDMLPZcimrnByXDuMAt75ISGwAb5t U5jGZsrYaB4F4XDlWtvexKscVXC5NIBplPzwZNmQIxAIJWX61V/xJPlTcMO0yFLKA03a aBkRUCea9Qi+Zsr9B4ObAZZrfeE2RsLDIjNsEph8H+5NbeNCAOp2QrHex497X0PYrEzE XsFDqamUvOYT88exCY3YfkUr1+rBnE0mLvOiAwEgD2JFx8qiNqEJ1Y3sPc7xwc05MVtR puzwSojWTuZ1zrY3BoFMM2+MGbE5U9SQAThNokdx4WZTS4HGBz3oe8wepcc86e1R3XDT sVsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354582; x=1699959382; 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=/uOByuhC3t5IOOn5XXUVJDYNM9V7BqpeySL2m3Y9NXo=; b=M8DmKdb58+8s9Tx2pTyFPz8Nk9OkffPcp83oFV1vkQDU8NoVMdtZtnbezaHk0dsd7u 8hZhxpX6/oMcsviYC1H1Oy2KZWuB2IOoGmII77ZvF3FtZqvHECgwqCDyvcnPTD5zMtfL rR7UswEYKwIe0aI96PaC/Y7KC1otRxE4Xai1+HoS/OjCgW2/MsCTdLdtbz2q1feiFwoQ 26V0yfdLtlqj4frZQL08D/rpwsgel/0GUAWTIrmi/0YaUwXOnm+eKoDWfXk2sgWYC6hN uy+VoAauIwsyUGbkJiufUou6YSBx2PG8emSQW0Wkh7zOSdU9S2sML56nmddZZvpJKU41 2MSg== X-Gm-Message-State: AOJu0YyBXGbGFm6PlZ1/KWynz3BuWD0ySp2i5HtElVHN0yhuKR54dNSZ qoPsnMUlAimUV9ie2LgcGDSOwg5DDo7MRdQUuxc+0g== X-Google-Smtp-Source: AGHT+IELIW3LIg2lrza+HJKbS5ridEWLR16IdBcQqrj8daJI6htUFeT4tLiej2ONYAZOAOmlBwC5Kg== X-Received: by 2002:a05:600c:5128:b0:401:c07f:72bd with SMTP id o40-20020a05600c512800b00401c07f72bdmr25945621wms.4.1699354582180; Tue, 07 Nov 2023 02:56:22 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:20 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz , Conor Dooley Subject: [PATCH v3 17/20] dt-bindings: riscv: add Zvfh[min] ISA extension description Date: Tue, 7 Nov 2023 11:55:53 +0100 Message-ID: <20231107105556.517187-18-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_105629_398692_4C0B1643 X-CRM114-Status: UNSURE ( 8.73 ) 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 Zvfh[min] ISA extension[1] which can now be reported through hwprobe for userspace usage. Link: https://drive.google.com/file/d/1_Yt60HGAf1r1hx7JnsIptw0sqkBd9BQ8/view [1] 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 c80774b518c9..87c7e3608217 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -366,6 +366,18 @@ properties: instructions, as ratified in commit 56ed795 ("Update riscv-crypto-spec-vector.adoc") of riscv-crypto. + - const: zvfh + description: + The standard Zvfh extension for vectored half-precision + floating-point instructions, as ratified in commit e2ccd05 + ("Remove draft warnings from Zvfh[min]") of riscv-v-spec. + + - const: zvfhmin + description: + The standard Zvfhmin extension for vectored minimal half-precision + floating-point instructions, as ratified in commit e2ccd05 + ("Remove draft warnings from Zvfh[min]") of riscv-v-spec. + - const: zvkb description: The standard Zvkb extension for vector cryptography bit-manipulation From patchwork Tue Nov 7 10:55:54 2023 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: 13448512 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 C51D2C4167B for ; Tue, 7 Nov 2023 10:56:39 +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=W0e+dXDkKNJoBJNWHS9paXjSTV01Zbkic7kR0Rjv4ew=; b=GEEdfmTnB6ztot /4zI2zNZXctn3CXFLAmjH1AbNv77P7Hr854pIaEO3mWcdx2SmB8JL7m4SYl58Ul1a0/nsSS6Cpq+n MDjF0bAU3ISSoN77iKh+Sd56JXKe0tpDnhzanvg7GMTr2SPNoZqp8qP/eZ7M2SSgRXmd2AXvFsa36 /9gPa+nKDCBgQetrn8IQuoCXQMyr6oYCuqc0HYipgqNYuIjR1IbS7wLQlTiTlCh96PbDyTB3kdake rsQpJ0ehq50esr/JIpMcWcULa24XrpJdqrAK0AavPteR1LcX0ClgChKTBHEosJ7Ebo9nzo8fgQ3AU Yahrn6eo/pHa6kAV/9wg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jl4-0019cv-1v; Tue, 07 Nov 2023 10:56:34 +0000 Received: from mail-lf1-f51.google.com ([209.85.167.51]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jkw-0019Qx-36 for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:29 +0000 Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-509469f552aso1185599e87.0 for ; Tue, 07 Nov 2023 02:56:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354583; x=1699959383; 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=hPj7UJhNk4bEKBTXmbiQszNoP65XhPNjIiphPr/bFIg=; b=A3Uk1L1btQ+k25SqptMY6r+0Rw6rZq3W2GmNwXsLve0F2gBX4s6Cuv8oyirDtnu3hv XXJcIUWkFR+DPLxBbtRLSDsbGPVK3Xf097CLYj4Uc+3njFxgqpIKLM7stfDKfqtxYZeG VY4TL/1NCLZCBkcrxpUADKotMpjDRjxJapMLSZNZxYdS9uXqIahn401yOLOFTaVQOPkc /3c5N/FwRVaD7ZzbqoDSHSDM8WA6ihkZKjUlec9jD8wLNxMNrvT44paocOTYobECh6M1 Ah5w791g2avUCk6rN55Oh4kYJoQxamnk5NuodQZcF0getCuB0aQZwrV1Ci10KPpe8m82 FrKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354583; x=1699959383; 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=hPj7UJhNk4bEKBTXmbiQszNoP65XhPNjIiphPr/bFIg=; b=vs4apdqN+wvXqg7J3jjIkvYlyEdkLiStpe8z6sbCqV8XOtdnIIOjllQ45ogTuSUJa4 Uxw1ic/23Ikia7tc2EbB/PFWcF9D48itqRFP7R6KETAR4SicTwo3znusZGT4B/Isq8b7 yIEPSiqTuWG6UBJ0dZbsWpK3aJq973BM9wXkCcbPKSshrgZaPsxgdzj99I8rf5GSTyS7 OdOavpgJD8Sgu+fP0iLChMDV8tDiYnR6vl6JdoiCjuRaj/hgvpBVToI8MZUJcP2AQect zw7iCbuXRAKazrgwFn24LcywbVrI5WDuMgU44f3EfWEykBm+agEA7NneyatNYwJ3vWPo 4PPA== X-Gm-Message-State: AOJu0YxULiSpHf2tDvd8DvwOfnaN7mqPp9VJqm9m/NDQ0L2vlYrsf7L1 6Rn8kQXwDcunyBa/06dE3NLKZf0bo8amEjWkul7PzQ== X-Google-Smtp-Source: AGHT+IGRA2Jq7n60JiFQFoG9YMwZlINwiDybS35zq6fryGJBSKL1K+FHC6LMZd0w5ZY6D/nx95IeyA== X-Received: by 2002:a05:6512:3196:b0:502:af44:21c2 with SMTP id i22-20020a056512319600b00502af4421c2mr23556282lfe.5.1699354583017; Tue, 07 Nov 2023 02:56:23 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:22 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz Subject: [PATCH v3 18/20] riscv: add ISA extension parsing for Zfa Date: Tue, 7 Nov 2023 11:55:54 +0100 Message-ID: <20231107105556.517187-19-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025627_028619_28F69E8F X-CRM114-Status: UNSURE ( 9.87 ) 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 Zfa ISA extension [1] which were ratified in commit 056b6ff467c7 ("Zfa is ratified") of riscv-isa-manual[2]. Link: https://drive.google.com/file/d/1VT6QIggpb59-8QRV266dEE4T8FZTxGq4/view [1] Link: https://github.com/riscv/riscv-isa-manual/commits/056b6ff467c7 [2] Signed-off-by: Clément Léger Reviewed-by: Evan Green --- 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 752be910e7c3..3fceae60ca39 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -86,6 +86,7 @@ #define RISCV_ISA_EXT_ZIHINTNTL 68 #define RISCV_ISA_EXT_ZVFH 69 #define RISCV_ISA_EXT_ZVFHMIN 70 +#define RISCV_ISA_EXT_ZFA 71 #define RISCV_ISA_EXT_MAX 128 #define RISCV_ISA_EXT_INVALID U32_MAX diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 0b9d16ea71f1..d58c8e9ceb05 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -261,6 +261,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(zihintntl, RISCV_ISA_EXT_ZIHINTNTL), __RISCV_ISA_EXT_DATA(zihintpause, RISCV_ISA_EXT_ZIHINTPAUSE), __RISCV_ISA_EXT_DATA(zihpm, RISCV_ISA_EXT_ZIHPM), + __RISCV_ISA_EXT_DATA(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(zba, RISCV_ISA_EXT_ZBA), From patchwork Tue Nov 7 10:55:55 2023 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: 13448515 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 64D4CC4332F for ; Tue, 7 Nov 2023 10:56: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=YTbz2NTSUtp9ZggXYy65L1VIgthNTF9HfrTubO/LD+c=; b=sK5z+6OHdPKDR4 pKcQMugZAUV2SZL2qkg9XkV8gLsECqbISwXHNJILJLQfh/mTFRsXVaXu32vyrdOAN0AmWykHQcQCX c4pgJWLhbQjrbg143X+NNzFsE26P14tfirtdnlEFMyvN8pyPdw5yATuaL3mbOYn0Ma9ipoCw9fqWC 4f8BhzfXPb6CiKHhBZCNYkKovq6un2F/7Znlz2ZNW6Rve2hO5b+dyZcAd0ak7cfEQDVPop2Dos8jx bA5R2QLYgYQxWxuOMCrEVR7R+TmsDC1sCxt9s94ZsVKLvvF1dYEQUojrRcxIuUsGDZFSSa+XH+azv QDK5+Q0hSAVzL3NC+o3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jl9-0019lr-39; Tue, 07 Nov 2023 10:56:40 +0000 Received: from mail-ej1-f46.google.com ([209.85.218.46]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jky-0019S3-06 for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:31 +0000 Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-9c96a82e93bso174654466b.0 for ; Tue, 07 Nov 2023 02:56:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354584; x=1699959384; 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=PQVPAaYHkpM0GEJ73m22K8qqx/erlq7lj5m1X7f1ukE=; b=bugMcJGVKkAeJfPg2ddtL2oq/l/yKgZSltFM59xpuwbghIKGWEhnLFRLNWZr5G6+ux 2qCnCnw63sTE1hzeQrrvbghBf30pkDLkP2cpFktl+pJ3SvcgNmvSq+rJKca4mnWMCYiR iTD+PJncTD3yITNxNgBjAdApjFtrJVB2tqi+kbKB6zUap9z620tOFIEpISFeD33gjimC 5A53cvpdykUYayfCpVVu8E92EVegNvWBvLKKm7y47z4R7T0WFTWjv5Se+SK4P0NNL6iL rm6jyCv4WniVzi6k7lo5WzT6YpwdQFroE/CkX+bX3TONjTfb0Of7MX6PcKV01AtlNAip bbnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354584; x=1699959384; 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=PQVPAaYHkpM0GEJ73m22K8qqx/erlq7lj5m1X7f1ukE=; b=EE3dzX5tAuqrfg7Ak3Ubve1uDEuOeaOHvFiCaW9mKKJzxtJBIZDISWxtNb2YjBIHTO Y/Qy+tP6LqoCiNCdMr0IW0OVp8wS24EOup5pQJU0GFcjdKtE6ze/ui57EJ3h+dpS0hRY zMjv8MFzZBQBU3/Z9ktMG0KSe+TExfQIBjjmiUfrUVfQo7Jo5BxMhhfyShvjnJk6YEwl XUGbwGpa/E6C3WfrygS8h3pLkOq0SHDqQH0ni+vIdscgVg0/0ZGQr1NE85/T24YELPF0 C7SkY24nTSk/kTuLzCs20b8Pwo/5YDMOffBpeZx07J/o5NHXuzGymuP+zANc6ipYFvu6 wN6Q== X-Gm-Message-State: AOJu0YxO7d7q0TmpqaI6+0sMF8bxNo2PS/fhL19u8b60KSDb5N82ZfEH AAILHNMW3gP/CGt6ILHmdUzO7eP5sQ5OJ3jPQT78Xg== X-Google-Smtp-Source: AGHT+IGj0yQcu+DGOcyOjDKINIocvRDdaol8XKw87jQoMj8DVyz/EpNBoI48Bn4wmnkpdAazd54/WA== X-Received: by 2002:a17:907:86aa:b0:9bf:b83c:5efd with SMTP id qa42-20020a17090786aa00b009bfb83c5efdmr24912005ejc.3.1699354584016; Tue, 07 Nov 2023 02:56:24 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:23 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz Subject: [PATCH v3 19/20] riscv: hwprobe: export Zfa ISA extension Date: Tue, 7 Nov 2023 11:55:55 +0100 Message-ID: <20231107105556.517187-20-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025628_084200_3C358581 X-CRM114-Status: GOOD ( 11.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 Export Zfa ISA extension[1] through hwprobe. Link: https://drive.google.com/file/d/1VT6QIggpb59-8QRV266dEE4T8FZTxGq4/view [1] Signed-off-by: Clément Léger Reviewed-by: Evan Green --- Documentation/arch/riscv/hwprobe.rst | 4 ++++ arch/riscv/include/uapi/asm/hwprobe.h | 1 + arch/riscv/kernel/sys_riscv.c | 1 + 3 files changed, 6 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index 2a2fe4b026e7..a53fbc076d7e 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -154,6 +154,10 @@ The following keys are defined: defined in the RISC-V Vector manual starting from commit e2ccd0548d6c ("Remove draft warnings from Zvfh[min]"). + * :c:macro:`RISCV_HWPROBE_EXT_ZFA`: The Zfa extension is supported as + defined in the RISC-V ISA manual starting from commit 056b6ff467c7 + ("Zfa is ratified"). + * :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 5124327b70ff..71f6cda52c4c 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -54,6 +54,7 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZIHINTNTL (1 << 28) #define RISCV_HWPROBE_EXT_ZVFH (1 << 29) #define RISCV_HWPROBE_EXT_ZVFHMIN (1 << 30) +#define RISCV_HWPROBE_EXT_ZFA (1 << 31) #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_riscv.c b/arch/riscv/kernel/sys_riscv.c index 3cd5d42ae01f..dedfe3c6a37b 100644 --- a/arch/riscv/kernel/sys_riscv.c +++ b/arch/riscv/kernel/sys_riscv.c @@ -192,6 +192,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, if (has_fpu()) { CHECK_ISA_EXT(ZFH); CHECK_ISA_EXT(ZFHMIN); + CHECK_ISA_EXT(ZFA); } #undef CHECK_ISA_EXT } From patchwork Tue Nov 7 10:55:56 2023 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: 13448514 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 7199DC4167B for ; Tue, 7 Nov 2023 10:56:43 +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=a3O79HyBfGSxsKtQf6DpijQi+PNepPHyqa2W8/RQmrI=; b=ZXT10u56TlpuKa /jIpJQ9QuzZUSPaBNwbezITNMhGUiKitmucrTHPZ3A2CNXW2hv0x3nJ6DDrpb1UkMA5vkfSkK9xzB 7yIm7cnmSUogZCye2KSSPCCiFi2m/XCTnZGedVioOMp9d4BFJ+IUrGZqw5ccKWVZqiDRn3crA/F2K uQPwsLl/HRwNuaiVbru6ov63uiW/C5HVi179Xf3sclCo5VV+gCMbeoWY0sMLrSpWtt21KscYEG+Wr WBDSkygrrnCTdAdLwPIOocPT9LLoeLntlYHzUnJHX75ysDuN4uz/ah0iymtvLWSQfZzoTsECOHBFr 8sUYaj5ZpBzIJYgV7gPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jl8-0019js-2k; Tue, 07 Nov 2023 10:56:38 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Jky-0019SJ-1c for linux-riscv@lists.infradead.org; Tue, 07 Nov 2023 10:56:31 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-32f9baca5bcso817497f8f.0 for ; Tue, 07 Nov 2023 02:56:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699354586; x=1699959386; 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=hiqFYUrrovnf1rhzBHvSluIgSBMGKUT9Q2F8cmlGclI=; b=H5AcaVnkFfYsb23aA0LPQA3GyoFKVPfiNbzQBCSvFbUOp58FyM1nupVRzSwVbYwt19 MUCBtKef1aZJiYwQbIwIDdJaVQaW7wfiZyAZ6coHjVk5IHSrp/DxVKDYyaAa3eAGiKAY j8OebHRq3hGQfm1QaH6+OzUAdwn3bhj/fkDC58l/MjOl80OMWrLFgvyvpJdgA293lbrg t3raR76UOJMmkbVAHV8Encd2lbOVbUdHt8zVpnyQ+L21YzM9adWpO8N8J1MbcsE8DZsL ZZctPxUTBBmfbtiI+7kQJzP8ZhfLp3VgZ7+5dMNvxNnz8FESdTX5FCWuLFXtckP6ZSBT sQig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699354586; x=1699959386; 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=hiqFYUrrovnf1rhzBHvSluIgSBMGKUT9Q2F8cmlGclI=; b=UNneTmXyIQpPG+QXmXMkHyOhvXX7XduUQItyW/JFAwmJwAsvTZMISukIIA+PgXYSm+ MulXz3kKazVUAvze0cBmh+8Hys4GpU1E48DGUO66W27KBQ8HkTW1cQozOfmk9aPenf50 zXwoHJSSxoHdZGbZ8bqq3sIcCeTdLkpXK8L2Wp0H3DBfjGb4d+VG8SU1+XJSRM91fqIk 6OnubU4FLeGvEeHvTZ0oIIzL0Kz/xu2TRHa5Q9wZGO5+ukc/US4iGifSpRrWJ3po5QMN aU1KAb4v7GYmcUHcfuHSZifL7GJpBGXlK30GrV26US6wkIz2KXJ8n1XvD9k/njMXjHna Ej8A== X-Gm-Message-State: AOJu0YySw0cid9eARTVN59lAKsrJRjpSTtBrhUyv6XO7zvPCHUy4E3E5 1KGwW07QhMLRoiHYpeALgy008R0T5Y7CGs1Ch1h5eQ== X-Google-Smtp-Source: AGHT+IF7Zo2YtACLiPHwQ6dLVhxCBp4VHRs60nrkUPyWwGQZ1utTTeaxqjcqGnJKdNMWHeSZvxGiKQ== X-Received: by 2002:a05:600c:3b91:b0:407:52f0:b01a with SMTP id n17-20020a05600c3b9100b0040752f0b01amr26054980wms.2.1699354585803; Tue, 07 Nov 2023 02:56:25 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7db3:bdd9:4cab:2ee3]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15396853wmr.14.2023.11.07.02.56.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 02:56:24 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz Subject: [PATCH v3 20/20] dt-bindings: riscv: add Zfa ISA extension description Date: Tue, 7 Nov 2023 11:55:56 +0100 Message-ID: <20231107105556.517187-21-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231107105556.517187-1-cleger@rivosinc.com> References: <20231107105556.517187-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_025628_538204_5CF3BB7A X-CRM114-Status: UNSURE ( 9.04 ) 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 Zfa ISA extension[1] which can now be reported through hwprobe for userspace usage. Link: https://drive.google.com/file/d/1VT6QIggpb59-8QRV266dEE4T8FZTxGq4/view [1] Signed-off-by: Clément Léger Acked-by: Conor Dooley --- Documentation/devicetree/bindings/riscv/extensions.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index 87c7e3608217..dcba5380f923 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -214,6 +214,12 @@ properties: instructions as ratified at commit 6d33919 ("Merge pull request #158 from hirooih/clmul-fix-loop-end-condition") of riscv-bitmanip. + - const: zfa + description: + The standard Zfa extension for additional floating point + instructions, as ratified in commit 056b6ff ("Zfa is ratified") of + riscv-isa-manual. + - const: zfh description: The standard Zfh extension for 16-bit half-precision binary