24fdd51899
1, Raise minimum clang version to 18.0.0; 2, Enable initial Rust support for LoongArch; 3, Add built-in dtb support for LoongArch; 4, Use generic interface to support crashkernel=X,[high,low]; 5, Some bug fixes and other small changes; 6, Update the default config file. -----BEGIN PGP SIGNATURE----- iQJKBAABCAA0FiEEzOlt8mkP+tbeiYy5AoYrw/LiJnoFAmWnW9cWHGNoZW5odWFj YWlAa2VybmVsLm9yZwAKCRAChivD8uImel3CD/0Wnd2VOhoPubJkCXd+v7SdPDFB +BlkevAdmKQXkxNVXHRwfirsEBnUdQTfSN/5hMd69ZWUTayYq3WFxOcaPs27AAyn cXmGAzxfCjanSj+zxK8Gcmef5kppx3PRSbFdnWgc42Povu0xTOH3M31HXx5WXGtv hZK439DspNGHlF1Bsbs3J8xbS76jc/HDZAqnIjLuefQUaWM8nhsYxJIwVeGKUX1T IyEgBwhHhsY9ho/86yk8VXgordAN4dnMVmAHbR63HqjLo/8sck4IiPNxWKFCHex8 vgxp0zGxfBBts284EfSofDQHrSrrWl4+e2fW2QJ81BBDSS0wPCs4TAnzH+x9X7Wb MJuh8WIJqhfXdPFxs5fdnUeykEm1V/oWFfkWORk4jbQkpY9aZbk/iv6uxsmRhmhv 2WPWvjF+7B2zSXtMcjgm71ymb/nU95W2FZO02GlwTnbGJRKA2xLkjn9rCXoHWjd3 IlxgIgZJ1vkPvFPS/sbekaTUEG+6/qTPGGa2Ol3Q5ZTTLk9serfDa8ay1xCZeOny +fRBgLsuQAOGO2pvxfXjs+uvboZNUHeKrAi7XeR61GcbNpQDkjuwNJXQMiMQ+f66 jWM6H+hV+6sQ/W43KVrGCyBqTX4J9PSN/gX/Cq0PL74Yheop6neYXZTl5uDNYDe9 WYxiS9j/FoYgj8lxYQ== =GzFR -----END PGP SIGNATURE----- Merge tag 'loongarch-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson Pull LoongArch updates from Huacai Chen: - Raise minimum clang version to 18.0.0 - Enable initial Rust support for LoongArch - Add built-in dtb support for LoongArch - Use generic interface to support crashkernel=X,[high,low] - Some bug fixes and other small changes - Update the default config file. * tag 'loongarch-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: (22 commits) MAINTAINERS: Add BPF JIT for LOONGARCH entry LoongArch: Update Loongson-3 default config file LoongArch: BPF: Prevent out-of-bounds memory access LoongArch: BPF: Support 64-bit pointers to kfuncs LoongArch: Fix definition of ftrace_regs_set_instruction_pointer() LoongArch: Use generic interface to support crashkernel=X,[high,low] LoongArch: Fix and simplify fcsr initialization on execve() LoongArch: Let cores_io_master cover the largest NR_CPUS LoongArch: Change SHMLBA from SZ_64K to PAGE_SIZE LoongArch: Add a missing call to efi_esrt_init() LoongArch: Parsing CPU-related information from DTS LoongArch: dts: DeviceTree for Loongson-2K2000 LoongArch: dts: DeviceTree for Loongson-2K1000 LoongArch: dts: DeviceTree for Loongson-2K0500 LoongArch: Allow device trees be built into the kernel dt-bindings: interrupt-controller: loongson,liointc: Fix dtbs_check warning for interrupt-names dt-bindings: interrupt-controller: loongson,liointc: Fix dtbs_check warning for reg-names dt-bindings: loongarch: Add Loongson SoC boards compatibles dt-bindings: loongarch: Add CPU bindings for LoongArch LoongArch: Enable initial Rust support ...
159 lines
3.5 KiB
ArmAsm
159 lines
3.5 KiB
ArmAsm
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright (C) 2020-2022 Loongson Technology Corporation Limited
|
|
*/
|
|
#include <linux/init.h>
|
|
#include <linux/threads.h>
|
|
|
|
#include <asm/addrspace.h>
|
|
#include <asm/asm.h>
|
|
#include <asm/asmmacro.h>
|
|
#include <asm/bug.h>
|
|
#include <asm/regdef.h>
|
|
#include <asm/loongarch.h>
|
|
#include <asm/stackframe.h>
|
|
|
|
#ifdef CONFIG_EFI_STUB
|
|
|
|
#include "efi-header.S"
|
|
|
|
__HEAD
|
|
|
|
_head:
|
|
.word MZ_MAGIC /* "MZ", MS-DOS header */
|
|
.org 0x8
|
|
.dword kernel_entry /* Kernel entry point */
|
|
.dword _kernel_asize /* Kernel image effective size */
|
|
.quad PHYS_LINK_KADDR /* Kernel image load offset from start of RAM */
|
|
.org 0x38 /* 0x20 ~ 0x37 reserved */
|
|
.long LINUX_PE_MAGIC
|
|
.long pe_header - _head /* Offset to the PE header */
|
|
|
|
pe_header:
|
|
__EFI_PE_HEADER
|
|
|
|
SYM_DATA(kernel_asize, .long _kernel_asize);
|
|
SYM_DATA(kernel_fsize, .long _kernel_fsize);
|
|
|
|
#endif
|
|
|
|
__REF
|
|
|
|
.align 12
|
|
|
|
SYM_CODE_START(kernel_entry) # kernel entry point
|
|
|
|
/* Config direct window and set PG */
|
|
li.d t0, CSR_DMW0_INIT # UC, PLV0, 0x8000 xxxx xxxx xxxx
|
|
csrwr t0, LOONGARCH_CSR_DMWIN0
|
|
li.d t0, CSR_DMW1_INIT # CA, PLV0, 0x9000 xxxx xxxx xxxx
|
|
csrwr t0, LOONGARCH_CSR_DMWIN1
|
|
|
|
JUMP_VIRT_ADDR t0, t1
|
|
|
|
/* Enable PG */
|
|
li.w t0, 0xb0 # PLV=0, IE=0, PG=1
|
|
csrwr t0, LOONGARCH_CSR_CRMD
|
|
li.w t0, 0x04 # PLV=0, PIE=1, PWE=0
|
|
csrwr t0, LOONGARCH_CSR_PRMD
|
|
li.w t0, 0x00 # FPE=0, SXE=0, ASXE=0, BTE=0
|
|
csrwr t0, LOONGARCH_CSR_EUEN
|
|
|
|
la.pcrel t0, __bss_start # clear .bss
|
|
st.d zero, t0, 0
|
|
la.pcrel t1, __bss_stop - LONGSIZE
|
|
1:
|
|
addi.d t0, t0, LONGSIZE
|
|
st.d zero, t0, 0
|
|
bne t0, t1, 1b
|
|
|
|
la.pcrel t0, fw_arg0
|
|
st.d a0, t0, 0 # firmware arguments
|
|
la.pcrel t0, fw_arg1
|
|
st.d a1, t0, 0
|
|
la.pcrel t0, fw_arg2
|
|
st.d a2, t0, 0
|
|
|
|
#ifdef CONFIG_PAGE_SIZE_4KB
|
|
li.d t0, 0
|
|
li.d t1, CSR_STFILL
|
|
csrxchg t0, t1, LOONGARCH_CSR_IMPCTL1
|
|
#endif
|
|
/* KSave3 used for percpu base, initialized as 0 */
|
|
csrwr zero, PERCPU_BASE_KS
|
|
/* GPR21 used for percpu base (runtime), initialized as 0 */
|
|
move u0, zero
|
|
|
|
la.pcrel tp, init_thread_union
|
|
/* Set the SP after an empty pt_regs. */
|
|
PTR_LI sp, (_THREAD_SIZE - PT_SIZE)
|
|
PTR_ADD sp, sp, tp
|
|
set_saved_sp sp, t0, t1
|
|
|
|
#ifdef CONFIG_RELOCATABLE
|
|
|
|
bl relocate_kernel
|
|
|
|
#ifdef CONFIG_RANDOMIZE_BASE
|
|
/* Repoint the sp into the new kernel */
|
|
PTR_LI sp, (_THREAD_SIZE - PT_SIZE)
|
|
PTR_ADD sp, sp, tp
|
|
set_saved_sp sp, t0, t1
|
|
|
|
/* Jump to the new kernel: new_pc = current_pc + random_offset */
|
|
pcaddi t0, 0
|
|
add.d t0, t0, a0
|
|
jirl zero, t0, 0xc
|
|
#endif /* CONFIG_RANDOMIZE_BASE */
|
|
|
|
#endif /* CONFIG_RELOCATABLE */
|
|
|
|
#ifdef CONFIG_KASAN
|
|
bl kasan_early_init
|
|
#endif
|
|
|
|
bl start_kernel
|
|
ASM_BUG()
|
|
|
|
SYM_CODE_END(kernel_entry)
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
/*
|
|
* SMP slave cpus entry point. Board specific code for bootstrap calls this
|
|
* function after setting up the stack and tp registers.
|
|
*/
|
|
SYM_CODE_START(smpboot_entry)
|
|
li.d t0, CSR_DMW0_INIT # UC, PLV0
|
|
csrwr t0, LOONGARCH_CSR_DMWIN0
|
|
li.d t0, CSR_DMW1_INIT # CA, PLV0
|
|
csrwr t0, LOONGARCH_CSR_DMWIN1
|
|
|
|
JUMP_VIRT_ADDR t0, t1
|
|
|
|
#ifdef CONFIG_PAGE_SIZE_4KB
|
|
li.d t0, 0
|
|
li.d t1, CSR_STFILL
|
|
csrxchg t0, t1, LOONGARCH_CSR_IMPCTL1
|
|
#endif
|
|
/* Enable PG */
|
|
li.w t0, 0xb0 # PLV=0, IE=0, PG=1
|
|
csrwr t0, LOONGARCH_CSR_CRMD
|
|
li.w t0, 0x04 # PLV=0, PIE=1, PWE=0
|
|
csrwr t0, LOONGARCH_CSR_PRMD
|
|
li.w t0, 0x00 # FPE=0, SXE=0, ASXE=0, BTE=0
|
|
csrwr t0, LOONGARCH_CSR_EUEN
|
|
|
|
la.pcrel t0, cpuboot_data
|
|
ld.d sp, t0, CPU_BOOT_STACK
|
|
ld.d tp, t0, CPU_BOOT_TINFO
|
|
|
|
bl start_secondary
|
|
ASM_BUG()
|
|
|
|
SYM_CODE_END(smpboot_entry)
|
|
|
|
#endif /* CONFIG_SMP */
|
|
|
|
SYM_ENTRY(kernel_entry_end, SYM_L_GLOBAL, SYM_A_NONE)
|