From patchwork Wed Sep 20 07:46:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Xiao W" X-Patchwork-Id: 14254 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp4016971vqi; Wed, 20 Sep 2023 03:08:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6sCJUUgyvNnxvGyuVQA30RvuYShq9HysuIUpNHlDOHxrp2bJ+sUEDJBm7BEmpRqXnT1cd X-Received: by 2002:a17:90b:3e89:b0:274:bdcc:85b1 with SMTP id rj9-20020a17090b3e8900b00274bdcc85b1mr6673002pjb.12.1695204499495; Wed, 20 Sep 2023 03:08:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695204499; cv=none; d=google.com; s=arc-20160816; b=r+Dq6AMAQLZFzYhQmy2XshPZX61UgrWFl+7lNSr1cfN8oZ983Oba/f4MdjHdnmq1E4 BgotE98zhC5s0y3spoSR4hTwX9ufKyrY3wXdmv6XBxdavmXv8GpDxBoYo0Wx+POlf7PH KprwY/6YYQj5nsSjOeobIKpcqRQvgYdRqovlOs3yywofRdFGsokauugdVAqbwVj3ssrw 9MuZLvCMgHEltXuVLZ6bTH+VGT4rjhmXosOs3QPrev0+eFvas0k/cG8CMBPOBqz+L89z uToJ7OxR2yAVf5XBGGUKW228YpkxI60fEr1bUTwApVy0X6bRw+3NGwOvIXdAclieLToT tK3Q== 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 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id mq5-20020a17090b380500b00269584b6a10si1367175pjb.15.2023.09.20.03.08.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 03:08:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; 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 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 4422683713A7; Wed, 20 Sep 2023 00:40:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233781AbjITHjv (ORCPT + 26 others); Wed, 20 Sep 2023 03:39:51 -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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 20 Sep 2023 00:40:03 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777550753401540845 X-GMAIL-MSGID: 1777550753401540845 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(-)