Skip to content

Commit eb5249b

Browse files
committed
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()
2 parents 9055c64 + 707610b commit eb5249b

16 files changed

Lines changed: 56 additions & 212 deletions

File tree

arch/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,13 @@ config ARCH_WANTS_MODULES_DATA_IN_VMALLOC
11271127
For architectures like powerpc/32 which have constraints on module
11281128
allocation and need to allocate module data outside of module area.
11291129

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+
11301137
config ARCH_WANTS_EXECMEM_LATE
11311138
bool
11321139
help

arch/parisc/Kconfig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ config PARISC
88
select HAVE_FUNCTION_GRAPH_TRACER
99
select HAVE_SYSCALL_TRACEPOINTS
1010
select ARCH_WANT_FRAME_POINTERS
11+
select ARCH_WANTS_MODULES_TEXT_SECTIONS if !64BIT
1112
select ARCH_HAS_CPU_CACHE_ALIASING
1213
select ARCH_HAS_DMA_ALLOC if PA11
1314
select ARCH_HAS_DMA_OPS
@@ -130,6 +131,9 @@ config GENERIC_BUG
130131
config GENERIC_BUG_RELATIVE_POINTERS
131132
bool
132133

134+
config GENERIC_CSUM
135+
def_bool y
136+
133137
config GENERIC_HWEIGHT
134138
bool
135139
default y
@@ -354,7 +358,8 @@ config ARCH_SPARSEMEM_DEFAULT
354358
source "kernel/Kconfig.hz"
355359

356360
config COMPAT
357-
def_bool y
361+
bool "Kernel support for 32-bit binaries"
362+
default 64BIT
358363
depends on 64BIT
359364

360365
config AUDIT_ARCH

arch/parisc/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,12 @@ prepare: vdso_prepare
176176
vdso_prepare: prepare0
177177
$(if $(CONFIG_64BIT),$(Q)$(MAKE) \
178178
$(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)
180181
endif
181182

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
183185
vdso-install-$(CONFIG_64BIT) += arch/parisc/kernel/vdso64/vdso64.so
184186

185187
install: KBUILD_IMAGE := vmlinux

arch/parisc/include/asm/checksum.h

Lines changed: 2 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -4,73 +4,7 @@
44

55
#include <linux/in6.h>
66

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
748
static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
759
__u32 len, __u8 proto,
7610
__wsum sum)
@@ -85,26 +19,7 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
8519
return sum;
8620
}
8721

88-
/*
89-
* computes the checksum of the TCP/UDP pseudo-header
90-
* returns a 16-bit checksum, already complemented
91-
*/
92-
static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
93-
__u32 len, __u8 proto,
94-
__wsum sum)
95-
{
96-
return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
97-
}
98-
99-
/*
100-
* this routine is used for miscellaneous IP-like checksums, mainly
101-
* in icmp.c
102-
*/
103-
static inline __sum16 ip_compute_csum(const void *buf, int len)
104-
{
105-
return csum_fold (csum_partial(buf, len, 0));
106-
}
107-
22+
#include <asm-generic/checksum.h>
10823

10924
#define _HAVE_ARCH_IPV6_CSUM
11025
static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,

arch/parisc/include/asm/compat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ typedef compat_ulong_t compat_elf_gregset_t[COMPAT_ELF_NGREG];
130130

131131
static inline int __is_compat_task(struct task_struct *t)
132132
{
133-
return test_tsk_thread_flag(t, TIF_32BIT);
133+
return IS_ENABLED(CONFIG_COMPAT) && test_tsk_thread_flag(t, TIF_32BIT);
134134
}
135135

136136
static inline int is_compat_task(void)

arch/parisc/include/asm/vdso.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
#ifdef CONFIG_64BIT
88
#include <generated/vdso64-offsets.h>
99
#endif
10+
#if !defined(CONFIG_64BIT) || defined(CONFIG_COMPAT)
1011
#include <generated/vdso32-offsets.h>
12+
#endif
1113

1214
#define VDSO64_SYMBOL(tsk, name) ((tsk)->mm->context.vdso_base + (vdso64_offset_##name))
1315
#define VDSO32_SYMBOL(tsk, name) ((tsk)->mm->context.vdso_base + (vdso32_offset_##name))

arch/parisc/kernel/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ obj-$(CONFIG_KEXEC_FILE) += kexec_file.o
4747
# vdso
4848
obj-y += vdso.o
4949
obj-$(CONFIG_64BIT) += vdso64/
50-
obj-y += vdso32/
50+
obj-$(CONFIG_PA11) += vdso32/
51+
obj-$(CONFIG_COMPAT) += vdso32/

arch/parisc/kernel/signal.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
8080
sigset_t set;
8181
unsigned long usp = (regs->gr[30] & ~(0x01UL));
8282
unsigned long sigframe_size = PARISC_RT_SIGFRAME_SIZE;
83-
#ifdef CONFIG_64BIT
83+
#ifdef CONFIG_COMPAT
8484
struct compat_rt_sigframe __user * compat_frame;
8585

8686
if (is_compat_task())
@@ -96,7 +96,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
9696

