From: Jisheng Zhang <jszhang@kernel.org>
To: Samuel Holland <samuel@sholland.org>
Cc: Heiko Stuebner <heiko@sntech.de>,
Palmer Dabbelt <palmer@dabbelt.com>,
linux-riscv@lists.infradead.org,
Andrew Jones <ajones@ventanamicro.com>,
Christoph Muellner <christoph.muellner@vrull.eu>,
Conor Dooley <conor.dooley@microchip.com>,
Guo Ren <guoren@kernel.org>,
Heiko Stuebner <heiko.stuebner@vrull.eu>,
Nathan Chancellor <nathan@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] riscv: Fix early alternative patching
Date: Tue, 14 Feb 2023 00:46:47 +0800 [thread overview]
Message-ID: <Y+ppd3YEM0BB6O5l@xhacker> (raw)
In-Reply-To: <20230212021534.59121-2-samuel@sholland.org>
On Sat, Feb 11, 2023 at 08:15:32PM -0600, 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.
Good catch!
>
> Fixes: 8d23e94a4433 ("riscv: switch to relative alternative entries")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jisheng Zhang <jszhang@kernel.org>
> ---
>
> 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
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Jisheng Zhang <jszhang@kernel.org>
To: Samuel Holland <samuel@sholland.org>
Cc: Heiko Stuebner <heiko@sntech.de>,
Palmer Dabbelt <palmer@dabbelt.com>,
linux-riscv@lists.infradead.org,
Andrew Jones <ajones@ventanamicro.com>,
Christoph Muellner <christoph.muellner@vrull.eu>,
Conor Dooley <conor.dooley@microchip.com>,
Guo Ren <guoren@kernel.org>,
Heiko Stuebner <heiko.stuebner@vrull.eu>,
Nathan Chancellor <nathan@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] riscv: Fix early alternative patching
Date: Tue, 14 Feb 2023 00:46:47 +0800 [thread overview]
Message-ID: <Y+ppd3YEM0BB6O5l@xhacker> (raw)
In-Reply-To: <20230212021534.59121-2-samuel@sholland.org>
On Sat, Feb 11, 2023 at 08:15:32PM -0600, 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.
Good catch!
>
> Fixes: 8d23e94a4433 ("riscv: switch to relative alternative entries")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jisheng Zhang <jszhang@kernel.org>
> ---
>
> 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
>
next prev parent reply other threads:[~2023-02-13 16:57 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-12 2:15 [PATCH 0/2] riscv: Fix alternatives issues on for-next Samuel Holland
2023-02-12 2:15 ` Samuel Holland
2023-02-12 2:15 ` [PATCH 1/2] riscv: Fix early alternative patching Samuel Holland
2023-02-12 2:15 ` Samuel Holland
2023-02-12 15:48 ` Conor Dooley
2023-02-12 15:48 ` Conor Dooley
2023-02-13 1:22 ` Guo Ren
2023-02-13 1:22 ` Guo Ren
2023-02-13 16:46 ` Jisheng Zhang [this message]
2023-02-13 16:46 ` Jisheng Zhang
2023-02-12 2:15 ` [PATCH 2/2] riscv: Fix Zbb alternative IDs Samuel Holland
2023-02-12 2:15 ` Samuel Holland
2023-02-12 15:20 ` Conor Dooley
2023-02-12 15:20 ` Conor Dooley
2023-02-12 16:31 ` Andrew Jones
2023-02-12 16:31 ` Andrew Jones
2023-02-13 1:19 ` Guo Ren
2023-02-13 1:19 ` Guo Ren
2023-02-12 15:09 ` [PATCH 0/2] riscv: Fix alternatives issues on for-next Conor Dooley
2023-02-12 15:09 ` Conor Dooley
2023-02-13 1:23 ` Guo Ren
2023-02-13 1:23 ` Guo Ren
2023-02-15 14:56 ` Palmer Dabbelt
2023-02-15 14:56 ` Palmer Dabbelt
2023-02-15 15:00 ` patchwork-bot+linux-riscv
2023-02-15 15:00 ` patchwork-bot+linux-riscv
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y+ppd3YEM0BB6O5l@xhacker \
--to=jszhang@kernel.org \
--cc=ajones@ventanamicro.com \
--cc=christoph.muellner@vrull.eu \
--cc=conor.dooley@microchip.com \
--cc=guoren@kernel.org \
--cc=heiko.stuebner@vrull.eu \
--cc=heiko@sntech.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=nathan@kernel.org \
--cc=palmer@dabbelt.com \
--cc=samuel@sholland.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.