From: Heiko Stuebner <heiko@...>
Date: Wed, 12 Jan 2022 21:15:04 +0100
Commit-Message
Move the application of boot alternatives to soc_early_init().
This allows to catch more generic cases of code needing patches
than doing it in smp_prepare_boot_cpu() and also makes it actually
work if CONFIG_SMP is disabled for whatever reason.
The position is chosen mainly as it is before the actual soc early
init runs but also already allows accessing the devicetree
via fdt_* functions.
Signed-off-by: Heiko Stuebner <heiko@...>
Patch-Comment
arch/riscv/kernel/smpboot.c | 2 --
arch/riscv/kernel/soc.c | 3 +++
2 files changed, 3 insertions(+), 2 deletions(-)
Statistics
- 3 lines added
- 2 lines removed
Changes
@@ -32,7 +32,6 @@
#include <asm/sections.h>
#include <asm/sbi.h>
#include <asm/smp.h>
-#include <asm/alternative.h>
#include "head.h"
@@ -41,7 +40,6 @@ static DECLARE_COMPLETION(cpu_running);
void __init smp_prepare_boot_cpu(void)
{
init_cpu_topology();
- apply_boot_alternatives();
}
void __init smp_prepare_cpus(unsigned int max_cpus)
@@ -5,6 +5,7 @@
#include <linux/init.h>
#include <linux/libfdt.h>
#include <linux/pgtable.h>
+#include <asm/alternative.h>
#include <asm/soc.h>
/*
@@ -17,6 +18,8 @@ void __init soc_early_init(void)
const struct of_device_id *s;
const void *fdt = dtb_early_va;
+ apply_boot_alternatives();
+
for (s = (void *)&__soc_early_init_table_start;
(void *)s < (void *)&__soc_early_init_table_end; s++) {
if (!fdt_node_check_compatible(fdt, 0, s->compatible)) {