From patchwork Tue Nov 14 14:12: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: 13455502 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 0A506C4332F for ; Tue, 14 Nov 2023 15:15:51 +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=DclTkluSV2/m5719ocUav3LomujOYCuvryYAghUCi4k=; b=CC30Wt/BzppGkQ 17WPJzG4D4+N8lSLX0ejMNNCOpqb6WJ+KRfQ43sv5nDOys2b1oTXGHRonGKF0kMdKmX6fhNjU89gE vRm/BAjbWdQPjA4GpUxJRfoBwqPl+cMnfjQhfVdvSn5ZFPMyG/up65FRyb57r+Bsi1vtpheFy17NL 9MsDcCrBRXtjdUJNK9TYE7NFM5CS7tVA0/gbW7TSC/TGOTjvZmCLybORZc9kn14MpVf4iG7OMO0ax bU0dJu114frZx9WU3lk3kKd/uOdNKTEpB7E82jEtF2cxPgPcgBZ6FmgG70gN6ylCPbJCsH9ul622w 8uBlG3JfoPTLbGM1hpaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r2v8W-00GHY1-2N; Tue, 14 Nov 2023 15:15:32 +0000 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r2uAm-00G8xD-18 for linux-riscv@lists.infradead.org; Tue, 14 Nov 2023 14:13:53 +0000 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3b2e08526b9so642660b6e.0 for ; Tue, 14 Nov 2023 06:13:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1699971225; x=1700576025; 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=iEYEszCfp8f2sFaBAy4eKryQQU+hp7kZpXxy9sdi/dQ=; b=nQb4Juoh+nZL4mLiMnIXOr6coreOILrftSJR51Hw8y6cU5zoBhX/sgB0zGI6F9JFWz lYcMrgUhfw5lclzbuHdCJO+6AqaIeGTgRRWra6QFRIQm9W/fg+A1oTIY6Qqh45zKBJhl NPuFwlX/oT/4/wzR3QRPlN7d001n5WuugYqkq7Z2VWfNFLjdmhD5nHcpKQM7RzcOEzOZ G02WHXi5bOUhAJKs6hlTGo70EZbwxmpcQglhn9/rK8TwnEwAk+ToB7goq1YDXbn2X9vi Mlk0h1vjfm7BTzq/8PNFYtgGQfSSipaEem3gz1SsXx2015lyAfZXoixP6ghhEgta8pek udew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699971225; x=1700576025; 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=iEYEszCfp8f2sFaBAy4eKryQQU+hp7kZpXxy9sdi/dQ=; b=UWX2nn1K7dZxfj3mFTJFuqs3rebPO0ijvp0m9j3Hl/S3CR6sD0e0IKGI/x9hakxU4a oGGvLS1dx7CzyeQBxXc/1gm/Ra+rEDITPYAfsQGCzhVF+4T3Jif9YBl3TU0goIkbVvzP eBGqUnWo/9dGinGPeLpqwheMQyHweJy7kYIAzJLz7THtsIZkMVFpR6JFF1ot+NpHCGlx 1aNhaWT4K3xQ2hxf4xoeH3fiJGz5Z7azG5c7J4GHyAMvSnnBQAJ9ySBOQiRbLWouQFIe dgYNRboe1Aib+45g1H+y1PcF6CNhwQbP5jhdGEJdd4pL4Ym0TNlnKXjbbneshGmPhTgx ynKg== X-Gm-Message-State: AOJu0YxqaChHhBju4hxyfiDZdAKBXBt3Q/xGGtVIiKy5Lj7UcAWrgjv3 Wnbqkn7Nq7dynEhJWOJoFbnbOzWCAVIeW5sJ4Fa8rg== X-Google-Smtp-Source: AGHT+IGZDXgDf7Oyda/sT4+/a1oolhnnDFVdqByG3o5P/z09X4SwtY07cxiO09aQ9LMMrzbgtkqFGw== X-Received: by 2002:a54:4688:0:b0:3b2:ef4e:23e1 with SMTP id k8-20020a544688000000b003b2ef4e23e1mr2189020oic.1.1699971225384; Tue, 14 Nov 2023 06:13:45 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 06:13:44 -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 10/20] riscv: hwprobe: export Zfh[min] ISA extensions Date: Tue, 14 Nov 2023 09:12:46 -0500 Message-ID: <20231114141256.126749-11-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231114_061348_391608_31555443 X-CRM114-Status: GOOD ( 11.15 ) 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 a08fcd899b6d..397d53195f49 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -140,6 +140,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 89628a76ca04..2d960777ea43 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -50,6 +50,8 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZVKSED (1 << 24) #define RISCV_HWPROBE_EXT_ZVKSH (1 << 25) #define RISCV_HWPROBE_EXT_ZVKT (1 << 26) +#define RISCV_HWPROBE_EXT_ZFH (1 << 27) +#define RISCV_HWPROBE_EXT_ZFHMIN (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 9bbcd7334d96..d776c6c39fcd 100644 --- a/arch/riscv/kernel/sys_riscv.c +++ b/arch/riscv/kernel/sys_riscv.c @@ -186,6 +186,11 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZVKSH); EXT_KEY(ZVKT); } + + if (has_fpu()) { + EXT_KEY(ZFH); + EXT_KEY(ZFHMIN); + } #undef EXT_KEY }