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 }