Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1296711rdb; Wed, 20 Sep 2023 05:34:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGkgUSoTYpuYgaa4uXRxRO2CJup0j5vnwuNl+bIr+DDhXWOYEFT7HjYZapqBrobUGBh+Owj X-Received: by 2002:a17:902:e743:b0:1b8:8682:62fb with SMTP id p3-20020a170902e74300b001b8868262fbmr7239387plf.4.1695213249971; Wed, 20 Sep 2023 05:34:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695213249; cv=none; d=google.com; s=arc-20160816; b=GEUUewFmx9ugN/dh6MgbDa7wBz9sRTZpa3gPlGB+R+HS8Bu7fLrVOXEtdgXkvdQZ35 Pav6CRHec1+QC9Q/GC+4wZoGAYmls7IZx0ugOVzOZguiRhaNybSOnxyd3l0FYulq0pVg Mt4DMgprdiH0kKqOPtbd6NadkcvLgyRz6x6Qt7Q3lh52vFrwxzEidPI1pSkkfizvlZ5d dBY37t6Sg6ev0uOrV4qdk+P493DgHZv0OBwaOF2iJ5THQuAPmqLupfp3RimwxkCrqSuw VbWW28VH00BKBO3v8vbKaptcPCwJl+EjqnrIjYZUWJONKa567iNFJYQJIN30ixqLI99Y 5FIA== 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=QmPZ/cK3Iv8u4NZKGegetXK0gkmCWhVcFAEkKRGyUYM=; fh=IZKJ+GLRBclpWEjBDtcqwANaV1EY2kJ9JKX1ZdioJYk=; b=vmEEihv8i5QC2Jjv6GqQmOWoW2cqtuSmdb2ZQHFTDGOM6bEiyjJTQmRQXC3WXaoDrm 646ogmTnWb4RpgIzahfCdjrY3+4KxrRO73izoZ/JbAgYLhKIt4vkwr1MesKecom0AzJP xAwBbDOW/SPxCTL67TbGlFlQyuHu01YyCdu3h2FZnl4ttoenmzYShqYucIDerUfhtZGO C9TXaTyLFLm0rV9DuDS4K9jyD5vcfxHYl15dHCFX/LGzxVpH3HODzu+WxHS23S9B+gw0 eMvtYpuUZCVbAd9qOBwQi1f8yzDLyinMdsWorupQzDKzGfyr+N7IMI6QJ7K+X8+2VuJ3 ooLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IkncGxvF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id f2-20020a170902ce8200b001b8a56b9895si12290984plg.616.2023.09.20.05.34.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 05:34:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IkncGxvF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5C984809C914; Wed, 20 Sep 2023 00:39:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233757AbjITHju (ORCPT + 99 others); Wed, 20 Sep 2023 03:39:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233681AbjITHjt (ORCPT ); Wed, 20 Sep 2023 03:39:49 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D0CE9E; Wed, 20 Sep 2023 00:39:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695195583; x=1726731583; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=hcN5dyOX2piu1MHW4eheSWMp4q3vJNBIWWMTg8pcyZs=; b=IkncGxvFMn56sh7LB+j2t1jKzPhwILqqk1RfcHzPjYRbW4WCJ2swrQaf 4YQ2YYguw4ClQxy9cHRacCrTi6rMmsRXeli2+36xi2KkU6hW9Wstrut92 OLD1G21tsEtJllC+f78CBNxgtP/LNx6ne2ToFhD1Dh7WdClMOg8vNUuHF 7JLTVSfJ+gKM6O1uqAjsMFHeksVcsx3suWqnwirgcp14Zmi+rIX0uQNeq VENuLN45pvkAjiHfQAJTbUIdwKMgB5Qx3eQG5TQxVAuD8yS+br6QFi7iC X0ucrYeDWkH7k2X/KRdfKAwPVzyH8N0sBciC8KBWAD6ZuGLZaGpipcIRA w==; X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="446622591" X-IronPort-AV: E=Sophos;i="6.02,161,1688454000"; d="scan'208";a="446622591" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 00:39:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="816791812" X-IronPort-AV: E=Sophos;i="6.02,161,1688454000"; d="scan'208";a="816791812" Received: from xiao-desktop.sh.intel.com ([10.239.46.158]) by fmsmga004.fm.intel.com with ESMTP; 20 Sep 2023 00:39:39 -0700 From: Xiao Wang To: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, ardb@kernel.org Cc: anup@brainfault.org, haicheng.li@intel.com, ajones@ventanamicro.com, linux-riscv@lists.infradead.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Xiao Wang Subject: [PATCH v2 0/2] riscv: Optimize bitops with Zbb extension Date: Wed, 20 Sep 2023 15:46:51 +0800 Message-Id: <20230920074653.2509631-1-xiao.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 20 Sep 2023 00:39:51 -0700 (PDT) Bitops optimization with specialized instructions is common practice in popular ISAs, this patch set uses RISC-V Zbb extension to optimize four bitops: __ffs, __fls, ffs and fls. The first patch rearranges the content in hwcap.h cpufeature.h, it helps to avoid a cyclic header including issue for patch 2. The second patch leverages the alternative mechanism to dynamically apply this optimization. The series has following dependency: https://lore.kernel.org/linux-riscv/20230918131518.56803-8-ajones@ventanamicro.com/ Thanks, Xiao v2: - Remove the "EFI_" prefix from macro name "EFI_NO_ALTERNATIVE" to make it generic. (Ard) - patch-1 is added, it's based on "RISC-V: Enable cbo.zero in usermode". (Andrew) Xiao Wang (2): riscv: Rearrange hwcap.h and cpufeature.h riscv: Optimize bitops with Zbb extension arch/riscv/include/asm/bitops.h | 266 +++++++++++++++++++++++++- arch/riscv/include/asm/cpufeature.h | 83 ++++++++ arch/riscv/include/asm/hwcap.h | 91 --------- arch/riscv/include/asm/pgtable.h | 1 + arch/riscv/include/asm/switch_to.h | 2 +- arch/riscv/include/asm/vector.h | 2 +- drivers/firmware/efi/libstub/Makefile | 2 +- 7 files changed, 350 insertions(+), 97 deletions(-) -- 2.25.1