Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2025261rwb; Sun, 15 Jan 2023 08:03:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXtPrp/jLQiT0Ff2i/eis+dMJxUzzAqIrZGzFLMwm/fzEIUleBw9flKaPgem3loQANdYFMZ7 X-Received: by 2002:a17:906:4a82:b0:86b:1130:5e55 with SMTP id x2-20020a1709064a8200b0086b11305e55mr8826514eju.22.1673798631811; Sun, 15 Jan 2023 08:03:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673798631; cv=none; d=google.com; s=arc-20160816; b=daUaWLZKFSguUcCof1cm8azFbbNpr1FbP7s5KWg3IU3bhqtFJGXzMeSkd3Xvrpa6CP 49Dxbzh4BY7m/XBQ9Peb1DXUG59Y6hVmiEqjG2m6WXJvd+cFWdoi9jYg0pbzk5rRLWzT DW8Ih/Njqyl+ESd2tyP74aBXxvnqjuVn4/y7KOTAfG5FLNPCzEZTJCEDvo6stdY92iCe cO240HNAJa8ARcHH9IH8FQ8i9tS6w8NmIdqcP/RoPWWIPf5UCa9t408ZJ/lfPCqwvlTj XvEvIzPB80cqaX786XQYzYQvDLbY+gnJcuKlaKfRVsY6+XwD7gaiOLDGsmj3BI2jrKBT w9eA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TYCji1GDQWGuqlFOy99Bq7XTmyNRizJpsGLW4tbPgjs=; b=sn2SrFyLK4S/d2amA1xlwHhTscBeEkhpAg7vYvVKVvQIouQdfisD+oaZLFm/g5H8EV gAja3wyuX+RdvzLv0Kcdn2dDiCIMPiG6lozAXf0UfBeBT6BNNmnDEAlHQI5YMwXAe0UX 0cY1nrHUPVpk2Lor5TeGe1RVzUiHWBjpVlxgOoFJ1vNBJvHrmsgiOmnMBXVb5j80DACy w+Gaf6XcAiTl7OG9EBFTZLAVnHv38jiJEA+APLeX3ifzbpLSSGy3FKtRGkVq9yLtOOm2 pQbBr6yFn/pLW5ojFidOGj6xw1RONllQbZp9a6L8vPZwzu9ylYBp+GWmSpTqjJ9f07Lc bTIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XIRTBx0m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s2-20020a17090699c200b0086fedd36776si1984928ejn.823.2023.01.15.08.03.36; Sun, 15 Jan 2023 08:03:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XIRTBx0m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231506AbjAOQAf (ORCPT + 52 others); Sun, 15 Jan 2023 11:00:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231480AbjAOQAX (ORCPT ); Sun, 15 Jan 2023 11:00:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63A0510422; Sun, 15 Jan 2023 08:00:22 -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 dfw.source.kernel.org (Postfix) with ESMTPS id EEFA660C8F; Sun, 15 Jan 2023 16:00:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70F7AC433EF; Sun, 15 Jan 2023 16:00:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673798421; bh=tkPW10BOmVwQ+xf9drtAfQkSUj0eKN05rtZPJxt7gQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XIRTBx0mtsJkAfSfFtiNpRCg91ubwV9z5K1d0x3hbV9QVR42yCOauFr/dot6B5n/5 F/qd1qvvkGSgWAtCcGOpt99tj1iGb/bT6q3SjktwDYGpJCzcr+4nS8qjwHcuLNS04b Rm82cc6JA7L+Yzah+Waxbk7Gf1g6ds3KP4Lk0sR+Z4AzN3ItIGOdkdEEY2QOCegh2s pY13oaVowNUcgkLyhsfxpiPrJ8wL5dFV9UPbUOxUYcRKpK7JnjCjkO45te6UGF5dbQ u85uKCB+2AYGqGp9jCwbYg4BZefL5PCt8d2e3slKA7+qCKpcCaqn6ty+nC1ewAGW7N fqfprqKQPeyxQ== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Anup Patel , Atish Patra , Heiko Stuebner , Conor Dooley , Andrew Jones Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org Subject: [PATCH v4 03/13] riscv: cpufeature: detect RISCV_ALTERNATIVES_EARLY_BOOT earlier Date: Sun, 15 Jan 2023 23:49:43 +0800 Message-Id: <20230115154953.831-4-jszhang@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230115154953.831-1-jszhang@kernel.org> References: <20230115154953.831-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 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 421b3d9578cc..37e8c5e69754 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -328,6 +328,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; -- 2.38.1