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 'mips_fixes_5.4_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux

Pull MIPS fixes from Paul Burton:

- Build fixes for Cavium Octeon & PMC-Sierra MSP systems, as well as
all pre-MIPSr6 configurations built with binutils < 2.25.

- Boot fixes for 64-bit Loongson systems & SGI IP28 systems.

- Wire up the new clone3 syscall.

- Clean ups for a few build-time warnings.

* tag 'mips_fixes_5.4_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux:
MIPS: fw/arc: Remove unused addr variable
MIPS: pmcs-msp71xx: Remove unused addr variable
MIPS: pmcs-msp71xx: Add missing MAX_PROM_MEM definition
mips: Loongson: Fix the link time qualifier of 'serial_exit()'
MIPS: init: Prevent adding memory before PHYS_OFFSET
MIPS: init: Fix reservation of memory between PHYS_OFFSET and mem start
MIPS: VDSO: Fix build for binutils < 2.25
MIPS: VDSO: Remove unused gettimeofday.c
MIPS: Wire up clone3 syscall
MIPS: octeon: Include required header; fix octeon ethernet build
MIPS: cpu-bugs64: Mark inline functions as __always_inline
MIPS: dts: ar9331: fix interrupt-controller size
MIPS: Loongson64: Fix boot failure after dropping boot_mem_map

