aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-17 11:58:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-17 11:58:04 -0400
commit57a8ec387e1441ea5e1232bc0749fb99a8cba7e7 (patch)
treeb5fb03fc6bc5754de8b5b1f8b0e4f36d67c8315c /arch
parent0a8ad0ffa4d80a544f6cbff703bf6394339afcdf (diff)
parent43e11fa2d1d3b6e35629fa556eb7d571edba2010 (diff)
Merge branch 'akpm' (patches from Andrew)
Merge more updates from Andrew Morton: "VM: - z3fold fixes and enhancements by Henry Burns and Vitaly Wool - more accurate reclaimed slab caches calculations by Yafang Shao - fix MAP_UNINITIALIZED UAPI symbol to not depend on config, by Christoph Hellwig - !CONFIG_MMU fixes by Christoph Hellwig - new novmcoredd parameter to omit device dumps from vmcore, by Kairui Song - new test_meminit module for testing heap and pagealloc initialization, by Alexander Potapenko - ioremap improvements for huge mappings, by Anshuman Khandual - generalize kprobe page fault handling, by Anshuman Khandual - device-dax hotplug fixes and improvements, by Pavel Tatashin - enable synchronous DAX fault on powerpc, by Aneesh Kumar K.V - add pte_devmap() support for arm64, by Robin Murphy - unify locked_vm accounting with a helper, by Daniel Jordan - several misc fixes core/lib: - new typeof_member() macro including some users, by Alexey Dobriyan - make BIT() and GENMASK() available in asm, by Masahiro Yamada - changed LIST_POISON2 on x86_64 to 0xdead000000000122 for better code generation, by Alexey Dobriyan - rbtree code size optimizations, by Michel Lespinasse - convert struct pid count to refcount_t, by Joel Fernandes get_maintainer.pl: - add --no-moderated switch to skip moderated ML's, by Joe Perches misc: - ptrace PTRACE_GET_SYSCALL_INFO interface - coda updates - gdb scripts, various" [ Using merge message suggestion from Vlastimil Babka, with some editing - Linus ] * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (100 commits) fs/select.c: use struct_size() in kmalloc() mm: add account_locked_vm utility function arm64: mm: implement pte_devmap support mm: introduce ARCH_HAS_PTE_DEVMAP mm: clean up is_device_*_page() definitions mm/mmap: move common defines to mman-common.h mm: move MAP_SYNC to asm-generic/mman-common.h device-dax: "Hotremove" persistent memory that is used like normal RAM mm/hotplug: make remove_memory() interface usable device-dax: fix memory and resource leak if hotplug fails include/linux/lz4.h: fix spelling and copy-paste errors in documentation ipc/mqueue.c: only perform resource calculation if user valid include/asm-generic/bug.h: fix "cut here" for WARN_ON for __WARN_TAINT architectures scripts/gdb: add helpers to find and list devices scripts/gdb: add lx-genpd-summary command drivers/pps/pps.c: clear offset flags in PPS_SETPARAMS ioctl kernel/pid.c: convert struct pid count to refcount_t drivers/rapidio/devices/rio_mport_cdev.c: NUL terminate some strings select: shift restore_saved_sigmask_unless() into poll_select_copy_remaining() select: change do_poll() to return -ERESTARTNOHAND rather than -EINTR ...
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/include/asm/io.h5
-rw-r--r--arch/arc/include/asm/pgtable.h8
-rw-r--r--arch/arc/plat-eznps/include/plat/ctop.h15
-rw-r--r--arch/arm/include/asm/io.h1
-rw-r--r--arch/arm/mm/fault.c24
-rw-r--r--arch/arm64/Kconfig1
-rw-r--r--arch/arm64/include/asm/pgtable-prot.h1
-rw-r--r--arch/arm64/include/asm/pgtable.h21
-rw-r--r--arch/arm64/include/asm/sysreg.h82
-rw-r--r--arch/arm64/mm/fault.c24
-rw-r--r--arch/arm64/mm/mmu.c5
-rw-r--r--arch/hexagon/include/asm/syscall.h14
-rw-r--r--arch/ia64/mm/fault.c24
-rw-r--r--arch/mips/include/asm/io.h2
-rw-r--r--arch/mips/include/asm/kprobes.h1
-rw-r--r--arch/mips/include/asm/syscall.h6
-rw-r--r--arch/mips/kernel/kprobes.c2
-rw-r--r--arch/nds32/include/asm/syscall.h27
-rw-r--r--arch/parisc/include/asm/syscall.h7
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/include/asm/book3s/64/pgtable.h1
-rw-r--r--arch/powerpc/include/asm/syscall.h10
-rw-r--r--arch/powerpc/include/uapi/asm/mman.h6
-rw-r--r--arch/powerpc/kvm/book3s_64_vio.c44
-rw-r--r--arch/powerpc/mm/book3s64/iommu_api.c41
-rw-r--r--arch/powerpc/mm/book3s64/radix_pgtable.c5
-rw-r--r--arch/powerpc/mm/fault.c23
-rw-r--r--arch/s390/include/asm/ctl_reg.h42
-rw-r--r--arch/s390/include/asm/nmi.h20
-rw-r--r--arch/s390/include/asm/processor.h20
-rw-r--r--arch/s390/include/asm/ptrace.h10
-rw-r--r--arch/s390/include/asm/setup.h40
-rw-r--r--arch/s390/include/asm/thread_info.h34
-rw-r--r--arch/s390/mm/fault.c16
-rw-r--r--arch/sh/mm/fault.c18
-rw-r--r--arch/sparc/include/uapi/asm/mman.h6
-rw-r--r--arch/sparc/mm/fault_64.c16
-rw-r--r--arch/x86/Kconfig2
-rw-r--r--arch/x86/include/asm/io.h1
-rw-r--r--arch/x86/include/asm/pgtable.h4
-rw-r--r--arch/x86/include/asm/pgtable_types.h1
-rw-r--r--arch/x86/mm/fault.c21
-rw-r--r--arch/x86/mm/ioremap.c5
-rw-r--r--arch/xtensa/include/uapi/asm/mman.h6
44 files changed, 255 insertions, 409 deletions
diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h
index ccf9d65166bb..af2c0063dc75 100644
--- a/arch/alpha/include/asm/io.h
+++ b/arch/alpha/include/asm/io.h
@@ -93,11 +93,6 @@ static inline void * phys_to_virt(unsigned long address)
93 93
94#define page_to_phys(page) page_to_pa(page) 94#define page_to_phys(page) page_to_pa(page)
95 95
96static inline dma_addr_t __deprecated isa_page_to_bus(struct page *page)
97{
98 return page_to_phys(page);
99}
100
101/* Maximum PIO space address supported? */ 96/* Maximum PIO space address supported? */
102#define IO_SPACE_LIMIT 0xffff 97#define IO_SPACE_LIMIT 0xffff
103 98
diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index da446180f17b..1d87c18a2976 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -32,7 +32,7 @@
32#ifndef _ASM_ARC_PGTABLE_H 32#ifndef _ASM_ARC_PGTABLE_H
33#define _ASM_ARC_PGTABLE_H 33#define _ASM_ARC_PGTABLE_H
34 34
35#include <linux/const.h> 35#include <linux/bits.h>
36#define __ARCH_USE_5LEVEL_HACK 36#define __ARCH_USE_5LEVEL_HACK
37#include <asm-generic/pgtable-nopmd.h> 37#include <asm-generic/pgtable-nopmd.h>
38#include <asm/page.h> 38#include <asm/page.h>
@@ -215,11 +215,11 @@
215#define BITS_FOR_PTE (PGDIR_SHIFT - PAGE_SHIFT) 215#define BITS_FOR_PTE (PGDIR_SHIFT - PAGE_SHIFT)
216#define BITS_FOR_PGD (32 - PGDIR_SHIFT) 216#define BITS_FOR_PGD (32 - PGDIR_SHIFT)
217 217
218#define PGDIR_SIZE _BITUL(PGDIR_SHIFT) /* vaddr span, not PDG sz */ 218#define PGDIR_SIZE BIT(PGDIR_SHIFT) /* vaddr span, not PDG sz */
219#define PGDIR_MASK (~(PGDIR_SIZE-1)) 219#define PGDIR_MASK (~(PGDIR_SIZE-1))
220 220
221#define PTRS_PER_PTE _BITUL(BITS_FOR_PTE) 221#define PTRS_PER_PTE BIT(BITS_FOR_PTE)
222#define PTRS_PER_PGD _BITUL(BITS_FOR_PGD) 222#define PTRS_PER_PGD BIT(BITS_FOR_PGD)
223 223
224/* 224/*
225 * Number of entries a user land program use. 225 * Number of entries a user land program use.
diff --git a/arch/arc/plat-eznps/include/plat/ctop.h b/arch/arc/plat-eznps/include/plat/ctop.h
index 309a994f64f0..a4a61531c7fb 100644
--- a/arch/arc/plat-eznps/include/plat/ctop.h
+++ b/arch/arc/plat-eznps/include/plat/ctop.h
@@ -10,6 +10,7 @@
10#error "Incorrect ctop.h include" 10#error "Incorrect ctop.h include"
11#endif 11#endif
12 12
13#include <linux/bits.h>
13#include <linux/types.h> 14#include <linux/types.h>
14#include <soc/nps/common.h> 15#include <soc/nps/common.h>
15 16
@@ -51,19 +52,19 @@
51#define CTOP_INST_AXOR_DI_R2_R2_R3 0x4A664C06 52#define CTOP_INST_AXOR_DI_R2_R2_R3 0x4A664C06
52 53
53/* Do not use D$ for address in 2G-3G */ 54/* Do not use D$ for address in 2G-3G */
54#define HW_COMPLY_KRN_NOT_D_CACHED _BITUL(28) 55#define HW_COMPLY_KRN_NOT_D_CACHED BIT(28)
55 56
56#define NPS_MSU_EN_CFG 0x80 57#define NPS_MSU_EN_CFG 0x80
57#define NPS_CRG_BLKID 0x480 58#define NPS_CRG_BLKID 0x480
58#define NPS_CRG_SYNC_BIT _BITUL(0) 59#define NPS_CRG_SYNC_BIT BIT(0)
59#define NPS_GIM_BLKID 0x5C0 60#define NPS_GIM_BLKID 0x5C0
60 61
61/* GIM registers and fields*/ 62/* GIM registers and fields*/
62#define NPS_GIM_UART_LINE _BITUL(7) 63#define NPS_GIM_UART_LINE BIT(7)
63#define NPS_GIM_DBG_LAN_EAST_TX_DONE_LINE _BITUL(10) 64#define NPS_GIM_DBG_LAN_EAST_TX_DONE_LINE BIT(10)
64#define NPS_GIM_DBG_LAN_EAST_RX_RDY_LINE _BITUL(11) 65#define NPS_GIM_DBG_LAN_EAST_RX_RDY_LINE BIT(11)
65#define NPS_GIM_DBG_LAN_WEST_TX_DONE_LINE _BITUL(25) 66#define NPS_GIM_DBG_LAN_WEST_TX_DONE_LINE BIT(25)
66#define NPS_GIM_DBG_LAN_WEST_RX_RDY_LINE _BITUL(26) 67#define NPS_GIM_DBG_LAN_WEST_RX_RDY_LINE BIT(26)
67 68
68#ifndef __ASSEMBLY__ 69#ifndef __ASSEMBLY__
69/* Functional registers definition */ 70/* Functional registers definition */
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index f11c35cf0b74..7a0596fcb2e7 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -30,7 +30,6 @@
30 * ISA I/O bus memory addresses are 1:1 with the physical address. 30 * ISA I/O bus memory addresses are 1:1 with the physical address.
31 */ 31 */
32#define isa_virt_to_bus virt_to_phys 32#define isa_virt_to_bus virt_to_phys
33#define isa_page_to_bus page_to_phys
34#define isa_bus_to_virt phys_to_virt 33#define isa_bus_to_virt phys_to_virt
35 34
36/* 35/*
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 0e417233dad7..890eeaac3cbb 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -27,28 +27,6 @@
27 27
28#ifdef CONFIG_MMU 28#ifdef CONFIG_MMU
29 29
30#ifdef CONFIG_KPROBES
31static inline int notify_page_fault(struct pt_regs *regs, unsigned int fsr)
32{
33 int ret = 0;
34
35 if (!user_mode(regs)) {
36 /* kprobe_running() needs smp_processor_id() */
37 preempt_disable();
38 if (kprobe_running() && kprobe_fault_handler(regs, fsr))
39 ret = 1;
40 preempt_enable();
41 }
42
43 return ret;
44}
45#else
46static inline int notify_page_fault(struct pt_regs *regs, unsigned int fsr)
47{
48 return 0;
49}
50#endif
51
52/* 30/*
53 * This is useful to dump out the page tables associated with 31 * This is useful to dump out the page tables associated with
54 * 'addr' in mm 'mm'. 32 * 'addr' in mm 'mm'.
@@ -265,7 +243,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
265 vm_fault_t fault; 243 vm_fault_t fault;
266 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 244 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
267 245
268 if (notify_page_fault(regs, fsr)) 246 if (kprobe_page_fault(regs, fsr))
269 return 0; 247 return 0;
270 248
271 tsk = current; 249 tsk = current;
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 86f81b5afd95..e1ea69994e0f 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -24,6 +24,7 @@ config ARM64
24 select ARCH_HAS_KCOV 24 select ARCH_HAS_KCOV
25 select ARCH_HAS_KEEPINITRD 25 select ARCH_HAS_KEEPINITRD
26 select ARCH_HAS_MEMBARRIER_SYNC_CORE 26 select ARCH_HAS_MEMBARRIER_SYNC_CORE
27 select ARCH_HAS_PTE_DEVMAP
27 select ARCH_HAS_PTE_SPECIAL 28 select ARCH_HAS_PTE_SPECIAL
28 select ARCH_HAS_SETUP_DMA_OPS 29 select ARCH_HAS_SETUP_DMA_OPS
29 select ARCH_HAS_SET_DIRECT_MAP 30 select ARCH_HAS_SET_DIRECT_MAP
diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h
index f318258a14be..92d2e9f28f28 100644
--- a/arch/arm64/include/asm/pgtable-prot.h
+++ b/arch/arm64/include/asm/pgtable-prot.h
@@ -16,6 +16,7 @@
16#define PTE_WRITE (PTE_DBM) /* same as DBM (51) */ 16#define PTE_WRITE (PTE_DBM) /* same as DBM (51) */
17#define PTE_DIRTY (_AT(pteval_t, 1) << 55) 17#define PTE_DIRTY (_AT(pteval_t, 1) << 55)
18#define PTE_SPECIAL (_AT(pteval_t, 1) << 56) 18#define PTE_SPECIAL (_AT(pteval_t, 1) << 56)
19#define PTE_DEVMAP (_AT(pteval_t, 1) << 57)
19#define PTE_PROT_NONE (_AT(pteval_t, 1) << 58) /* only when !PTE_VALID */ 20#define PTE_PROT_NONE (_AT(pteval_t, 1) << 58) /* only when !PTE_VALID */
20 21
21#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 3052381baaeb..87a4b2ddc1a1 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -79,6 +79,7 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
79#define pte_write(pte) (!!(pte_val(pte) & PTE_WRITE)) 79#define pte_write(pte) (!!(pte_val(pte) & PTE_WRITE))
80#define pte_user_exec(pte) (!(pte_val(pte) & PTE_UXN)) 80#define pte_user_exec(pte) (!(pte_val(pte) & PTE_UXN))
81#define pte_cont(pte) (!!(pte_val(pte) & PTE_CONT)) 81#define pte_cont(pte) (!!(pte_val(pte) & PTE_CONT))
82#define pte_devmap(pte) (!!(pte_val(pte) & PTE_DEVMAP))
82 83
83#define pte_cont_addr_end(addr, end) \ 84#define pte_cont_addr_end(addr, end) \
84({ unsigned long __boundary = ((addr) + CONT_PTE_SIZE) & CONT_PTE_MASK; \ 85({ unsigned long __boundary = ((addr) + CONT_PTE_SIZE) & CONT_PTE_MASK; \
@@ -206,6 +207,11 @@ static inline pmd_t pmd_mkcont(pmd_t pmd)
206 return __pmd(pmd_val(pmd) | PMD_SECT_CONT); 207 return __pmd(pmd_val(pmd) | PMD_SECT_CONT);
207} 208}
208 209
210static inline pte_t pte_mkdevmap(pte_t pte)
211{
212 return set_pte_bit(pte, __pgprot(PTE_DEVMAP));
213}
214
209static inline void set_pte(pte_t *ptep, pte_t pte) 215static inline void set_pte(pte_t *ptep, pte_t pte)
210{ 216{
211 WRITE_ONCE(*ptep, pte); 217 WRITE_ONCE(*ptep, pte);
@@ -388,6 +394,11 @@ static inline int pmd_protnone(pmd_t pmd)
388 394
389#define pmd_mkhuge(pmd) (__pmd(pmd_val(pmd) & ~PMD_TABLE_BIT)) 395#define pmd_mkhuge(pmd) (__pmd(pmd_val(pmd) & ~PMD_TABLE_BIT))
390 396
397#ifdef CONFIG_TRANSPARENT_HUGEPAGE
398#define pmd_devmap(pmd) pte_devmap(pmd_pte(pmd))
399#endif
400#define pmd_mkdevmap(pmd) pte_pmd(pte_mkdevmap(pmd_pte(pmd)))
401
391#define __pmd_to_phys(pmd) __pte_to_phys(pmd_pte(pmd)) 402#define __pmd_to_phys(pmd) __pte_to_phys(pmd_pte(pmd))
392#define __phys_to_pmd_val(phys) __phys_to_pte_val(phys) 403#define __phys_to_pmd_val(phys) __phys_to_pte_val(phys)
393#define pmd_pfn(pmd) ((__pmd_to_phys(pmd) & PMD_MASK) >> PAGE_SHIFT) 404#define pmd_pfn(pmd) ((__pmd_to_phys(pmd) & PMD_MASK) >> PAGE_SHIFT)
@@ -673,6 +684,16 @@ static inline int pmdp_set_access_flags(struct vm_area_struct *vma,
673{ 684{
674 return ptep_set_access_flags(vma, address, (pte_t *)pmdp, pmd_pte(entry), dirty); 685 return ptep_set_access_flags(vma, address, (pte_t *)pmdp, pmd_pte(entry), dirty);
675} 686}
687
688static inline int pud_devmap(pud_t pud)
689{
690 return 0;
691}
692
693static inline int pgd_devmap(pgd_t pgd)
694{
695 return 0;
696}
676#endif 697#endif
677 698
678/* 699/*
diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
index a7522fca1105..06ebcfef73df 100644
--- a/arch/arm64/include/asm/sysreg.h
+++ b/arch/arm64/include/asm/sysreg.h
@@ -9,7 +9,7 @@
9#ifndef __ASM_SYSREG_H 9#ifndef __ASM_SYSREG_H
10#define __ASM_SYSREG_H 10#define __ASM_SYSREG_H
11 11
12#include <linux/const.h> 12#include <linux/bits.h>
13#include <linux/stringify.h> 13#include <linux/stringify.h>
14 14
15/* 15/*
@@ -478,31 +478,31 @@
478#define SYS_CNTV_CVAL_EL02 sys_reg(3, 5, 14, 3, 2) 478#define SYS_CNTV_CVAL_EL02 sys_reg(3, 5, 14, 3, 2)
479 479
480/* Common SCTLR_ELx flags. */ 480/* Common SCTLR_ELx flags. */
481#define SCTLR_ELx_DSSBS (_BITUL(44)) 481#define SCTLR_ELx_DSSBS (BIT(44))
482#define SCTLR_ELx_ENIA (_BITUL(31)) 482#define SCTLR_ELx_ENIA (BIT(31))
483#define SCTLR_ELx_ENIB (_BITUL(30)) 483#define SCTLR_ELx_ENIB (BIT(30))
484#define SCTLR_ELx_ENDA (_BITUL(27)) 484#define SCTLR_ELx_ENDA (BIT(27))
485#define SCTLR_ELx_EE (_BITUL(25)) 485#define SCTLR_ELx_EE (BIT(25))
486#define SCTLR_ELx_IESB (_BITUL(21)) 486#define SCTLR_ELx_IESB (BIT(21))
487#define SCTLR_ELx_WXN (_BITUL(19)) 487#define SCTLR_ELx_WXN (BIT(19))
488#define SCTLR_ELx_ENDB (_BITUL(13)) 488#define SCTLR_ELx_ENDB (BIT(13))
489#define SCTLR_ELx_I (_BITUL(12)) 489#define SCTLR_ELx_I (BIT(12))
490#define SCTLR_ELx_SA (_BITUL(3)) 490#define SCTLR_ELx_SA (BIT(3))
491#define SCTLR_ELx_C (_BITUL(2)) 491#define SCTLR_ELx_C (BIT(2))
492#define SCTLR_ELx_A (_BITUL(1)) 492#define SCTLR_ELx_A (BIT(1))
493#define SCTLR_ELx_M (_BITUL(0)) 493#define SCTLR_ELx_M (BIT(0))
494 494
495#define SCTLR_ELx_FLAGS (SCTLR_ELx_M | SCTLR_ELx_A | SCTLR_ELx_C | \ 495#define SCTLR_ELx_FLAGS (SCTLR_ELx_M | SCTLR_ELx_A | SCTLR_ELx_C | \
496 SCTLR_ELx_SA | SCTLR_ELx_I | SCTLR_ELx_IESB) 496 SCTLR_ELx_SA | SCTLR_ELx_I | SCTLR_ELx_IESB)
497 497
498/* SCTLR_EL2 specific flags. */ 498/* SCTLR_EL2 specific flags. */
499#define SCTLR_EL2_RES1 ((_BITUL(4)) | (_BITUL(5)) | (_BITUL(11)) | (_BITUL(16)) | \ 499#define SCTLR_EL2_RES1 ((BIT(4)) | (BIT(5)) | (BIT(11)) | (BIT(16)) | \
500 (_BITUL(18)) | (_BITUL(22)) | (_BITUL(23)) | (_BITUL(28)) | \ 500 (BIT(18)) | (BIT(22)) | (BIT(23)) | (BIT(28)) | \
501 (_BITUL(29))) 501 (BIT(29)))
502#define SCTLR_EL2_RES0 ((_BITUL(6)) | (_BITUL(7)) | (_BITUL(8)) | (_BITUL(9)) | \ 502#define SCTLR_EL2_RES0 ((BIT(6)) | (BIT(7)) | (BIT(8)) | (BIT(9)) | \
503 (_BITUL(10)) | (_BITUL(13)) | (_BITUL(14)) | (_BITUL(15)) | \ 503 (BIT(10)) | (BIT(13)) | (BIT(14)) | (BIT(15)) | \
504 (_BITUL(17)) | (_BITUL(20)) | (_BITUL(24)) | (_BITUL(26)) | \ 504 (BIT(17)) | (BIT(20)) | (BIT(24)) | (BIT(26)) | \
505 (_BITUL(27)) | (_BITUL(30)) | (_BITUL(31)) | \ 505 (BIT(27)) | (BIT(30)) | (BIT(31)) | \
506 (0xffffefffUL << 32)) 506 (0xffffefffUL << 32))
507 507
508#ifdef CONFIG_CPU_BIG_ENDIAN 508#ifdef CONFIG_CPU_BIG_ENDIAN
@@ -524,23 +524,23 @@
524#endif 524#endif
525 525
526/* SCTLR_EL1 specific flags. */ 526/* SCTLR_EL1 specific flags. */
527#define SCTLR_EL1_UCI (_BITUL(26)) 527#define SCTLR_EL1_UCI (BIT(26))
528#define SCTLR_EL1_E0E (_BITUL(24)) 528#define SCTLR_EL1_E0E (BIT(24))
529#define SCTLR_EL1_SPAN (_BITUL(23)) 529#define SCTLR_EL1_SPAN (BIT(23))
530#define SCTLR_EL1_NTWE (_BITUL(18)) 530#define SCTLR_EL1_NTWE (BIT(18))
531#define SCTLR_EL1_NTWI (_BITUL(16)) 531#define SCTLR_EL1_NTWI (BIT(16))
532#define SCTLR_EL1_UCT (_BITUL(15)) 532#define SCTLR_EL1_UCT (BIT(15))
533#define SCTLR_EL1_DZE (_BITUL(14)) 533#define SCTLR_EL1_DZE (BIT(14))
534#define SCTLR_EL1_UMA (_BITUL(9)) 534#define SCTLR_EL1_UMA (BIT(9))
535#define SCTLR_EL1_SED (_BITUL(8)) 535#define SCTLR_EL1_SED (BIT(8))
536#define SCTLR_EL1_ITD (_BITUL(7)) 536#define SCTLR_EL1_ITD (BIT(7))
537#define SCTLR_EL1_CP15BEN (_BITUL(5)) 537#define SCTLR_EL1_CP15BEN (BIT(5))
538#define SCTLR_EL1_SA0 (_BITUL(4)) 538#define SCTLR_EL1_SA0 (BIT(4))
539 539
540#define SCTLR_EL1_RES1 ((_BITUL(11)) | (_BITUL(20)) | (_BITUL(22)) | (_BITUL(28)) | \ 540#define SCTLR_EL1_RES1 ((BIT(11)) | (BIT(20)) | (BIT(22)) | (BIT(28)) | \
541 (_BITUL(29))) 541 (BIT(29)))
542#define SCTLR_EL1_RES0 ((_BITUL(6)) | (_BITUL(10)) | (_BITUL(13)) | (_BITUL(17)) | \ 542#define SCTLR_EL1_RES0 ((BIT(6)) | (BIT(10)) | (BIT(13)) | (BIT(17)) | \
543 (_BITUL(27)) | (_BITUL(30)) | (_BITUL(31)) | \ 543 (BIT(27)) | (BIT(30)) | (BIT(31)) | \
544 (0xffffefffUL << 32)) 544 (0xffffefffUL << 32))
545 545
546#ifdef CONFIG_CPU_BIG_ENDIAN 546#ifdef CONFIG_CPU_BIG_ENDIAN
@@ -756,13 +756,13 @@
756#define ZCR_ELx_LEN_SIZE 9 756#define ZCR_ELx_LEN_SIZE 9
757#define ZCR_ELx_LEN_MASK 0x1ff 757#define ZCR_ELx_LEN_MASK 0x1ff
758 758
759#define CPACR_EL1_ZEN_EL1EN (_BITUL(16)) /* enable EL1 access */ 759#define CPACR_EL1_ZEN_EL1EN (BIT(16)) /* enable EL1 access */
760#define CPACR_EL1_ZEN_EL0EN (_BITUL(17)) /* enable EL0 access, if EL1EN set */ 760#define CPACR_EL1_ZEN_EL0EN (BIT(17)) /* enable EL0 access, if EL1EN set */
761#define CPACR_EL1_ZEN (CPACR_EL1_ZEN_EL1EN | CPACR_EL1_ZEN_EL0EN) 761#define CPACR_EL1_ZEN (CPACR_EL1_ZEN_EL1EN | CPACR_EL1_ZEN_EL0EN)
762 762
763 763
764/* Safe value for MPIDR_EL1: Bit31:RES1, Bit30:U:0, Bit24:MT:0 */ 764/* Safe value for MPIDR_EL1: Bit31:RES1, Bit30:U:0, Bit24:MT:0 */
765#define SYS_MPIDR_SAFE_VAL (_BITUL(31)) 765#define SYS_MPIDR_SAFE_VAL (BIT(31))
766 766
767#ifdef __ASSEMBLY__ 767#ifdef __ASSEMBLY__
768 768
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index c8c61b1eb479..9568c116ac7f 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -59,28 +59,6 @@ static inline const struct fault_info *esr_to_debug_fault_info(unsigned int esr)
59 return debug_fault_info + DBG_ESR_EVT(esr); 59 return debug_fault_info + DBG_ESR_EVT(esr);
60} 60}
61 61
62#ifdef CONFIG_KPROBES
63static inline int notify_page_fault(struct pt_regs *regs, unsigned int esr)
64{
65 int ret = 0;
66
67 /* kprobe_running() needs smp_processor_id() */
68 if (!user_mode(regs)) {
69 preempt_disable();
70 if (kprobe_running() && kprobe_fault_handler(regs, esr))
71 ret = 1;
72 preempt_enable();
73 }
74
75 return ret;
76}
77#else
78static inline int notify_page_fault(struct pt_regs *regs, unsigned int esr)
79{
80 return 0;
81}
82#endif
83
84static void data_abort_decode(unsigned int esr) 62static void data_abort_decode(unsigned int esr)
85{ 63{
86 pr_alert("Data abort info:\n"); 64 pr_alert("Data abort info:\n");
@@ -434,7 +412,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
434 unsigned long vm_flags = VM_READ | VM_WRITE; 412 unsigned long vm_flags = VM_READ | VM_WRITE;
435 unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 413 unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
436 414
437 if (notify_page_fault(regs, esr)) 415 if (kprobe_page_fault(regs, esr))
438 return 0; 416 return 0;
439 417
440 /* 418 /*
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 1b49c08dfa2b..e661469cabdd 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -942,6 +942,11 @@ void *__init fixmap_remap_fdt(phys_addr_t dt_phys)
942 return dt_virt; 942 return dt_virt;
943} 943}
944 944
945int __init arch_ioremap_p4d_supported(void)
946{
947 return 0;
948}
949
945int __init arch_ioremap_pud_supported(void) 950int __init arch_ioremap_pud_supported(void)
946{ 951{
947 /* 952 /*
diff --git a/arch/hexagon/include/asm/syscall.h b/arch/hexagon/include/asm/syscall.h
index 4f054b1ddef5..f6e454f18038 100644
--- a/arch/hexagon/include/asm/syscall.h
+++ b/arch/hexagon/include/asm/syscall.h
@@ -9,6 +9,8 @@
9#define _ASM_HEXAGON_SYSCALL_H 9#define _ASM_HEXAGON_SYSCALL_H
10 10
11#include <uapi/linux/audit.h> 11#include <uapi/linux/audit.h>
12#include <linux/err.h>
13#include <asm/ptrace.h>
12 14
13typedef long (*syscall_fn)(unsigned long, unsigned long, 15typedef long (*syscall_fn)(unsigned long, unsigned long,
14 unsigned long, unsigned long, 16 unsigned long, unsigned long,
@@ -31,6 +33,18 @@ static inline void syscall_get_arguments(struct task_struct *task,
31 memcpy(args, &(&regs->r00)[0], 6 * sizeof(args[0])); 33 memcpy(args, &(&regs->r00)[0], 6 * sizeof(args[0]));
32} 34}
33 35
36static inline long syscall_get_error(struct task_struct *task,
37 struct pt_regs *regs)
38{
39 return IS_ERR_VALUE(regs->r00) ? regs->r00 : 0;
40}
41
42static inline long syscall_get_return_value(struct task_struct *task,
43 struct pt_regs *regs)
44{
45 return regs->r00;
46}
47
34static inline int syscall_get_arch(struct task_struct *task) 48static inline int syscall_get_arch(struct task_struct *task)
35{ 49{
36 return AUDIT_ARCH_HEXAGON; 50 return AUDIT_ARCH_HEXAGON;
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index 3c3a283d3172..c2f299fe9e04 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -21,28 +21,6 @@
21 21
22extern int die(char *, struct pt_regs *, long); 22extern int die(char *, struct pt_regs *, long);
23 23
24#ifdef CONFIG_KPROBES
25static inline int notify_page_fault(struct pt_regs *regs, int trap)
26{
27 int ret = 0;
28
29 if (!user_mode(regs)) {
30 /* kprobe_running() needs smp_processor_id() */
31 preempt_disable();
32 if (kprobe_running() && kprobe_fault_handler(regs, trap))
33 ret = 1;
34 preempt_enable();
35 }
36
37 return ret;
38}
39#else
40static inline int notify_page_fault(struct pt_regs *regs, int trap)
41{
42 return 0;
43}
44#endif
45
46/* 24/*
47 * Return TRUE if ADDRESS points at a page in the kernel's mapped segment 25 * Return TRUE if ADDRESS points at a page in the kernel's mapped segment
48 * (inside region 5, on ia64) and that page is present. 26 * (inside region 5, on ia64) and that page is present.
@@ -116,7 +94,7 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
116 /* 94 /*
117 * This is to handle the kprobes on user space access instructions 95 * This is to handle the kprobes on user space access instructions
118 */ 96 */
119 if (notify_page_fault(regs, TRAP_BRKPT)) 97 if (kprobe_page_fault(regs, TRAP_BRKPT))
120 return; 98 return;
121 99
122 if (user_mode(regs)) 100 if (user_mode(regs))
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index 29997e42480e..1790274c27eb 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -149,8 +149,6 @@ static inline void *isa_bus_to_virt(unsigned long address)
149 return phys_to_virt(address); 149 return phys_to_virt(address);
150} 150}
151 151
152#define isa_page_to_bus page_to_phys
153
154/* 152/*
155 * However PCI ones are not necessarily 1:1 and therefore these interfaces 153 * However PCI ones are not necessarily 1:1 and therefore these interfaces
156 * are forbidden in portable PCI drivers. 154 * are forbidden in portable PCI drivers.
diff --git a/arch/mips/include/asm/kprobes.h b/arch/mips/include/asm/kprobes.h
index 3cf8e4d5fa28..68b1e5d458cf 100644
--- a/arch/mips/include/asm/kprobes.h
+++ b/arch/mips/include/asm/kprobes.h
@@ -41,6 +41,7 @@ do { \
41#define kretprobe_blacklist_size 0 41#define kretprobe_blacklist_size 0
42 42
43void arch_remove_kprobe(struct kprobe *p); 43void arch_remove_kprobe(struct kprobe *p);
44int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
44 45
45/* Architecture specific copy of original instruction*/ 46/* Architecture specific copy of original instruction*/
46struct arch_specific_insn { 47struct arch_specific_insn {
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
index acf80ae0a430..83bb439597d8 100644
--- a/arch/mips/include/asm/syscall.h
+++ b/arch/mips/include/asm/syscall.h
@@ -89,6 +89,12 @@ static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
89 unreachable(); 89 unreachable();
90} 90}
91 91
92static inline long syscall_get_error(struct task_struct *task,
93 struct pt_regs *regs)
94{
95 return regs->regs[7] ? -regs->regs[2] : 0;
96}
97
92static inline long syscall_get_return_value(struct task_struct *task, 98static inline long syscall_get_return_value(struct task_struct *task,
93 struct pt_regs *regs) 99 struct pt_regs *regs)
94{ 100{
diff --git a/arch/mips/kernel/kprobes.c b/arch/mips/kernel/kprobes.c
index 81ba1d3c367c..6cfae2411c04 100644
--- a/arch/mips/kernel/kprobes.c
+++ b/arch/mips/kernel/kprobes.c
@@ -398,7 +398,7 @@ out:
398 return 1; 398 return 1;
399} 399}
400 400
401static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) 401int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
402{ 402{
403 struct kprobe *cur = kprobe_running(); 403 struct kprobe *cur = kprobe_running();
404 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 404 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
index 899b2fb4b52f..7b5180d78e20 100644
--- a/arch/nds32/include/asm/syscall.h
+++ b/arch/nds32/include/asm/syscall.h
@@ -26,7 +26,8 @@ struct pt_regs;
26 * 26 *
27 * It's only valid to call this when @task is known to be blocked. 27 * It's only valid to call this when @task is known to be blocked.
28 */ 28 */
29int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) 29static inline int
30syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
30{ 31{
31 return regs->syscallno; 32 return regs->syscallno;
32} 33}
@@ -47,7 +48,8 @@ int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
47 * system call instruction. This may not be the same as what the 48 * system call instruction. This may not be the same as what the
48 * register state looked like at system call entry tracing. 49 * register state looked like at system call entry tracing.
49 */ 50 */
50void syscall_rollback(struct task_struct *task, struct pt_regs *regs) 51static inline void
52syscall_rollback(struct task_struct *task, struct pt_regs *regs)
51{ 53{
52 regs->uregs[0] = regs->orig_r0; 54 regs->uregs[0] = regs->orig_r0;
53} 55}
@@ -62,7 +64,8 @@ void syscall_rollback(struct task_struct *task, struct pt_regs *regs)
62 * It's only valid to call this when @task is stopped for tracing on exit 64 * It's only valid to call this when @task is stopped for tracing on exit
63 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT. 65 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
64 */ 66 */
65long syscall_get_error(struct task_struct *task, struct pt_regs *regs) 67static inline long
68syscall_get_error(struct task_struct *task, struct pt_regs *regs)
66{ 69{
67 unsigned long error = regs->uregs[0]; 70 unsigned long error = regs->uregs[0];
68 return IS_ERR_VALUE(error) ? error : 0; 71 return IS_ERR_VALUE(error) ? error : 0;
@@ -79,7 +82,8 @@ long syscall_get_error(struct task_struct *task, struct pt_regs *regs)
79 * It's only valid to call this when @task is stopped for tracing on exit 82 * It's only valid to call this when @task is stopped for tracing on exit
80 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT. 83 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
81 */ 84 */
82long syscall_get_return_value(struct task_struct *task, struct pt_regs *regs) 85static inline long
86syscall_get_return_value(struct task_struct *task, struct pt_regs *regs)
83{ 87{
84 return regs->uregs[0]; 88 return regs->uregs[0];
85} 89}
@@ -99,8 +103,9 @@ long syscall_get_return_value(struct task_struct *task, struct pt_regs *regs)
99 * It's only valid to call this when @task is stopped for tracing on exit 103 * It's only valid to call this when @task is stopped for tracing on exit
100 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT. 104 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
101 */ 105 */
102void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, 106static inline void
103 int error, long val) 107syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
108 int error, long val)
104{ 109{
105 regs->uregs[0] = (long)error ? error : val; 110 regs->uregs[0] = (long)error ? error : val;
106} 111}
@@ -118,8 +123,9 @@ void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
118 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT. 123 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
119 */ 124 */
120#define SYSCALL_MAX_ARGS 6 125#define SYSCALL_MAX_ARGS 6
121void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, 126static inline void
122 unsigned long *args) 127syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
128 unsigned long *args)
123{ 129{
124 args[0] = regs->orig_r0; 130 args[0] = regs->orig_r0;
125 args++; 131 args++;
@@ -138,8 +144,9 @@ void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
138 * It's only valid to call this when @task is stopped for tracing on 144 * It's only valid to call this when @task is stopped for tracing on
139 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT. 145 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
140 */ 146 */
141void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs, 147static inline void
142 const unsigned long *args) 148syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
149 const unsigned long *args)
143{ 150{
144 regs->orig_r0 = args[0]; 151 regs->orig_r0 = args[0];
145 args++; 152 args++;
diff --git a/arch/parisc/include/asm/syscall.h b/arch/parisc/include/asm/syscall.h
index 80757e43cf2c..00b127a5e09b 100644
--- a/arch/parisc/include/asm/syscall.h
+++ b/arch/parisc/include/asm/syscall.h
@@ -29,6 +29,13 @@ static inline void syscall_get_arguments(struct task_struct *tsk,
29 args[0] = regs->gr[26]; 29 args[0] = regs->gr[26];
30} 30}
31 31
32static inline long syscall_get_error(struct task_struct *task,
33 struct pt_regs *regs)
34{
35 unsigned long error = regs->gr[28];
36 return IS_ERR_VALUE(error) ? error : 0;
37}
38
32static inline long syscall_get_return_value(struct task_struct *task, 39static inline long syscall_get_return_value(struct task_struct *task,
33 struct pt_regs *regs) 40 struct pt_regs *regs)
34{ 41{
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index f516796dd819..d8dcd8820369 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -129,6 +129,7 @@ config PPC
129 select ARCH_HAS_MMIOWB if PPC64 129 select ARCH_HAS_MMIOWB if PPC64
130 select ARCH_HAS_PHYS_TO_DMA 130 select ARCH_HAS_PHYS_TO_DMA
131 select ARCH_HAS_PMEM_API if PPC64 131 select ARCH_HAS_PMEM_API if PPC64
132 select ARCH_HAS_PTE_DEVMAP if PPC_BOOK3S_64
132 select ARCH_HAS_PTE_SPECIAL 133 select ARCH_HAS_PTE_SPECIAL
133 select ARCH_HAS_MEMBARRIER_CALLBACKS 134 select ARCH_HAS_MEMBARRIER_CALLBACKS
134 select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE && PPC64 135 select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE && PPC64
@@ -136,7 +137,6 @@ config PPC
136 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST 137 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
137 select ARCH_HAS_UACCESS_FLUSHCACHE if PPC64 138 select ARCH_HAS_UACCESS_FLUSHCACHE if PPC64
138 select ARCH_HAS_UBSAN_SANITIZE_ALL 139 select ARCH_HAS_UBSAN_SANITIZE_ALL
139 select ARCH_HAS_ZONE_DEVICE if PPC_BOOK3S_64
140 select ARCH_HAVE_NMI_SAFE_CMPXCHG 140 select ARCH_HAVE_NMI_SAFE_CMPXCHG
141 select ARCH_KEEP_MEMBLOCK 141 select ARCH_KEEP_MEMBLOCK
142 select ARCH_MIGHT_HAVE_PC_PARPORT 142 select ARCH_MIGHT_HAVE_PC_PARPORT
diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h
index 62e6ea0a7650..8308f32e9782 100644
--- a/arch/powerpc/include/asm/book3s/64/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
@@ -90,7 +90,6 @@
90#define _PAGE_SOFT_DIRTY _RPAGE_SW3 /* software: software dirty tracking */ 90#define _PAGE_SOFT_DIRTY _RPAGE_SW3 /* software: software dirty tracking */
91#define _PAGE_SPECIAL _RPAGE_SW2 /* software: special page */ 91#define _PAGE_SPECIAL _RPAGE_SW2 /* software: special page */
92#define _PAGE_DEVMAP _RPAGE_SW1 /* software: ZONE_DEVICE page */ 92#define _PAGE_DEVMAP _RPAGE_SW1 /* software: ZONE_DEVICE page */
93#define __HAVE_ARCH_PTE_DEVMAP
94 93
95/* 94/*
96 * Drivers request for cache inhibited pte mapping using _PAGE_NO_CACHE 95 * Drivers request for cache inhibited pte mapping using _PAGE_NO_CACHE
diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h
index 81abcf6a737b..38d62acfdce7 100644
--- a/arch/powerpc/include/asm/syscall.h
+++ b/arch/powerpc/include/asm/syscall.h
@@ -35,6 +35,16 @@ static inline void syscall_rollback(struct task_struct *task,
35 regs->gpr[3] = regs->orig_gpr3; 35 regs->gpr[3] = regs->orig_gpr3;
36} 36}
37 37
38static inline long syscall_get_error(struct task_struct *task,
39 struct pt_regs *regs)
40{
41 /*
42 * If the system call failed,
43 * regs->gpr[3] contains a positive ERRORCODE.
44 */
45 return (regs->ccr & 0x10000000UL) ? -regs->gpr[3] : 0;
46}
47
38static inline long syscall_get_return_value(struct task_struct *task, 48static inline long syscall_get_return_value(struct task_struct *task,
39 struct pt_regs *regs) 49 struct pt_regs *regs)
40{ 50{
diff --git a/arch/powerpc/include/uapi/asm/mman.h b/arch/powerpc/include/uapi/asm/mman.h
index 65065ce32814..c0c737215b00 100644
--- a/arch/powerpc/include/uapi/asm/mman.h
+++ b/arch/powerpc/include/uapi/asm/mman.h
@@ -21,15 +21,11 @@
21#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 21#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
22#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 22#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
23 23
24
24#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ 25#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */
25#define MCL_FUTURE 0x4000 /* lock all additions to address space */ 26#define MCL_FUTURE 0x4000 /* lock all additions to address space */
26#define MCL_ONFAULT 0x8000 /* lock all pages that are faulted in */ 27#define MCL_ONFAULT 0x8000 /* lock all pages that are faulted in */
27 28
28#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
29#define MAP_NONBLOCK 0x10000 /* do not block on IO */
30#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
31#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
32
33/* Override any generic PKEY permission defines */ 29/* Override any generic PKEY permission defines */
34#define PKEY_DISABLE_EXECUTE 0x4 30#define PKEY_DISABLE_EXECUTE 0x4
35#undef PKEY_ACCESS_MASK 31#undef PKEY_ACCESS_MASK
diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
index 5bf05cc774e2..e99a14798ab0 100644
--- a/arch/powerpc/kvm/book3s_64_vio.c
+++ b/arch/powerpc/kvm/book3s_64_vio.c
@@ -19,6 +19,7 @@
19#include <linux/anon_inodes.h> 19#include <linux/anon_inodes.h>
20#include <linux/iommu.h> 20#include <linux/iommu.h>
21#include <linux/file.h> 21#include <linux/file.h>
22#include <linux/mm.h>
22 23
23#include <asm/kvm_ppc.h> 24#include <asm/kvm_ppc.h>
24#include <asm/kvm_book3s.h> 25#include <asm/kvm_book3s.h>
@@ -45,43 +46,6 @@ static unsigned long kvmppc_stt_pages(unsigned long tce_pages)
45 return tce_pages + ALIGN(stt_bytes, PAGE_SIZE) / PAGE_SIZE; 46 return tce_pages + ALIGN(stt_bytes, PAGE_SIZE) / PAGE_SIZE;
46} 47}
47 48
48static long kvmppc_account_memlimit(unsigned long stt_pages, bool inc)
49{
50 long ret = 0;
51
52 if (!current || !current->mm)
53 return ret; /* process exited */
54
55 down_write(&current->mm->mmap_sem);
56
57 if (inc) {
58 unsigned long locked, lock_limit;
59
60 locked = current->mm->locked_vm + stt_pages;
61 lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
62 if (locked > lock_limit && !capable(CAP_IPC_LOCK))
63 ret = -ENOMEM;
64 else
65 current->mm->locked_vm += stt_pages;
66 } else {
67 if (WARN_ON_ONCE(stt_pages > current->mm->locked_vm))
68 stt_pages = current->mm->locked_vm;
69
70 current->mm->locked_vm -= stt_pages;
71 }
72
73 pr_debug("[%d] RLIMIT_MEMLOCK KVM %c%ld %ld/%ld%s\n", current->pid,
74 inc ? '+' : '-',
75 stt_pages << PAGE_SHIFT,
76 current->mm->locked_vm << PAGE_SHIFT,
77 rlimit(RLIMIT_MEMLOCK),
78 ret ? " - exceeded" : "");
79
80 up_write(&current->mm->mmap_sem);
81
82 return ret;
83}
84
85static void kvm_spapr_tce_iommu_table_free(struct rcu_head *head) 49static void kvm_spapr_tce_iommu_table_free(struct rcu_head *head)
86{ 50{
87 struct kvmppc_spapr_tce_iommu_table *stit = container_of(head, 51 struct kvmppc_spapr_tce_iommu_table *stit = container_of(head,
@@ -291,7 +255,7 @@ static int kvm_spapr_tce_release(struct inode *inode, struct file *filp)
291 255
292 kvm_put_kvm(stt->kvm); 256 kvm_put_kvm(stt->kvm);
293 257
294 kvmppc_account_memlimit( 258 account_locked_vm(current->mm,
295 kvmppc_stt_pages(kvmppc_tce_pages(stt->size)), false); 259 kvmppc_stt_pages(kvmppc_tce_pages(stt->size)), false);
296 call_rcu(&stt->rcu, release_spapr_tce_table); 260 call_rcu(&stt->rcu, release_spapr_tce_table);
297 261
@@ -316,7 +280,7 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
316 return -EINVAL; 280 return -EINVAL;
317 281
318 npages = kvmppc_tce_pages(size); 282 npages = kvmppc_tce_pages(size);
319 ret = kvmppc_account_memlimit(kvmppc_stt_pages(npages), true); 283 ret = account_locked_vm(current->mm, kvmppc_stt_pages(npages), true);
320 if (ret) 284 if (ret)
321 return ret; 285 return ret;
322 286
@@ -362,7 +326,7 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
362 326
363 kfree(stt); 327 kfree(stt);
364 fail_acct: 328 fail_acct:
365 kvmppc_account_memlimit(kvmppc_stt_pages(npages), false); 329 account_locked_vm(current->mm, kvmppc_stt_pages(npages), false);
366 return ret; 330 return ret;
367} 331}
368 332
diff --git a/arch/powerpc/mm/book3s64/iommu_api.c b/arch/powerpc/mm/book3s64/iommu_api.c
index 90ee3a89722c..b056cae3388b 100644
--- a/arch/powerpc/mm/book3s64/iommu_api.c
+++ b/arch/powerpc/mm/book3s64/iommu_api.c
@@ -14,6 +14,7 @@
14#include <linux/hugetlb.h> 14#include <linux/hugetlb.h>
15#include <linux/swap.h> 15#include <linux/swap.h>
16#include <linux/sizes.h> 16#include <linux/sizes.h>
17#include <linux/mm.h>
17#include <asm/mmu_context.h> 18#include <asm/mmu_context.h>
18#include <asm/pte-walk.h> 19#include <asm/pte-walk.h>
19#include <linux/mm_inline.h> 20#include <linux/mm_inline.h>
@@ -46,40 +47,6 @@ struct mm_iommu_table_group_mem_t {
46 u64 dev_hpa; /* Device memory base address */ 47 u64 dev_hpa; /* Device memory base address */
47}; 48};
48 49
49static long mm_iommu_adjust_locked_vm(struct mm_struct *mm,
50 unsigned long npages, bool incr)
51{
52 long ret = 0, locked, lock_limit;
53
54 if (!npages)
55 return 0;
56
57 down_write(&mm->mmap_sem);
58
59 if (incr) {
60 locked = mm->locked_vm + npages;
61 lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
62 if (locked > lock_limit && !capable(CAP_IPC_LOCK))
63 ret = -ENOMEM;
64 else
65 mm->locked_vm += npages;
66 } else {
67 if (WARN_ON_ONCE(npages > mm->locked_vm))
68 npages = mm->locked_vm;
69 mm->locked_vm -= npages;
70 }
71
72 pr_debug("[%d] RLIMIT_MEMLOCK HASH64 %c%ld %ld/%ld\n",
73 current ? current->pid : 0,
74 incr ? '+' : '-',
75 npages << PAGE_SHIFT,
76 mm->locked_vm << PAGE_SHIFT,
77 rlimit(RLIMIT_MEMLOCK));
78 up_write(&mm->mmap_sem);
79
80 return ret;
81}
82
83bool mm_iommu_preregistered(struct mm_struct *mm) 50bool mm_iommu_preregistered(struct mm_struct *mm)
84{ 51{
85 return !list_empty(&mm->context.iommu_group_mem_list); 52 return !list_empty(&mm->context.iommu_group_mem_list);
@@ -96,7 +63,7 @@ static long mm_iommu_do_alloc(struct mm_struct *mm, unsigned long ua,
96 unsigned long entry, chunk; 63 unsigned long entry, chunk;
97 64
98 if (dev_hpa == MM_IOMMU_TABLE_INVALID_HPA) { 65 if (dev_hpa == MM_IOMMU_TABLE_INVALID_HPA) {
99 ret = mm_iommu_adjust_locked_vm(mm, entries, true); 66 ret = account_locked_vm(mm, entries, true);
100 if (ret) 67 if (ret)
101 return ret; 68 return ret;
102 69
@@ -211,7 +178,7 @@ free_exit:
211 kfree(mem); 178 kfree(mem);
212 179
213unlock_exit: 180unlock_exit:
214 mm_iommu_adjust_locked_vm(mm, locked_entries, false); 181 account_locked_vm(mm, locked_entries, false);
215 182
216 return ret; 183 return ret;
217} 184}
@@ -311,7 +278,7 @@ long mm_iommu_put(struct mm_struct *mm, struct mm_iommu_table_group_mem_t *mem)
311unlock_exit: 278unlock_exit:
312 mutex_unlock(&mem_list_mutex); 279 mutex_unlock(&mem_list_mutex);
313 280
314 mm_iommu_adjust_locked_vm(mm, unlock_entries, false); 281 account_locked_vm(mm, unlock_entries, false);
315 282
316 return ret; 283 return ret;
317} 284}
diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c
index 65c2ba1e1783..b4ca9e95e678 100644
--- a/arch/powerpc/mm/book3s64/radix_pgtable.c
+++ b/arch/powerpc/mm/book3s64/radix_pgtable.c
@@ -1237,3 +1237,8 @@ int radix__ioremap_range(unsigned long ea, phys_addr_t pa, unsigned long size,
1237 return 0; 1237 return 0;
1238 } 1238 }
1239} 1239}
1240
1241int __init arch_ioremap_p4d_supported(void)
1242{
1243 return 0;
1244}
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index d989592b6fc8..8432c281de92 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -42,26 +42,6 @@
42#include <asm/debug.h> 42#include <asm/debug.h>
43#include <asm/kup.h> 43#include <asm/kup.h>
44 44
45static inline bool notify_page_fault(struct pt_regs *regs)
46{
47 bool ret = false;
48
49#ifdef CONFIG_KPROBES
50 /* kprobe_running() needs smp_processor_id() */
51 if (!user_mode(regs)) {
52 preempt_disable();
53 if (kprobe_running() && kprobe_fault_handler(regs, 11))
54 ret = true;
55 preempt_enable();
56 }
57#endif /* CONFIG_KPROBES */
58
59 if (unlikely(debugger_fault_handler(regs)))
60 ret = true;
61
62 return ret;
63}
64
65/* 45/*
66 * Check whether the instruction inst is a store using 46 * Check whether the instruction inst is a store using
67 * an update addressing form which will update r1. 47 * an update addressing form which will update r1.
@@ -461,8 +441,9 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,
461 int is_write = page_fault_is_write(error_code); 441 int is_write = page_fault_is_write(error_code);
462 vm_fault_t fault, major = 0; 442 vm_fault_t fault, major = 0;
463 bool must_retry = false; 443 bool must_retry = false;
444 bool kprobe_fault = kprobe_page_fault(regs, 11);
464 445
465 if (notify_page_fault(regs)) 446 if (unlikely(debugger_fault_handler(regs) || kprobe_fault))
466 return 0; 447 return 0;
467 448
468 if (unlikely(page_fault_is_bad(error_code))) { 449 if (unlikely(page_fault_is_bad(error_code))) {
diff --git a/arch/s390/include/asm/ctl_reg.h b/arch/s390/include/asm/ctl_reg.h
index 0cf6b53587db..60f907516335 100644
--- a/arch/s390/include/asm/ctl_reg.h
+++ b/arch/s390/include/asm/ctl_reg.h
@@ -8,27 +8,27 @@
8#ifndef __ASM_CTL_REG_H 8#ifndef __ASM_CTL_REG_H
9#define __ASM_CTL_REG_H 9#define __ASM_CTL_REG_H
10 10
11#include <linux/const.h> 11#include <linux/bits.h>
12 12
13#define CR0_CLOCK_COMPARATOR_SIGN _BITUL(63 - 10) 13#define CR0_CLOCK_COMPARATOR_SIGN BIT(63 - 10)
14#define CR0_EMERGENCY_SIGNAL_SUBMASK _BITUL(63 - 49) 14#define CR0_EMERGENCY_SIGNAL_SUBMASK BIT(63 - 49)
15#define CR0_EXTERNAL_CALL_SUBMASK _BITUL(63 - 50) 15#define CR0_EXTERNAL_CALL_SUBMASK BIT(63 - 50)
16#define CR0_CLOCK_COMPARATOR_SUBMASK _BITUL(63 - 52) 16#define CR0_CLOCK_COMPARATOR_SUBMASK BIT(63 - 52)
17#define CR0_CPU_TIMER_SUBMASK _BITUL(63 - 53) 17#define CR0_CPU_TIMER_SUBMASK BIT(63 - 53)
18#define CR0_SERVICE_SIGNAL_SUBMASK _BITUL(63 - 54) 18#define CR0_SERVICE_SIGNAL_SUBMASK BIT(63 - 54)
19#define CR0_UNUSED_56 _BITUL(63 - 56) 19#define CR0_UNUSED_56 BIT(63 - 56)
20#define CR0_INTERRUPT_KEY_SUBMASK _BITUL(63 - 57) 20#define CR0_INTERRUPT_KEY_SUBMASK BIT(63 - 57)
21#define CR0_MEASUREMENT_ALERT_SUBMASK _BITUL(63 - 58) 21#define CR0_MEASUREMENT_ALERT_SUBMASK BIT(63 - 58)
22 22
23#define CR2_GUARDED_STORAGE _BITUL(63 - 59) 23#define CR2_GUARDED_STORAGE BIT(63 - 59)
24 24
25#define CR14_UNUSED_32 _BITUL(63 - 32) 25#define CR14_UNUSED_32 BIT(63 - 32)
26#define CR14_UNUSED_33 _BITUL(63 - 33) 26#define CR14_UNUSED_33 BIT(63 - 33)
27#define CR14_CHANNEL_REPORT_SUBMASK _BITUL(63 - 35) 27#define CR14_CHANNEL_REPORT_SUBMASK BIT(63 - 35)
28#define CR14_RECOVERY_SUBMASK _BITUL(63 - 36) 28#define CR14_RECOVERY_SUBMASK BIT(63 - 36)
29#define CR14_DEGRADATION_SUBMASK _BITUL(63 - 37) 29#define CR14_DEGRADATION_SUBMASK BIT(63 - 37)
30#define CR14_EXTERNAL_DAMAGE_SUBMASK _BITUL(63 - 38) 30#define CR14_EXTERNAL_DAMAGE_SUBMASK BIT(63 - 38)
31#define CR14_WARNING_SUBMASK _BITUL(63 - 39) 31#define CR14_WARNING_SUBMASK BIT(63 - 39)
32 32
33#ifndef __ASSEMBLY__ 33#ifndef __ASSEMBLY__
34 34
diff --git a/arch/s390/include/asm/nmi.h b/arch/s390/include/asm/nmi.h
index 1e5dc4537bf2..b160da8fa14b 100644
--- a/arch/s390/include/asm/nmi.h
+++ b/arch/s390/include/asm/nmi.h
@@ -12,7 +12,7 @@
12#ifndef _ASM_S390_NMI_H 12#ifndef _ASM_S390_NMI_H
13#define _ASM_S390_NMI_H 13#define _ASM_S390_NMI_H
14 14
15#include <linux/const.h> 15#include <linux/bits.h>
16#include <linux/types.h> 16#include <linux/types.h>
17 17
18#define MCIC_SUBCLASS_MASK (1ULL<<63 | 1ULL<<62 | 1ULL<<61 | \ 18#define MCIC_SUBCLASS_MASK (1ULL<<63 | 1ULL<<62 | 1ULL<<61 | \
@@ -20,15 +20,15 @@
20 1ULL<<55 | 1ULL<<54 | 1ULL<<53 | \ 20 1ULL<<55 | 1ULL<<54 | 1ULL<<53 | \
21 1ULL<<52 | 1ULL<<47 | 1ULL<<46 | \ 21 1ULL<<52 | 1ULL<<47 | 1ULL<<46 | \
22 1ULL<<45 | 1ULL<<44) 22 1ULL<<45 | 1ULL<<44)
23#define MCCK_CODE_SYSTEM_DAMAGE _BITUL(63) 23#define MCCK_CODE_SYSTEM_DAMAGE BIT(63)
24#define MCCK_CODE_EXT_DAMAGE _BITUL(63 - 5) 24#define MCCK_CODE_EXT_DAMAGE BIT(63 - 5)
25#define MCCK_CODE_CP _BITUL(63 - 9) 25#define MCCK_CODE_CP BIT(63 - 9)
26#define MCCK_CODE_CPU_TIMER_VALID _BITUL(63 - 46) 26#define MCCK_CODE_CPU_TIMER_VALID BIT(63 - 46)
27#define MCCK_CODE_PSW_MWP_VALID _BITUL(63 - 20) 27#define MCCK_CODE_PSW_MWP_VALID BIT(63 - 20)
28#define MCCK_CODE_PSW_IA_VALID _BITUL(63 - 23) 28#define MCCK_CODE_PSW_IA_VALID BIT(63 - 23)
29#define MCCK_CODE_CR_VALID _BITUL(63 - 29) 29#define MCCK_CODE_CR_VALID BIT(63 - 29)
30#define MCCK_CODE_GS_VALID _BITUL(63 - 36) 30#define MCCK_CODE_GS_VALID BIT(63 - 36)
31#define MCCK_CODE_FC_VALID _BITUL(63 - 43) 31#define MCCK_CODE_FC_VALID BIT(63 - 43)
32 32
33#ifndef __ASSEMBLY__ 33#ifndef __ASSEMBLY__
34 34
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index 14883b1562e0..d56c519bc696 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -12,7 +12,7 @@
12#ifndef __ASM_S390_PROCESSOR_H 12#ifndef __ASM_S390_PROCESSOR_H
13#define __ASM_S390_PROCESSOR_H 13#define __ASM_S390_PROCESSOR_H
14 14
15#include <linux/const.h> 15#include <linux/bits.h>
16 16
17#define CIF_MCCK_PENDING 0 /* machine check handling is pending */ 17#define CIF_MCCK_PENDING 0 /* machine check handling is pending */
18#define CIF_ASCE_PRIMARY 1 /* primary asce needs fixup / uaccess */ 18#define CIF_ASCE_PRIMARY 1 /* primary asce needs fixup / uaccess */
@@ -24,15 +24,15 @@
24#define CIF_MCCK_GUEST 7 /* machine check happening in guest */ 24#define CIF_MCCK_GUEST 7 /* machine check happening in guest */
25#define CIF_DEDICATED_CPU 8 /* this CPU is dedicated */ 25#define CIF_DEDICATED_CPU 8 /* this CPU is dedicated */
26 26
27#define _CIF_MCCK_PENDING _BITUL(CIF_MCCK_PENDING) 27#define _CIF_MCCK_PENDING BIT(CIF_MCCK_PENDING)
28#define _CIF_ASCE_PRIMARY _BITUL(CIF_ASCE_PRIMARY) 28#define _CIF_ASCE_PRIMARY BIT(CIF_ASCE_PRIMARY)
29#define _CIF_ASCE_SECONDARY _BITUL(CIF_ASCE_SECONDARY) 29#define _CIF_ASCE_SECONDARY BIT(CIF_ASCE_SECONDARY)
30#define _CIF_NOHZ_DELAY _BITUL(CIF_NOHZ_DELAY) 30#define _CIF_NOHZ_DELAY BIT(CIF_NOHZ_DELAY)
31#define _CIF_FPU _BITUL(CIF_FPU) 31#define _CIF_FPU BIT(CIF_FPU)
32#define _CIF_IGNORE_IRQ _BITUL(CIF_IGNORE_IRQ) 32#define _CIF_IGNORE_IRQ BIT(CIF_IGNORE_IRQ)
33#define _CIF_ENABLED_WAIT _BITUL(CIF_ENABLED_WAIT) 33#define _CIF_ENABLED_WAIT BIT(CIF_ENABLED_WAIT)
34#define _CIF_MCCK_GUEST _BITUL(CIF_MCCK_GUEST) 34#define _CIF_MCCK_GUEST BIT(CIF_MCCK_GUEST)
35#define _CIF_DEDICATED_CPU _BITUL(CIF_DEDICATED_CPU) 35#define _CIF_DEDICATED_CPU BIT(CIF_DEDICATED_CPU)
36 36
37#ifndef __ASSEMBLY__ 37#ifndef __ASSEMBLY__
38 38
diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h
index 6f70d81c40f2..f009a13afe71 100644
--- a/arch/s390/include/asm/ptrace.h
+++ b/arch/s390/include/asm/ptrace.h
@@ -7,7 +7,7 @@
7#ifndef _S390_PTRACE_H 7#ifndef _S390_PTRACE_H
8#define _S390_PTRACE_H 8#define _S390_PTRACE_H
9 9
10#include <linux/const.h> 10#include <linux/bits.h>
11#include <uapi/asm/ptrace.h> 11#include <uapi/asm/ptrace.h>
12 12
13#define PIF_SYSCALL 0 /* inside a system call */ 13#define PIF_SYSCALL 0 /* inside a system call */
@@ -15,10 +15,10 @@
15#define PIF_SYSCALL_RESTART 2 /* restart the current system call */ 15#define PIF_SYSCALL_RESTART 2 /* restart the current system call */
16#define PIF_GUEST_FAULT 3 /* indicates program check in sie64a */ 16#define PIF_GUEST_FAULT 3 /* indicates program check in sie64a */
17 17
18#define _PIF_SYSCALL _BITUL(PIF_SYSCALL) 18#define _PIF_SYSCALL BIT(PIF_SYSCALL)
19#define _PIF_PER_TRAP _BITUL(PIF_PER_TRAP) 19#define _PIF_PER_TRAP BIT(PIF_PER_TRAP)
20#define _PIF_SYSCALL_RESTART _BITUL(PIF_SYSCALL_RESTART) 20#define _PIF_SYSCALL_RESTART BIT(PIF_SYSCALL_RESTART)
21#define _PIF_GUEST_FAULT _BITUL(PIF_GUEST_FAULT) 21#define _PIF_GUEST_FAULT BIT(PIF_GUEST_FAULT)
22 22
23#ifndef __ASSEMBLY__ 23#ifndef __ASSEMBLY__
24 24
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
index 925889d360c1..82deb8fc8319 100644
--- a/arch/s390/include/asm/setup.h
+++ b/arch/s390/include/asm/setup.h
@@ -6,7 +6,7 @@
6#ifndef _ASM_S390_SETUP_H 6#ifndef _ASM_S390_SETUP_H
7#define _ASM_S390_SETUP_H 7#define _ASM_S390_SETUP_H
8 8
9#include <linux/const.h> 9#include <linux/bits.h>
10#include <uapi/asm/setup.h> 10#include <uapi/asm/setup.h>
11 11
12#define EP_OFFSET 0x10008 12#define EP_OFFSET 0x10008
@@ -21,25 +21,25 @@
21 * Machine features detected in early.c 21 * Machine features detected in early.c
22 */ 22 */
23 23
24#define MACHINE_FLAG_VM _BITUL(0) 24#define MACHINE_FLAG_VM BIT(0)
25#define MACHINE_FLAG_KVM _BITUL(1) 25#define MACHINE_FLAG_KVM BIT(1)
26#define MACHINE_FLAG_LPAR _BITUL(2) 26#define MACHINE_FLAG_LPAR BIT(2)
27#define MACHINE_FLAG_DIAG9C _BITUL(3) 27#define MACHINE_FLAG_DIAG9C BIT(3)
28#define MACHINE_FLAG_ESOP _BITUL(4) 28#define MACHINE_FLAG_ESOP BIT(4)
29#define MACHINE_FLAG_IDTE _BITUL(5) 29#define MACHINE_FLAG_IDTE BIT(5)
30#define MACHINE_FLAG_DIAG44 _BITUL(6) 30#define MACHINE_FLAG_DIAG44 BIT(6)
31#define MACHINE_FLAG_EDAT1 _BITUL(7) 31#define MACHINE_FLAG_EDAT1 BIT(7)
32#define MACHINE_FLAG_EDAT2 _BITUL(8) 32#define MACHINE_FLAG_EDAT2 BIT(8)
33#define MACHINE_FLAG_TOPOLOGY _BITUL(10) 33#define MACHINE_FLAG_TOPOLOGY BIT(10)
34#define MACHINE_FLAG_TE _BITUL(11) 34#define MACHINE_FLAG_TE BIT(11)
35#define MACHINE_FLAG_TLB_LC _BITUL(12) 35#define MACHINE_FLAG_TLB_LC BIT(12)
36#define MACHINE_FLAG_VX _BITUL(13) 36#define MACHINE_FLAG_VX BIT(13)
37#define MACHINE_FLAG_TLB_GUEST _BITUL(14) 37#define MACHINE_FLAG_TLB_GUEST BIT(14)
38#define MACHINE_FLAG_NX _BITUL(15) 38#define MACHINE_FLAG_NX BIT(15)
39#define MACHINE_FLAG_GS _BITUL(16) 39#define MACHINE_FLAG_GS BIT(16)
40#define MACHINE_FLAG_SCC _BITUL(17) 40#define MACHINE_FLAG_SCC BIT(17)
41 41
42#define LPP_MAGIC _BITUL(31) 42#define LPP_MAGIC BIT(31)
43#define LPP_PID_MASK _AC(0xffffffff, UL) 43#define LPP_PID_MASK _AC(0xffffffff, UL)
44 44
45/* Offsets to entry points in kernel/head.S */ 45/* Offsets to entry points in kernel/head.S */
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h
index ce4e17c9aad6..e582fbe59e20 100644
--- a/arch/s390/include/asm/thread_info.h
+++ b/arch/s390/include/asm/thread_info.h
@@ -8,7 +8,7 @@
8#ifndef _ASM_THREAD_INFO_H 8#ifndef _ASM_THREAD_INFO_H
9#define _ASM_THREAD_INFO_H 9#define _ASM_THREAD_INFO_H
10 10
11#include <linux/const.h> 11#include <linux/bits.h>
12 12
13/* 13/*
14 * General size of kernel stacks 14 * General size of kernel stacks
@@ -82,21 +82,21 @@ void arch_setup_new_exec(void);
82#define TIF_SECCOMP 26 /* secure computing */ 82#define TIF_SECCOMP 26 /* secure computing */
83#define TIF_SYSCALL_TRACEPOINT 27 /* syscall tracepoint instrumentation */ 83#define TIF_SYSCALL_TRACEPOINT 27 /* syscall tracepoint instrumentation */
84 84
85#define _TIF_NOTIFY_RESUME _BITUL(TIF_NOTIFY_RESUME) 85#define _TIF_NOTIFY_RESUME BIT(TIF_NOTIFY_RESUME)
86#define _TIF_SIGPENDING _BITUL(TIF_SIGPENDING) 86#define _TIF_SIGPENDING BIT(TIF_SIGPENDING)
87#define _TIF_NEED_RESCHED _BITUL(TIF_NEED_RESCHED) 87#define _TIF_NEED_RESCHED BIT(TIF_NEED_RESCHED)
88#define _TIF_UPROBE _BITUL(TIF_UPROBE) 88#define _TIF_UPROBE BIT(TIF_UPROBE)
89#define _TIF_GUARDED_STORAGE _BITUL(TIF_GUARDED_STORAGE) 89#define _TIF_GUARDED_STORAGE BIT(TIF_GUARDED_STORAGE)
90#define _TIF_PATCH_PENDING _BITUL(TIF_PATCH_PENDING) 90#define _TIF_PATCH_PENDING BIT(TIF_PATCH_PENDING)
91#define _TIF_ISOLATE_BP _BITUL(TIF_ISOLATE_BP) 91#define _TIF_ISOLATE_BP BIT(TIF_ISOLATE_BP)
92#define _TIF_ISOLATE_BP_GUEST _BITUL(TIF_ISOLATE_BP_GUEST) 92#define _TIF_ISOLATE_BP_GUEST BIT(TIF_ISOLATE_BP_GUEST)
93 93
94#define _TIF_31BIT _BITUL(TIF_31BIT) 94#define _TIF_31BIT BIT(TIF_31BIT)
95#define _TIF_SINGLE_STEP _BITUL(TIF_SINGLE_STEP) 95#define _TIF_SINGLE_STEP BIT(TIF_SINGLE_STEP)
96 96
97#define _TIF_SYSCALL_TRACE _BITUL(TIF_SYSCALL_TRACE) 97#define _TIF_SYSCALL_TRACE BIT(TIF_SYSCALL_TRACE)
98#define _TIF_SYSCALL_AUDIT _BITUL(TIF_SYSCALL_AUDIT) 98#define _TIF_SYSCALL_AUDIT BIT(TIF_SYSCALL_AUDIT)
99#define _TIF_SECCOMP _BITUL(TIF_SECCOMP) 99#define _TIF_SECCOMP BIT(TIF_SECCOMP)
100#define _TIF_SYSCALL_TRACEPOINT _BITUL(TIF_SYSCALL_TRACEPOINT) 100#define _TIF_SYSCALL_TRACEPOINT BIT(TIF_SYSCALL_TRACEPOINT)
101 101
102#endif /* _ASM_THREAD_INFO_H */ 102#endif /* _ASM_THREAD_INFO_H */
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 0ba174f779da..63507662828f 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -67,20 +67,6 @@ static int __init fault_init(void)
67} 67}
68early_initcall(fault_init); 68early_initcall(fault_init);
69 69
70static inline int notify_page_fault(struct pt_regs *regs)
71{
72 int ret = 0;
73
74 /* kprobe_running() needs smp_processor_id() */
75 if (kprobes_built_in() && !user_mode(regs)) {
76 preempt_disable();
77 if (kprobe_running() && kprobe_fault_handler(regs, 14))
78 ret = 1;
79 preempt_enable();
80 }
81 return ret;
82}
83
84/* 70/*
85 * Find out which address space caused the exception. 71 * Find out which address space caused the exception.
86 */ 72 */
@@ -412,7 +398,7 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access)
412 */ 398 */
413 clear_pt_regs_flag(regs, PIF_PER_TRAP); 399 clear_pt_regs_flag(regs, PIF_PER_TRAP);
414 400
415 if (notify_page_fault(regs)) 401 if (kprobe_page_fault(regs, 14))
416 return 0; 402 return 0;
417 403
418 mm = tsk->mm; 404 mm = tsk->mm;
diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c
index 3093bc372138..5f51456f4fc7 100644
--- a/arch/sh/mm/fault.c
+++ b/arch/sh/mm/fault.c
@@ -24,20 +24,6 @@
24#include <asm/tlbflush.h> 24#include <asm/tlbflush.h>
25#include <asm/traps.h> 25#include <asm/traps.h>
26 26
27static inline int notify_page_fault(struct pt_regs *regs, int trap)
28{
29 int ret = 0;
30
31 if (kprobes_built_in() && !user_mode(regs)) {
32 preempt_disable();
33 if (kprobe_running() && kprobe_fault_handler(regs, trap))
34 ret = 1;
35 preempt_enable();
36 }
37
38 return ret;
39}
40
41static void 27static void
42force_sig_info_fault(int si_signo, int si_code, unsigned long address) 28force_sig_info_fault(int si_signo, int si_code, unsigned long address)
43{ 29{
@@ -412,14 +398,14 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
412 if (unlikely(fault_in_kernel_space(address))) { 398 if (unlikely(fault_in_kernel_space(address))) {
413 if (vmalloc_fault(address) >= 0) 399 if (vmalloc_fault(address) >= 0)
414 return; 400 return;
415 if (notify_page_fault(regs, vec)) 401 if (kprobe_page_fault(regs, vec))
416 return; 402 return;
417 403
418 bad_area_nosemaphore(regs, error_code, address); 404 bad_area_nosemaphore(regs, error_code, address);
419 return; 405 return;
420 } 406 }
421 407
422 if (unlikely(notify_page_fault(regs, vec))) 408 if (unlikely(kprobe_page_fault(regs, vec)))
423 return; 409 return;
424 410
425 /* Only enable interrupts if they were on before the fault */ 411 /* Only enable interrupts if they were on before the fault */
diff --git a/arch/sparc/include/uapi/asm/mman.h b/arch/sparc/include/uapi/asm/mman.h
index f6f99ec65bb3..cec9f4109687 100644
--- a/arch/sparc/include/uapi/asm/mman.h
+++ b/arch/sparc/include/uapi/asm/mman.h
@@ -22,10 +22,4 @@
22#define MCL_FUTURE 0x4000 /* lock all additions to address space */ 22#define MCL_FUTURE 0x4000 /* lock all additions to address space */
23#define MCL_ONFAULT 0x8000 /* lock all pages that are faulted in */ 23#define MCL_ONFAULT 0x8000 /* lock all pages that are faulted in */
24 24
25#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
26#define MAP_NONBLOCK 0x10000 /* do not block on IO */
27#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
28#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
29
30
31#endif /* _UAPI__SPARC_MMAN_H__ */ 25#endif /* _UAPI__SPARC_MMAN_H__ */
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
index 83fda4d9c3b2..2371fb6b97e4 100644
--- a/arch/sparc/mm/fault_64.c
+++ b/arch/sparc/mm/fault_64.c
@@ -38,20 +38,6 @@
38 38
39int show_unhandled_signals = 1; 39int show_unhandled_signals = 1;
40 40
41static inline __kprobes int notify_page_fault(struct pt_regs *regs)
42{
43 int ret = 0;
44
45 /* kprobe_running() needs smp_processor_id() */
46 if (kprobes_built_in() && !user_mode(regs)) {
47 preempt_disable();
48 if (kprobe_running() && kprobe_fault_handler(regs, 0))
49 ret = 1;
50 preempt_enable();
51 }
52 return ret;
53}
54
55static void __kprobes unhandled_fault(unsigned long address, 41static void __kprobes unhandled_fault(unsigned long address,
56 struct task_struct *tsk, 42 struct task_struct *tsk,
57 struct pt_regs *regs) 43 struct pt_regs *regs)
@@ -285,7 +271,7 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
285 271
286 fault_code = get_thread_fault_code(); 272 fault_code = get_thread_fault_code();
287 273
288 if (notify_page_fault(regs)) 274 if (kprobe_page_fault(regs, 0))
289 goto exit_exception; 275 goto exit_exception;
290 276
291 si_code = SEGV_MAPERR; 277 si_code = SEGV_MAPERR;
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 57d3b5d96bd2..1342654e8057 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -70,6 +70,7 @@ config X86
70 select ARCH_HAS_KCOV if X86_64 70 select ARCH_HAS_KCOV if X86_64
71 select ARCH_HAS_MEMBARRIER_SYNC_CORE 71 select ARCH_HAS_MEMBARRIER_SYNC_CORE
72 select ARCH_HAS_PMEM_API if X86_64 72 select ARCH_HAS_PMEM_API if X86_64
73 select ARCH_HAS_PTE_DEVMAP if X86_64
73 select ARCH_HAS_PTE_SPECIAL 74 select ARCH_HAS_PTE_SPECIAL
74 select ARCH_HAS_REFCOUNT 75 select ARCH_HAS_REFCOUNT
75 select ARCH_HAS_UACCESS_FLUSHCACHE if X86_64 76 select ARCH_HAS_UACCESS_FLUSHCACHE if X86_64
@@ -80,7 +81,6 @@ config X86
80 select ARCH_HAS_STRICT_MODULE_RWX 81 select ARCH_HAS_STRICT_MODULE_RWX
81 select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE 82 select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE
82 select ARCH_HAS_UBSAN_SANITIZE_ALL 83 select ARCH_HAS_UBSAN_SANITIZE_ALL
83 select ARCH_HAS_ZONE_DEVICE if X86_64
84 select ARCH_HAVE_NMI_SAFE_CMPXCHG 84 select ARCH_HAVE_NMI_SAFE_CMPXCHG
85 select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI 85 select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
86 select ARCH_MIGHT_HAVE_PC_PARPORT 86 select ARCH_MIGHT_HAVE_PC_PARPORT
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index a06a9f8294ea..6bed97ff6db2 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -165,7 +165,6 @@ static inline unsigned int isa_virt_to_bus(volatile void *address)
165{ 165{
166 return (unsigned int)virt_to_phys(address); 166 return (unsigned int)virt_to_phys(address);
167} 167}
168#define isa_page_to_bus(page) ((unsigned int)page_to_phys(page))
169#define isa_bus_to_virt phys_to_virt 168#define isa_bus_to_virt phys_to_virt
170 169
171/* 170/*
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 5e0509b41986..0bc530c4eb13 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -271,7 +271,7 @@ static inline int has_transparent_hugepage(void)
271 return boot_cpu_has(X86_FEATURE_PSE); 271 return boot_cpu_has(X86_FEATURE_PSE);
272} 272}
273 273
274#ifdef __HAVE_ARCH_PTE_DEVMAP 274#ifdef CONFIG_ARCH_HAS_PTE_DEVMAP
275static inline int pmd_devmap(pmd_t pmd) 275static inline int pmd_devmap(pmd_t pmd)
276{ 276{
277 return !!(pmd_val(pmd) & _PAGE_DEVMAP); 277 return !!(pmd_val(pmd) & _PAGE_DEVMAP);
@@ -732,7 +732,7 @@ static inline int pte_present(pte_t a)
732 return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE); 732 return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE);
733} 733}
734 734
735#ifdef __HAVE_ARCH_PTE_DEVMAP 735#ifdef CONFIG_ARCH_HAS_PTE_DEVMAP
736static inline int pte_devmap(pte_t a) 736static inline int pte_devmap(pte_t a)
737{ 737{
738 return (pte_flags(a) & _PAGE_DEVMAP) == _PAGE_DEVMAP; 738 return (pte_flags(a) & _PAGE_DEVMAP) == _PAGE_DEVMAP;
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index d6ff0bbdb394..b5e49e6bac63 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -103,7 +103,6 @@
103#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) 103#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
104#define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX) 104#define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX)
105#define _PAGE_DEVMAP (_AT(u64, 1) << _PAGE_BIT_DEVMAP) 105#define _PAGE_DEVMAP (_AT(u64, 1) << _PAGE_BIT_DEVMAP)
106#define __HAVE_ARCH_PTE_DEVMAP
107#else 106#else
108#define _PAGE_NX (_AT(pteval_t, 0)) 107#define _PAGE_NX (_AT(pteval_t, 0))
109#define _PAGE_DEVMAP (_AT(pteval_t, 0)) 108#define _PAGE_DEVMAP (_AT(pteval_t, 0))
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 794f364cb882..d1634c59ed56 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -46,23 +46,6 @@ kmmio_fault(struct pt_regs *regs, unsigned long addr)
46 return 0; 46 return 0;
47} 47}
48 48
49static nokprobe_inline int kprobes_fault(struct pt_regs *regs)
50{
51 if (!kprobes_built_in())
52 return 0;
53 if (user_mode(regs))
54 return 0;
55 /*
56 * To be potentially processing a kprobe fault and to be allowed to call
57 * kprobe_running(), we have to be non-preemptible.
58 */
59 if (preemptible())
60 return 0;
61 if (!kprobe_running())
62 return 0;
63 return kprobe_fault_handler(regs, X86_TRAP_PF);
64}
65
66/* 49/*
67 * Prefetch quirks: 50 * Prefetch quirks:
68 * 51 *
@@ -1282,7 +1265,7 @@ do_kern_addr_fault(struct pt_regs *regs, unsigned long hw_error_code,
1282 return; 1265 return;
1283 1266
1284 /* kprobes don't want to hook the spurious faults: */ 1267 /* kprobes don't want to hook the spurious faults: */
1285 if (kprobes_fault(regs)) 1268 if (kprobe_page_fault(regs, X86_TRAP_PF))
1286 return; 1269 return;
1287 1270
1288 /* 1271 /*
@@ -1313,7 +1296,7 @@ void do_user_addr_fault(struct pt_regs *regs,
1313 mm = tsk->mm; 1296 mm = tsk->mm;
1314 1297
1315 /* kprobes don't want to hook the spurious faults: */ 1298 /* kprobes don't want to hook the spurious faults: */
1316 if (unlikely(kprobes_fault(regs))) 1299 if (unlikely(kprobe_page_fault(regs, X86_TRAP_PF)))
1317 return; 1300 return;
1318 1301
1319 /* 1302 /*
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index e500f1df1140..63e99f15d7cf 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -459,6 +459,11 @@ void iounmap(volatile void __iomem *addr)
459} 459}
460EXPORT_SYMBOL(iounmap); 460EXPORT_SYMBOL(iounmap);
461 461
462int __init arch_ioremap_p4d_supported(void)
463{
464 return 0;
465}
466
462int __init arch_ioremap_pud_supported(void) 467int __init arch_ioremap_pud_supported(void)
463{ 468{
464#ifdef CONFIG_X86_64 469#ifdef CONFIG_X86_64
diff --git a/arch/xtensa/include/uapi/asm/mman.h b/arch/xtensa/include/uapi/asm/mman.h
index be726062412b..ebbb48842190 100644
--- a/arch/xtensa/include/uapi/asm/mman.h
+++ b/arch/xtensa/include/uapi/asm/mman.h
@@ -56,12 +56,8 @@
56#define MAP_STACK 0x40000 /* give out an address that is best suited for process/thread stacks */ 56#define MAP_STACK 0x40000 /* give out an address that is best suited for process/thread stacks */
57#define MAP_HUGETLB 0x80000 /* create a huge page mapping */ 57#define MAP_HUGETLB 0x80000 /* create a huge page mapping */
58#define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */ 58#define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */
59#ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED 59#define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be
60# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be
61 * uninitialized */ 60 * uninitialized */
62#else
63# define MAP_UNINITIALIZED 0x0 /* Don't support this flag */
64#endif
65 61
66/* 62/*
67 * Flags for msync 63 * Flags for msync