2019-05-29 22:18:00 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2017-07-11 09:08:08 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 Regents of the University of California
|
|
|
|
* Copyright (C) 2017 SiFive
|
|
|
|
*/
|
|
|
|
|
2021-04-13 14:35:14 +08:00
|
|
|
#ifdef CONFIG_XIP_KERNEL
|
|
|
|
#include "vmlinux-xip.lds.S"
|
|
|
|
#else
|
|
|
|
|
2021-04-12 00:41:44 +08:00
|
|
|
#include <asm/pgtable.h>
|
|
|
|
#define LOAD_OFFSET KERNEL_LINK_ADDR
|
2021-04-13 14:35:14 +08:00
|
|
|
|
2017-07-11 09:08:08 +08:00
|
|
|
#include <asm/vmlinux.lds.h>
|
|
|
|
#include <asm/page.h>
|
|
|
|
#include <asm/cache.h>
|
|
|
|
#include <asm/thread_info.h>
|
2020-03-10 00:55:40 +08:00
|
|
|
#include <asm/set_memory.h>
|
2020-09-18 06:37:13 +08:00
|
|
|
#include "image-vars.h"
|
2017-07-11 09:08:08 +08:00
|
|
|
|
2020-03-18 09:11:39 +08:00
|
|
|
#include <linux/sizes.h>
|
2017-07-11 09:08:08 +08:00
|
|
|
OUTPUT_ARCH(riscv)
|
|
|
|
ENTRY(_start)
|
|
|
|
|
|
|
|
jiffies = jiffies_64;
|
|
|
|
|
2020-09-18 06:37:13 +08:00
|
|
|
PECOFF_SECTION_ALIGNMENT = 0x1000;
|
|
|
|
PECOFF_FILE_ALIGNMENT = 0x200;
|
|
|
|
|
2017-07-11 09:08:08 +08:00
|
|
|
SECTIONS
|
|
|
|
{
|
|
|
|
/* Beginning of code and text segment */
|
|
|
|
. = LOAD_OFFSET;
|
|
|
|
_start = .;
|
|
|
|
HEAD_TEXT_SECTION
|
2020-03-18 09:11:39 +08:00
|
|
|
. = ALIGN(PAGE_SIZE);
|
|
|
|
|
2020-11-05 08:04:38 +08:00
|
|
|
.text : {
|
|
|
|
_text = .;
|
|
|
|
_stext = .;
|
|
|
|
TEXT_TEXT
|
|
|
|
SCHED_TEXT
|
|
|
|
CPUIDLE_TEXT
|
|
|
|
LOCK_TEXT
|
|
|
|
KPROBES_TEXT
|
|
|
|
ENTRY_TEXT
|
|
|
|
IRQENTRY_TEXT
|
|
|
|
SOFTIRQENTRY_TEXT
|
|
|
|
*(.fixup)
|
|
|
|
_etext = .;
|
|
|
|
}
|
|
|
|
|
|
|
|
. = ALIGN(SECTION_ALIGN);
|
2020-03-18 09:11:39 +08:00
|
|
|
__init_begin = .;
|
2020-11-05 08:04:37 +08:00
|
|
|
__init_text_begin = .;
|
|
|
|
.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) ALIGN(SECTION_ALIGN) { \
|
|
|
|
_sinittext = .; \
|
|
|
|
INIT_TEXT \
|
|
|
|
_einittext = .; \
|
|
|
|
}
|
|
|
|
|
2020-03-16 08:47:38 +08:00
|
|
|
. = ALIGN(8);
|
|
|
|
__soc_early_init_table : {
|
|
|
|
__soc_early_init_table_start = .;
|
|
|
|
KEEP(*(__soc_early_init_table))
|
|
|
|
__soc_early_init_table_end = .;
|
|
|
|
}
|
2020-04-14 12:43:24 +08:00
|
|
|
__soc_builtin_dtb_table : {
|
|
|
|
__soc_builtin_dtb_table_start = .;
|
|
|
|
KEEP(*(__soc_builtin_dtb_table))
|
|
|
|
__soc_builtin_dtb_table_end = .;
|
|
|
|
}
|
2017-07-11 09:08:08 +08:00
|
|
|
/* we have to discard exit text and such at runtime, not link time */
|
|
|
|
.exit.text :
|
|
|
|
{
|
|
|
|
EXIT_TEXT
|
|
|
|
}
|
|
|
|
|
2020-11-05 08:04:38 +08:00
|
|
|
__init_text_end = .;
|
2020-03-10 00:55:40 +08:00
|
|
|
. = ALIGN(SECTION_ALIGN);
|
2020-09-18 06:37:13 +08:00
|
|
|
#ifdef CONFIG_EFI
|
|
|
|
. = ALIGN(PECOFF_SECTION_ALIGNMENT);
|
|
|
|
__pecoff_text_end = .;
|
|
|
|
#endif
|
2020-11-05 08:04:38 +08:00
|
|
|
/* Start of init data section */
|
|
|
|
__init_data_begin = .;
|
2020-10-07 00:49:33 +08:00
|
|
|
INIT_DATA_SECTION(16)
|
2020-11-05 08:04:38 +08:00
|
|
|
.exit.data :
|
|
|
|
{
|
|
|
|
EXIT_DATA
|
|
|
|
}
|
|
|
|
PERCPU_SECTION(L1_CACHE_BYTES)
|
|
|
|
|
2020-11-05 08:04:39 +08:00
|
|
|
.rel.dyn : {
|
|
|
|
*(.rel.dyn*)
|
|
|
|
}
|
|
|
|
|
2020-11-05 08:04:38 +08:00
|
|
|
__init_data_end = .;
|
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-03-22 22:26:03 +08:00
|
|
|
|
|
|
|
. = ALIGN(8);
|
|
|
|
.alternative : {
|
|
|
|
__alt_start = .;
|
|
|
|
*(.alternative)
|
|
|
|
__alt_end = .;
|
|
|
|
}
|
2020-11-05 08:04:38 +08:00
|
|
|
__init_end = .;
|
2020-10-07 00:49:33 +08:00
|
|
|
|
2017-07-11 09:08:08 +08:00
|
|
|
/* Start of data section */
|
|
|
|
_sdata = .;
|
2020-03-10 00:55:40 +08:00
|
|
|
RO_DATA(SECTION_ALIGN)
|
2017-07-11 09:08:08 +08:00
|
|
|
.srodata : {
|
|
|
|
*(.srodata*)
|
|
|
|
}
|
|
|
|
|
2020-03-10 00:55:39 +08:00
|
|
|
EXCEPTION_TABLE(0x10)
|
|
|
|
|
2020-03-10 00:55:40 +08:00
|
|
|
. = ALIGN(SECTION_ALIGN);
|
2020-03-10 00:55:39 +08:00
|
|
|
_data = .;
|
|
|
|
|
2019-10-30 05:13:35 +08:00
|
|
|
RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
|
2017-07-11 09:08:08 +08:00
|
|
|
.sdata : {
|
|
|
|
__global_pointer$ = . + 0x800;
|
|
|
|
*(.sdata*)
|
|
|
|
}
|
|
|
|
|
2020-09-18 06:37:13 +08:00
|
|
|
#ifdef CONFIG_EFI
|
|
|
|
.pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
|
|
|
|
__pecoff_data_raw_size = ABSOLUTE(. - __pecoff_text_end);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* End of data section */
|
|
|
|
_edata = .;
|
|
|
|
|
2019-02-09 01:11:08 +08:00
|
|
|
BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
|
|
|
|
|
2020-09-18 06:37:13 +08:00
|
|
|
#ifdef CONFIG_EFI
|
|
|
|
. = ALIGN(PECOFF_SECTION_ALIGNMENT);
|
|
|
|
__pecoff_data_virt_size = ABSOLUTE(. - __pecoff_text_end);
|
|
|
|
#endif
|
2017-07-11 09:08:08 +08:00
|
|
|
_end = .;
|
|
|
|
|
|
|
|
STABS_DEBUG
|
|
|
|
DWARF_DEBUG
|
2020-08-22 03:42:45 +08:00
|
|
|
ELF_DETAILS
|
2017-07-11 09:08:08 +08:00
|
|
|
|
|
|
|
DISCARDS
|
|
|
|
}
|
2021-04-13 14:35:14 +08:00
|
|
|
#endif /* CONFIG_XIP_KERNEL */
|