+41 -313
+1 -1
arch/mips/boot/dts/qca/ar9331.dtsi
··· 99 99 100 100 miscintc: interrupt-controller@18060010 { 101 101 compatible = "qca,ar7240-misc-intc"; 102 - reg = <0x18060010 0x4>; 102 + reg = <0x18060010 0x8>; 103 103 104 104 interrupt-parent = <&cpuintc>; 105 105 interrupts = <6>;
-1
arch/mips/fw/arc/memory.c
··· 160 160 161 161 void __init prom_free_prom_memory(void) 162 162 { 163 - unsigned long addr; 164 163 int i; 165 164 166 165 if (prom_flags & PROM_FLAG_DONT_FREE_TEMP)
+1
arch/mips/include/asm/octeon/cvmx-ipd.h
··· 36 36 #include <asm/octeon/octeon-feature.h> 37 37 38 38 #include <asm/octeon/cvmx-ipd-defs.h> 39 + #include <asm/octeon/cvmx-pip-defs.h> 39 40 40 41 enum cvmx_ipd_mode { 41 42 CVMX_IPD_OPC_MODE_STT = 0LL, /* All blocks DRAM, not cached in L2 */
+1
arch/mips/include/asm/unistd.h
··· 52 52 # endif 53 53 #define __ARCH_WANT_SYS_FORK 54 54 #define __ARCH_WANT_SYS_CLONE 55 + #define __ARCH_WANT_SYS_CLONE3 55 56 56 57 /* whitelists for checksyscalls */ 57 58 #define __IGNORE_fadvise64_64
+8 -6
arch/mips/kernel/cpu-bugs64.c
··· 24 24 static char daddiwar[] __initdata = 25 25 "Enable CPU_DADDI_WORKAROUNDS to rectify."; 26 26 27 - static inline void align_mod(const int align, const int mod) 27 + static __always_inline __init 28 + void align_mod(const int align, const int mod) 28 29 { 29 30 asm volatile( 30 31 ".set push\n\t" ··· 39 38 : "n"(align), "n"(mod)); 40 39 } 41 40 42 - static __always_inline void mult_sh_align_mod(long *v1, long *v2, long *w, 43 - const int align, const int mod) 41 + static __always_inline __init 42 + void mult_sh_align_mod(long *v1, long *v2, long *w, 43 + const int align, const int mod) 44 44 { 45 45 unsigned long flags; 46 46 int m1, m2; ··· 115 113 *w = lw; 116 114 } 117 115 118 - static inline void check_mult_sh(void) 116 + static __always_inline __init void check_mult_sh(void) 119 117 { 120 118 long v1[8], v2[8], w[8]; 121 119 int bug, fix, i; ··· 178 176 exception_exit(prev_state); 179 177 } 180 178 181 - static inline void check_daddi(void) 179 + static __init void check_daddi(void) 182 180 { 183 181 extern asmlinkage void handle_daddi_ov(void); 184 182 unsigned long flags; ··· 244 242 245 243 int daddiu_bug = IS_ENABLED(CONFIG_CPU_MIPSR6) ? 0 : -1; 246 244 247 - static inline void check_daddiu(void) 245 + static __init void check_daddiu(void) 248 246 { 249 247 long v, w, tmp; 250 248
+4 -1
arch/mips/kernel/setup.c
··· 108 108 return; 109 109 } 110 110 111 + if (start < PHYS_OFFSET) 112 + return; 113 + 111 114 memblock_add(start, size); 112 115 /* Reserve any memory except the ordinary RAM ranges. */ 113 116 switch (type) { ··· 324 321 * Reserve any memory between the start of RAM and PHYS_OFFSET 325 322 */ 326 323 if (ramstart > PHYS_OFFSET) 327 - memblock_reserve(PHYS_OFFSET, PFN_UP(ramstart) - PHYS_OFFSET); 324 + memblock_reserve(PHYS_OFFSET, ramstart - PHYS_OFFSET); 328 325 329 326 if (PFN_UP(ramstart) > ARCH_PFN_OFFSET) { 330 327 pr_info("Wasting %lu bytes for tracking %lu unused pages\n",
+1
arch/mips/kernel/syscall.c
··· 80 80 81 81 save_static_function(sys_fork); 82 82 save_static_function(sys_clone); 83 + save_static_function(sys_clone3); 83 84 84 85 SYSCALL_DEFINE1(set_thread_area, unsigned long, addr) 85 86 {
+1 -1
arch/mips/kernel/syscalls/syscall_n32.tbl
··· 373 373 432 n32 fsmount sys_fsmount 374 374 433 n32 fspick sys_fspick 375 375 434 n32 pidfd_open sys_pidfd_open 376 - # 435 reserved for clone3 376 + 435 n32 clone3 __sys_clone3
+1 -1
arch/mips/kernel/syscalls/syscall_n64.tbl
··· 349 349 432 n64 fsmount sys_fsmount 350 350 433 n64 fspick sys_fspick 351 351 434 n64 pidfd_open sys_pidfd_open 352 - # 435 reserved for clone3 352 + 435 n64 clone3 __sys_clone3
+1 -1
arch/mips/kernel/syscalls/syscall_o32.tbl
··· 422 422 432 o32 fsmount sys_fsmount 423 423 433 o32 fspick sys_fspick 424 424 434 o32 pidfd_open sys_pidfd_open 425 - # 435 reserved for clone3 425 + 435 o32 clone3 __sys_clone3
+17 -18
arch/mips/loongson64/common/mem.c
··· 3 3 */ 4 4 #include <linux/fs.h> 5 5 #include <linux/fcntl.h> 6 + #include <linux/memblock.h> 6 7 #include <linux/mm.h> 7 8 8 9 #include <asm/bootinfo.h> ··· 65 64 node_id = loongson_memmap->map[i].node_id; 66 65 mem_type = loongson_memmap->map[i].mem_type; 67 66 68 - if (node_id == 0) { 69 - switch (mem_type) { 70 - case SYSTEM_RAM_LOW: 71 - add_memory_region(loongson_memmap->map[i].mem_start, 72 - (u64)loongson_memmap->map[i].mem_size << 20, 73 - BOOT_MEM_RAM); 74 - break; 75 - case SYSTEM_RAM_HIGH: 76 - add_memory_region(loongson_memmap->map[i].mem_start, 77 - (u64)loongson_memmap->map[i].mem_size << 20, 78 - BOOT_MEM_RAM); 79 - break; 80 - case SYSTEM_RAM_RESERVED: 81 - add_memory_region(loongson_memmap->map[i].mem_start, 82 - (u64)loongson_memmap->map[i].mem_size << 20, 83 - BOOT_MEM_RESERVED); 84 - break; 85 - } 67 + if (node_id != 0) 68 + continue; 69 + 70 + switch (mem_type) { 71 + case SYSTEM_RAM_LOW: 72 + memblock_add(loongson_memmap->map[i].mem_start, 73 + (u64)loongson_memmap->map[i].mem_size << 20); 74 + break; 75 + case SYSTEM_RAM_HIGH: 76 + memblock_add(loongson_memmap->map[i].mem_start, 77 + (u64)loongson_memmap->map[i].mem_size << 20); 78 + break; 79 + case SYSTEM_RAM_RESERVED: 80 + memblock_reserve(loongson_memmap->map[i].mem_start, 81 + (u64)loongson_memmap->map[i].mem_size << 20); 82 + break; 86 83 } 87 84 } 88 85 }
+1 -1
arch/mips/loongson64/common/serial.c
··· 110 110 } 111 111 module_init(serial_init); 112 112 113 - static void __init serial_exit(void) 113 + static void __exit serial_exit(void) 114 114 { 115 115 platform_device_unregister(&uart8250_device); 116 116 }
+1 -10
arch/mips/loongson64/loongson-3/numa.c
··· 142 142 (u32)node_id, mem_type, mem_start, mem_size); 143 143 pr_info(" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n", 144 144 start_pfn, end_pfn, num_physpages); 145 - add_memory_region((node_id << 44) + mem_start, 146 - (u64)mem_size << 20, BOOT_MEM_RAM); 147 145 memblock_add_node(PFN_PHYS(start_pfn), 148 146 PFN_PHYS(end_pfn - start_pfn), node); 149 147 break; ··· 154 156 (u32)node_id, mem_type, mem_start, mem_size); 155 157 pr_info(" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n", 156 158 start_pfn, end_pfn, num_physpages); 157 - add_memory_region((node_id << 44) + mem_start, 158 - (u64)mem_size << 20, BOOT_MEM_RAM); 159 159 memblock_add_node(PFN_PHYS(start_pfn), 160 160 PFN_PHYS(end_pfn - start_pfn), node); 161 161 break; 162 162 case SYSTEM_RAM_RESERVED: 163 163 pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx MB\n", 164 164 (u32)node_id, mem_type, mem_start, mem_size); 165 - add_memory_region((node_id << 44) + mem_start, 166 - (u64)mem_size << 20, BOOT_MEM_RESERVED); 167 165 memblock_reserve(((node_id << 44) + mem_start), 168 166 mem_size << 20); 169 167 break; ··· 185 191 NODE_DATA(node)->node_start_pfn = start_pfn; 186 192 NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn; 187 193 188 - free_bootmem_with_active_regions(node, end_pfn); 189 - 190 194 if (node == 0) { 191 195 /* kernel end address */ 192 196 unsigned long kernel_end_pfn = PFN_UP(__pa_symbol(&_end)); ··· 201 209 memblock_reserve((node_addrspace_offset | 0xfe000000), 202 210 32 << 20); 203 211 } 204 - 205 - sparse_memory_present_with_active_regions(node); 206 212 } 207 213 208 214 static __init void prom_meminit(void) ··· 217 227 cpumask_clear(&__node_data[(node)]->cpumask); 218 228 } 219 229 } 230 + memblocks_present(); 220 231 max_low_pfn = PHYS_PFN(memblock_end_of_DRAM()); 221 232 222 233 for (cpu = 0; cpu < loongson_sysconf.nr_cpus; cpu++) {
+2 -2
arch/mips/pmcs-msp71xx/msp_prom.c
··· 61 61 /* memory blocks */ 62 62 struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS]; 63 63 64 + #define MAX_PROM_MEM 5 64 65 static phys_addr_t prom_mem_base[MAX_PROM_MEM] __initdata; 65 66 static phys_addr_t prom_mem_size[MAX_PROM_MEM] __initdata; 66 67 static unsigned int nr_prom_mem __initdata; ··· 359 358 p++; 360 359 361 360 if (type == BOOT_MEM_ROM_DATA) { 362 - if (nr_prom_mem >= 5) { 361 + if (nr_prom_mem >= MAX_PROM_MEM) { 363 362 pr_err("Too many ROM DATA regions"); 364 363 continue; 365 364 } ··· 378 377 char *ptr; 379 378 int len = 0; 380 379 int i; 381 - unsigned long addr; 382 380 383 381 /* 384 382 * preserve environment variables and command line from pmon/bbload
+1 -1
arch/mips/vdso/Makefile
··· 59 59 ifndef CONFIG_CPU_MIPSR6 60 60 ifeq ($(call ld-ifversion, -lt, 225000000, y),y) 61 61 $(warning MIPS VDSO requires binutils >= 2.25) 62 - obj-vdso-y := $(filter-out gettimeofday.o, $(obj-vdso-y)) 62 + obj-vdso-y := $(filter-out vgettimeofday.o, $(obj-vdso-y)) 63 63 ccflags-vdso += -DDISABLE_MIPS_VDSO 64 64 endif 65 65 endif
-269
arch/mips/vdso/gettimeofday.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * Copyright (C) 2015 Imagination Technologies 4 - * Author: Alex Smith <alex.smith@imgtec.com> 5 - */ 6 - 7 - #include "vdso.h" 8 - 9 - #include <linux/compiler.h> 10 - #include <linux/time.h> 11 - 12 - #include <asm/clocksource.h> 13 - #include <asm/io.h> 14 - #include <asm/unistd.h> 15 - #include <asm/vdso.h> 16 - 17 - #ifdef CONFIG_MIPS_CLOCK_VSYSCALL 18 - 19 - static __always_inline long gettimeofday_fallback(struct timeval *_tv, 20 - struct timezone *_tz) 21 - { 22 - register struct timezone *tz asm("a1") = _tz; 23 - register struct timeval *tv asm("a0") = _tv; 24 - register long ret asm("v0"); 25 - register long nr asm("v0") = __NR_gettimeofday; 26 - register long error asm("a3"); 27 - 28 - asm volatile( 29 - " syscall\n" 30 - : "=r" (ret), "=r" (error) 31 - : "r" (tv), "r" (tz), "r" (nr) 32 - : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", 33 - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); 34 - 35 - return error ? -ret : ret; 36 - } 37 - 38 - #endif 39 - 40 - static __always_inline long clock_gettime_fallback(clockid_t _clkid, 41 - struct timespec *_ts) 42 - { 43 - register struct timespec *ts asm("a1") = _ts; 44 - register clockid_t clkid asm("a0") = _clkid; 45 - register long ret asm("v0"); 46 - register long nr asm("v0") = __NR_clock_gettime; 47 - register long error asm("a3"); 48 - 49 - asm volatile( 50 - " syscall\n" 51 - : "=r" (ret), "=r" (error) 52 - : "r" (clkid), "r" (ts), "r" (nr) 53 - : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", 54 - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); 55 - 56 - return error ? -ret : ret; 57 - } 58 - 59 - static __always_inline int do_realtime_coarse(struct timespec *ts, 60 - const union mips_vdso_data *data) 61 - { 62 - u32 start_seq; 63 - 64 - do { 65 - start_seq = vdso_data_read_begin(data); 66 - 67 - ts->tv_sec = data->xtime_sec; 68 - ts->tv_nsec = data->xtime_nsec >> data->cs_shift; 69 - } while (vdso_data_read_retry(data, start_seq)); 70 - 71 - return 0; 72 - } 73 - 74 - static __always_inline int do_monotonic_coarse(struct timespec *ts, 75 - const union mips_vdso_data *data) 76 - { 77 - u32 start_seq; 78 - u64 to_mono_sec; 79 - u64 to_mono_nsec; 80 - 81 - do { 82 - start_seq = vdso_data_read_begin(data); 83 - 84 - ts->tv_sec = data->xtime_sec; 85 - ts->tv_nsec = data->xtime_nsec >> data->cs_shift; 86 - 87 - to_mono_sec = data->wall_to_mono_sec; 88 - to_mono_nsec = data->wall_to_mono_nsec; 89 - } while (vdso_data_read_retry(data, start_seq)); 90 - 91 - ts->tv_sec += to_mono_sec; 92 - timespec_add_ns(ts, to_mono_nsec); 93 - 94 - return 0; 95 - } 96 - 97 - #ifdef CONFIG_CSRC_R4K 98 - 99 - static __always_inline u64 read_r4k_count(void) 100 - { 101 - unsigned int count; 102 - 103 - __asm__ __volatile__( 104 - " .set push\n" 105 - " .set mips32r2\n" 106 - " rdhwr %0, $2\n" 107 - " .set pop\n" 108 - : "=r" (count)); 109 - 110 - return count; 111 - } 112 - 113 - #endif 114 - 115 - #ifdef CONFIG_CLKSRC_MIPS_GIC 116 - 117 - static __always_inline u64 read_gic_count(const union mips_vdso_data *data) 118 - { 119 - void __iomem *gic = get_gic(data); 120 - u32 hi, hi2, lo; 121 - 122 - do { 123 - hi = __raw_readl(gic + sizeof(lo)); 124 - lo = __raw_readl(gic); 125 - hi2 = __raw_readl(gic + sizeof(lo)); 126 - } while (hi2 != hi); 127 - 128 - return (((u64)hi) << 32) + lo; 129 - } 130 - 131 - #endif 132 - 133 - static __always_inline u64 get_ns(const union mips_vdso_data *data) 134 - { 135 - u64 cycle_now, delta, nsec; 136 - 137 - switch (data->clock_mode) { 138 - #ifdef CONFIG_CSRC_R4K 139 - case VDSO_CLOCK_R4K: 140 - cycle_now = read_r4k_count(); 141 - break; 142 - #endif 143 - #ifdef CONFIG_CLKSRC_MIPS_GIC 144 - case VDSO_CLOCK_GIC: 145 - cycle_now = read_gic_count(data); 146 - break; 147 - #endif 148 - default: 149 - return 0; 150 - } 151 - 152 - delta = (cycle_now - data->cs_cycle_last) & data->cs_mask; 153 - 154 - nsec = (delta * data->cs_mult) + data->xtime_nsec; 155 - nsec >>= data->cs_shift; 156 - 157 - return nsec; 158 - } 159 - 160 - static __always_inline int do_realtime(struct timespec *ts, 161 - const union mips_vdso_data *data) 162 - { 163 - u32 start_seq; 164 - u64 ns; 165 - 166 - do { 167 - start_seq = vdso_data_read_begin(data); 168 - 169 - if (data->clock_mode == VDSO_CLOCK_NONE) 170 - return -ENOSYS; 171 - 172 - ts->tv_sec = data->xtime_sec; 173 - ns = get_ns(data); 174 - } while (vdso_data_read_retry(data, start_seq)); 175 - 176 - ts->tv_nsec = 0; 177 - timespec_add_ns(ts, ns); 178 - 179 - return 0; 180 - } 181 - 182 - static __always_inline int do_monotonic(struct timespec *ts, 183 - const union mips_vdso_data *data) 184 - { 185 - u32 start_seq; 186 - u64 ns; 187 - u64 to_mono_sec; 188 - u64 to_mono_nsec; 189 - 190 - do { 191 - start_seq = vdso_data_read_begin(data); 192 - 193 - if (data->clock_mode == VDSO_CLOCK_NONE) 194 - return -ENOSYS; 195 - 196 - ts->tv_sec = data->xtime_sec; 197 - ns = get_ns(data); 198 - 199 - to_mono_sec = data->wall_to_mono_sec; 200 - to_mono_nsec = data->wall_to_mono_nsec; 201 - } while (vdso_data_read_retry(data, start_seq)); 202 - 203 - ts->tv_sec += to_mono_sec; 204 - ts->tv_nsec = 0; 205 - timespec_add_ns(ts, ns + to_mono_nsec); 206 - 207 - return 0; 208 - } 209 - 210 - #ifdef CONFIG_MIPS_CLOCK_VSYSCALL 211 - 212 - /* 213 - * This is behind the ifdef so that we don't provide the symbol when there's no 214 - * possibility of there being a usable clocksource, because there's nothing we 215 - * can do without it. When libc fails the symbol lookup it should fall back on 216 - * the standard syscall path. 217 - */ 218 - int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) 219 - { 220 - const union mips_vdso_data *data = get_vdso_data(); 221 - struct timespec ts; 222 - int ret; 223 - 224 - ret = do_realtime(&ts, data); 225 - if (ret) 226 - return gettimeofday_fallback(tv, tz); 227 - 228 - if (tv) { 229 - tv->tv_sec = ts.tv_sec; 230 - tv->tv_usec = ts.tv_nsec / 1000; 231 - } 232 - 233 - if (tz) { 234 - tz->tz_minuteswest = data->tz_minuteswest; 235 - tz->tz_dsttime = data->tz_dsttime; 236 - } 237 - 238 - return 0; 239 - } 240 - 241 - #endif /* CONFIG_MIPS_CLOCK_VSYSCALL */ 242 - 243 - int __vdso_clock_gettime(clockid_t clkid, struct timespec *ts) 244 - { 245 - const union mips_vdso_data *data = get_vdso_data(); 246 - int ret = -1; 247 - 248 - switch (clkid) { 249 - case CLOCK_REALTIME_COARSE: 250 - ret = do_realtime_coarse(ts, data); 251 - break; 252 - case CLOCK_MONOTONIC_COARSE: 253 - ret = do_monotonic_coarse(ts, data); 254 - break; 255 - case CLOCK_REALTIME: 256 - ret = do_realtime(ts, data); 257 - break; 258 - case CLOCK_MONOTONIC: 259 - ret = do_monotonic(ts, data); 260 - break; 261 - default: 262 - break; 263 - } 264 - 265 - if (ret) 266 - ret = clock_gettime_fallback(clkid, ts); 267 - 268 - return ret; 269 - }