From patchwork Tue Nov 14 14:12: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: 164925 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1888845vqg; Tue, 14 Nov 2023 06:13:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IFSLDEPolYfIoGnxIkfgPcY6/lH6W0FfJGK6FKBh0/3lovnyVunZ2J6r0Tju0rXvNMv2lX6 X-Received: by 2002:a05:6a20:8f1a:b0:16b:80d3:7f10 with SMTP id b26-20020a056a208f1a00b0016b80d37f10mr8437481pzk.34.1699971229418; Tue, 14 Nov 2023 06:13:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699971229; cv=none; d=google.com; s=arc-20160816; b=t3PBGzOFFEIGEi2vxrezew4SVhDzUczZ7pzglvYOt5hYPixH9emZ64pn3mX3VuYaeZ eOlMJI7kmYZS6uMBQ6Z/PoiugeOz4Y7DdwyUk+qp0ww0EkRl9QfK4Gnxg2JucSECwuJb dogzFgARLB4oLTbFSZKYvvK3sWWT3Ag1YRgHFFSTUhhdsgFgYxMfCfgDiMo5w/CPP78r 7sNwM8wgKDIDbmpCg4DuZEBY0aDw31HIWH5DOYil5QDpVe7JHG68PHXHdFfky22WGzBS VKLXs3nPdmpeL+T/+r0xM7pu2Kcy0rp7LNVe4YzkNbe7sAHT+Au2t1i/9XxNa6v4w2Dy BPAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pkOxZJ0AR04vpaXdb9zeN8RXHX4RQvWz8fPabjRmmO0=; fh=fL+bVAQlkNPxUacOFaQ2MOsckJp5zEG7p4hgbp/lFuw=; b=olS9o7VAc7hFtCgPjD1d4DpYJSfDkMJympH+LkoHw95W+wTrr8ZbTr3cdMGIfcnsqn srW9V60MbjgTgWf9DcusMeAGT2I4jjsyk1WTtyYIyDleipMFlRdUgv9vq6uourI/AZV+ KRDfyZFB1f2irtciuLJzIxKqVhGsC67lBVhXJbie4QLQPHMytuOx93H3g9vovXbuITg3 r9uRzV7wYQMnz5z5UArZvznotXBf/TZxyCwQc+GSioUzgx+/cBjxMDNG2wvoFkL7Hb2L E2dfqfJAxyL6l1l765yLzjTAnHnC+nWNx6qvq4OR3OcwNTEhUgyek/dIdM5BvRanN6bw yh+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=VnYyclTz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id r27-20020a635d1b000000b005c1b2d6aa3esi2066533pgb.355.2023.11.14.06.13.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 06:13:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=VnYyclTz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3316C80FA9E2; Tue, 14 Nov 2023 06:13:48 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233397AbjKNONo (ORCPT + 29 others); Tue, 14 Nov 2023 09:13:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233374AbjKNONj (ORCPT ); Tue, 14 Nov 2023 09:13:39 -0500 Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 427E7E8 for ; Tue, 14 Nov 2023 06:13:36 -0800 (PST) Received: by mail-qk1-x729.google.com with SMTP id af79cd13be357-778a25cad6dso14498685a.0 for ; Tue, 14 Nov 2023 06:13:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699971215; x=1700576015; darn=vger.kernel.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=pkOxZJ0AR04vpaXdb9zeN8RXHX4RQvWz8fPabjRmmO0=; b=VnYyclTziqw/v901eO6D0yTjatw233rwn+9V4wpYt/27Q3kzJzJVsKQHpm6A2OgdPn Re0cqEJUKWnK9dCUIJOl8W1sfhgi+Lys2WTVISsER+LBNdta6gPDOxfqe6Sn4HpLjd97 x1iBQs5YeXSja1Gn2oP8FiaGDs/Eq6Zm3ZuSHdGUzB3xDY7OAwN516NzBbb9WC0yiofU YpxRulJeh4SKb2Uf02fJdwWHgKx9WQexnpFkrOgtxF/VGJhCsags2HOMHk/Xfg2MF19a d1U7Wft6Oxgnaf+nCDTwAdYRmuUX/lzNguJPakdVEPEA5n+LuWvKTWUa/Te1tXP67UlQ 8FKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699971215; x=1700576015; 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=pkOxZJ0AR04vpaXdb9zeN8RXHX4RQvWz8fPabjRmmO0=; b=sYTR8SAPHqfHlP7ha37FnB+zTyg9dumIQRBX1u0MJBzkWmunQMk2PScva18Kqo8NvD XEcOC7TrLHy9SLr6D28L7kXOI6VJymToXgxODHePY52GrZx1xBibXlMjOrFbxt+Fz9Ar LJaDm7odbQCHG6lxCdzHFdCLbfw6GOsFddX1RIiRHW53Ez9p8ot1zWMEetnhQkbbIAd6 3p3MgRNGjpgHBAhmefxyO4sjFPhwnyVFjnxQz27gN/eRle29ZpwwNAfh6/9cdBf57fGR ybzGfilpuLQ5DaBrpyqJrNxs1wh7rRx07jZPbH4hvGUP/T3SKUBxkVJiS+XAlCGdHaxo ElGg== X-Gm-Message-State: AOJu0YwnPrV+1pSGElWChhEVT/N1pVtXYTGjvmRHASODX3WT42of1D0E jIXflQd8Ze1UxNRK5uZ1TJCyCg== X-Received: by 2002:a05:620a:1a83:b0:76f:1846:2f6b with SMTP id bl3-20020a05620a1a8300b0076f18462f6bmr2662819qkb.1.1699971215392; Tue, 14 Nov 2023 06:13:35 -0800 (PST) Received: from carbon-x1.. ([12.186.190.2]) by smtp.gmail.com with ESMTPSA id m2-20020a05620a220200b00777611164c5sm2701263qkh.106.2023.11.14.06.13.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 06:13:34 -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 , Jerry Shih Subject: [PATCH v4 04/20] riscv: hwprobe: add support for scalar crypto ISA extensions Date: Tue, 14 Nov 2023 09:12:40 -0500 Message-ID: <20231114141256.126749-5-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231114141256.126749-1-cleger@rivosinc.com> References: <20231114141256.126749-1-cleger@rivosinc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 14 Nov 2023 06:13:48 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782549031651851839 X-GMAIL-MSGID: 1782549031651851839 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 | 10 ++++++++++ 3 files changed, 46 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index 3f71da935a65..3a18a31e32c3 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -83,6 +83,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 aca5abc7ebee..624abd5cde29 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -31,6 +31,15 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZBS (1 << 5) #define RISCV_HWPROBE_EXT_ZICBOZ (1 << 6) #define RISCV_HWPROBE_EXT_ZBC (1 << 7) +#define RISCV_HWPROBE_EXT_ZBKB (1 << 8) +#define RISCV_HWPROBE_EXT_ZBKC (1 << 9) +#define RISCV_HWPROBE_EXT_ZBKX (1 << 10) +#define RISCV_HWPROBE_EXT_ZKND (1 << 11) +#define RISCV_HWPROBE_EXT_ZKNE (1 << 12) +#define RISCV_HWPROBE_EXT_ZKNH (1 << 13) +#define RISCV_HWPROBE_EXT_ZKSED (1 << 14) +#define RISCV_HWPROBE_EXT_ZKSH (1 << 15) +#define RISCV_HWPROBE_EXT_ZKT (1 << 16) #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 7a40145e9628..43aa66e71418 100644 --- a/arch/riscv/kernel/sys_riscv.c +++ b/arch/riscv/kernel/sys_riscv.c @@ -163,6 +163,16 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZBS); EXT_KEY(ZICBOZ); EXT_KEY(ZBC); + + EXT_KEY(ZBKB); + EXT_KEY(ZBKC); + EXT_KEY(ZBKX); + EXT_KEY(ZKND); + EXT_KEY(ZKNE); + EXT_KEY(ZKNH); + EXT_KEY(ZKSED); + EXT_KEY(ZKSH); + EXT_KEY(ZKT); #undef EXT_KEY }