From patchwork Sat Jan 28 17:28:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 1733319 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=HvSeeszC; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=bCOcZ4V9; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P41t05g8vz1yhq for ; Sun, 29 Jan 2023 04:39:52 +1100 (AEDT) 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=weXOjCxZMREYt/DJT5f/8apvMsnHcix43P70cuwGcMQ=; b=HvSeeszCRfux0H 4MZIZQyur8C2lMSNxBLTw0nGX9ncFHBRkarmiYGAxoPqcGGJfWReKqf7O1j2CiwZ5fFd0xUSDtoTf UFyyeqbUW70ANuWGA/LM8wVgL29Zjz+cuB6/XKFRiY83bhzo7trWQcTtU8Wjqe3Ir0lQbqKm0gj3F ANwQ24ANpza3ebEZ1VaY7AUuS5e/F+paBxnkBOMKd+HsjtG2Ha8nuThhMf60BHZJ29HZ6Y684ClC2 V62gZF21EciTQyc4cTnxFgWaXNrZHEjTPtnEP9Tklf9qCv4sjZaUu2xZ45H/8pQbdDxg8jYMk9/HZ mOyM0/MdYgkSaSB3XZXQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pLpB6-000T9L-PT; Sat, 28 Jan 2023 17:39:48 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pLpB1-000T3g-PV; Sat, 28 Jan 2023 17:39:45 +0000 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 64356B80B88; Sat, 28 Jan 2023 17:39:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80EB3C433D2; Sat, 28 Jan 2023 17:39:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674927581; bh=a+5QZf9cRg0N2ZzfrrrGF2H31LP1zc5XIp+raVH9xP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bCOcZ4V9XDkJ5wWljeWU20Sde8cDhpniyQvi/aZWm1g2Y7jlYc4p11fL5Ie+we9ye CP8+Nluu5rOSahshmseQnNNFzEGH39khv+vGHVqcvkAvVZ4O6i41qg6FZFkpHwpdoa cvB4Jv/tlRWg5YxXtIpYv1g/ZU987OyFHVY4KeJJfKHmws9hJnSIFRamg4oOC+ZiOA /WcqKlKqc4hT3XrZTe8GH2BDWqzFPSyYORVkwvGNcuFM90s2z5VRvFbq7rbbw0D1ep SI7ZL1nI5C6B12p7Qso3JURdQQ6rZs2rxKSpqmnfPTFiU/TTxA9RhyYF37hmGR9ilm IK+0MTYUX1ptw== From: Jisheng Zhang To: Palmer Dabbelt , Paul Walmsley , Albert Ou , Anup Patel , Atish Patra , Heiko Stuebner , Andrew Jones , Conor Dooley Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org Subject: [PATCH v5 06/13] riscv: fpu: switch has_fpu() to riscv_has_extension_likely() Date: Sun, 29 Jan 2023 01:28:49 +0800 Message-Id: <20230128172856.3814-7-jszhang@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230128172856.3814-1-jszhang@kernel.org> References: <20230128172856.3814-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230128_093944_021263_3D48FDF6 X-CRM114-Status: UNSURE ( 9.57 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.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; }