Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3278659lfo; Mon, 23 May 2022 00:32:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxu9nBXYRdC+LtQvfTTmLqPWAwgGIAclB9LGIy1v2cXD2+kLlZPdWzTjaKALZVmQR2QT5zw X-Received: by 2002:a17:90a:4417:b0:1ca:a861:3fbf with SMTP id s23-20020a17090a441700b001caa8613fbfmr25432891pjg.80.1653291162312; Mon, 23 May 2022 00:32:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653291162; cv=none; d=google.com; s=arc-20160816; b=TVOOLllxZJ5fZearlhJMfLbeQBvLovbRfuBlSRSkhYAoCT5Qcc+HN0Y4i38ucs3K6l ghV4SXwkAnwZcEVX/BM9Tw0ZHKOeU0qj1dQCgoqCbLSEFat22Eh3/BjYzyp62bGvO1ac TbVi+hH00/m//9MvtL0u5kdQfCmlta2WOec9ug9fhyIqEkPquJpAYmWZJ20hEjBzispS 890QRqGHB4KIQLIajgjNUDdEmu2B3/hyt/SW4sYhmdvSkdkT7l/xlQ/KRgogOej3fIzC /vsNz9NWuShdZNeaTPK6KNIYqYTisMnRXWlnsWYogb0dbCENdf/YgbH91bht90+utPX3 /kng== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=JxTg1WF5tlNrP4LBYnpOYs3H7gIkcFJMbEigrfZ3afc=; b=zl+rCC2/harmf5lKbLKOBenb6nxEFPnjwnmZpS3odEDfUeL/6+3rkR0GhY0USIE12c IcV9Ik4juokbfzIfDFBp4eY+9e+0+hzB38PPGUJ7GNs6DFr93APcGD6NWBFk4JsSRrWQ 9RUYPXmIplOwqNzpzI1mjiJAySvx5DDtKidOxqvhmlBND3e9OMzFQIDhyg+BXNSorPZn Qw8+sO8s9IbKLNVdFjCMJWkvg2LgaqkMh2aNaL9kbr91JCXINuyeOaJ8hK/uz4YDz234 1UvfgTjBv1np4Ba70ynVAAcodpt5H90Vcw/uyiNbzf6y8GCpaL/r3iVTXNS6RPs6ysZR r5rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eG8Vd5gL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b2-20020a170902b60200b001562b0bf47bsi10193131pls.58.2022.05.23.00.32.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 00:32:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eG8Vd5gL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A6D0C14B656; Sun, 22 May 2022 23:43:33 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344886AbiEVPoZ (ORCPT + 99 others); Sun, 22 May 2022 11:44:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231847AbiEVPoY (ORCPT ); Sun, 22 May 2022 11:44:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ABB73668B for ; Sun, 22 May 2022 08:44:23 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id E08E861003 for ; Sun, 22 May 2022 15:44:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64598C385AA; Sun, 22 May 2022 15:44:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653234262; bh=CPNC12uceBtIeQyvRUTPv/UYyC2ND+l4jhk3iSdDZH4=; h=From:To:Cc:Subject:Date:From; b=eG8Vd5gLFwRA/AUWAQKkSxcx5rGuM2sg3+5whCD0+EzCdhPETdXJXE2Zn5TYunoES oPrJsSZzjyO7EjxaqRfxnFP4JBYWmdLPfwc4A5qRzvP2gbgvKMzBOXHoJtoIQ2eC7I 23VpxiZajsJkUU80RP/ym22/DbrqCuOhMKdRfCU7daipkrBi4W5XqWG8MnJY6D+dgZ 0+eMNeTH7y8zjf6qiGCkQnUCdbolnShHeou42Twaoz/dDiC4FKwUa/CqLtobilNiRY 97TFGKk+i+pT+a7hG6xSPrpmGk/CWSHxAGYYRhJAgIanHx6uBn7aPRVrBPlUopoOPE Q4qJ7yXymKDKA== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Atish Patra , Anup Patel Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/2] introduce unified static key mechanism for ISA ext Date: Sun, 22 May 2022 23:35:41 +0800 Message-Id: <20220522153543.2656-1-jszhang@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Currently, riscv has several extensions which may not be supported on all riscv platforms, for example, FPU and so on. To support unified kernel Image style, we need to check whether the feature is supported or not. If the check sits at hot code path, the performance will be impacted a lot. static key can be used to solve the issue. In the past, FPU support has been converted to use static key mechanism. I believe we will have similar cases in the future. Since v1: - fix typo, thank Atish - remove riscv_isa_have_key_extension() instead use the isa ext keys directly as pointed out by Atish. Jisheng Zhang (2): riscv: introduce unified static key mechanism for ISA extensions riscv: switch has_fpu() to the unified static key mechanism arch/riscv/include/asm/hwcap.h | 25 +++++++++++++++++++++++++ arch/riscv/include/asm/switch_to.h | 4 ++-- arch/riscv/kernel/cpufeature.c | 14 +++++++------- 3 files changed, 34 insertions(+), 9 deletions(-) -- 2.34.1