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 B7645C636D7 for ; Mon, 13 Feb 2023 01:22:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229655AbjBMBWU (ORCPT ); Sun, 12 Feb 2023 20:22:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbjBMBWS (ORCPT ); Sun, 12 Feb 2023 20:22:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22514E059 for ; Sun, 12 Feb 2023 17:22:18 -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 AF6E160DFD for ; Mon, 13 Feb 2023 01:22:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1813FC4339E for ; Mon, 13 Feb 2023 01:22:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676251337; bh=wlM+Ecx2iuslNVdjwg8XLBf+mOAcdUJmrmZhSBMapRg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=QPSLrbIYqsxHLJMAdSXZCTc09YpOfAMoiZq7cBEwVVRpYGG139APGI5ka02DBtxlE k2aMmI4mTZh1RGfs9l+UgTG7lObep+Zy+1KNAFeKX65yXQqRXNn1bgTYpEHQ7XgY1W 0acK1gTTA7+uETwee7rss+sX9UmM7QWgSWNIXJlp6Mfs+5qdOkJqv5z3eKSD2dWUbU jEqA4ADqEDbODAl3s6BmLy5o+uwoSiEPYuI35XmMoOCGyyaAegd5O/4BluGhUIuIop g+bD0TqViVsP8JxSvJuwQcakvv8lm7WKc1hTo1/e4i2SnxAbUojjA4iyIU1BF01DZz Tk8A+fm7vROjw== Received: by mail-ed1-f50.google.com with SMTP id p12so3746771edc.0 for ; Sun, 12 Feb 2023 17:22:16 -0800 (PST) X-Gm-Message-State: AO0yUKX7p42uJgglYpXS3qWpWQ34X6UNGg5rXIPiwvdjlS5Hisa0p6YN NgCsWKhBNB9UZidKPzuQymCcQYhGJK6TyKGPpuI= X-Google-Smtp-Source: AK7set9Wnap2DtVffUeW5OU2ClIoBIQPsGGx1U3RdhWtx5jT/9yWwTz7INrdhOyrr63SToh1bowg5JYi5JFRN152pwc= X-Received: by 2002:a50:955e:0:b0:4ab:4676:f927 with SMTP id v30-20020a50955e000000b004ab4676f927mr3100715eda.7.1676251335341; Sun, 12 Feb 2023 17:22:15 -0800 (PST) MIME-Version: 1.0 References: <20230212021534.59121-1-samuel@sholland.org> <20230212021534.59121-2-samuel@sholland.org> In-Reply-To: <20230212021534.59121-2-samuel@sholland.org> From: Guo Ren Date: Mon, 13 Feb 2023 09:22:03 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] riscv: Fix early alternative patching To: Samuel Holland Cc: Heiko Stuebner , Jisheng Zhang , Palmer Dabbelt , linux-riscv@lists.infradead.org, Andrew Jones , Christoph Muellner , Conor Dooley , Heiko Stuebner , Nathan Chancellor , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 12, 2023 at 10:15 AM Samuel Holland wrote: > > 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 > Reviewed-by: Guo Ren -- Best Regards Guo Ren