Commit bfd6fc5d authored by Samuel Holland's avatar Samuel Holland Committed by Palmer Dabbelt

riscv: Fix early alternative patching

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: 8d23e94a ("riscv: switch to relative alternative entries")
Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
Reviewed-by: default avatarConor Dooley <conor.dooley@microchip.com>
Reviewed-by: default avatarGuo Ren <guoren@kernel.org>
Reviewed-by: default avatarJisheng Zhang <jszhang@kernel.org>
Tested-by: default avatarConor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20230212021534.59121-2-samuel@sholland.orgSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
parent 5f365c13
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment