Skip to content

Commit a04b1bf

Browse files
committed
Merge tag 'for-5.18/parisc-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc architecture updates from Helge Deller: - add vDSO support (allows us to use non-executable stacks) - many TLB and cache flush optimizations (by Dave Anglin) - fix handling of probe non-access faults (by Dave Anglin) - fix invalidate/flush vmap routines (by Dave Anglin) - avoid using hardware single-step in kprobes - enable ARCH_HAS_DEBUG_VM_PGTABLE - many cleanups in unaligned handlers, e.g. rewrite of existing assembly code - always use the self-extracting kernel feature - big refacturing and code reductions regarding space-register usage in get_user() and put_user() - add fillrect() support to stifb graphics driver * tag 'for-5.18/parisc-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: (23 commits) parisc: Fix invalidate/flush vmap routines parisc: Avoid flushing cache on cache-less machines parisc: Avoid using hardware single-step in kprobes parisc: Improve CPU socket and core bootup info text parisc: Enable ARCH_HAS_DEBUG_VM_PGTABLE parisc: Avoid calling SMP cache flush functions on cache-less machines parisc: Increase parisc_cache_flush_threshold setting parisc/unaligned: Enhance user-space visible output parisc/unaligned: Rewrite 32-bit inline assembly of emulate_sth() parisc/unaligned: Rewrite 32-bit inline assembly of emulate_ldd() parisc/unaligned: Rewrite inline assembly of emulate_ldw() parisc/unaligned: Rewrite inline assembly of emulate_ldh() parisc/unaligned: Use EFAULT fixup handler in unaligned handlers parisc: Reduce code size by optimizing get_current() function calls parisc: Use constants to encode the space registers like SR_KERNEL parisc: Use SR_USER and SR_KERNEL in get_user() and put_user() parisc: Add defines for various space register parisc: Always use the self-extracting kernel feature video/fbdev/stifb: Implement the stifb_fillrect() function parisc: Add vDSO support ...
2 parents 93287e2 + 53d862f commit a04b1bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1534
-550
lines changed

arch/parisc/Kconfig

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ config PARISC
1010
select ARCH_HAS_ELF_RANDOMIZE
1111
select ARCH_HAS_STRICT_KERNEL_RWX
1212
select ARCH_HAS_UBSAN_SANITIZE_ALL
13+
select ARCH_HAS_PTE_SPECIAL
1314
select ARCH_NO_SG_CHAIN
1415
select ARCH_SUPPORTS_HUGETLBFS if PA20
1516
select ARCH_SUPPORTS_MEMORY_FAILURE
1617
select ARCH_STACKWALK
18+
select ARCH_HAS_DEBUG_VM_PGTABLE
1719
select HAVE_RELIABLE_STACKTRACE
1820
select DMA_OPS
1921
select RTC_CLASS
@@ -259,18 +261,6 @@ config PARISC_PAGE_SIZE_64KB
259261

260262
endchoice
261263

262-
config PARISC_SELF_EXTRACT
263-
bool "Build kernel as self-extracting executable"
264-
default y
265-
help
266-
Say Y if you want to build the parisc kernel as a kind of
267-
self-extracting executable.
268-
269-
If you say N here, the kernel will be compressed with gzip
270-
which can be loaded by the palo bootloader directly too.
271-
272-
If you don't know what to do here, say Y.
273-
274264
config SMP
275265
bool "Symmetric multi-processing support"
276266
help

arch/parisc/Makefile

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,8 @@
1515
# Mike Shaver, Helge Deller and Martin K. Petersen
1616
#
1717

18-
ifdef CONFIG_PARISC_SELF_EXTRACT
1918
boot := arch/parisc/boot
2019
KBUILD_IMAGE := $(boot)/bzImage
21-
else
22-
KBUILD_IMAGE := vmlinuz
23-
endif
2420

2521
NM = sh $(srctree)/arch/parisc/nm
2622
CHECKFLAGS += -D__hppa__=1
@@ -44,6 +40,16 @@ endif
4440

4541
export LD_BFD
4642