9797
regs->orig_r28 = 1; /* no restarts for sigreturn */
9898

99-
#ifdef CONFIG_64BIT
99+
#ifdef CONFIG_COMPAT
100100
compat_frame = (struct compat_rt_sigframe __user *)frame;
101101

102102
if (is_compat_task()) {
@@ -112,7 +112,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
112112
set_current_blocked(&set);
113113

114114
/* Good thing we saved the old gr[30], eh? */
115-
#ifdef CONFIG_64BIT
115+
#ifdef CONFIG_COMPAT
116116
if (is_compat_task()) {
117117
DBG(1, "%s: compat_frame->uc.uc_mcontext 0x%p\n",
118118
__func__, &compat_frame->uc.uc_mcontext);
@@ -218,13 +218,13 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs,
218218
unsigned long haddr, sigframe_size;
219219
unsigned long start;
220220
int err = 0;
221-
#ifdef CONFIG_64BIT
221+
#ifdef CONFIG_COMPAT
222222
struct compat_rt_sigframe __user * compat_frame;
223223
#endif
224-
224+
225225
usp = (regs->gr[30] & ~(0x01UL));
226226
sigframe_size = PARISC_RT_SIGFRAME_SIZE;
227-
#ifdef CONFIG_64BIT
227+
#ifdef CONFIG_COMPAT
228228
if (is_compat_task()) {
229229
/* The gcc alloca implementation leaves garbage in the upper 32 bits of sp */
230230
usp = (compat_uint_t)usp;
@@ -239,7 +239,7 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs,
239239
if (start >= TASK_SIZE_MAX - sigframe_size)
240240
return -EFAULT;
241241

242-
#ifdef CONFIG_64BIT
242+
#ifdef CONFIG_COMPAT
243243

244244
compat_frame = (struct compat_rt_sigframe __user *)frame;
245245

@@ -349,8 +349,8 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs,
349349

350350
regs->gr[2] = rp; /* userland return pointer */
351351
regs->gr[26] = ksig->sig; /* signal number */
352-
353-
#ifdef CONFIG_64BIT
352+
353+
#ifdef CONFIG_COMPAT
354354
if (is_compat_task()) {
355355
regs->gr[25] = A(&compat_frame->info); /* siginfo pointer */
356356
regs->gr[24] = A(&compat_frame->uc); /* ucontext pointer */

arch/parisc/kernel/sys_parisc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,13 @@ static inline unsigned long COLOR_ALIGN(unsigned long addr,
5050
}
5151

5252

53+
#ifdef CONFIG_COMPAT
5354
#define STACK_SIZE_DEFAULT (USER_WIDE_MODE \
5455
? (1 << 30) /* 1 GB */ \
5556
: (CONFIG_STACK_MAX_DEFAULT_SIZE_MB*1024*1024))
57+
#else
58+
#define STACK_SIZE_DEFAULT (1 << 30)
59+
#endif
5660

5761
unsigned long calc_max_stack_size(unsigned long stack_max)
5862
{

arch/parisc/kernel/syscall.S

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ linux_gateway_entry:
241241
/* Note! We cannot use the syscall table that is mapped
242242
nearby since the gateway page is mapped execute-only. */
243243

244-
#ifdef CONFIG_64BIT
244+
#ifdef CONFIG_COMPAT
245245
ldil L%sys_call_table, %r1
246246
or,ev %r2,%r2,%r2
247247
ldil L%sys_call_table64, %r1
@@ -250,7 +250,7 @@ linux_gateway_entry:
250250
ldo R%sys_call_table64(%r1), %r19
251251
#else
252252
load32 sys_call_table, %r19
253-
#endif
253+
#endif
254254
comiclr,>> __NR_Linux_syscalls, %r20, %r0
255255
b,n .Lsyscall_nosys
256256

@@ -374,7 +374,7 @@ tracesys_next:
374374
/* Note! We cannot use the syscall table that is mapped
375375
nearby since the gateway page is mapped execute-only. */
376376

377-
#ifdef CONFIG_64BIT
377+
#ifdef CONFIG_COMPAT
378378
LDREG TASK_PT_GR30(%r1), %r19 /* get users sp back */
379379
extrd,u %r19,63,1,%r2 /* W hidden in bottom bit */
380380

@@ -1326,16 +1326,19 @@ ENTRY(lws_table)
13261326
END(lws_table)
13271327
/* End of lws table */
13281328

1329-
#ifdef CONFIG_64BIT
1329+
#ifdef CONFIG_COMPAT
13301330
#define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, compat)
13311331
#else
13321332
#define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native)
13331333
#endif
13341334
#define __SYSCALL(nr, entry) ASM_ULONG_INSN entry
1335+
13351336
.align 8
13361337
ENTRY(sys_call_table)
13371338
.export sys_call_table,data
1339+
#if defined(CONFIG_COMPAT) || !defined(CONFIG_64BIT)
13381340
#include <asm/syscall_table_32.h> /* 32-bit syscalls */
1341+
#endif
13391342
END(sys_call_table)
13401343

13411344
#ifdef CONFIG_64BIT

0 commit comments

Comments
 (0)