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 BED60C636D7 for ; Sun, 12 Feb 2023 02:15:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229632AbjBLCPj (ORCPT ); Sat, 11 Feb 2023 21:15:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbjBLCPh (ORCPT ); Sat, 11 Feb 2023 21:15:37 -0500 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1957F1422A for ; Sat, 11 Feb 2023 18:15:34 -0800 (PST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 7B88F5C00B2; Sat, 11 Feb 2023 21:15:32 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sat, 11 Feb 2023 21:15:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1676168132; x=1676254532; bh=XF d2itQ9Q8tRMCuANmPpVcUQz7tHsp9UVd1TrH5jLFM=; b=bDR6b4n0NG+2t72sIG VAH6ziPmwqPxQxLfm1jzqnPrshKt7OXIccm/Gr8vEnAX+VnkyNyrA2s8PZCabm4z 4M4FEHh5osWWgS1UrmO5YK4HpFRGWG15l5ZgclBxrkALRG6tG8sqZWtEWLkB0pkz LHGMJsdKmISsZOZllphS/lJZbadEp/hymDNckm/2gTRKyeygpDoqUJPFqnQEZ6V1 Ib6mvL1GjdhoVPF1gaDSskqx7tfp10dz0shDtHX5zPE6Ui5qt1hCHwMT+gCFlF44 NhLEBHRLml30VP1TUvrVErscqm3ZiUtiwe1iLP7v4NPHOkDStH0wFFe4+OUeEub6 MvJw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1676168132; x=1676254532; bh=XFd2itQ9Q8tRM CuANmPpVcUQz7tHsp9UVd1TrH5jLFM=; b=KLEtnz0+tCfMFjMxGOhUF5UGpmLT9 E2k+2D7fWrC3t31yEROpLLQOiyem0XfuNqRlgKtuGX0Uq0zdKgvCdUkOvl3K21Qn p2+cSuMAhjljl6r7nJEISPFAmW2YTQdIXqGx6GBFxoLoUot90pOxQMvCgrH5WJPk WzEyK/jETrR6HMD4JzR6yxNuH3OOkkcPmHS4PQPnd4KH32IAUy14FFQ61Mh3Ucr4 A7dpgCsWsouPzfenRBYOu0g/OjRbZL4sp+JbTYfEFikpC57gNNLEOYCnIR5UKpnw knAFgTlygdyEmIT2AIwa8++VVJEzmqlU8mRw5zagsvvflrPlU0dxXJlLg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudehkedggeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudekteeuudehtdelteevgfduvddvjefhfedulefgudevgeeghefg udefiedtveetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 11 Feb 2023 21:15:31 -0500 (EST) From: Samuel Holland To: Heiko Stuebner , Jisheng Zhang , Palmer Dabbelt , linux-riscv@lists.infradead.org Cc: Samuel Holland , Andrew Jones , Christoph Muellner , Conor Dooley , Guo Ren , Heiko Stuebner , Nathan Chancellor , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] riscv: Fix early alternative patching Date: Sat, 11 Feb 2023 20:15:32 -0600 Message-Id: <20230212021534.59121-2-samuel@sholland.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20230212021534.59121-1-samuel@sholland.org> References: <20230212021534.59121-1-samuel@sholland.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that the text to patch is located using a relative offset from the alternative entry, the text address should be computed without applying the kernel mapping offset, both before and after VM setup. Fixes: 8d23e94a4433 ("riscv: switch to relative alternative entries") Signed-off-by: Samuel Holland --- arch/riscv/errata/thead/errata.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/riscv/errata/thead/errata.c b/arch/riscv/errata/thead/errata.c index c0bea5c94128..1dd90a5f86f0 100644 --- a/arch/riscv/errata/thead/errata.c +++ b/arch/riscv/errata/thead/errata.c @@ -102,9 +102,7 @@ void __init_or_module thead_errata_patch_func(struct alt_entry *begin, struct al /* On vm-alternatives, the mmu isn't running yet */ if (stage == RISCV_ALTERNATIVES_EARLY_BOOT) - memcpy((void *)__pa_symbol(oldptr), - (void *)__pa_symbol(altptr), - alt->alt_len); + memcpy(oldptr, altptr, alt->alt_len); else patch_text_nosync(oldptr, altptr, alt->alt_len); } -- 2.37.4