Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3150200rdg; Tue, 17 Oct 2023 06:16:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG17rBGVwnVANdYnuiMfvOaO56JC62EK//7x8dq1lD/UGDRB1ImyN3RTxaiItwa8LH87b/I X-Received: by 2002:a17:90a:d448:b0:276:6be8:8bfe with SMTP id cz8-20020a17090ad44800b002766be88bfemr2878357pjb.23.1697548582546; Tue, 17 Oct 2023 06:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697548582; cv=none; d=google.com; s=arc-20160816; b=E3m/XrSlNCrs/r7aAwdL3e/KaHfaJTrSB0W/XDrgdsvX2eFskopzylpv5MgPuW16+d YKpf0/iBaiNbNZDSRi9RvtQo6M5wFFW0GMsbX23KlPq8wCcwVAzWIUZQ5Ty5r/ffyxud 8HqtEU7tjdVvh+MK3nymRX4vlowwGbXhw/h+DWNG0CkipEhzwlcCA1m832DfxY5T+axo Lbb9N0rUenepQHwfURSdZB+BpYm275NCa5oWQDrShj+tLpnwKWl848LHn3qzes4vB3M0 89MWc5rPZnGJiS115jhvVBUr6hEWIm0VV0HBvaWhI6moAhsKeKdvB3nhH+G724LM3cUj NM6g== 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=3obtZPNOKP8LH+KjJEwDeimcpj3eT+9Cd34xi+FsYNw=; fh=lvGFqwUxN+Dx1jonz8cRGrvjuKDcjMXylffmtrJGOYA=; b=MnM3oLS1bWapCdhjxN2m0HKigOqXsCDG6QOJMMupudI4Cg2mt611RN/kt8Y12v5iFe Xvdk9S62s39ppJnArmKee6G+am/EqltOJskfGPtDU7coSjufIN0DPMum9t/Yb1RAPUq6 xzrY8Mitkh6pZZI7AbILYjom+5t7SWP/TqNb2IrQF2iZnNGnICwshMnqRLEap0wEnPDT ssFNMRxllTGk4i789+4GA9uRG2VVGcgzoUpuMI6sZapL1iyowOtTBTiIeC7ifDKJ9FlJ GHNHdkhhQZYll2cE4prI/8hoBkOirxOFzR2jqlfqFFskpPnvvYcXtTvspWTS1ha0x7Nv JidQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=u5ZkaH2b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id z7-20020a633307000000b005af126df279si1664834pgz.503.2023.10.17.06.16.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 06:16:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=u5ZkaH2b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id AC18C801CCC8; Tue, 17 Oct 2023 06:16:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343932AbjJQNQI (ORCPT + 99 others); Tue, 17 Oct 2023 09:16:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343833AbjJQNPi (ORCPT ); Tue, 17 Oct 2023 09:15:38 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07173107 for ; Tue, 17 Oct 2023 06:15:37 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2c51774da07so6837751fa.1 for ; Tue, 17 Oct 2023 06:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1697548535; x=1698153335; 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=3obtZPNOKP8LH+KjJEwDeimcpj3eT+9Cd34xi+FsYNw=; b=u5ZkaH2bN/ItQa1WQ4P8FXFoAITbBqWQIulaDtndjIOMQShIKOLFu0FcM5qBO4URTj g6Hgaft8g3okguJy/haY3vpj9LeNY9cUe5ROcpiHEMhIJ2f2p1B+v8nIhR/VPf/Rczsz v3hv9mTEPBnqcgI28wW7uPsKwRzocHA96gFk3/P3RuzUdigvu6Wela8JUb3RuXODoKL9 jxVuPaSXuUK9f3bOWw5dnn5zNpMgbTGtPRiWXf8dbKJ826OI6fjJ7fQODs3sq8x7k4TE dCjV9z97j7r5xI/W016egpc/UpHKYDQA864Cd03cGZ+Oa/4p45TX69HOOkdbYVKSet5t iD1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697548535; x=1698153335; 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=3obtZPNOKP8LH+KjJEwDeimcpj3eT+9Cd34xi+FsYNw=; b=qPLLFSYPCrMbiqLaONWMIJVY7/lZbk31TRmDK8Nsp9pbTGI3xb4W6LEwdWj37oyYSf YDDWz6A/NDMAZl79BL69OagVCaUHE4d8JlA/yvaxCLy0cCo29em0ecFOhNW6WKPrMF+w 3FWrbtawtwr7l0DQG0I11cIlpgV3P9MT2dpXazpUsvht3SXBAJFYA1lyiGNNTI4lJg9v TivUhcp3EjwYyajMrgO4CXRYfw2Mw4f8SeV9mEXoTNZkn/DSbbnPYp4ITxEL8ccz8t55 HCO0ktmCJ/J3UFxRCzsrvQYkGBjJgCr0QEQs+k9iSPy1nY8qSRcLRAJJ/qlr5Rtn2Mwl c/5Q== X-Gm-Message-State: AOJu0Yyzj28zTGaBFWrmbHYA7hjGmPEdrfxa6c11rAaeSidMtrVMO/7W 7KiJ4/TM/HDKmcO1y+544wlNxKae8PsnMSHUD97Kyw== X-Received: by 2002:a05:651c:c8c:b0:2bf:b0d3:20f9 with SMTP id bz12-20020a05651c0c8c00b002bfb0d320f9mr1924875ljb.5.1697548535010; Tue, 17 Oct 2023 06:15:35 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:96:820c:ecf7:a817]) by smtp.gmail.com with ESMTPSA id fj7-20020a05600c0c8700b0040772138bb7sm9873393wmb.2.2023.10.17.06.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 06:15:34 -0700 (PDT) From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= To: linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Albert Ou , Jonathan Corbet , Andrew Jones , Evan Green , Conor Dooley , Samuel Ortiz Subject: [PATCH v2 09/19] riscv: hwprobe: export Zfh/Zfhmin ISA extensions Date: Tue, 17 Oct 2023 15:14:46 +0200 Message-ID: <20231017131456.2053396-10-cleger@rivosinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231017131456.2053396-1-cleger@rivosinc.com> References: <20231017131456.2053396-1-cleger@rivosinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 17 Oct 2023 06:16:19 -0700 (PDT) Export Zfh/Zfhmin 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 --- Documentation/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/riscv/hwprobe.rst b/Documentation/riscv/hwprobe.rst index 8681fb601500..35aedfff5049 100644 --- a/Documentation/riscv/hwprobe.rst +++ b/Documentation/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 2529cee323db..390805c49674 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 25d35800809f..4cca8b982a7a 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 } -- 2.42.0