43+
# Set default 32 bits cross compilers for vdso
44+
CC_ARCHES_32 = hppa hppa2.0 hppa1.1
45+
CC_SUFFIXES = linux linux-gnu unknown-linux-gnu
46+
CROSS32_COMPILE := $(call cc-cross-prefix, \
47+
$(foreach a,$(CC_ARCHES_32), \
48+
$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
49+
CROSS32CC := $(CROSS32_COMPILE)gcc
50+
export CROSS32CC
51+
52+
# Set default cross compiler for kernel build
4753
ifdef cross_compiling
4854
ifeq ($(CROSS_COMPILE),)
4955
CC_SUFFIXES = linux linux-gnu unknown-linux-gnu
@@ -155,14 +161,29 @@ Image: vmlinux
155161
bzImage: vmlinux
156162
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
157163

158-
ifdef CONFIG_PARISC_SELF_EXTRACT
159164
vmlinuz: bzImage
160165
$(OBJCOPY) $(boot)/bzImage $@
161-
else
162-
vmlinuz: vmlinux
163-
@$(KGZIP) -cf -9 $< > $@
166+
167+
ifeq ($(KBUILD_EXTMOD),)
168+
# We need to generate vdso-offsets.h before compiling certain files in kernel/.
169+
# In order to do that, we should use the archprepare target, but we can't since
170+
# asm-offsets.h is included in some files used to generate vdso-offsets.h, and
171+
# asm-offsets.h is built in prepare0, for which archprepare is a dependency.
172+
# Therefore we need to generate the header after prepare0 has been made, hence
173+
# this hack.
174+
prepare: vdso_prepare
175+
vdso_prepare: prepare0
176+
$(if $(CONFIG_64BIT),$(Q)$(MAKE) \
177+
$(build)=arch/parisc/kernel/vdso64 include/generated/vdso64-offsets.h)
178+
$(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 include/generated/vdso32-offsets.h
164179
endif
165180

181+
PHONY += vdso_install
182+
183+
vdso_install:
184+
$(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso $@
185+
$(if $(CONFIG_COMPAT_VDSO), \
186+
$(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 $@)
166187
install:
167188
$(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
168189
$(KERNELRELEASE) vmlinux System.map "$(INSTALL_PATH)"

arch/parisc/include/asm/assembly.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@
4747
#define PRIV_USER 3
4848
#define PRIV_KERNEL 0
4949

50+
/* Space register used inside kernel */
51+
#define SR_KERNEL 0
52+
#define SR_TEMP1 1
53+
#define SR_TEMP2 2
54+
#define SR_USER 3
55+
5056
#ifdef __ASSEMBLY__
5157

5258
#ifdef CONFIG_64BIT

arch/parisc/include/asm/cache.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,13 @@ extern int icache_stride;
3939
extern struct pdc_cache_info cache_info;
4040
void parisc_setup_cache_timing(void);
4141

42-
#define pdtlb(addr) asm volatile("pdtlb 0(%%sr1,%0)" \
42+
#define pdtlb(sr, addr) asm volatile("pdtlb 0(%%sr%0,%1)" \
4343
ALTERNATIVE(ALT_COND_NO_SMP, INSN_PxTLB) \
44-
: : "r" (addr) : "memory")
45-
#define pitlb(addr) asm volatile("pitlb 0(%%sr1,%0)" \
44+
: : "i"(sr), "r" (addr) : "memory")
45+
#define pitlb(sr, addr) asm volatile("pitlb 0(%%sr%0,%1)" \
4646
ALTERNATIVE(ALT_COND_NO_SMP, INSN_PxTLB) \
4747
ALTERNATIVE(ALT_COND_NO_SPLIT_TLB, INSN_NOP) \
48-
: : "r" (addr) : "memory")
49-
#define pdtlb_kernel(addr) asm volatile("pdtlb 0(%0)" \
50-
ALTERNATIVE(ALT_COND_NO_SMP, INSN_PxTLB) \
51-
: : "r" (addr) : "memory")
48+
: : "i"(sr), "r" (addr) : "memory")
5249

5350
#define asm_io_fdc(addr) asm volatile("fdc %%r0(%0)" \
5451
ALTERNATIVE(ALT_COND_NO_DCACHE, INSN_NOP) \

arch/parisc/include/asm/cacheflush.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,11 @@
99
/* The usual comment is "Caches aren't brain-dead on the <architecture>".
1010
* Unfortunately, that doesn't apply to PA-RISC. */
1111

12-
/* Internal implementation */
13-
void flush_data_cache_local(void *); /* flushes local data-cache only */
14-
void flush_instruction_cache_local(void *); /* flushes local code-cache only */
15-
#ifdef CONFIG_SMP
16-
void flush_data_cache(void); /* flushes data-cache only (all processors) */
17-
void flush_instruction_cache(void); /* flushes i-cache only (all processors) */
18-
#else
19-
#define flush_data_cache() flush_data_cache_local(NULL)
20-
#define flush_instruction_cache() flush_instruction_cache_local(NULL)
21-
#endif
12+
#include <linux/jump_label.h>
13+
14+
DECLARE_STATIC_KEY_TRUE(parisc_has_cache);
15+
DECLARE_STATIC_KEY_TRUE(parisc_has_dcache);
16+
DECLARE_STATIC_KEY_TRUE(parisc_has_icache);
2217

2318
#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
2419

arch/parisc/include/asm/current.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
#ifndef _ASM_PARISC_CURRENT_H
33
#define _ASM_PARISC_CURRENT_H
44

5-
#include <asm/special_insns.h>
6-
75
#ifndef __ASSEMBLY__
86
struct task_struct;
97

108
static __always_inline struct task_struct *get_current(void)
119
{
12-
return (struct task_struct *) mfctl(30);
10+
struct task_struct *ts;
11+
12+
/* do not use mfctl() macro as it is marked volatile */
13+
asm( "mfctl %%cr30,%0" : "=r" (ts) );
14+
return ts;
1315
}
1416

1517
#define current get_current()

arch/parisc/include/asm/elf.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,4 +359,19 @@ struct mm_struct;
359359
extern unsigned long arch_randomize_brk(struct mm_struct *);
360360
#define arch_randomize_brk arch_randomize_brk
361361

362+
363+
#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
364+
struct linux_binprm;
365+
extern int arch_setup_additional_pages(struct linux_binprm *bprm,
366+
int executable_stack);
367+
#define VDSO_AUX_ENT(a, b) NEW_AUX_ENT(a, b)
368+
#define VDSO_CURRENT_BASE current->mm->context.vdso_base
369+
370+
#define ARCH_DLINFO \
371+
do { \
372+
if (VDSO_CURRENT_BASE) { \
373+
NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_CURRENT_BASE);\
374+
} \
375+
} while (0)
376+
362377
#endif

