Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'loongarch-fixes-6.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson

Pull LoongArch fixes from Huacai Chen:
"Export smp_send_reschedule() for modules use, fix a huge page entry
update issue, and add documents for booting description"

* tag 'loongarch-fixes-6.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson:
docs/zh_CN: Add LoongArch booting description's translation
docs/LoongArch: Add booting description
LoongArch: mm: Fix huge page entry update for virtual machine
LoongArch: Export symbol for function smp_send_reschedule()

+119 -24
+42
Documentation/loongarch/booting.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + ======================= 4 + Booting Linux/LoongArch 5 + ======================= 6 + 7 + :Author: Yanteng Si <siyanteng@loongson.cn> 8 + :Date: 18 Nov 2022 9 + 10 + Information passed from BootLoader to kernel 11 + ============================================ 12 + 13 + LoongArch supports ACPI and FDT. The information that needs to be passed 14 + to the kernel includes the memmap, the initrd, the command line, optionally 15 + the ACPI/FDT tables, and so on. 16 + 17 + The kernel is passed the following arguments on `kernel_entry` : 18 + 19 + - a0 = efi_boot: `efi_boot` is a flag indicating whether 20 + this boot environment is fully UEFI-compliant. 21 + 22 + - a1 = cmdline: `cmdline` is a pointer to the kernel command line. 23 + 24 + - a2 = systemtable: `systemtable` points to the EFI system table. 25 + All pointers involved at this stage are in physical addresses. 26 + 27 + Header of Linux/LoongArch kernel images 28 + ======================================= 29 + 30 + Linux/LoongArch kernel images are EFI images. Being PE files, they have 31 + a 64-byte header structured like:: 32 + 33 + u32 MZ_MAGIC /* "MZ", MS-DOS header */ 34 + u32 res0 = 0 /* Reserved */ 35 + u64 kernel_entry /* Kernel entry point */ 36 + u64 _end - _text /* Kernel image effective size */ 37 + u64 load_offset /* Kernel image load offset from start of RAM */ 38 + u64 res1 = 0 /* Reserved */ 39 + u64 res2 = 0 /* Reserved */ 40 + u64 res3 = 0 /* Reserved */ 41 + u32 LINUX_PE_MAGIC /* Magic number */ 42 + u32 pe_header - _head /* Offset to the PE header */
+1
Documentation/loongarch/index.rst
··· 9 9 :numbered: 10 10 11 11 introduction 12 + booting 12 13 irq-chip-model 13 14 14 15 features
+48
Documentation/translations/zh_CN/loongarch/booting.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + .. include:: ../disclaimer-zh_CN.rst 4 + 5 + :Original: Documentation/loongarch/booting.rst 6 + 7 + :翻译: 8 + 9 + 司延腾 Yanteng Si <siyanteng@loongson.cn> 10 + 11 + ==================== 12 + 启动 Linux/LoongArch 13 + ==================== 14 + 15 + :作者: 司延腾 <siyanteng@loongson.cn> 16 + :日期: 2022年11月18日 17 + 18 + BootLoader传递给内核的信息 19 + ========================== 20 + 21 + LoongArch支持ACPI和FDT启动,需要传递给内核的信息包括memmap、initrd、cmdline、可 22 + 选的ACPI/FDT表等。 23 + 24 + 内核在 `kernel_entry` 入口处被传递以下参数: 25 + 26 + - a0 = efi_boot: `efi_boot` 是一个标志,表示这个启动环境是否完全符合UEFI 27 + 的要求。 28 + 29 + - a1 = cmdline: `cmdline` 是一个指向内核命令行的指针。 30 + 31 + - a2 = systemtable: `systemtable` 指向EFI的系统表,在这个阶段涉及的所有 32 + 指针都是物理地址。 33 + 34 + Linux/LoongArch内核镜像文件头 35 + ============================= 36 + 37 + 内核镜像是EFI镜像。作为PE文件,它们有一个64字节的头部结构体,如下所示:: 38 + 39 + u32 MZ_MAGIC /* "MZ", MS-DOS 头 */ 40 + u32 res0 = 0 /* 保留 */ 41 + u64 kernel_entry /* 内核入口点 */ 42 + u64 _end - _text /* 内核镜像有效大小 */ 43 + u64 load_offset /* 加载内核镜像相对内存起始地址的偏移量 */ 44 + u64 res1 = 0 /* 保留 */ 45 + u64 res2 = 0 /* 保留 */ 46 + u64 res3 = 0 /* 保留 */ 47 + u32 LINUX_PE_MAGIC /* 魔术数 */ 48 + u32 pe_header - _head /* 到PE头的偏移量 */
+1
Documentation/translations/zh_CN/loongarch/index.rst
··· 14 14 :numbered: 15 15 16 16 introduction 17 + booting 17 18 irq-chip-model 18 19 19 20 features
-10
arch/loongarch/include/asm/smp.h
··· 78 78 */ 79 79 extern void show_ipi_list(struct seq_file *p, int prec); 80 80 81 - /* 82 - * This function sends a 'reschedule' IPI to another CPU. 83 - * it goes straight through and wastes no time serializing 84 - * anything. Worst case is that we lose a reschedule ... 85 - */ 86 - static inline void smp_send_reschedule(int cpu) 87 - { 88 - loongson_send_ipi_single(cpu, SMP_RESCHEDULE); 89 - } 90 - 91 81 static inline void arch_send_call_function_single_ipi(int cpu) 92 82 { 93 83 loongson_send_ipi_single(cpu, SMP_CALL_FUNCTION);
+11
arch/loongarch/kernel/smp.c
··· 149 149 ipi_write_action(cpu_logical_map(i), (u32)action); 150 150 } 151 151 152 + /* 153 + * This function sends a 'reschedule' IPI to another CPU. 154 + * it goes straight through and wastes no time serializing 155 + * anything. Worst case is that we lose a reschedule ... 156 + */ 157 + void smp_send_reschedule(int cpu) 158 + { 159 + loongson_send_ipi_single(cpu, SMP_RESCHEDULE); 160 + } 161 + EXPORT_SYMBOL_GPL(smp_send_reschedule); 162 + 152 163 irqreturn_t loongson_ipi_interrupt(int irq, void *dev) 153 164 { 154 165 unsigned int action;
+16 -14
arch/loongarch/mm/tlbex.S
··· 10 10 #include <asm/regdef.h> 11 11 #include <asm/stackframe.h> 12 12 13 + #define INVTLB_ADDR_GFALSE_AND_ASID 5 14 + 13 15 #define PTRS_PER_PGD_BITS (PAGE_SHIFT - 3) 14 16 #define PTRS_PER_PUD_BITS (PAGE_SHIFT - 3) 15 17 #define PTRS_PER_PMD_BITS (PAGE_SHIFT - 3) ··· 138 136 ori t0, ra, _PAGE_VALID 139 137 st.d t0, t1, 0 140 138 #endif 141 - tlbsrch 142 - addu16i.d t1, zero, -(CSR_TLBIDX_EHINV >> 16) 143 - addi.d ra, t1, 0 144 - csrxchg ra, t1, LOONGARCH_CSR_TLBIDX 145 - tlbwr 146 - 147 - csrxchg zero, t1, LOONGARCH_CSR_TLBIDX 139 + csrrd ra, LOONGARCH_CSR_ASID 140 + csrrd t1, LOONGARCH_CSR_BADV 141 + andi ra, ra, CSR_ASID_ASID 142 + invtlb INVTLB_ADDR_GFALSE_AND_ASID, ra, t1 148 143 149 144 /* 150 145 * A huge PTE describes an area the size of the ··· 286 287 ori t0, ra, (_PAGE_VALID | _PAGE_DIRTY | _PAGE_MODIFIED) 287 288 st.d t0, t1, 0 288 289 #endif 289 - tlbsrch 290 - addu16i.d t1, zero, -(CSR_TLBIDX_EHINV >> 16) 291 - addi.d ra, t1, 0 292 - csrxchg ra, t1, LOONGARCH_CSR_TLBIDX 293 - tlbwr 290 + csrrd ra, LOONGARCH_CSR_ASID 291 + csrrd t1, LOONGARCH_CSR_BADV 292 + andi ra, ra, CSR_ASID_ASID 293 + invtlb INVTLB_ADDR_GFALSE_AND_ASID, ra, t1 294 294 295 - csrxchg zero, t1, LOONGARCH_CSR_TLBIDX 296 295 /* 297 296 * A huge PTE describes an area the size of the 298 297 * configured huge page size. This is twice the ··· 433 436 ori t0, ra, (_PAGE_VALID | _PAGE_DIRTY | _PAGE_MODIFIED) 434 437 st.d t0, t1, 0 435 438 #endif 439 + csrrd ra, LOONGARCH_CSR_ASID 440 + csrrd t1, LOONGARCH_CSR_BADV 441 + andi ra, ra, CSR_ASID_ASID 442 + invtlb INVTLB_ADDR_GFALSE_AND_ASID, ra, t1 443 + 436 444 /* 437 445 * A huge PTE describes an area the size of the 438 446 * configured huge page size. This is twice the ··· 468 466 addu16i.d t1, zero, (PS_HUGE_SIZE << (CSR_TLBIDX_PS_SHIFT - 16)) 469 467 csrxchg t1, t0, LOONGARCH_CSR_TLBIDX 470 468 471 - tlbwr 469 + tlbfill 472 470 473 471 /* Reset default page size */ 474 472 addu16i.d t0, zero, (CSR_TLBIDX_PS >> 16)