linux/arch/riscv
Vincent Chen 6f4eea9046
riscv: Introduce alternative mechanism to apply errata solution
Introduce the "alternative" mechanism from ARM64 and x86 to apply the CPU
vendors' errata solution at runtime. The main purpose of this patch is
to provide a framework. Therefore, the implementation is quite basic for
now so that some scenarios could not use this schemei, such as patching
code to a module, relocating the patching code and heterogeneous CPU
topology.

Users could use the macro ALTERNATIVE to apply an errata to the existing
code flow. In the macro ALTERNATIVE, users need to specify the manufacturer
information(vendorid, archid, and impid) for this errata. Therefore, kernel
will know this errata is suitable for which CPU core. During the booting
procedure, kernel will select the errata required by the CPU core and then
patch it. It means that the kernel only applies the errata to the specified
CPU core. In this case, the vendor's errata does not affect each other at
runtime. The above patching procedure only occurs during the booting phase,
so we only take the overhead of the "alternative" mechanism once.

This "alternative" mechanism is enabled by default to ensure that all
required errata will be applied. However, users can disable this feature by
the Kconfig "CONFIG_RISCV_ERRATA_ALTERNATIVE".

Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
2021-04-26 08:24:55 -07:00
..
boot RISC-V Patches for the 5.12 Merge Window 2021-02-26 10:28:35 -08:00
configs RISC-V: Enable CPU Hotplug in defconfigs 2021-02-26 21:24:02 -08:00
errata riscv: Introduce alternative mechanism to apply errata solution 2021-04-26 08:24:55 -07:00
include riscv: Introduce alternative mechanism to apply errata solution 2021-04-26 08:24:55 -07:00
kernel riscv: Introduce alternative mechanism to apply errata solution 2021-04-26 08:24:55 -07:00
lib riscv: Add support for function error injection 2021-01-14 15:09:09 -08:00
mm riscv: Cleanup KASAN_VMALLOC support 2021-03-29 23:13:29 -07:00
net bpf: Rename BPF_XADD and prepare to encode other atomics in .imm 2021-01-14 18:34:29 -08:00
Kbuild riscv: Allow device trees to be built into the kernel 2020-05-18 11:38:05 -07:00
Kconfig riscv: Introduce alternative mechanism to apply errata solution 2021-04-26 08:24:55 -07:00
Kconfig.debug RISC-V: Remove EARLY_PRINTK support 2018-12-17 10:23:46 -08:00
Kconfig.erratas riscv: Introduce alternative mechanism to apply errata solution 2021-04-26 08:24:55 -07:00
Kconfig.socs riscv: Update Canaan Kendryte K210 device tree 2021-02-22 17:51:13 -08:00
Makefile riscv: Introduce alternative mechanism to apply errata solution 2021-04-26 08:24:55 -07:00