Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9745081rwl; Wed, 11 Jan 2023 09:22:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXv41rtiUB6MCBF8kSE/iZY32Nk16Nopf8oZf5JGBPk9YFy4DM23yfGF6tr6h+Nwwc0l9hgy X-Received: by 2002:a05:6a20:cf62:b0:ab:ee20:b003 with SMTP id hz34-20020a056a20cf6200b000abee20b003mr68509011pzb.14.1673457775434; Wed, 11 Jan 2023 09:22:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673457775; cv=none; d=google.com; s=arc-20160816; b=bV3Ft8e/IafO0WK/4kwwzAKjZlZw/kEta3XTgbdpi06VuedOqPQFbKsMuAtUJrf0hF gWLxfUWsH9QeaCDslsLu3OpOV5X5kJAcKmbU1LdLKVXnks+YvoLS9+5LkCo50KncuvQ4 dyw5j8YiDl5MWS6+Vh1LsMbOuJ092sP5QD0PtbHdzAZPq5ZxXGEntGKgvGtvc+Z0cibu L/yIcPZ+Z62luUgZFg4cfFyuiITCC59Xp/kWhnO/QLAYOpGOQ+sHiDtCwvU+VO1C0h/2 VcT0rHxBNCim5/HJrTWvudTnrliMqULILRBMWk8zuP+tr6r8EfMUbA/VqYlIdtFeeyOJ f8GA== 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=nn8b0JeHOVP1AZD4ckTZENZxqZpBCCfPedaqDyHwL24=; b=Cf5ZJ2oUB/PGiRoktRvGaEIifl6swpVcHdGkquUTONJVRd23kTkA99Bs4HBZqimjmP LJTh97aCZaDI2DLbPUMkR8bT3UnYnLU8Nrxu/wwrc0spttroXHCqbDVh3FHKcBgT3tIR WLk7qqLCg1RyzieAj4mFC7iIQWZgFN3mIQ+jxgbqPsg/uB8lOVTKUHpt+aC5SfdRJ2NN l9Dqtcj2wtcEHUAQpuvGzWbVDTQoeIvlDDFdbTfqV9ikrUeyfx6QEiki8ibBvqnEA2TI 1pp1B3wiU4/HZnk9Qm8UkyV2Xz9+QhM6Dh4320nDamyAfYDvWhvGnDd6McG2oJFBUqJh A2lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=muCp1adD; 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 k24-20020a63f018000000b004b5620ecea4si5450187pgh.356.2023.01.11.09.22.49; Wed, 11 Jan 2023 09:22:55 -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=muCp1adD; 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 S238218AbjAKRVK (ORCPT + 51 others); Wed, 11 Jan 2023 12:21:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234749AbjAKRU4 (ORCPT ); Wed, 11 Jan 2023 12:20:56 -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 A8E4AE26; Wed, 11 Jan 2023 09:20:54 -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 469BC61D9E; Wed, 11 Jan 2023 17:20:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62672C433F1; Wed, 11 Jan 2023 17:20:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673457653; bh=XfFLNWhAd8k4qxV8rXLEBaM1QQgAKaJ6LOhZRHyHg+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=muCp1adDcrT3TviFaKXdg0Pic8fXJRdvzrirnhFO1zFdeYWn/dET9sP7d1RdUdFAp DWxW08xXfBBtPd1rb+d48sLNkQQPnmss5DhciXz35D4n8UHO1DE1JhNEGLkAKHE6Ah taBSW9mbljzQvG+6oD+fvAHKEKilx/yD8HaAvHvgMPbQAEbjKvGzZEEIvHXTQUX+EE GJNrEsSIE5bWQtkY0U7nD1VanPzihUX3CuDncZoPfDPiG1gtMhGXnBxxQlPtONq+r1 5jLS2amJ5VeyhyBDjO5dH5DSMV6q4r8JBsdz9yhre14+cpSkEmEE43VsFskr8J5qEj wx7SU9f2rQEkg== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Anup Patel , Atish Patra , Heiko Stuebner Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, Andrew Jones Subject: [PATCH v3 03/13] riscv: cpufeature: detect RISCV_ALTERNATIVES_EARLY_BOOT earlier Date: Thu, 12 Jan 2023 01:10:17 +0800 Message-Id: <20230111171027.2392-4-jszhang@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230111171027.2392-1-jszhang@kernel.org> References: <20230111171027.2392-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 --- 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