Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2049699rwb; Sun, 15 Jan 2023 08:23:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXta2FHjxo05PHal9PhkJsw9ADgEtDGHxqDme6rDMBMSoBuKBnZdvNBI5gOrwppDVkMNN4DW X-Received: by 2002:a17:907:395:b0:7c0:d2b2:eb07 with SMTP id ss21-20020a170907039500b007c0d2b2eb07mr9631229ejb.26.1673799822765; Sun, 15 Jan 2023 08:23:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673799822; cv=none; d=google.com; s=arc-20160816; b=kNwQC/my4s+R5to/sENgoGCfJuePk9OlJkEIOWFoHKL8FwHl2/nIq5CCcJM1z5IIEs /ydk4b1uQStx0kkdNFLV5cxNrSf47TIE705f0xm+qpsybpUhxFleam5cmLiHuvQVB25q Tlr36ZMo3Js4x9n/81/c6iWHM7KVvIfNdu2WXB1s0MEiE60wusDqhJqz/gUmOBY9OUfK dJPhl1otExwYoAksDWp9Dhb7pxjAaLPHVTfW7KIcs7xjKXAG2NRXEaHquoKK7Rt2z2ch l97fdoajM9y7hAE3RMq3IsQ1tv52g4ANW32qCHkgz24gX3zfTjpUkgL6XY6Tm/Js16j3 DrFA== 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=UUZCMDHT9ow9f6aA9hMHHMel+k/ZbW5eVbimycB0uhA=; b=xW4T/Fg35dGgtQpTAEE0Q4df+p0amvy58tXlnmJrqEChFTnTjtQNtINin1uOx6mP0w itCBUFcvMVjzgm4ewobAIkXKsqSlLbjA5P4sYAce5WScBAjU/KB5rn/O68EmKY1Vx05F 9wnDrtQifFn8EuDpB1JXu0njWpFcOVg7/907sxm71H/O/Ed3qRP+q3bc6k3gT6xi38yR ip7wPPIpoeDjq3RpO2QlOKlhWKztCdk0itp87x3QzGdL/LvM/9BQ4gloGYu69CsGD+dE mebVpPuWPJvnhYZ031ZVrmwNDtMmq5q65cPGBOraRKw4iNWEOhsh69/fnmSjB4Vpra6O SHdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eeATq3Ge; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc9-20020a170907168900b0073d9c412570si11936818ejc.785.2023.01.15.08.23.29; Sun, 15 Jan 2023 08:23:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eeATq3Ge; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231500AbjAOQCN (ORCPT + 54 others); Sun, 15 Jan 2023 11:02:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231480AbjAOQBF (ORCPT ); Sun, 15 Jan 2023 11:01:05 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F7861352F; Sun, 15 Jan 2023 08:00:36 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 227FAB80B8B; Sun, 15 Jan 2023 16:00:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4123CC433D2; Sun, 15 Jan 2023 16:00:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673798433; bh=a+5QZf9cRg0N2ZzfrrrGF2H31LP1zc5XIp+raVH9xP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eeATq3GeOjDCnHtOuIlblgyo54bNCI8Be+rNhdZO3EH1ekeEJDMyGH66ChnMB+NWj I+ZhDDI8WeAibt7FSddSrGJuVDOdYgIVjVL8tfnyZ+h5JWyxroyMQOMIqrxpE1uO2Y l2EGhswWLUQM0+iDWNaX1hM7+KjMIx10mq5JVRhs7x+1iVddB9DLhpryCAsh+XaSLB tLjBCyWIXEpy8OuKgl+/a7qYz7DgQeJ9ssf9IosOGNqVsevHbCxuqLhCqoUSa1PveT mO71cZVCTOxn7pDzuJKFU4seP2uSYCYyx0FJS+EdPP54bTlJBKtb5jyz8lqJa2QIEh pHrgbTj3v8z7w== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Anup Patel , Atish Patra , Heiko Stuebner , Conor Dooley , Andrew Jones Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org Subject: [PATCH v4 07/13] riscv: fpu: switch has_fpu() to riscv_has_extension_likely() Date: Sun, 15 Jan 2023 23:49:47 +0800 Message-Id: <20230115154953.831-8-jszhang@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230115154953.831-1-jszhang@kernel.org> References: <20230115154953.831-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Switch has_fpu() from static branch to the new helper riscv_has_extension_likely(). Signed-off-by: Jisheng Zhang Reviewed-by: Andrew Jones Reviewed-by: Heiko Stuebner Reviewed-by: Conor Dooley --- arch/riscv/include/asm/switch_to.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/switch_to.h b/arch/riscv/include/asm/switch_to.h index 11463489fec6..60f8ca01d36e 100644 --- a/arch/riscv/include/asm/switch_to.h +++ b/arch/riscv/include/asm/switch_to.h @@ -59,7 +59,8 @@ static inline void __switch_to_aux(struct task_struct *prev, static __always_inline bool has_fpu(void) { - return static_branch_likely(&riscv_isa_ext_keys[RISCV_ISA_EXT_KEY_FPU]); + return riscv_has_extension_likely(RISCV_ISA_EXT_f) || + riscv_has_extension_likely(RISCV_ISA_EXT_d); } #else static __always_inline bool has_fpu(void) { return false; } -- 2.38.1