arch/parisc/include/asm/kprobes.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
#include <linux/notifier.h>
1919

2020
#define PARISC_KPROBES_BREAK_INSN 0x3ff801f
21+
#define PARISC_KPROBES_BREAK_INSN2 0x3ff801e
2122
#define __ARCH_WANT_KPROBES_INSN_SLOT
22-
#define MAX_INSN_SIZE 1
23+
#define MAX_INSN_SIZE 2
2324

2425
typedef u32 kprobe_opcode_t;
2526
struct kprobe;
@@ -29,7 +30,7 @@ void arch_remove_kprobe(struct kprobe *p);
2930
#define flush_insn_slot(p) \
3031
flush_icache_range((unsigned long)&(p)->ainsn.insn[0], \
3132
(unsigned long)&(p)->ainsn.insn[0] + \
32-
sizeof(kprobe_opcode_t))
33+
MAX_INSN_SIZE*sizeof(kprobe_opcode_t))
3334

3435
#define kretprobe_blacklist_size 0
3536

arch/parisc/include/asm/mmu.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
#ifndef _PARISC_MMU_H_
33
#define _PARISC_MMU_H_
44

5-
/* On parisc, we store the space id here */
6-
typedef unsigned long mm_context_t;
5+
typedef struct {
6+
unsigned long space_id;
7+
unsigned long vdso_base;
8+
} mm_context_t;
79

810
#endif /* _PARISC_MMU_H_ */

arch/parisc/include/asm/mmu_context.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,30 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
2020
{
2121
BUG_ON(atomic_read(&mm->mm_users) != 1);
2222

23-
mm->context = alloc_sid();
23+
mm->context.space_id = alloc_sid();
2424
return 0;
2525
}
2626

2727
#define destroy_context destroy_context
2828
static inline void
2929
destroy_context(struct mm_struct *mm)
3030
{
31-
free_sid(mm->context);
32-
mm->context = 0;
31+
free_sid(mm->context.space_id);
32+
mm->context.space_id = 0;
3333
}
3434

3535
static inline unsigned long __space_to_prot(mm_context_t context)
3636
{
3737
#if SPACEID_SHIFT == 0
38-
return context << 1;
38+
return context.space_id << 1;
3939
#else
40-
return context >> (SPACEID_SHIFT - 1);
40+
return context.space_id >> (SPACEID_SHIFT - 1);
4141
#endif
4242
}
4343

4444
static inline void load_context(mm_context_t context)
4545
{
46-
mtsp(context, 3);
46+
mtsp(context.space_id, SR_USER);
4747
mtctl(__space_to_prot(context), 8);
4848
}
4949

@@ -89,8 +89,8 @@ static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
8989

9090
BUG_ON(next == &init_mm); /* Should never happen */
9191

92-
if (next->context == 0)
93-
next->context = alloc_sid();
92+
if (next->context.space_id == 0)
93+
next->context.space_id = alloc_sid();
9494

9595
switch_mm(prev,next,current);
9696
}

0 commit comments

Comments
 (0)