riscv: move boot alternatives to a slightly earlier

A patch from »SVPBMT + T-Head memory types next try« in state Mainline for linux-kernel

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

------------------------- arch/riscv/kernel/smpboot.c --------------------------
index a6d13dca1403..f1e4948a4b52 100644
@@ -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)
--------------------------- arch/riscv/kernel/soc.c ----------------------------
index a0516172a33c..b4e8aae59b82 100644
@@ -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)) {
 
 

Recent Patches

About Us

Sed lacus. Donec lectus. Nullam pretium nibh ut turpis. Nam bibendum. In nulla tortor, elementum vel, tempor at, varius non, purus. Mauris vitae nisl nec metus placerat consectetuer.

Read More...