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 'parisc-for-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux

Pull parisc architecture updates from Helge Deller:

- A fix to make modules on 32-bit parisc architecture work again

- Drop ip_fast_csum() inline assembly to avoid unaligned memory
accesses

- Allow to build kernel without 32-bit VDSO

- Reference leak fix in error path in LED driver

* tag 'parisc-for-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
parisc: led: fix reference leak on failed device registration
module.lds.S: Fix modules on 32-bit parisc architecture
parisc: Allow to build without VDSO32
parisc: Include 32-bit VDSO only when building for 32-bit or compat mode
parisc: Allow to disable COMPAT mode on 64-bit kernel
parisc: Fix default stack size when COMPAT=n
parisc: Fix signal code to depend on CONFIG_COMPAT instead of CONFIG_64BIT
parisc: is_compat_task() shall return false for COMPAT=n
parisc: Avoid compat syscalls when COMPAT=n
parisc: _llseek syscall is only available for 32-bit userspace
parisc: Drop ip_fast_csum() inline assembly implementation
parisc: update outdated comments for renamed ccio_alloc_consistent()

+56 -212
+7
arch/Kconfig
··· 1127 1127 For architectures like powerpc/32 which have constraints on module 1128 1128 allocation and need to allocate module data outside of module area. 1129 1129 1130 + config ARCH_WANTS_MODULES_TEXT_SECTIONS 1131 + bool 1132 + help 1133 + For architectures like 32-bit parisc which require that functions in 1134 + modules have to keep code in own text sections (-ffunction-sections) 1135 + and to avoid merging all text into one big text section, 1136 + 1130 1137 config ARCH_WANTS_EXECMEM_LATE 1131 1138 bool 1132 1139 help
+6 -1
arch/parisc/Kconfig
··· 8 8 select HAVE_FUNCTION_GRAPH_TRACER 9 9 select HAVE_SYSCALL_TRACEPOINTS 10 10 select ARCH_WANT_FRAME_POINTERS 11 + select ARCH_WANTS_MODULES_TEXT_SECTIONS if !64BIT 11 12 select ARCH_HAS_CPU_CACHE_ALIASING 12 13 select ARCH_HAS_DMA_ALLOC if PA11 13 14 select ARCH_HAS_DMA_OPS ··· 130 129 131 130 config GENERIC_BUG_RELATIVE_POINTERS 132 131 bool 132 + 133 + config GENERIC_CSUM 134 + def_bool y 133 135 134 136 config GENERIC_HWEIGHT 135 137 bool ··· 358 354 source "kernel/Kconfig.hz" 359 355 360 356 config COMPAT 361 - def_bool y 357 + bool "Kernel support for 32-bit binaries" 358 + default 64BIT 362 359 depends on 64BIT 363 360 364 361 config AUDIT_ARCH
+4 -2
arch/parisc/Makefile
··· 176 176 vdso_prepare: prepare0 177 177 $(if $(CONFIG_64BIT),$(Q)$(MAKE) \ 178 178 $(build)=arch/parisc/kernel/vdso64 include/generated/vdso64-offsets.h) 179 - $(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 include/generated/vdso32-offsets.h 179 + $(if $(CONFIG_PA11)$(CONFIG_COMPAT),$(Q)$(MAKE) \ 180 + $(build)=arch/parisc/kernel/vdso32 include/generated/vdso32-offsets.h) 180 181 endif 181 182 182 - vdso-install-y += arch/parisc/kernel/vdso32/vdso32.so 183 + vdso-install-$(CONFIG_PA11) += arch/parisc/kernel/vdso32/vdso32.so 184 + vdso-install-$(CONFIG_COMPAT) += arch/parisc/kernel/vdso32/vdso32.so 183 185 vdso-install-$(CONFIG_64BIT) += arch/parisc/kernel/vdso64/vdso64.so 184 186 185 187 install: KBUILD_IMAGE := vmlinux
+2 -87
arch/parisc/include/asm/checksum.h
··· 4 4 5 5 #include <linux/in6.h> 6 6 7 - /* 8 - * computes the checksum of a memory block at buff, length len, 9 - * and adds in "sum" (32-bit) 10 - * 11 - * returns a 32-bit number suitable for feeding into itself 12 - * or csum_tcpudp_magic 13 - * 14 - * this function must be called with even lengths, except 15 - * for the last fragment, which may be odd 16 - * 17 - * it's best to have buff aligned on a 32-bit boundary 18 - */ 19 - extern __wsum csum_partial(const void *, int, __wsum); 20 - 21 - /* 22 - * Optimized for IP headers, which always checksum on 4 octet boundaries. 23 - * 24 - * Written by Randolph Chung <tausq@debian.org>, and then mucked with by 25 - * LaMont Jones <lamont@debian.org> 26 - */ 27 - static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl) 28 - { 29 - unsigned int sum; 30 - unsigned long t0, t1, t2; 31 - 32 - __asm__ __volatile__ ( 33 - " ldws,ma 4(%1), %0\n" 34 - " addib,<= -4, %2, 2f\n" 35 - "\n" 36 - " ldws 4(%1), %4\n" 37 - " ldws 8(%1), %5\n" 38 - " add %0, %4, %0\n" 39 - " ldws,ma 12(%1), %3\n" 40 - " addc %0, %5, %0\n" 41 - " addc %0, %3, %0\n" 42 - "1: ldws,ma 4(%1), %3\n" 43 - " addib,> -1, %2, 1b\n" 44 - " addc %0, %3, %0\n" 45 - "\n" 46 - " extru %0, 31, 16, %4\n" 47 - " extru %0, 15, 16, %5\n" 48 - " addc %4, %5, %0\n" 49 - " extru %0, 15, 16, %5\n" 50 - " add %0, %5, %0\n" 51 - " subi -1, %0, %0\n" 52 - "2:\n" 53 - : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (t0), "=r" (t1), "=r" (t2) 54 - : "1" (iph), "2" (ihl) 55 - : "memory"); 56 - 57 - return (__force __sum16)sum; 58 - } 59 - 60 - /* 61 - * Fold a partial checksum 62 - */ 63 - static inline __sum16 csum_fold(__wsum csum) 64 - { 65 - u32 sum = (__force u32)csum; 66 - /* add the swapped two 16-bit halves of sum, 67 - a possible carry from adding the two 16-bit halves, 68 - will carry from the lower half into the upper half, 69 - giving us the correct sum in the upper half. */ 70 - sum += (sum << 16) + (sum >> 16); 71 - return (__force __sum16)(~sum >> 16); 72 - } 73 - 7 + #define csum_tcpudp_nofold csum_tcpudp_nofold 74 8 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 75 9 __u32 len, __u8 proto, 76 10 __wsum sum) ··· 19 85 return sum; 20 86 } 21 87 22 - /* 23 - * computes the checksum of the TCP/UDP pseudo-header 24 - * returns a 16-bit checksum, already complemented 25 - */ 26 - static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 27 - __u32 len, __u8 proto, 28 - __wsum sum) 29 - { 30 - return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 31 - } 32 - 33 - /* 34 - * this routine is used for miscellaneous IP-like checksums, mainly 35 - * in icmp.c 36 - */ 37 - static inline __sum16 ip_compute_csum(const void *buf, int len) 38 - { 39 - return csum_fold (csum_partial(buf, len, 0)); 40 - } 41 - 88 + #include <asm-generic/checksum.h> 42 89 43 90 #define _HAVE_ARCH_IPV6_CSUM 44 91 static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
+1 -1
arch/parisc/include/asm/compat.h
··· 130 130 131 131 static inline int __is_compat_task(struct task_struct *t) 132 132 { 133 - return test_tsk_thread_flag(t, TIF_32BIT); 133 + return IS_ENABLED(CONFIG_COMPAT) && test_tsk_thread_flag(t, TIF_32BIT); 134 134 } 135 135 136 136 static inline int is_compat_task(void)
+2
arch/parisc/include/asm/vdso.h
··· 7 7 #ifdef CONFIG_64BIT 8 8 #include <generated/vdso64-offsets.h> 9 9 #endif 10 + #if !defined(CONFIG_64BIT) || defined(CONFIG_COMPAT) 10 11 #include <generated/vdso32-offsets.h> 12 + #endif 11 13 12 14 #define VDSO64_SYMBOL(tsk, name) ((tsk)->mm->context.vdso_base + (vdso64_offset_##name)) 13 15 #define VDSO32_SYMBOL(tsk, name) ((tsk)->mm->context.vdso_base + (vdso32_offset_##name))
+2 -1
arch/parisc/kernel/Makefile
··· 47 47 # vdso 48 48 obj-y += vdso.o 49 49 obj-$(CONFIG_64BIT) += vdso64/ 50 - obj-y += vdso32/ 50 + obj-$(CONFIG_PA11) += vdso32/ 51 + obj-$(CONFIG_COMPAT) += vdso32/
+9 -9
arch/parisc/kernel/signal.c
··· 80 80 sigset_t set; 81 81 unsigned long usp = (regs->gr[30] & ~(0x01UL)); 82 82 unsigned long sigframe_size = PARISC_RT_SIGFRAME_SIZE; 83 - #ifdef CONFIG_64BIT 83 + #ifdef CONFIG_COMPAT 84 84 struct compat_rt_sigframe __user * compat_frame; 85 85 86 86 if (is_compat_task()) ··· 96 96 97 97 regs->orig_r28 = 1; /* no restarts for sigreturn */ 98 98 99 - #ifdef CONFIG_64BIT 99 + #ifdef CONFIG_COMPAT 100 100 compat_frame = (struct compat_rt_sigframe __user *)frame; 101 101 102 102 if (is_compat_task()) { ··· 112 112 set_current_blocked(&set); 113 113 114 114 /* Good thing we saved the old gr[30], eh? */ 115 - #ifdef CONFIG_64BIT 115 + #ifdef CONFIG_COMPAT 116 116 if (is_compat_task()) { 117 117 DBG(1, "%s: compat_frame->uc.uc_mcontext 0x%p\n", 118 118 __func__, &compat_frame->uc.uc_mcontext); ··· 218 218 unsigned long haddr, sigframe_size; 219 219 unsigned long start; 220 220 int err = 0; 221 - #ifdef CONFIG_64BIT 221 + #ifdef CONFIG_COMPAT 222 222 struct compat_rt_sigframe __user * compat_frame; 223 223 #endif 224 - 224 + 225 225 usp = (regs->gr[30] & ~(0x01UL)); 226 226 sigframe_size = PARISC_RT_SIGFRAME_SIZE; 227 - #ifdef CONFIG_64BIT 227 + #ifdef CONFIG_COMPAT 228 228 if (is_compat_task()) { 229 229 /* The gcc alloca implementation leaves garbage in the upper 32 bits of sp */ 230 230 usp = (compat_uint_t)usp; ··· 239 239 if (start >= TASK_SIZE_MAX - sigframe_size) 240 240 return -EFAULT; 241 241 242 - #ifdef CONFIG_64BIT 242 + #ifdef CONFIG_COMPAT 243 243 244 244 compat_frame = (struct compat_rt_sigframe __user *)frame; 245 245 ··· 349 349 350 350 regs->gr[2] = rp; /* userland return pointer */ 351 351 regs->gr[26] = ksig->sig; /* signal number */ 352 - 353 - #ifdef CONFIG_64BIT 352 + 353 + #ifdef CONFIG_COMPAT 354 354 if (is_compat_task()) { 355 355 regs->gr[25] = A(&compat_frame->info); /* siginfo pointer */ 356 356 regs->gr[24] = A(&compat_frame->uc); /* ucontext pointer */
+4
arch/parisc/kernel/sys_parisc.c
··· 50 50 } 51 51 52 52 53 + #ifdef CONFIG_COMPAT 53 54 #define STACK_SIZE_DEFAULT (USER_WIDE_MODE \ 54 55 ? (1 << 30) /* 1 GB */ \ 55 56 : (CONFIG_STACK_MAX_DEFAULT_SIZE_MB*1024*1024)) 57 + #else 58 + #define STACK_SIZE_DEFAULT (1 << 30) 59 + #endif 56 60 57 61 unsigned long calc_max_stack_size(unsigned long stack_max) 58 62 {
+7 -4
arch/parisc/kernel/syscall.S
··· 241 241 /* Note! We cannot use the syscall table that is mapped 242 242 nearby since the gateway page is mapped execute-only. */ 243 243 244 - #ifdef CONFIG_64BIT 244 + #ifdef CONFIG_COMPAT 245 245 ldil L%sys_call_table, %r1 246 246 or,ev %r2,%r2,%r2 247 247 ldil L%sys_call_table64, %r1 ··· 250 250 ldo R%sys_call_table64(%r1), %r19 251 251 #else 252 252 load32 sys_call_table, %r19 253 - #endif 253 + #endif 254 254 comiclr,>> __NR_Linux_syscalls, %r20, %r0 255 255 b,n .Lsyscall_nosys 256 256 ··· 374 374 /* Note! We cannot use the syscall table that is mapped 375 375 nearby since the gateway page is mapped execute-only. */ 376 376 377 - #ifdef CONFIG_64BIT 377 + #ifdef CONFIG_COMPAT 378 378 LDREG TASK_PT_GR30(%r1), %r19 /* get users sp back */ 379 379 extrd,u %r19,63,1,%r2 /* W hidden in bottom bit */ 380 380 ··· 1326 1326 END(lws_table) 1327 1327 /* End of lws table */ 1328 1328 1329 - #ifdef CONFIG_64BIT 1329 + #ifdef CONFIG_COMPAT 1330 1330 #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, compat) 1331 1331 #else 1332 1332 #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native) 1333 1333 #endif 1334 1334 #define __SYSCALL(nr, entry) ASM_ULONG_INSN entry 1335 + 1335 1336 .align 8 1336 1337 ENTRY(sys_call_table) 1337 1338 .export sys_call_table,data 1339 + #if defined(CONFIG_COMPAT) || !defined(CONFIG_64BIT) 1338 1340 #include <asm/syscall_table_32.h> /* 32-bit syscalls */ 1341 + #endif 1339 1342 END(sys_call_table) 1340 1343 1341 1344 #ifdef CONFIG_64BIT
+1 -1
arch/parisc/kernel/syscalls/syscall.tbl
··· 154 154 # 137 was afs_syscall 155 155 138 common setfsuid sys_setfsuid 156 156 139 common setfsgid sys_setfsgid 157 - 140 common _llseek sys_llseek 157 + 140 32 _llseek sys_llseek 158 158 141 common getdents sys_getdents compat_sys_getdents 159 159 142 common _newselect sys_select compat_sys_select 160 160 143 common flock sys_flock
+1 -1
arch/parisc/lib/Makefile
··· 3 3 # Makefile for parisc-specific library files 4 4 # 5 5 6 - lib-y := lusercopy.o bitops.o checksum.o io.o memset.o memcpy.o \ 6 + lib-y := lusercopy.o bitops.o io.o memset.o memcpy.o \ 7 7 ucmpdi2.o delay.o 8 8 9 9 obj-y := iomap.o
-99
arch/parisc/lib/checksum.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * INET An implementation of the TCP/IP protocol suite for the LINUX 4 - * operating system. INET is implemented using the BSD Socket 5 - * interface as the means of communication with the user level. 6 - * 7 - * MIPS specific IP/TCP/UDP checksumming routines 8 - * 9 - * Authors: Ralf Baechle, <ralf@waldorf-gmbh.de> 10 - * Lots of code moved from tcp.c and ip.c; see those files 11 - * for more names. 12 - */ 13 - #include <linux/module.h> 14 - #include <linux/types.h> 15 - 16 - #include <net/checksum.h> 17 - #include <asm/byteorder.h> 18 - #include <asm/string.h> 19 - #include <linux/uaccess.h> 20 - 21 - #define addc(_t,_r) \ 22 - __asm__ __volatile__ ( \ 23 - " add %0, %1, %0\n" \ 24 - " addc %0, %%r0, %0\n" \ 25 - : "=r"(_t) \ 26 - : "r"(_r), "0"(_t)); 27 - 28 - static inline unsigned int do_csum(const unsigned char * buff, int len) 29 - { 30 - int odd, count; 31 - unsigned int result = 0; 32 - 33 - if (len <= 0) 34 - goto out; 35 - odd = 1 & (unsigned long) buff; 36 - if (odd) { 37 - result = be16_to_cpu(*buff); 38 - len--; 39 - buff++; 40 - } 41 - count = len >> 1; /* nr of 16-bit words.. */ 42 - if (count) { 43 - if (2 & (unsigned long) buff) { 44 - result += *(unsigned short *) buff; 45 - count--; 46 - len -= 2; 47 - buff += 2; 48 - } 49 - count >>= 1; /* nr of 32-bit words.. */ 50 - if (count) { 51 - while (count >= 4) { 52 - unsigned int r1, r2, r3, r4; 53 - r1 = *(unsigned int *)(buff + 0); 54 - r2 = *(unsigned int *)(buff + 4); 55 - r3 = *(unsigned int *)(buff + 8); 56 - r4 = *(unsigned int *)(buff + 12); 57 - addc(result, r1); 58 - addc(result, r2); 59 - addc(result, r3); 60 - addc(result, r4); 61 - count -= 4; 62 - buff += 16; 63 - } 64 - while (count) { 65 - unsigned int w = *(unsigned int *) buff; 66 - count--; 67 - buff += 4; 68 - addc(result, w); 69 - } 70 - result = (result & 0xffff) + (result >> 16); 71 - } 72 - if (len & 2) { 73 - result += *(unsigned short *) buff; 74 - buff += 2; 75 - } 76 - } 77 - if (len & 1) 78 - result += le16_to_cpu(*buff); 79 - result = csum_from32to16(result); 80 - if (odd) 81 - result = swab16(result); 82 - out: 83 - return result; 84 - } 85 - 86 - /* 87 - * computes a partial checksum, e.g. for TCP/UDP fragments 88 - */ 89 - /* 90 - * why bother folding? 91 - */ 92 - __wsum csum_partial(const void *buff, int len, __wsum sum) 93 - { 94 - unsigned int result = do_csum(buff, len); 95 - addc(result, sum); 96 - return (__force __wsum)csum_from32to16(result); 97 - } 98 - 99 - EXPORT_SYMBOL(csum_partial);
+4 -4
drivers/parisc/ccio-dma.c
··· 503 503 504 504 505 505 /* 506 - ** Use direction (ie PCI_DMA_TODEVICE) to pick hint. 507 - ** ccio_alloc_consistent() depends on this to get SAFE_DMA 506 + ** Use direction (ie DMA_TO_DEVICE) to pick hint. 507 + ** ccio_alloc() depends on this to get SAFE_DMA 508 508 ** when it passes in BIDIRECTIONAL flag. 509 509 */ 510 510 static u32 hint_lookup[] = { ··· 865 865 * ccio_free - Free a consistent DMA mapping. 866 866 * @dev: The PCI device. 867 867 * @size: The length of the DMA region. 868 - * @cpu_addr: The cpu address returned from the ccio_alloc_consistent. 869 - * @dma_handle: The device address returned from the ccio_alloc_consistent. 868 + * @cpu_addr: The cpu address returned from ccio_alloc(). 869 + * @dma_handle: The device address returned from ccio_alloc(). 870 870 * @attrs: attributes 871 871 * 872 872 * This function implements the pci_free_consistent function.
+4 -2
drivers/parisc/led.c
··· 543 543 544 544 static int __init startup_leds(void) 545 545 { 546 - if (platform_device_register(&platform_leds)) 547 - printk(KERN_INFO "LED: failed to register LEDs\n"); 546 + if (platform_device_register(&platform_leds)) { 547 + pr_info("LED: failed to register LEDs\n"); 548 + platform_device_put(&platform_leds); 549 + } 548 550 register_led_regions(); 549 551 return 0; 550 552 }
+2
scripts/module.lds.S
··· 40 40 __kcfi_traps 0 : { KEEP(*(.kcfi_traps)) } 41 41 #endif 42 42 43 + #ifndef CONFIG_ARCH_WANTS_MODULES_TEXT_SECTIONS 43 44 .text 0 : { 44 45 *(.text .text.[0-9a-zA-Z_]*) 45 46 } 47 + #endif 46 48 47 49 .bss 0 : { 48 50 *(.bss .bss.[0-9a-zA-Z_]*)