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 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm

Pull ARM fixes from Russell King:

- Fix latent bug with DC21285 (Footbridge PCI bridge) configuration
accessors that affects GCC >= 4.9.2

- Fix misplaced tegra_uart_config in decompressor

- Ensure signal page contents are initialised

- Fix kexec oops

* tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
ARM: kexec: fix oops after TLB are invalidated
ARM: ensure the signal page contains defined contents
ARM: 9043/1: tegra: Fix misplaced tegra_uart_config in decompressor
ARM: footbridge: fix dc21285 PCI configuration accessors

+77 -78
+12
arch/arm/include/asm/kexec-internal.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _ARM_KEXEC_INTERNAL_H 3 + #define _ARM_KEXEC_INTERNAL_H 4 + 5 + struct kexec_relocate_data { 6 + unsigned long kexec_start_address; 7 + unsigned long kexec_indirection_page; 8 + unsigned long kexec_mach_type; 9 + unsigned long kexec_r2; 10 + }; 11 + 12 + #endif
+27 -27
arch/arm/include/debug/tegra.S
··· 149 149 150 150 .align 151 151 99: .word . 152 + #if defined(ZIMAGE) 153 + .word . + 4 154 + /* 155 + * Storage for the state maintained by the macro. 156 + * 157 + * In the kernel proper, this data is located in arch/arm/mach-tegra/tegra.c. 158 + * That's because this header is included from multiple files, and we only 159 + * want a single copy of the data. In particular, the UART probing code above 160 + * assumes it's running using physical addresses. This is true when this file 161 + * is included from head.o, but not when included from debug.o. So we need 162 + * to share the probe results between the two copies, rather than having 163 + * to re-run the probing again later. 164 + * 165 + * In the decompressor, we put the storage right here, since common.c 166 + * isn't included in the decompressor build. This storage data gets put in 167 + * .text even though it's really data, since .data is discarded from the 168 + * decompressor. Luckily, .text is writeable in the decompressor, unless 169 + * CONFIG_ZBOOT_ROM. That dependency is handled in arch/arm/Kconfig.debug. 170 + */ 171 + /* Debug UART initialization required */ 172 + .word 1 173 + /* Debug UART physical address */ 174 + .word 0 175 + /* Debug UART virtual address */ 176 + .word 0 177 + #else 152 178 .word tegra_uart_config 179 + #endif 153 180 .ltorg 154 181 155 182 /* Load previously selected UART address */ ··· 216 189 217 190 .macro waituarttxrdy,rd,rx 218 191 .endm 219 - 220 - /* 221 - * Storage for the state maintained by the macros above. 222 - * 223 - * In the kernel proper, this data is located in arch/arm/mach-tegra/tegra.c. 224 - * That's because this header is included from multiple files, and we only 225 - * want a single copy of the data. In particular, the UART probing code above 226 - * assumes it's running using physical addresses. This is true when this file 227 - * is included from head.o, but not when included from debug.o. So we need 228 - * to share the probe results between the two copies, rather than having 229 - * to re-run the probing again later. 230 - * 231 - * In the decompressor, we put the symbol/storage right here, since common.c 232 - * isn't included in the decompressor build. This symbol gets put in .text 233 - * even though it's really data, since .data is discarded from the 234 - * decompressor. Luckily, .text is writeable in the decompressor, unless 235 - * CONFIG_ZBOOT_ROM. That dependency is handled in arch/arm/Kconfig.debug. 236 - */ 237 - #if defined(ZIMAGE) 238 - tegra_uart_config: 239 - /* Debug UART initialization required */ 240 - .word 1 241 - /* Debug UART physical address */ 242 - .word 0 243 - /* Debug UART virtual address */ 244 - .word 0 245 - #endif
+5
arch/arm/kernel/asm-offsets.c
··· 12 12 #include <linux/mm.h> 13 13 #include <linux/dma-mapping.h> 14 14 #include <asm/cacheflush.h> 15 + #include <asm/kexec-internal.h> 15 16 #include <asm/glue-df.h> 16 17 #include <asm/glue-pf.h> 17 18 #include <asm/mach/arch.h> ··· 171 170 DEFINE(MPU_RGN_PRBAR, offsetof(struct mpu_rgn, prbar)); 172 171 DEFINE(MPU_RGN_PRLAR, offsetof(struct mpu_rgn, prlar)); 173 172 #endif 173 + DEFINE(KEXEC_START_ADDR, offsetof(struct kexec_relocate_data, kexec_start_address)); 174 + DEFINE(KEXEC_INDIR_PAGE, offsetof(struct kexec_relocate_data, kexec_indirection_page)); 175 + DEFINE(KEXEC_MACH_TYPE, offsetof(struct kexec_relocate_data, kexec_mach_type)); 176 + DEFINE(KEXEC_R2, offsetof(struct kexec_relocate_data, kexec_r2)); 174 177 return 0; 175 178 }
+8 -12
arch/arm/kernel/machine_kexec.c
··· 13 13 #include <linux/of_fdt.h> 14 14 #include <asm/mmu_context.h> 15 15 #include <asm/cacheflush.h> 16 + #include <asm/kexec-internal.h> 16 17 #include <asm/fncpy.h> 17 18 #include <asm/mach-types.h> 18 19 #include <asm/smp_plat.h> ··· 22 21 23 22 extern void relocate_new_kernel(void); 24 23 extern const unsigned int relocate_new_kernel_size; 25 - 26 - extern unsigned long kexec_start_address; 27 - extern unsigned long kexec_indirection_page; 28 - extern unsigned long kexec_mach_type; 29 - extern unsigned long kexec_boot_atags; 30 24 31 25 static atomic_t waiting_for_crash_ipi; 32 26 ··· 155 159 void machine_kexec(struct kimage *image) 156 160 { 157 161 unsigned long page_list, reboot_entry_phys; 162 + struct kexec_relocate_data *data; 158 163 void (*reboot_entry)(void); 159 164 void *reboot_code_buffer; 160 165 ··· 171 174 172 175 reboot_code_buffer = page_address(image->control_code_page); 173 176 174 - /* Prepare parameters for reboot_code_buffer*/ 175 - set_kernel_text_rw(); 176 - kexec_start_address = image->start; 177 - kexec_indirection_page = page_list; 178 - kexec_mach_type = machine_arch_type; 179 - kexec_boot_atags = image->arch.kernel_r2; 180 - 181 177 /* copy our kernel relocation code to the control code page */ 182 178 reboot_entry = fncpy(reboot_code_buffer, 183 179 &relocate_new_kernel, 184 180 relocate_new_kernel_size); 181 + 182 + data = reboot_code_buffer + relocate_new_kernel_size; 183 + data->kexec_start_address = image->start; 184 + data->kexec_indirection_page = page_list; 185 + data->kexec_mach_type = machine_arch_type; 186 + data->kexec_r2 = image->arch.kernel_r2; 185 187 186 188 /* get the identity mapping physical address for the reboot code */ 187 189 reboot_entry_phys = virt_to_idmap(reboot_entry);
+11 -27
arch/arm/kernel/relocate_kernel.S
··· 5 5 6 6 #include <linux/linkage.h> 7 7 #include <asm/assembler.h> 8 + #include <asm/asm-offsets.h> 8 9 #include <asm/kexec.h> 9 10 10 11 .align 3 /* not needed for this code, but keeps fncpy() happy */ 11 12 12 13 ENTRY(relocate_new_kernel) 13 14 14 - ldr r0,kexec_indirection_page 15 - ldr r1,kexec_start_address 15 + adr r7, relocate_new_kernel_end 16 + ldr r0, [r7, #KEXEC_INDIR_PAGE] 17 + ldr r1, [r7, #KEXEC_START_ADDR] 16 18 17 19 /* 18 20 * If there is no indirection page (we are doing crashdumps) ··· 59 57 60 58 2: 61 59 /* Jump to relocated kernel */ 62 - mov lr,r1 63 - mov r0,#0 64 - ldr r1,kexec_mach_type 65 - ldr r2,kexec_boot_atags 66 - ARM( ret lr ) 67 - THUMB( bx lr ) 68 - 69 - .align 70 - 71 - .globl kexec_start_address 72 - kexec_start_address: 73 - .long 0x0 74 - 75 - .globl kexec_indirection_page 76 - kexec_indirection_page: 77 - .long 0x0 78 - 79 - .globl kexec_mach_type 80 - kexec_mach_type: 81 - .long 0x0 82 - 83 - /* phy addr of the atags for the new kernel */ 84 - .globl kexec_boot_atags 85 - kexec_boot_atags: 86 - .long 0x0 60 + mov lr, r1 61 + mov r0, #0 62 + ldr r1, [r7, #KEXEC_MACH_TYPE] 63 + ldr r2, [r7, #KEXEC_R2] 64 + ARM( ret lr ) 65 + THUMB( bx lr ) 87 66 88 67 ENDPROC(relocate_new_kernel) 89 68 69 + .align 3 90 70 relocate_new_kernel_end: 91 71 92 72 .globl relocate_new_kernel_size
+8 -6
arch/arm/kernel/signal.c
··· 693 693 694 694 addr = page_address(page); 695 695 696 + /* Poison the entire page */ 697 + memset32(addr, __opcode_to_mem_arm(0xe7fddef1), 698 + PAGE_SIZE / sizeof(u32)); 699 + 696 700 /* Give the signal return code some randomness */ 697 701 offset = 0x200 + (get_random_int() & 0x7fc); 698 702 signal_return_offset = offset; 699 703 700 - /* 701 - * Copy signal return handlers into the vector page, and 702 - * set sigreturn to be a pointer to these. 703 - */ 704 + /* Copy signal return handlers into the page */ 704 705 memcpy(addr + offset, sigreturn_codes, sizeof(sigreturn_codes)); 705 706 706 - ptr = (unsigned long)addr + offset; 707 - flush_icache_range(ptr, ptr + sizeof(sigreturn_codes)); 707 + /* Flush out all instructions in this page */ 708 + ptr = (unsigned long)addr; 709 + flush_icache_range(ptr, ptr + PAGE_SIZE); 708 710 709 711 return page; 710 712 }
+6 -6
arch/arm/mach-footbridge/dc21285.c
··· 65 65 if (addr) 66 66 switch (size) { 67 67 case 1: 68 - asm("ldrb %0, [%1, %2]" 68 + asm volatile("ldrb %0, [%1, %2]" 69 69 : "=r" (v) : "r" (addr), "r" (where) : "cc"); 70 70 break; 71 71 case 2: 72 - asm("ldrh %0, [%1, %2]" 72 + asm volatile("ldrh %0, [%1, %2]" 73 73 : "=r" (v) : "r" (addr), "r" (where) : "cc"); 74 74 break; 75 75 case 4: 76 - asm("ldr %0, [%1, %2]" 76 + asm volatile("ldr %0, [%1, %2]" 77 77 : "=r" (v) : "r" (addr), "r" (where) : "cc"); 78 78 break; 79 79 } ··· 99 99 if (addr) 100 100 switch (size) { 101 101 case 1: 102 - asm("strb %0, [%1, %2]" 102 + asm volatile("strb %0, [%1, %2]" 103 103 : : "r" (value), "r" (addr), "r" (where) 104 104 : "cc"); 105 105 break; 106 106 case 2: 107 - asm("strh %0, [%1, %2]" 107 + asm volatile("strh %0, [%1, %2]" 108 108 : : "r" (value), "r" (addr), "r" (where) 109 109 : "cc"); 110 110 break; 111 111 case 4: 112 - asm("str %0, [%1, %2]" 112 + asm volatile("str %0, [%1, %2]" 113 113 : : "r" (value), "r" (addr), "r" (where) 114 114 : "cc"); 115 115 break;