From patchwork Sat Jan 28 17:28:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13119892 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB258C27C76 for ; Sat, 28 Jan 2023 17:40:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234551AbjA1RkY (ORCPT ); Sat, 28 Jan 2023 12:40:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234767AbjA1RkX (ORCPT ); Sat, 28 Jan 2023 12:40:23 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34D33298DA; Sat, 28 Jan 2023 09:39:51 -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 6EAFCB800E2; Sat, 28 Jan 2023 17:39:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91502C433D2; Sat, 28 Jan 2023 17:39:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674927569; bh=TTEHjs77lMSGyMyLb+GPNvLBucTI1hfj0V7Hm4KfZnM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sqouXPdwpFFry4G0PA0upcZn7eKG9kRL3+Eb7Svbv0uYsIBMt9RCKmR/0tA47fmqY HNtmXimUsJwyoj/53MBMd+h2CAD+6WuxO7nokFEZMVFmb1NezKIVBt0zNxjjvqryqK rjEgHJHOxrSYC7g/41hu+Ejnf6tCil7UQcjFpGbilF12+I5t3D9TsnqlpFH2OEzTde j/APOjrf+RxNzfCpmKF6hu9MFkjO93pJbzbBvOuiRDHyL2j4mJ7wHB9OWoObjMDd2K ztJR8wG/PqTVbNPhVwS7ekIm+QQBba/zedyz6GRCNZo945hJmNek6m8FPevzTik2fU lAfUdq39q5gAw== 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 02/13] riscv: cpufeature: detect RISCV_ALTERNATIVES_EARLY_BOOT earlier Date: Sun, 29 Jan 2023 01:28:45 +0800 Message-Id: <20230128172856.3814-3-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 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Currently riscv_cpufeature_patch_func() does nothing at the RISCV_ALTERNATIVES_EARLY_BOOT stage. Add a check to detect whether we are in this stage and exit early. This will allow us to use riscv_cpufeature_patch_func() for scanning of all ISA extensions. Signed-off-by: Jisheng Zhang Reviewed-by: Andrew Jones Reviewed-by: Heiko Stuebner Reviewed-by: Conor Dooley --- arch/riscv/kernel/cpufeature.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 62443fd32fa7..59e20cad1b3d 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -330,6 +330,9 @@ void __init_or_module riscv_cpufeature_patch_func(struct alt_entry *begin, struct alt_entry *alt; u32 tmp; + if (stage == RISCV_ALTERNATIVES_EARLY_BOOT) + return; + for (alt = begin; alt < end; alt++) { if (alt->vendor_id != 0) continue;