aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/include/asm/syscall.h11
-rw-r--r--arch/alpha/kernel/ptrace.c2
-rw-r--r--arch/arm/include/asm/kvm_mmu.h31
-rw-r--r--arch/arm/include/asm/pgtable.h2
-rw-r--r--arch/arm/kernel/ptrace.c4
-rw-r--r--arch/arm/kvm/arm.c5
-rw-r--r--arch/arm/kvm/interrupts_head.S7
-rw-r--r--arch/arm/kvm/mmu.c235
-rw-r--r--arch/arm/mach-omap2/gpmc.c2
-rw-r--r--arch/arm64/boot/dts/apm-mustang.dts4
-rw-r--r--arch/arm64/boot/dts/apm-storm.dtsi24
-rw-r--r--arch/arm64/include/asm/Kbuild1
-rw-r--r--arch/arm64/include/asm/dma-contiguous.h28
-rw-r--r--arch/arm64/include/asm/kvm_mmu.h127
-rw-r--r--arch/arm64/include/asm/pgtable.h2
-rw-r--r--arch/arm64/kernel/ptrace.c4
-rw-r--r--arch/arm64/kvm/vgic-v2-switch.S12
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c19
-rw-r--r--arch/avr32/mach-at32ap/include/mach/atmel-mci.h2
-rw-r--r--arch/ia64/include/asm/syscall.h6
-rw-r--r--arch/ia64/kernel/ptrace.c2
-rw-r--r--arch/microblaze/include/asm/syscall.h5
-rw-r--r--arch/microblaze/kernel/ptrace.c3
-rw-r--r--arch/mips/Kconfig6
-rw-r--r--arch/mips/Makefile11
-rw-r--r--arch/mips/alchemy/devboards/db1300.c47
-rw-r--r--arch/mips/alchemy/devboards/db1550.c9
-rw-r--r--arch/mips/alchemy/devboards/platform.c3
-rw-r--r--arch/mips/boot/.gitignore1
-rw-r--r--arch/mips/boot/dts/Makefile20
-rw-r--r--arch/mips/boot/dts/danube.dtsi (renamed from arch/mips/lantiq/dts/danube.dtsi)0
-rw-r--r--arch/mips/boot/dts/easy50712.dts (renamed from arch/mips/lantiq/dts/easy50712.dts)0
-rw-r--r--arch/mips/boot/dts/mt7620a.dtsi (renamed from arch/mips/ralink/dts/mt7620a.dtsi)0
-rw-r--r--arch/mips/boot/dts/mt7620a_eval.dts (renamed from arch/mips/ralink/dts/mt7620a_eval.dts)0
-rw-r--r--arch/mips/boot/dts/octeon_3xxx.dts (renamed from arch/mips/cavium-octeon/octeon_3xxx.dts)0
-rw-r--r--arch/mips/boot/dts/octeon_68xx.dts (renamed from arch/mips/cavium-octeon/octeon_68xx.dts)0
-rw-r--r--arch/mips/boot/dts/rt2880.dtsi (renamed from arch/mips/ralink/dts/rt2880.dtsi)0
-rw-r--r--arch/mips/boot/dts/rt2880_eval.dts (renamed from arch/mips/ralink/dts/rt2880_eval.dts)0
-rw-r--r--arch/mips/boot/dts/rt3050.dtsi (renamed from arch/mips/ralink/dts/rt3050.dtsi)0
-rw-r--r--arch/mips/boot/dts/rt3052_eval.dts (renamed from arch/mips/ralink/dts/rt3052_eval.dts)0
-rw-r--r--arch/mips/boot/dts/rt3883.dtsi (renamed from arch/mips/ralink/dts/rt3883.dtsi)0
-rw-r--r--arch/mips/boot/dts/rt3883_eval.dts (renamed from arch/mips/ralink/dts/rt3883_eval.dts)0
-rw-r--r--arch/mips/boot/dts/sead3.dts (renamed from arch/mips/mti-sead3/sead3.dts)0
-rw-r--r--arch/mips/boot/dts/xlp_evp.dts (renamed from arch/mips/netlogic/dts/xlp_evp.dts)0
-rw-r--r--arch/mips/boot/dts/xlp_fvp.dts (renamed from arch/mips/netlogic/dts/xlp_fvp.dts)0
-rw-r--r--arch/mips/boot/dts/xlp_gvp.dts (renamed from arch/mips/netlogic/dts/xlp_gvp.dts)0
-rw-r--r--arch/mips/boot/dts/xlp_svp.dts (renamed from arch/mips/netlogic/dts/xlp_svp.dts)0
-rw-r--r--arch/mips/cavium-octeon/.gitignore2
-rw-r--r--arch/mips/cavium-octeon/Makefile10
-rw-r--r--arch/mips/configs/sead3_defconfig2
-rw-r--r--arch/mips/configs/sead3micro_defconfig2
-rw-r--r--arch/mips/include/asm/Kbuild1
-rw-r--r--arch/mips/include/asm/cpu-features.h10
-rw-r--r--arch/mips/include/asm/cpu-info.h5
-rw-r--r--arch/mips/include/asm/mach-au1x00/cpu-feature-overrides.h12
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h1
-rw-r--r--arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h2
-rw-r--r--arch/mips/include/asm/pgtable-bits.h44
-rw-r--r--arch/mips/include/asm/pgtable.h10
-rw-r--r--arch/mips/include/asm/syscall.h2
-rw-r--r--arch/mips/include/uapi/asm/swab.h18
-rw-r--r--arch/mips/kernel/cpu-probe.c21
-rw-r--r--arch/mips/kernel/ptrace.c4
-rw-r--r--arch/mips/kernel/setup.c9
-rw-r--r--arch/mips/lantiq/Kconfig1
-rw-r--r--arch/mips/lantiq/Makefile2
-rw-r--r--arch/mips/lantiq/dts/Makefile1
-rw-r--r--arch/mips/lib/csum_partial.S10
-rw-r--r--arch/mips/mm/dma-default.c37
-rw-r--r--arch/mips/mti-sead3/Makefile4
-rw-r--r--arch/mips/net/bpf_jit.c53
-rw-r--r--arch/mips/netlogic/Kconfig4
-rw-r--r--arch/mips/netlogic/Makefile1
-rw-r--r--arch/mips/netlogic/dts/Makefile4
-rw-r--r--arch/mips/ralink/Kconfig4
-rw-r--r--arch/mips/ralink/Makefile2
-rw-r--r--arch/mips/ralink/dts/Makefile4
-rw-r--r--arch/mips/ralink/timer.c2
-rw-r--r--arch/openrisc/include/asm/syscall.h5
-rw-r--r--arch/openrisc/include/uapi/asm/elf.h3
-rw-r--r--arch/openrisc/kernel/ptrace.c3
-rw-r--r--arch/parisc/include/asm/syscall.h11
-rw-r--r--arch/parisc/kernel/ptrace.c9
-rw-r--r--arch/powerpc/include/asm/syscall.h6
-rw-r--r--arch/powerpc/kernel/pci-common.c6
-rw-r--r--arch/powerpc/kernel/ptrace.c7
-rw-r--r--arch/s390/kernel/ptrace.c4
-rw-r--r--arch/sh/include/asm/syscall_32.h10
-rw-r--r--arch/sh/include/asm/syscall_64.h14
-rw-r--r--arch/sh/kernel/ptrace_32.c14
-rw-r--r--arch/sh/kernel/ptrace_64.c17
-rw-r--r--arch/sparc/include/asm/syscall.h7
-rw-r--r--arch/sparc/include/asm/thread_info_32.h2
-rw-r--r--arch/sparc/include/asm/thread_info_64.h5
-rw-r--r--arch/sparc/include/asm/visasm.h8
-rw-r--r--arch/sparc/kernel/dtlb_prot.S6
-rw-r--r--arch/sparc/kernel/ptrace_64.c9
-rw-r--r--arch/sparc/kernel/tsb.S6
-rw-r--r--arch/sparc/lib/NG4memcpy.S14
-rw-r--r--arch/um/kernel/ptrace.c3
-rw-r--r--arch/x86/ia32/ia32entry.S12
-rw-r--r--arch/x86/include/asm/Kbuild1
-rw-r--r--arch/x86/include/asm/dma-contiguous.h12
-rw-r--r--arch/x86/include/asm/kprobes.h1
-rw-r--r--arch/x86/kernel/entry_32.S11
-rw-r--r--arch/x86/kernel/ptrace.c4
-rw-r--r--arch/x86/kvm/vmx.c16
-rw-r--r--arch/x86/net/bpf_jit_comp.c25
-rw-r--r--arch/x86/um/asm/ptrace.h4
-rw-r--r--arch/x86/um/asm/syscall.h15
-rw-r--r--arch/xtensa/kernel/ptrace.c2
111 files changed, 869 insertions, 322 deletions
diff --git a/arch/alpha/include/asm/syscall.h b/arch/alpha/include/asm/syscall.h
new file mode 100644
index 000000000000..88d28eb2a566
--- /dev/null
+++ b/arch/alpha/include/asm/syscall.h
@@ -0,0 +1,11 @@
1#ifndef _ASM_ALPHA_SYSCALL_H
2#define _ASM_ALPHA_SYSCALL_H
3
4#include <uapi/linux/audit.h>
5
6static inline int syscall_get_arch(void)
7{
8 return AUDIT_ARCH_ALPHA;
9}
10
11#endif /* _ASM_ALPHA_SYSCALL_H */
diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c
index 86d835157b54..d9ee81769899 100644
--- a/arch/alpha/kernel/ptrace.c
+++ b/arch/alpha/kernel/ptrace.c
@@ -321,7 +321,7 @@ asmlinkage unsigned long syscall_trace_enter(void)
321 if (test_thread_flag(TIF_SYSCALL_TRACE) && 321 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
322 tracehook_report_syscall_entry(current_pt_regs())) 322 tracehook_report_syscall_entry(current_pt_regs()))
323 ret = -1UL; 323 ret = -1UL;
324 audit_syscall_entry(AUDIT_ARCH_ALPHA, regs->r0, regs->r16, regs->r17, regs->r18, regs->r19); 324 audit_syscall_entry(regs->r0, regs->r16, regs->r17, regs->r18, regs->r19);
325 return ret ?: current_pt_regs()->r0; 325 return ret ?: current_pt_regs()->r0;
326} 326}
327 327
diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h
index 3f688b458143..acb0d5712716 100644
--- a/arch/arm/include/asm/kvm_mmu.h
+++ b/arch/arm/include/asm/kvm_mmu.h
@@ -37,6 +37,11 @@
37 */ 37 */
38#define TRAMPOLINE_VA UL(CONFIG_VECTORS_BASE) 38#define TRAMPOLINE_VA UL(CONFIG_VECTORS_BASE)
39 39
40/*
41 * KVM_MMU_CACHE_MIN_PAGES is the number of stage2 page table translation levels.
42 */
43#define KVM_MMU_CACHE_MIN_PAGES 2
44
40#ifndef __ASSEMBLY__ 45#ifndef __ASSEMBLY__
41 46
42#include <asm/cacheflush.h> 47#include <asm/cacheflush.h>
@@ -50,7 +55,7 @@ void free_hyp_pgds(void);
50int kvm_alloc_stage2_pgd(struct kvm *kvm); 55int kvm_alloc_stage2_pgd(struct kvm *kvm);
51void kvm_free_stage2_pgd(struct kvm *kvm); 56void kvm_free_stage2_pgd(struct kvm *kvm);
52int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr_t guest_ipa, 57int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr_t guest_ipa,
53 phys_addr_t pa, unsigned long size); 58 phys_addr_t pa, unsigned long size, bool writable);
54 59
55int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run); 60int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run);
56 61
@@ -83,6 +88,11 @@ static inline void kvm_clean_pgd(pgd_t *pgd)
83 clean_dcache_area(pgd, PTRS_PER_S2_PGD * sizeof(pgd_t)); 88 clean_dcache_area(pgd, PTRS_PER_S2_PGD * sizeof(pgd_t));
84} 89}
85 90
91static inline void kvm_clean_pmd(pmd_t *pmd)
92{
93 clean_dcache_area(pmd, PTRS_PER_PMD * sizeof(pmd_t));
94}
95
86static inline void kvm_clean_pmd_entry(pmd_t *pmd) 96static inline void kvm_clean_pmd_entry(pmd_t *pmd)
87{ 97{
88 clean_pmd_entry(pmd); 98 clean_pmd_entry(pmd);
@@ -123,10 +133,23 @@ static inline bool kvm_page_empty(void *ptr)
123} 133}
124 134
125 135
126#define kvm_pte_table_empty(ptep) kvm_page_empty(ptep) 136#define kvm_pte_table_empty(kvm, ptep) kvm_page_empty(ptep)
127#define kvm_pmd_table_empty(pmdp) kvm_page_empty(pmdp) 137#define kvm_pmd_table_empty(kvm, pmdp) kvm_page_empty(pmdp)
128#define kvm_pud_table_empty(pudp) (0) 138#define kvm_pud_table_empty(kvm, pudp) (0)
139
140#define KVM_PREALLOC_LEVEL 0
129 141
142static inline int kvm_prealloc_hwpgd(struct kvm *kvm, pgd_t *pgd)
143{
144 return 0;
145}
146
147static inline void kvm_free_hwpgd(struct kvm *kvm) { }
148
149static inline void *kvm_get_hwpgd(struct kvm *kvm)
150{
151 return kvm->arch.pgd;
152}
130 153
131struct kvm; 154struct kvm;
132 155
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 90aa4583b308..3b30062975b2 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -100,7 +100,7 @@ extern pgprot_t pgprot_s2_device;
100#define PAGE_HYP _MOD_PROT(pgprot_kernel, L_PTE_HYP) 100#define PAGE_HYP _MOD_PROT(pgprot_kernel, L_PTE_HYP)
101#define PAGE_HYP_DEVICE _MOD_PROT(pgprot_hyp_device, L_PTE_HYP) 101#define PAGE_HYP_DEVICE _MOD_PROT(pgprot_hyp_device, L_PTE_HYP)
102#define PAGE_S2 _MOD_PROT(pgprot_s2, L_PTE_S2_RDONLY) 102#define PAGE_S2 _MOD_PROT(pgprot_s2, L_PTE_S2_RDONLY)
103#define PAGE_S2_DEVICE _MOD_PROT(pgprot_s2_device, L_PTE_S2_RDWR) 103#define PAGE_S2_DEVICE _MOD_PROT(pgprot_s2_device, L_PTE_S2_RDONLY)
104 104
105#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN | L_PTE_NONE) 105#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN | L_PTE_NONE)
106#define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN) 106#define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN)
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 5e772a21ab97..ef9119f7462e 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -949,8 +949,8 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
949 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 949 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
950 trace_sys_enter(regs, scno); 950 trace_sys_enter(regs, scno);
951 951
952 audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1, 952 audit_syscall_entry(scno, regs->ARM_r0, regs->ARM_r1, regs->ARM_r2,
953 regs->ARM_r2, regs->ARM_r3); 953 regs->ARM_r3);
954 954
955 return scno; 955 return scno;
956} 956}
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 779605122f32..9e193c8a959e 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -409,7 +409,7 @@ static void update_vttbr(struct kvm *kvm)
409 kvm_next_vmid++; 409 kvm_next_vmid++;
410 410
411 /* update vttbr to be used with the new vmid */ 411 /* update vttbr to be used with the new vmid */
412 pgd_phys = virt_to_phys(kvm->arch.pgd); 412 pgd_phys = virt_to_phys(kvm_get_hwpgd(kvm));
413 BUG_ON(pgd_phys & ~VTTBR_BADDR_MASK); 413 BUG_ON(pgd_phys & ~VTTBR_BADDR_MASK);
414 vmid = ((u64)(kvm->arch.vmid) << VTTBR_VMID_SHIFT) & VTTBR_VMID_MASK; 414 vmid = ((u64)(kvm->arch.vmid) << VTTBR_VMID_SHIFT) & VTTBR_VMID_MASK;
415 kvm->arch.vttbr = pgd_phys | vmid; 415 kvm->arch.vttbr = pgd_phys | vmid;
@@ -808,7 +808,8 @@ static int hyp_init_cpu_notify(struct notifier_block *self,
808 switch (action) { 808 switch (action) {
809 case CPU_STARTING: 809 case CPU_STARTING:
810 case CPU_STARTING_FROZEN: 810 case CPU_STARTING_FROZEN:
811 cpu_init_hyp_mode(NULL); 811 if (__hyp_get_vectors() == hyp_default_vectors)
812 cpu_init_hyp_mode(NULL);
812 break; 813 break;
813 } 814 }
814 815
diff --git a/arch/arm/kvm/interrupts_head.S b/arch/arm/kvm/interrupts_head.S
index 98c8c5b9a87f..14d488388480 100644
--- a/arch/arm/kvm/interrupts_head.S
+++ b/arch/arm/kvm/interrupts_head.S
@@ -433,10 +433,17 @@ ARM_BE8(rev r10, r10 )
433 str r3, [r11, #VGIC_V2_CPU_HCR] 433 str r3, [r11, #VGIC_V2_CPU_HCR]
434 str r4, [r11, #VGIC_V2_CPU_VMCR] 434 str r4, [r11, #VGIC_V2_CPU_VMCR]
435 str r5, [r11, #VGIC_V2_CPU_MISR] 435 str r5, [r11, #VGIC_V2_CPU_MISR]
436#ifdef CONFIG_CPU_ENDIAN_BE8
437 str r6, [r11, #(VGIC_V2_CPU_EISR + 4)]
438 str r7, [r11, #VGIC_V2_CPU_EISR]
439 str r8, [r11, #(VGIC_V2_CPU_ELRSR + 4)]
440 str r9, [r11, #VGIC_V2_CPU_ELRSR]
441#else
436 str r6, [r11, #VGIC_V2_CPU_EISR] 442 str r6, [r11, #VGIC_V2_CPU_EISR]
437 str r7, [r11, #(VGIC_V2_CPU_EISR + 4)] 443 str r7, [r11, #(VGIC_V2_CPU_EISR + 4)]
438 str r8, [r11, #VGIC_V2_CPU_ELRSR] 444 str r8, [r11, #VGIC_V2_CPU_ELRSR]
439 str r9, [r11, #(VGIC_V2_CPU_ELRSR + 4)] 445 str r9, [r11, #(VGIC_V2_CPU_ELRSR + 4)]
446#endif
440 str r10, [r11, #VGIC_V2_CPU_APR] 447 str r10, [r11, #VGIC_V2_CPU_APR]
441 448
442 /* Clear GICH_HCR */ 449 /* Clear GICH_HCR */
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index eea03069161b..57a403a5c22b 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -42,7 +42,7 @@ static unsigned long hyp_idmap_start;
42static unsigned long hyp_idmap_end; 42static unsigned long hyp_idmap_end;
43static phys_addr_t hyp_idmap_vector; 43static phys_addr_t hyp_idmap_vector;
44 44
45#define pgd_order get_order(PTRS_PER_PGD * sizeof(pgd_t)) 45#define hyp_pgd_order get_order(PTRS_PER_PGD * sizeof(pgd_t))
46 46
47#define kvm_pmd_huge(_x) (pmd_huge(_x) || pmd_trans_huge(_x)) 47#define kvm_pmd_huge(_x) (pmd_huge(_x) || pmd_trans_huge(_x))
48 48
@@ -134,7 +134,7 @@ static void unmap_ptes(struct kvm *kvm, pmd_t *pmd,
134 } 134 }
135 } while (pte++, addr += PAGE_SIZE, addr != end); 135 } while (pte++, addr += PAGE_SIZE, addr != end);
136 136
137 if (kvm_pte_table_empty(start_pte)) 137 if (kvm_pte_table_empty(kvm, start_pte))
138 clear_pmd_entry(kvm, pmd, start_addr); 138 clear_pmd_entry(kvm, pmd, start_addr);
139} 139}
140 140
@@ -158,7 +158,7 @@ static void unmap_pmds(struct kvm *kvm, pud_t *pud,
158 } 158 }
159 } while (pmd++, addr = next, addr != end); 159 } while (pmd++, addr = next, addr != end);
160 160
161 if (kvm_pmd_table_empty(start_pmd)) 161 if (kvm_pmd_table_empty(kvm, start_pmd))
162 clear_pud_entry(kvm, pud, start_addr); 162 clear_pud_entry(kvm, pud, start_addr);
163} 163}
164 164
@@ -182,7 +182,7 @@ static void unmap_puds(struct kvm *kvm, pgd_t *pgd,
182 } 182 }
183 } while (pud++, addr = next, addr != end); 183 } while (pud++, addr = next, addr != end);
184 184
185 if (kvm_pud_table_empty(start_pud)) 185 if (kvm_pud_table_empty(kvm, start_pud))
186 clear_pgd_entry(kvm, pgd, start_addr); 186 clear_pgd_entry(kvm, pgd, start_addr);
187} 187}
188 188
@@ -306,7 +306,7 @@ void free_boot_hyp_pgd(void)
306 if (boot_hyp_pgd) { 306 if (boot_hyp_pgd) {
307 unmap_range(NULL, boot_hyp_pgd, hyp_idmap_start, PAGE_SIZE); 307 unmap_range(NULL, boot_hyp_pgd, hyp_idmap_start, PAGE_SIZE);
308 unmap_range(NULL, boot_hyp_pgd, TRAMPOLINE_VA, PAGE_SIZE); 308 unmap_range(NULL, boot_hyp_pgd, TRAMPOLINE_VA, PAGE_SIZE);
309 free_pages((unsigned long)boot_hyp_pgd, pgd_order); 309 free_pages((unsigned long)boot_hyp_pgd, hyp_pgd_order);
310 boot_hyp_pgd = NULL; 310 boot_hyp_pgd = NULL;
311 } 311 }
312 312
@@ -343,7 +343,7 @@ void free_hyp_pgds(void)
343 for (addr = VMALLOC_START; is_vmalloc_addr((void*)addr); addr += PGDIR_SIZE) 343 for (addr = VMALLOC_START; is_vmalloc_addr((void*)addr); addr += PGDIR_SIZE)
344 unmap_range(NULL, hyp_pgd, KERN_TO_HYP(addr), PGDIR_SIZE); 344 unmap_range(NULL, hyp_pgd, KERN_TO_HYP(addr), PGDIR_SIZE);
345 345
346 free_pages((unsigned long)hyp_pgd, pgd_order); 346 free_pages((unsigned long)hyp_pgd, hyp_pgd_order);
347 hyp_pgd = NULL; 347 hyp_pgd = NULL;
348 } 348 }
349 349
@@ -401,13 +401,46 @@ static int create_hyp_pmd_mappings(pud_t *pud, unsigned long start,
401 return 0; 401 return 0;
402} 402}
403 403
404static int create_hyp_pud_mappings(pgd_t *pgd, unsigned long start,
405 unsigned long end, unsigned long pfn,
406 pgprot_t prot)
407{
408 pud_t *pud;
409 pmd_t *pmd;
410 unsigned long addr, next;
411 int ret;
412
413 addr = start;
414 do {
415 pud = pud_offset(pgd, addr);
416
417 if (pud_none_or_clear_bad(pud)) {
418 pmd = pmd_alloc_one(NULL, addr);
419 if (!pmd) {
420 kvm_err("Cannot allocate Hyp pmd\n");
421 return -ENOMEM;
422 }
423 pud_populate(NULL, pud, pmd);
424 get_page(virt_to_page(pud));
425 kvm_flush_dcache_to_poc(pud, sizeof(*pud));
426 }
427
428 next = pud_addr_end(addr, end);
429 ret = create_hyp_pmd_mappings(pud, addr, next, pfn, prot);
430 if (ret)
431 return ret;
432 pfn += (next - addr) >> PAGE_SHIFT;
433 } while (addr = next, addr != end);
434
435 return 0;
436}
437
404static int __create_hyp_mappings(pgd_t *pgdp, 438static int __create_hyp_mappings(pgd_t *pgdp,
405 unsigned long start, unsigned long end, 439 unsigned long start, unsigned long end,
406 unsigned long pfn, pgprot_t prot) 440 unsigned long pfn, pgprot_t prot)
407{ 441{
408 pgd_t *pgd; 442 pgd_t *pgd;
409 pud_t *pud; 443 pud_t *pud;
410 pmd_t *pmd;
411 unsigned long addr, next; 444 unsigned long addr, next;
412 int err = 0; 445 int err = 0;
413 446
@@ -416,22 +449,21 @@ static int __create_hyp_mappings(pgd_t *pgdp,
416 end = PAGE_ALIGN(end); 449 end = PAGE_ALIGN(end);
417 do { 450 do {
418 pgd = pgdp + pgd_index(addr); 451 pgd = pgdp + pgd_index(addr);
419 pud = pud_offset(pgd, addr);
420 452
421 if (pud_none_or_clear_bad(pud)) { 453 if (pgd_none(*pgd)) {
422 pmd = pmd_alloc_one(NULL, addr); 454 pud = pud_alloc_one(NULL, addr);
423 if (!pmd) { 455 if (!pud) {
424 kvm_err("Cannot allocate Hyp pmd\n"); 456 kvm_err("Cannot allocate Hyp pud\n");
425 err = -ENOMEM; 457 err = -ENOMEM;
426 goto out; 458 goto out;
427 } 459 }
428 pud_populate(NULL, pud, pmd); 460 pgd_populate(NULL, pgd, pud);
429 get_page(virt_to_page(pud)); 461 get_page(virt_to_page(pgd));
430 kvm_flush_dcache_to_poc(pud, sizeof(*pud)); 462 kvm_flush_dcache_to_poc(pgd, sizeof(*pgd));
431 } 463 }
432 464
433 next = pgd_addr_end(addr, end); 465 next = pgd_addr_end(addr, end);
434 err = create_hyp_pmd_mappings(pud, addr, next, pfn, prot); 466 err = create_hyp_pud_mappings(pgd, addr, next, pfn, prot);
435 if (err) 467 if (err)
436 goto out; 468 goto out;
437 pfn += (next - addr) >> PAGE_SHIFT; 469 pfn += (next - addr) >> PAGE_SHIFT;
@@ -521,6 +553,7 @@ int create_hyp_io_mappings(void *from, void *to, phys_addr_t phys_addr)
521 */ 553 */
522int kvm_alloc_stage2_pgd(struct kvm *kvm) 554int kvm_alloc_stage2_pgd(struct kvm *kvm)
523{ 555{
556 int ret;
524 pgd_t *pgd; 557 pgd_t *pgd;
525 558
526 if (kvm->arch.pgd != NULL) { 559 if (kvm->arch.pgd != NULL) {
@@ -528,15 +561,38 @@ int kvm_alloc_stage2_pgd(struct kvm *kvm)
528 return -EINVAL; 561 return -EINVAL;
529 } 562 }
530 563
531 pgd = (pgd_t *)__get_free_pages(GFP_KERNEL, S2_PGD_ORDER); 564 if (KVM_PREALLOC_LEVEL > 0) {
565 /*
566 * Allocate fake pgd for the page table manipulation macros to
567 * work. This is not used by the hardware and we have no
568 * alignment requirement for this allocation.
569 */
570 pgd = (pgd_t *)kmalloc(PTRS_PER_S2_PGD * sizeof(pgd_t),
571 GFP_KERNEL | __GFP_ZERO);
572 } else {
573 /*
574 * Allocate actual first-level Stage-2 page table used by the
575 * hardware for Stage-2 page table walks.
576 */
577 pgd = (pgd_t *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, S2_PGD_ORDER);
578 }
579
532 if (!pgd) 580 if (!pgd)
533 return -ENOMEM; 581 return -ENOMEM;
534 582
535 memset(pgd, 0, PTRS_PER_S2_PGD * sizeof(pgd_t)); 583 ret = kvm_prealloc_hwpgd(kvm, pgd);
584 if (ret)
585 goto out_err;
586
536 kvm_clean_pgd(pgd); 587 kvm_clean_pgd(pgd);
537 kvm->arch.pgd = pgd; 588 kvm->arch.pgd = pgd;
538
539 return 0; 589 return 0;
590out_err:
591 if (KVM_PREALLOC_LEVEL > 0)
592 kfree(pgd);
593 else
594 free_pages((unsigned long)pgd, S2_PGD_ORDER);
595 return ret;
540} 596}
541 597
542/** 598/**
@@ -572,19 +628,39 @@ void kvm_free_stage2_pgd(struct kvm *kvm)
572 return; 628 return;
573 629
574 unmap_stage2_range(kvm, 0, KVM_PHYS_SIZE); 630 unmap_stage2_range(kvm, 0, KVM_PHYS_SIZE);
575 free_pages((unsigned long)kvm->arch.pgd, S2_PGD_ORDER); 631 kvm_free_hwpgd(kvm);
632 if (KVM_PREALLOC_LEVEL > 0)
633 kfree(kvm->arch.pgd);
634 else
635 free_pages((unsigned long)kvm->arch.pgd, S2_PGD_ORDER);
576 kvm->arch.pgd = NULL; 636 kvm->arch.pgd = NULL;
577} 637}
578 638
579static pmd_t *stage2_get_pmd(struct kvm *kvm, struct kvm_mmu_memory_cache *cache, 639static pud_t *stage2_get_pud(struct kvm *kvm, struct kvm_mmu_memory_cache *cache,
580 phys_addr_t addr) 640 phys_addr_t addr)
581{ 641{
582 pgd_t *pgd; 642 pgd_t *pgd;
583 pud_t *pud; 643 pud_t *pud;
584 pmd_t *pmd;
585 644
586 pgd = kvm->arch.pgd + pgd_index(addr); 645 pgd = kvm->arch.pgd + pgd_index(addr);
587 pud = pud_offset(pgd, addr); 646 if (WARN_ON(pgd_none(*pgd))) {
647 if (!cache)
648 return NULL;
649 pud = mmu_memory_cache_alloc(cache);
650 pgd_populate(NULL, pgd, pud);
651 get_page(virt_to_page(pgd));
652 }
653
654 return pud_offset(pgd, addr);
655}
656
657static pmd_t *stage2_get_pmd(struct kvm *kvm, struct kvm_mmu_memory_cache *cache,
658 phys_addr_t addr)
659{
660 pud_t *pud;
661 pmd_t *pmd;
662
663 pud = stage2_get_pud(kvm, cache, addr);
588 if (pud_none(*pud)) { 664 if (pud_none(*pud)) {
589 if (!cache) 665 if (!cache)
590 return NULL; 666 return NULL;
@@ -630,7 +706,7 @@ static int stage2_set_pte(struct kvm *kvm, struct kvm_mmu_memory_cache *cache,
630 pmd_t *pmd; 706 pmd_t *pmd;
631 pte_t *pte, old_pte; 707 pte_t *pte, old_pte;
632 708
633 /* Create stage-2 page table mapping - Level 1 */ 709 /* Create stage-2 page table mapping - Levels 0 and 1 */
634 pmd = stage2_get_pmd(kvm, cache, addr); 710 pmd = stage2_get_pmd(kvm, cache, addr);
635 if (!pmd) { 711 if (!pmd) {
636 /* 712 /*
@@ -675,7 +751,7 @@ static int stage2_set_pte(struct kvm *kvm, struct kvm_mmu_memory_cache *cache,
675 * @size: The size of the mapping 751 * @size: The size of the mapping
676 */ 752 */
677int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr_t guest_ipa, 753int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr_t guest_ipa,
678 phys_addr_t pa, unsigned long size) 754 phys_addr_t pa, unsigned long size, bool writable)
679{ 755{
680 phys_addr_t addr, end; 756 phys_addr_t addr, end;
681 int ret = 0; 757 int ret = 0;
@@ -688,7 +764,11 @@ int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr_t guest_ipa,
688 for (addr = guest_ipa; addr < end; addr += PAGE_SIZE) { 764 for (addr = guest_ipa; addr < end; addr += PAGE_SIZE) {
689 pte_t pte = pfn_pte(pfn, PAGE_S2_DEVICE); 765 pte_t pte = pfn_pte(pfn, PAGE_S2_DEVICE);
690 766
691 ret = mmu_topup_memory_cache(&cache, 2, 2); 767 if (writable)
768 kvm_set_s2pte_writable(&pte);
769
770 ret = mmu_topup_memory_cache(&cache, KVM_MMU_CACHE_MIN_PAGES,
771 KVM_NR_MEM_OBJS);
692 if (ret) 772 if (ret)
693 goto out; 773 goto out;
694 spin_lock(&kvm->mmu_lock); 774 spin_lock(&kvm->mmu_lock);
@@ -777,6 +857,12 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
777 /* Let's check if we will get back a huge page backed by hugetlbfs */ 857 /* Let's check if we will get back a huge page backed by hugetlbfs */
778 down_read(&current->mm->mmap_sem); 858 down_read(&current->mm->mmap_sem);
779 vma = find_vma_intersection(current->mm, hva, hva + 1); 859 vma = find_vma_intersection(current->mm, hva, hva + 1);
860 if (unlikely(!vma)) {
861 kvm_err("Failed to find VMA for hva 0x%lx\n", hva);
862 up_read(&current->mm->mmap_sem);
863 return -EFAULT;
864 }
865
780 if (is_vm_hugetlb_page(vma)) { 866 if (is_vm_hugetlb_page(vma)) {
781 hugetlb = true; 867 hugetlb = true;
782 gfn = (fault_ipa & PMD_MASK) >> PAGE_SHIFT; 868 gfn = (fault_ipa & PMD_MASK) >> PAGE_SHIFT;
@@ -797,7 +883,8 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
797 up_read(&current->mm->mmap_sem); 883 up_read(&current->mm->mmap_sem);
798 884
799 /* We need minimum second+third level pages */ 885 /* We need minimum second+third level pages */
800 ret = mmu_topup_memory_cache(memcache, 2, KVM_NR_MEM_OBJS); 886 ret = mmu_topup_memory_cache(memcache, KVM_MMU_CACHE_MIN_PAGES,
887 KVM_NR_MEM_OBJS);
801 if (ret) 888 if (ret)
802 return ret; 889 return ret;
803 890
@@ -843,7 +930,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
843 } 930 }
844 coherent_cache_guest_page(vcpu, hva, PAGE_SIZE); 931 coherent_cache_guest_page(vcpu, hva, PAGE_SIZE);
845 ret = stage2_set_pte(kvm, memcache, fault_ipa, &new_pte, 932 ret = stage2_set_pte(kvm, memcache, fault_ipa, &new_pte,
846 mem_type == PAGE_S2_DEVICE); 933 pgprot_val(mem_type) == pgprot_val(PAGE_S2_DEVICE));
847 } 934 }
848 935
849 936
@@ -916,6 +1003,9 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run)
916 goto out_unlock; 1003 goto out_unlock;
917 } 1004 }
918 1005
1006 /* Userspace should not be able to register out-of-bounds IPAs */
1007 VM_BUG_ON(fault_ipa >= KVM_PHYS_SIZE);
1008
919 ret = user_mem_abort(vcpu, fault_ipa, memslot, hva, fault_status); 1009 ret = user_mem_abort(vcpu, fault_ipa, memslot, hva, fault_status);
920 if (ret == 0) 1010 if (ret == 0)
921 ret = 1; 1011 ret = 1;
@@ -1072,8 +1162,8 @@ int kvm_mmu_init(void)
1072 (unsigned long)phys_base); 1162 (unsigned long)phys_base);
1073 } 1163 }
1074 1164
1075 hyp_pgd = (pgd_t *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, pgd_order); 1165 hyp_pgd = (pgd_t *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, hyp_pgd_order);
1076 boot_hyp_pgd = (pgd_t *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, pgd_order); 1166 boot_hyp_pgd = (pgd_t *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, hyp_pgd_order);
1077 1167
1078 if (!hyp_pgd || !boot_hyp_pgd) { 1168 if (!hyp_pgd || !boot_hyp_pgd) {
1079 kvm_err("Hyp mode PGD not allocated\n"); 1169 kvm_err("Hyp mode PGD not allocated\n");
@@ -1126,13 +1216,6 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
1126 const struct kvm_memory_slot *old, 1216 const struct kvm_memory_slot *old,
1127 enum kvm_mr_change change) 1217 enum kvm_mr_change change)
1128{ 1218{
1129 gpa_t gpa = old->base_gfn << PAGE_SHIFT;
1130 phys_addr_t size = old->npages << PAGE_SHIFT;
1131 if (change == KVM_MR_DELETE || change == KVM_MR_MOVE) {
1132 spin_lock(&kvm->mmu_lock);
1133 unmap_stage2_range(kvm, gpa, size);
1134 spin_unlock(&kvm->mmu_lock);
1135 }
1136} 1219}
1137 1220
1138int kvm_arch_prepare_memory_region(struct kvm *kvm, 1221int kvm_arch_prepare_memory_region(struct kvm *kvm,
@@ -1140,7 +1223,77 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
1140 struct kvm_userspace_memory_region *mem, 1223 struct kvm_userspace_memory_region *mem,
1141 enum kvm_mr_change change) 1224 enum kvm_mr_change change)
1142{ 1225{
1143 return 0; 1226 hva_t hva = mem->userspace_addr;
1227 hva_t reg_end = hva + mem->memory_size;
1228 bool writable = !(mem->flags & KVM_MEM_READONLY);
1229 int ret = 0;
1230
1231 if (change != KVM_MR_CREATE && change != KVM_MR_MOVE)
1232 return 0;
1233
1234 /*
1235 * Prevent userspace from creating a memory region outside of the IPA
1236 * space addressable by the KVM guest IPA space.
1237 */
1238 if (memslot->base_gfn + memslot->npages >=
1239 (KVM_PHYS_SIZE >> PAGE_SHIFT))
1240 return -EFAULT;
1241
1242 /*
1243 * A memory region could potentially cover multiple VMAs, and any holes
1244 * between them, so iterate over all of them to find out if we can map
1245 * any of them right now.
1246 *
1247 * +--------------------------------------------+
1248 * +---------------+----------------+ +----------------+
1249 * | : VMA 1 | VMA 2 | | VMA 3 : |
1250 * +---------------+----------------+ +----------------+
1251 * | memory region |
1252 * +--------------------------------------------+
1253 */
1254 do {
1255 struct vm_area_struct *vma = find_vma(current->mm, hva);
1256 hva_t vm_start, vm_end;
1257
1258 if (!vma || vma->vm_start >= reg_end)
1259 break;
1260
1261 /*
1262 * Mapping a read-only VMA is only allowed if the
1263 * memory region is configured as read-only.
1264 */
1265 if (writable && !(vma->vm_flags & VM_WRITE)) {
1266 ret = -EPERM;
1267 break;
1268 }
1269
1270 /*
1271 * Take the intersection of this VMA with the memory region
1272 */
1273 vm_start = max(hva, vma->vm_start);
1274 vm_end = min(reg_end, vma->vm_end);
1275
1276 if (vma->vm_flags & VM_PFNMAP) {
1277 gpa_t gpa = mem->guest_phys_addr +
1278 (vm_start - mem->userspace_addr);
1279 phys_addr_t pa = (vma->vm_pgoff << PAGE_SHIFT) +
1280 vm_start - vma->vm_start;
1281
1282 ret = kvm_phys_addr_ioremap(kvm, gpa, pa,
1283 vm_end - vm_start,
1284 writable);
1285 if (ret)
1286 break;
1287 }
1288 hva = vm_end;
1289 } while (hva < reg_end);
1290
1291 if (ret) {
1292 spin_lock(&kvm->mmu_lock);
1293 unmap_stage2_range(kvm, mem->guest_phys_addr, mem->memory_size);
1294 spin_unlock(&kvm->mmu_lock);
1295 }
1296 return ret;
1144} 1297}
1145 1298
1146void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free, 1299void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
@@ -1165,4 +1318,10 @@ void kvm_arch_flush_shadow_all(struct kvm *kvm)
1165void kvm_arch_flush_shadow_memslot(struct kvm *kvm, 1318void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
1166 struct kvm_memory_slot *slot) 1319 struct kvm_memory_slot *slot)
1167{ 1320{
1321 gpa_t gpa = slot->base_gfn << PAGE_SHIFT;
1322 phys_addr_t size = slot->npages << PAGE_SHIFT;
1323
1324 spin_lock(&kvm->mmu_lock);
1325 unmap_stage2_range(kvm, gpa, size);
1326 spin_unlock(&kvm->mmu_lock);
1168} 1327}
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index a4d52c42a438..5fa3755261ce 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -1440,6 +1440,8 @@ static int gpmc_probe_nand_child(struct platform_device *pdev,
1440 break; 1440 break;
1441 } 1441 }
1442 1442
1443 gpmc_nand_data->flash_bbt = of_get_nand_on_flash_bbt(child);
1444
1443 val = of_get_nand_bus_width(child); 1445 val = of_get_nand_bus_width(child);
1444 if (val == 16) 1446 if (val == 16)
1445 gpmc_nand_data->devsize = NAND_BUSWIDTH_16; 1447 gpmc_nand_data->devsize = NAND_BUSWIDTH_16;
diff --git a/arch/arm64/boot/dts/apm-mustang.dts b/arch/arm64/boot/dts/apm-mustang.dts
index 8eb6d94c7851..2e25de0800b9 100644
--- a/arch/arm64/boot/dts/apm-mustang.dts
+++ b/arch/arm64/boot/dts/apm-mustang.dts
@@ -41,6 +41,10 @@
41 status = "ok"; 41 status = "ok";
42}; 42};
43 43
44&sgenet0 {
45 status = "ok";
46};
47
44&xgenet { 48&xgenet {
45 status = "ok"; 49 status = "ok";
46}; 50};
diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi
index 87d3205e98d5..295c72d52a1f 100644
--- a/arch/arm64/boot/dts/apm-storm.dtsi
+++ b/arch/arm64/boot/dts/apm-storm.dtsi
@@ -176,6 +176,16 @@
176 clock-output-names = "menetclk"; 176 clock-output-names = "menetclk";
177 }; 177 };
178 178
179 sge0clk: sge0clk@1f21c000 {
180 compatible = "apm,xgene-device-clock";
181 #clock-cells = <1>;
182 clocks = <&socplldiv2 0>;
183 reg = <0x0 0x1f21c000 0x0 0x1000>;
184 reg-names = "csr-reg";
185 csr-mask = <0x3>;
186 clock-output-names = "sge0clk";
187 };
188
179 xge0clk: xge0clk@1f61c000 { 189 xge0clk: xge0clk@1f61c000 {
180 compatible = "apm,xgene-device-clock"; 190 compatible = "apm,xgene-device-clock";
181 #clock-cells = <1>; 191 #clock-cells = <1>;
@@ -611,6 +621,20 @@
611 }; 621 };
612 }; 622 };
613 623
624 sgenet0: ethernet@1f210000 {
625 compatible = "apm,xgene-enet";
626 status = "disabled";
627 reg = <0x0 0x1f210000 0x0 0x10000>,
628 <0x0 0x1f200000 0x0 0X10000>,
629 <0x0 0x1B000000 0x0 0X20000>;
630 reg-names = "enet_csr", "ring_csr", "ring_cmd";
631 interrupts = <0x0 0xA0 0x4>;
632 dma-coherent;
633 clocks = <&sge0clk 0>;
634 local-mac-address = [00 00 00 00 00 00];
635 phy-connection-type = "sgmii";
636 };
637
614 xgenet: ethernet@1f610000 { 638 xgenet: ethernet@1f610000 {
615 compatible = "apm,xgene-enet"; 639 compatible = "apm,xgene-enet";
616 status = "disabled"; 640 status = "disabled";
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index 774a7c85e70f..dc770bd4f5a5 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -9,6 +9,7 @@ generic-y += current.h
9generic-y += delay.h 9generic-y += delay.h
10generic-y += div64.h 10generic-y += div64.h
11generic-y += dma.h 11generic-y += dma.h
12generic-y += dma-contiguous.h
12generic-y += early_ioremap.h 13generic-y += early_ioremap.h
13generic-y += emergency-restart.h 14generic-y += emergency-restart.h
14generic-y += errno.h 15generic-y += errno.h
diff --git a/arch/arm64/include/asm/dma-contiguous.h b/arch/arm64/include/asm/dma-contiguous.h
deleted file mode 100644
index 14c4c0ca7f2a..000000000000
--- a/arch/arm64/include/asm/dma-contiguous.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _ASM_DMA_CONTIGUOUS_H
15#define _ASM_DMA_CONTIGUOUS_H
16
17#ifdef __KERNEL__
18#ifdef CONFIG_DMA_CMA
19
20#include <linux/types.h>
21
22static inline void
23dma_contiguous_early_fixup(phys_addr_t base, unsigned long size) { }
24
25#endif
26#endif
27
28#endif
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
index a030d163840b..0caf7a59f6a1 100644
--- a/arch/arm64/include/asm/kvm_mmu.h
+++ b/arch/arm64/include/asm/kvm_mmu.h
@@ -41,6 +41,18 @@
41 */ 41 */
42#define TRAMPOLINE_VA (HYP_PAGE_OFFSET_MASK & PAGE_MASK) 42#define TRAMPOLINE_VA (HYP_PAGE_OFFSET_MASK & PAGE_MASK)
43 43
44/*
45 * KVM_MMU_CACHE_MIN_PAGES is the number of stage2 page table translation
46 * levels in addition to the PGD and potentially the PUD which are
47 * pre-allocated (we pre-allocate the fake PGD and the PUD when the Stage-2
48 * tables use one level of tables less than the kernel.
49 */
50#ifdef CONFIG_ARM64_64K_PAGES
51#define KVM_MMU_CACHE_MIN_PAGES 1
52#else
53#define KVM_MMU_CACHE_MIN_PAGES 2
54#endif
55
44#ifdef __ASSEMBLY__ 56#ifdef __ASSEMBLY__
45 57
46/* 58/*
@@ -53,6 +65,7 @@
53 65
54#else 66#else
55 67
68#include <asm/pgalloc.h>
56#include <asm/cachetype.h> 69#include <asm/cachetype.h>
57#include <asm/cacheflush.h> 70#include <asm/cacheflush.h>
58 71
@@ -65,10 +78,6 @@
65#define KVM_PHYS_SIZE (1UL << KVM_PHYS_SHIFT) 78#define KVM_PHYS_SIZE (1UL << KVM_PHYS_SHIFT)
66#define KVM_PHYS_MASK (KVM_PHYS_SIZE - 1UL) 79#define KVM_PHYS_MASK (KVM_PHYS_SIZE - 1UL)
67 80
68/* Make sure we get the right size, and thus the right alignment */
69#define PTRS_PER_S2_PGD (1 << (KVM_PHYS_SHIFT - PGDIR_SHIFT))
70#define S2_PGD_ORDER get_order(PTRS_PER_S2_PGD * sizeof(pgd_t))
71
72int create_hyp_mappings(void *from, void *to); 81int create_hyp_mappings(void *from, void *to);
73int create_hyp_io_mappings(void *from, void *to, phys_addr_t); 82int create_hyp_io_mappings(void *from, void *to, phys_addr_t);
74void free_boot_hyp_pgd(void); 83void free_boot_hyp_pgd(void);
@@ -77,7 +86,7 @@ void free_hyp_pgds(void);
77int kvm_alloc_stage2_pgd(struct kvm *kvm); 86int kvm_alloc_stage2_pgd(struct kvm *kvm);
78void kvm_free_stage2_pgd(struct kvm *kvm); 87void kvm_free_stage2_pgd(struct kvm *kvm);
79int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr_t guest_ipa, 88int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr_t guest_ipa,
80 phys_addr_t pa, unsigned long size); 89 phys_addr_t pa, unsigned long size, bool writable);
81 90
82int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run); 91int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run);
83 92
@@ -93,6 +102,7 @@ void kvm_clear_hyp_idmap(void);
93#define kvm_set_pmd(pmdp, pmd) set_pmd(pmdp, pmd) 102#define kvm_set_pmd(pmdp, pmd) set_pmd(pmdp, pmd)
94 103
95static inline void kvm_clean_pgd(pgd_t *pgd) {} 104static inline void kvm_clean_pgd(pgd_t *pgd) {}
105static inline void kvm_clean_pmd(pmd_t *pmd) {}
96static inline void kvm_clean_pmd_entry(pmd_t *pmd) {} 106static inline void kvm_clean_pmd_entry(pmd_t *pmd) {}
97static inline void kvm_clean_pte(pte_t *pte) {} 107static inline void kvm_clean_pte(pte_t *pte) {}
98static inline void kvm_clean_pte_entry(pte_t *pte) {} 108static inline void kvm_clean_pte_entry(pte_t *pte) {}
@@ -111,19 +121,116 @@ static inline void kvm_set_s2pmd_writable(pmd_t *pmd)
111#define kvm_pud_addr_end(addr, end) pud_addr_end(addr, end) 121#define kvm_pud_addr_end(addr, end) pud_addr_end(addr, end)
112#define kvm_pmd_addr_end(addr, end) pmd_addr_end(addr, end) 122#define kvm_pmd_addr_end(addr, end) pmd_addr_end(addr, end)
113 123
124/*
125 * In the case where PGDIR_SHIFT is larger than KVM_PHYS_SHIFT, we can address
126 * the entire IPA input range with a single pgd entry, and we would only need
127 * one pgd entry. Note that in this case, the pgd is actually not used by
128 * the MMU for Stage-2 translations, but is merely a fake pgd used as a data
129 * structure for the kernel pgtable macros to work.
130 */
131#if PGDIR_SHIFT > KVM_PHYS_SHIFT
132#define PTRS_PER_S2_PGD_SHIFT 0
133#else
134#define PTRS_PER_S2_PGD_SHIFT (KVM_PHYS_SHIFT - PGDIR_SHIFT)
135#endif
136#define PTRS_PER_S2_PGD (1 << PTRS_PER_S2_PGD_SHIFT)
137#define S2_PGD_ORDER get_order(PTRS_PER_S2_PGD * sizeof(pgd_t))
138
139/*
140 * If we are concatenating first level stage-2 page tables, we would have less
141 * than or equal to 16 pointers in the fake PGD, because that's what the
142 * architecture allows. In this case, (4 - CONFIG_ARM64_PGTABLE_LEVELS)
143 * represents the first level for the host, and we add 1 to go to the next
144 * level (which uses contatenation) for the stage-2 tables.
145 */
146#if PTRS_PER_S2_PGD <= 16
147#define KVM_PREALLOC_LEVEL (4 - CONFIG_ARM64_PGTABLE_LEVELS + 1)
148#else
149#define KVM_PREALLOC_LEVEL (0)
150#endif
151
152/**
153 * kvm_prealloc_hwpgd - allocate inital table for VTTBR
154 * @kvm: The KVM struct pointer for the VM.
155 * @pgd: The kernel pseudo pgd
156 *
157 * When the kernel uses more levels of page tables than the guest, we allocate
158 * a fake PGD and pre-populate it to point to the next-level page table, which
159 * will be the real initial page table pointed to by the VTTBR.
160 *
161 * When KVM_PREALLOC_LEVEL==2, we allocate a single page for the PMD and
162 * the kernel will use folded pud. When KVM_PREALLOC_LEVEL==1, we
163 * allocate 2 consecutive PUD pages.
164 */
165static inline int kvm_prealloc_hwpgd(struct kvm *kvm, pgd_t *pgd)
166{
167 unsigned int i;
168 unsigned long hwpgd;
169
170 if (KVM_PREALLOC_LEVEL == 0)
171 return 0;
172
173 hwpgd = __get_free_pages(GFP_KERNEL | __GFP_ZERO, PTRS_PER_S2_PGD_SHIFT);
174 if (!hwpgd)
175 return -ENOMEM;
176
177 for (i = 0; i < PTRS_PER_S2_PGD; i++) {
178 if (KVM_PREALLOC_LEVEL == 1)
179 pgd_populate(NULL, pgd + i,
180 (pud_t *)hwpgd + i * PTRS_PER_PUD);
181 else if (KVM_PREALLOC_LEVEL == 2)
182 pud_populate(NULL, pud_offset(pgd, 0) + i,
183 (pmd_t *)hwpgd + i * PTRS_PER_PMD);
184 }
185
186 return 0;
187}
188
189static inline void *kvm_get_hwpgd(struct kvm *kvm)
190{
191 pgd_t *pgd = kvm->arch.pgd;
192 pud_t *pud;
193
194 if (KVM_PREALLOC_LEVEL == 0)
195 return pgd;
196
197 pud = pud_offset(pgd, 0);
198 if (KVM_PREALLOC_LEVEL == 1)
199 return pud;
200
201 BUG_ON(KVM_PREALLOC_LEVEL != 2);
202 return pmd_offset(pud, 0);
203}
204
205static inline void kvm_free_hwpgd(struct kvm *kvm)
206{
207 if (KVM_PREALLOC_LEVEL > 0) {
208 unsigned long hwpgd = (unsigned long)kvm_get_hwpgd(kvm);
209 free_pages(hwpgd, PTRS_PER_S2_PGD_SHIFT);
210 }
211}
212
114static inline bool kvm_page_empty(void *ptr) 213static inline bool kvm_page_empty(void *ptr)
115{ 214{
116 struct page *ptr_page = virt_to_page(ptr); 215 struct page *ptr_page = virt_to_page(ptr);
117 return page_count(ptr_page) == 1; 216 return page_count(ptr_page) == 1;
118} 217}
119 218
120#define kvm_pte_table_empty(ptep) kvm_page_empty(ptep) 219#define kvm_pte_table_empty(kvm, ptep) kvm_page_empty(ptep)
121#ifndef CONFIG_ARM64_64K_PAGES 220
122#define kvm_pmd_table_empty(pmdp) kvm_page_empty(pmdp) 221#ifdef __PAGETABLE_PMD_FOLDED
222#define kvm_pmd_table_empty(kvm, pmdp) (0)
223#else
224#define kvm_pmd_table_empty(kvm, pmdp) \
225 (kvm_page_empty(pmdp) && (!(kvm) || KVM_PREALLOC_LEVEL < 2))
226#endif
227
228#ifdef __PAGETABLE_PUD_FOLDED
229#define kvm_pud_table_empty(kvm, pudp) (0)
123#else 230#else
124#define kvm_pmd_table_empty(pmdp) (0) 231#define kvm_pud_table_empty(kvm, pudp) \
232 (kvm_page_empty(pudp) && (!(kvm) || KVM_PREALLOC_LEVEL < 1))
125#endif 233#endif
126#define kvm_pud_table_empty(pudp) (0)
127 234
128 235
129struct kvm; 236struct kvm;
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index cefd3e825612..41a43bf26492 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -79,7 +79,7 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
79#define PAGE_HYP_DEVICE __pgprot(PROT_DEVICE_nGnRE | PTE_HYP) 79#define PAGE_HYP_DEVICE __pgprot(PROT_DEVICE_nGnRE | PTE_HYP)
80 80
81#define PAGE_S2 __pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_NORMAL) | PTE_S2_RDONLY) 81#define PAGE_S2 __pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_NORMAL) | PTE_S2_RDONLY)
82#define PAGE_S2_DEVICE __pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_DEVICE_nGnRE) | PTE_S2_RDWR | PTE_UXN) 82#define PAGE_S2_DEVICE __pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_DEVICE_nGnRE) | PTE_S2_RDONLY | PTE_UXN)
83 83
84#define PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_TYPE_MASK) | PTE_PROT_NONE | PTE_PXN | PTE_UXN) 84#define PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_TYPE_MASK) | PTE_PROT_NONE | PTE_PXN | PTE_UXN)
85#define PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_WRITE) 85#define PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_WRITE)
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index fe63ac5e9bf5..8a4ae8e73213 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -1120,8 +1120,8 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
1120 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 1120 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
1121 trace_sys_enter(regs, regs->syscallno); 1121 trace_sys_enter(regs, regs->syscallno);
1122 1122
1123 audit_syscall_entry(syscall_get_arch(), regs->syscallno, 1123 audit_syscall_entry(regs->syscallno, regs->orig_x0, regs->regs[1],
1124 regs->orig_x0, regs->regs[1], regs->regs[2], regs->regs[3]); 1124 regs->regs[2], regs->regs[3]);
1125 1125
1126 return regs->syscallno; 1126 return regs->syscallno;
1127} 1127}
diff --git a/arch/arm64/kvm/vgic-v2-switch.S b/arch/arm64/kvm/vgic-v2-switch.S
index ae211772f991..f002fe1c3700 100644
--- a/arch/arm64/kvm/vgic-v2-switch.S
+++ b/arch/arm64/kvm/vgic-v2-switch.S
@@ -67,10 +67,14 @@ CPU_BE( rev w11, w11 )
67 str w4, [x3, #VGIC_V2_CPU_HCR] 67 str w4, [x3, #VGIC_V2_CPU_HCR]
68 str w5, [x3, #VGIC_V2_CPU_VMCR] 68 str w5, [x3, #VGIC_V2_CPU_VMCR]
69 str w6, [x3, #VGIC_V2_CPU_MISR] 69 str w6, [x3, #VGIC_V2_CPU_MISR]
70 str w7, [x3, #VGIC_V2_CPU_EISR] 70CPU_LE( str w7, [x3, #VGIC_V2_CPU_EISR] )
71 str w8, [x3, #(VGIC_V2_CPU_EISR + 4)] 71CPU_LE( str w8, [x3, #(VGIC_V2_CPU_EISR + 4)] )
72 str w9, [x3, #VGIC_V2_CPU_ELRSR] 72CPU_LE( str w9, [x3, #VGIC_V2_CPU_ELRSR] )
73 str w10, [x3, #(VGIC_V2_CPU_ELRSR + 4)] 73CPU_LE( str w10, [x3, #(VGIC_V2_CPU_ELRSR + 4)] )
74CPU_BE( str w7, [x3, #(VGIC_V2_CPU_EISR + 4)] )
75CPU_BE( str w8, [x3, #VGIC_V2_CPU_EISR] )
76CPU_BE( str w9, [x3, #(VGIC_V2_CPU_ELRSR + 4)] )
77CPU_BE( str w10, [x3, #VGIC_V2_CPU_ELRSR] )
74 str w11, [x3, #VGIC_V2_CPU_APR] 78 str w11, [x3, #VGIC_V2_CPU_APR]
75 79
76 /* Clear GICH_HCR */ 80 /* Clear GICH_HCR */
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index db85b5ec3351..37b75602adf6 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -7,7 +7,7 @@
7 */ 7 */
8#include <linux/clk.h> 8#include <linux/clk.h>
9#include <linux/delay.h> 9#include <linux/delay.h>
10#include <linux/dw_dmac.h> 10#include <linux/platform_data/dma-dw.h>
11#include <linux/fb.h> 11#include <linux/fb.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
@@ -1356,10 +1356,10 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
1356 goto fail; 1356 goto fail;
1357 1357
1358 slave->sdata.dma_dev = &dw_dmac0_device.dev; 1358 slave->sdata.dma_dev = &dw_dmac0_device.dev;
1359 slave->sdata.cfg_hi = (DWC_CFGH_SRC_PER(0) 1359 slave->sdata.src_id = 0;
1360 | DWC_CFGH_DST_PER(1)); 1360 slave->sdata.dst_id = 1;
1361 slave->sdata.cfg_lo &= ~(DWC_CFGL_HS_DST_POL 1361 slave->sdata.src_master = 1;
1362 | DWC_CFGL_HS_SRC_POL); 1362 slave->sdata.dst_master = 0;
1363 1363
1364 data->dma_slave = slave; 1364 data->dma_slave = slave;
1365 1365
@@ -2052,8 +2052,7 @@ at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data,
2052 /* Check if DMA slave interface for capture should be configured. */ 2052 /* Check if DMA slave interface for capture should be configured. */
2053 if (flags & AC97C_CAPTURE) { 2053 if (flags & AC97C_CAPTURE) {
2054 rx_dws->dma_dev = &dw_dmac0_device.dev; 2054 rx_dws->dma_dev = &dw_dmac0_device.dev;
2055 rx_dws->cfg_hi = DWC_CFGH_SRC_PER(3); 2055 rx_dws->src_id = 3;
2056 rx_dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
2057 rx_dws->src_master = 0; 2056 rx_dws->src_master = 0;
2058 rx_dws->dst_master = 1; 2057 rx_dws->dst_master = 1;
2059 } 2058 }
@@ -2061,8 +2060,7 @@ at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data,
2061 /* Check if DMA slave interface for playback should be configured. */ 2060 /* Check if DMA slave interface for playback should be configured. */
2062 if (flags & AC97C_PLAYBACK) { 2061 if (flags & AC97C_PLAYBACK) {
2063 tx_dws->dma_dev = &dw_dmac0_device.dev; 2062 tx_dws->dma_dev = &dw_dmac0_device.dev;
2064 tx_dws->cfg_hi = DWC_CFGH_DST_PER(4); 2063 tx_dws->dst_id = 4;
2065 tx_dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
2066 tx_dws->src_master = 0; 2064 tx_dws->src_master = 0;
2067 tx_dws->dst_master = 1; 2065 tx_dws->dst_master = 1;
2068 } 2066 }
@@ -2134,8 +2132,7 @@ at32_add_device_abdac(unsigned int id, struct atmel_abdac_pdata *data)
2134 dws = &data->dws; 2132 dws = &data->dws;
2135 2133
2136 dws->dma_dev = &dw_dmac0_device.dev; 2134 dws->dma_dev = &dw_dmac0_device.dev;
2137 dws->cfg_hi = DWC_CFGH_DST_PER(2); 2135 dws->dst_id = 2;
2138 dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
2139 dws->src_master = 0; 2136 dws->src_master = 0;
2140 dws->dst_master = 1; 2137 dws->dst_master = 1;
2141 2138
diff --git a/arch/avr32/mach-at32ap/include/mach/atmel-mci.h b/arch/avr32/mach-at32ap/include/mach/atmel-mci.h
index 4bba58561d5c..11d7f4b28dc8 100644
--- a/arch/avr32/mach-at32ap/include/mach/atmel-mci.h
+++ b/arch/avr32/mach-at32ap/include/mach/atmel-mci.h
@@ -1,7 +1,7 @@
1#ifndef __MACH_ATMEL_MCI_H 1#ifndef __MACH_ATMEL_MCI_H
2#define __MACH_ATMEL_MCI_H 2#define __MACH_ATMEL_MCI_H
3 3
4#include <linux/dw_dmac.h> 4#include <linux/platform_data/dma-dw.h>
5 5
6/** 6/**
7 * struct mci_dma_data - DMA data for MCI interface 7 * struct mci_dma_data - DMA data for MCI interface
diff --git a/arch/ia64/include/asm/syscall.h b/arch/ia64/include/asm/syscall.h
index a7ff1c6ab068..1d0b875fec44 100644
--- a/arch/ia64/include/asm/syscall.h
+++ b/arch/ia64/include/asm/syscall.h
@@ -13,6 +13,7 @@
13#ifndef _ASM_SYSCALL_H 13#ifndef _ASM_SYSCALL_H
14#define _ASM_SYSCALL_H 1 14#define _ASM_SYSCALL_H 1
15 15
16#include <uapi/linux/audit.h>
16#include <linux/sched.h> 17#include <linux/sched.h>
17#include <linux/err.h> 18#include <linux/err.h>
18 19
@@ -79,4 +80,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
79 80
80 ia64_syscall_get_set_arguments(task, regs, i, n, args, 1); 81 ia64_syscall_get_set_arguments(task, regs, i, n, args, 1);
81} 82}
83
84static inline int syscall_get_arch(void)
85{
86 return AUDIT_ARCH_IA64;
87}
82#endif /* _ASM_SYSCALL_H */ 88#endif /* _ASM_SYSCALL_H */
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index b7a5fffe0924..6f54d511cc50 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -1219,7 +1219,7 @@ syscall_trace_enter (long arg0, long arg1, long arg2, long arg3,
1219 ia64_sync_krbs(); 1219 ia64_sync_krbs();
1220 1220
1221 1221
1222 audit_syscall_entry(AUDIT_ARCH_IA64, regs.r15, arg0, arg1, arg2, arg3); 1222 audit_syscall_entry(regs.r15, arg0, arg1, arg2, arg3);
1223 1223
1224 return 0; 1224 return 0;
1225} 1225}
diff --git a/arch/microblaze/include/asm/syscall.h b/arch/microblaze/include/asm/syscall.h
index 9bc431783105..53cfaf34c343 100644
--- a/arch/microblaze/include/asm/syscall.h
+++ b/arch/microblaze/include/asm/syscall.h
@@ -1,6 +1,7 @@
1#ifndef __ASM_MICROBLAZE_SYSCALL_H 1#ifndef __ASM_MICROBLAZE_SYSCALL_H
2#define __ASM_MICROBLAZE_SYSCALL_H 2#define __ASM_MICROBLAZE_SYSCALL_H
3 3
4#include <uapi/linux/audit.h>
4#include <linux/kernel.h> 5#include <linux/kernel.h>
5#include <linux/sched.h> 6#include <linux/sched.h>
6#include <asm/ptrace.h> 7#include <asm/ptrace.h>
@@ -99,4 +100,8 @@ static inline void syscall_set_arguments(struct task_struct *task,
99asmlinkage long do_syscall_trace_enter(struct pt_regs *regs); 100asmlinkage long do_syscall_trace_enter(struct pt_regs *regs);
100asmlinkage void do_syscall_trace_leave(struct pt_regs *regs); 101asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);
101 102
103static inline int syscall_get_arch(void)
104{
105 return AUDIT_ARCH_MICROBLAZE;
106}
102#endif /* __ASM_MICROBLAZE_SYSCALL_H */ 107#endif /* __ASM_MICROBLAZE_SYSCALL_H */
diff --git a/arch/microblaze/kernel/ptrace.c b/arch/microblaze/kernel/ptrace.c
index 39cf50841f6d..bb10637ce688 100644
--- a/arch/microblaze/kernel/ptrace.c
+++ b/arch/microblaze/kernel/ptrace.c
@@ -147,8 +147,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
147 */ 147 */
148 ret = -1L; 148 ret = -1L;
149 149
150 audit_syscall_entry(EM_MICROBLAZE, regs->r12, regs->r5, regs->r6, 150 audit_syscall_entry(regs->r12, regs->r5, regs->r6, regs->r7, regs->r8);
151 regs->r7, regs->r8);
152 151
153 return ret ?: regs->r12; 152 return ret ?: regs->r12;
154} 153}
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 574c43000699..ad6badb6be71 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -29,6 +29,7 @@ config MIPS
29 select GENERIC_ATOMIC64 if !64BIT 29 select GENERIC_ATOMIC64 if !64BIT
30 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 30 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
31 select HAVE_DMA_ATTRS 31 select HAVE_DMA_ATTRS
32 select HAVE_DMA_CONTIGUOUS
32 select HAVE_DMA_API_DEBUG 33 select HAVE_DMA_API_DEBUG
33 select GENERIC_IRQ_PROBE 34 select GENERIC_IRQ_PROBE
34 select GENERIC_IRQ_SHOW 35 select GENERIC_IRQ_SHOW
@@ -353,6 +354,7 @@ config MIPS_SEAD3
353 bool "MIPS SEAD3 board" 354 bool "MIPS SEAD3 board"
354 select BOOT_ELF32 355 select BOOT_ELF32
355 select BOOT_RAW 356 select BOOT_RAW
357 select BUILTIN_DTB
356 select CEVT_R4K 358 select CEVT_R4K
357 select CSRC_R4K 359 select CSRC_R4K
358 select CSRC_GIC 360 select CSRC_GIC
@@ -742,6 +744,7 @@ config CAVIUM_OCTEON_SOC
742 select ARCH_SPARSEMEM_ENABLE 744 select ARCH_SPARSEMEM_ENABLE
743 select SYS_SUPPORTS_SMP 745 select SYS_SUPPORTS_SMP
744 select NR_CPUS_DEFAULT_16 746 select NR_CPUS_DEFAULT_16
747 select BUILTIN_DTB
745 help 748 help
746 This option supports all of the Octeon reference boards from Cavium 749 This option supports all of the Octeon reference boards from Cavium
747 Networks. It builds a kernel that dynamically determines the Octeon 750 Networks. It builds a kernel that dynamically determines the Octeon
@@ -2482,6 +2485,9 @@ config USE_OF
2482 select OF_EARLY_FLATTREE 2485 select OF_EARLY_FLATTREE
2483 select IRQ_DOMAIN 2486 select IRQ_DOMAIN
2484 2487
2488config BUILTIN_DTB
2489 bool
2490
2485endmenu 2491endmenu
2486 2492
2487config LOCKDEP_SUPPORT 2493config LOCKDEP_SUPPORT
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index bbac51e11179..23cb94806fbc 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -333,6 +333,16 @@ endif
333 333
334CLEAN_FILES += vmlinux.32 vmlinux.64 334CLEAN_FILES += vmlinux.32 vmlinux.64
335 335
336# device-trees
337core-$(CONFIG_BUILTIN_DTB) += arch/mips/boot/dts/
338
339%.dtb %.dtb.S %.dtb.o: | scripts
340 $(Q)$(MAKE) $(build)=arch/mips/boot/dts arch/mips/boot/dts/$@
341
342PHONY += dtbs
343dtbs: scripts
344 $(Q)$(MAKE) $(build)=arch/mips/boot/dts dtbs
345
336archprepare: 346archprepare:
337ifdef CONFIG_MIPS32_N32 347ifdef CONFIG_MIPS32_N32
338 @echo ' Checking missing-syscalls for N32' 348 @echo ' Checking missing-syscalls for N32'
@@ -367,6 +377,7 @@ define archhelp
367 echo ' vmlinuz.srec - SREC zboot image' 377 echo ' vmlinuz.srec - SREC zboot image'
368 echo ' uImage - U-Boot image' 378 echo ' uImage - U-Boot image'
369 echo ' uImage.gz - U-Boot image (gzip)' 379 echo ' uImage.gz - U-Boot image (gzip)'
380 echo ' dtbs - Device-tree blobs for enabled boards'
370 echo 381 echo
371 echo ' These will be default as appropriate for a configured platform.' 382 echo ' These will be default as appropriate for a configured platform.'
372endef 383endef
diff --git a/arch/mips/alchemy/devboards/db1300.c b/arch/mips/alchemy/devboards/db1300.c
index ef93ee3f6a2c..1c64fdbe4c81 100644
--- a/arch/mips/alchemy/devboards/db1300.c
+++ b/arch/mips/alchemy/devboards/db1300.c
@@ -21,6 +21,7 @@
21#include <linux/mtd/partitions.h> 21#include <linux/mtd/partitions.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/smsc911x.h> 23#include <linux/smsc911x.h>
24#include <linux/wm97xx.h>
24 25
25#include <asm/mach-au1x00/au1000.h> 26#include <asm/mach-au1x00/au1000.h>
26#include <asm/mach-au1x00/au1100_mmc.h> 27#include <asm/mach-au1x00/au1100_mmc.h>
@@ -711,6 +712,46 @@ static struct platform_device db1300_lcd_dev = {
711 712
712/**********************************************************************/ 713/**********************************************************************/
713 714
715static void db1300_wm97xx_irqen(struct wm97xx *wm, int enable)
716{
717 if (enable)
718 enable_irq(DB1300_AC97_PEN_INT);
719 else
720 disable_irq_nosync(DB1300_AC97_PEN_INT);
721}
722
723static struct wm97xx_mach_ops db1300_wm97xx_ops = {
724 .irq_enable = db1300_wm97xx_irqen,
725 .irq_gpio = WM97XX_GPIO_3,
726};
727
728static int db1300_wm97xx_probe(struct platform_device *pdev)
729{
730 struct wm97xx *wm = platform_get_drvdata(pdev);
731
732 /* external pendown indicator */
733 wm97xx_config_gpio(wm, WM97XX_GPIO_13, WM97XX_GPIO_IN,
734 WM97XX_GPIO_POL_LOW, WM97XX_GPIO_STICKY,
735 WM97XX_GPIO_WAKE);
736
737 /* internal "virtual" pendown gpio */
738 wm97xx_config_gpio(wm, WM97XX_GPIO_3, WM97XX_GPIO_OUT,
739 WM97XX_GPIO_POL_LOW, WM97XX_GPIO_NOTSTICKY,
740 WM97XX_GPIO_NOWAKE);
741
742 wm->pen_irq = DB1300_AC97_PEN_INT;
743
744 return wm97xx_register_mach_ops(wm, &db1300_wm97xx_ops);
745}
746
747static struct platform_driver db1300_wm97xx_driver = {
748 .driver.name = "wm97xx-touch",
749 .driver.owner = THIS_MODULE,
750 .probe = db1300_wm97xx_probe,
751};
752
753/**********************************************************************/
754
714static struct platform_device *db1300_dev[] __initdata = { 755static struct platform_device *db1300_dev[] __initdata = {
715 &db1300_eth_dev, 756 &db1300_eth_dev,
716 &db1300_i2c_dev, 757 &db1300_i2c_dev,
@@ -755,6 +796,9 @@ int __init db1300_dev_setup(void)
755 i2c_register_board_info(0, db1300_i2c_devs, 796 i2c_register_board_info(0, db1300_i2c_devs,
756 ARRAY_SIZE(db1300_i2c_devs)); 797 ARRAY_SIZE(db1300_i2c_devs));
757 798
799 if (platform_driver_register(&db1300_wm97xx_driver))
800 pr_warn("DB1300: failed to init touch pen irq support!\n");
801
758 /* Audio PSC clock is supplied by codecs (PSC1, 2) */ 802 /* Audio PSC clock is supplied by codecs (PSC1, 2) */
759 __raw_writel(PSC_SEL_CLK_SERCLK, 803 __raw_writel(PSC_SEL_CLK_SERCLK,
760 (void __iomem *)KSEG1ADDR(AU1300_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET); 804 (void __iomem *)KSEG1ADDR(AU1300_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET);
@@ -762,9 +806,10 @@ int __init db1300_dev_setup(void)
762 __raw_writel(PSC_SEL_CLK_SERCLK, 806 __raw_writel(PSC_SEL_CLK_SERCLK,
763 (void __iomem *)KSEG1ADDR(AU1300_PSC2_PHYS_ADDR) + PSC_SEL_OFFSET); 807 (void __iomem *)KSEG1ADDR(AU1300_PSC2_PHYS_ADDR) + PSC_SEL_OFFSET);
764 wmb(); 808 wmb();
765 /* I2C uses internal 48MHz EXTCLK1 */ 809 /* I2C driver wants 50MHz, get as close as possible */
766 c = clk_get(NULL, "psc3_intclk"); 810 c = clk_get(NULL, "psc3_intclk");
767 if (!IS_ERR(c)) { 811 if (!IS_ERR(c)) {
812 clk_set_rate(c, 50000000);
768 clk_prepare_enable(c); 813 clk_prepare_enable(c);
769 clk_put(c); 814 clk_put(c);
770 } 815 }
diff --git a/arch/mips/alchemy/devboards/db1550.c b/arch/mips/alchemy/devboards/db1550.c
index 7e89936f763e..0fd5177e35ab 100644
--- a/arch/mips/alchemy/devboards/db1550.c
+++ b/arch/mips/alchemy/devboards/db1550.c
@@ -34,12 +34,9 @@ static void __init db1550_hw_setup(void)
34 void __iomem *base; 34 void __iomem *base;
35 unsigned long v; 35 unsigned long v;
36 36
37 /* complete SPI setup: link psc0_intclk to a 48MHz source, 37 /* complete pin setup: assign GPIO16 to PSC0_SYNC1 (SPI cs# line)
38 * and assign GPIO16 to PSC0_SYNC1 (SPI cs# line) as well as PSC1_SYNC 38 * as well as PSC1_SYNC for AC97 on PB1550.
39 * for AC97 on PB1550.
40 */ 39 */
41 v = alchemy_rdsys(AU1000_SYS_CLKSRC);
42 alchemy_wrsys(v | 0x000001e0, AU1000_SYS_CLKSRC);
43 v = alchemy_rdsys(AU1000_SYS_PINFUNC); 40 v = alchemy_rdsys(AU1000_SYS_PINFUNC);
44 alchemy_wrsys(v | 1 | SYS_PF_PSC1_S1, AU1000_SYS_PINFUNC); 41 alchemy_wrsys(v | 1 | SYS_PF_PSC1_S1, AU1000_SYS_PINFUNC);
45 42
@@ -586,11 +583,13 @@ int __init db1550_dev_setup(void)
586 583
587 c = clk_get(NULL, "psc0_intclk"); 584 c = clk_get(NULL, "psc0_intclk");
588 if (!IS_ERR(c)) { 585 if (!IS_ERR(c)) {
586 clk_set_rate(c, 50000000);
589 clk_prepare_enable(c); 587 clk_prepare_enable(c);
590 clk_put(c); 588 clk_put(c);
591 } 589 }
592 c = clk_get(NULL, "psc2_intclk"); 590 c = clk_get(NULL, "psc2_intclk");
593 if (!IS_ERR(c)) { 591 if (!IS_ERR(c)) {
592 clk_set_rate(c, db1550_spi_platdata.mainclk_hz);
594 clk_prepare_enable(c); 593 clk_prepare_enable(c);
595 clk_put(c); 594 clk_put(c);
596 } 595 }
diff --git a/arch/mips/alchemy/devboards/platform.c b/arch/mips/alchemy/devboards/platform.c
index 8df86eb94972..be139a0198b0 100644
--- a/arch/mips/alchemy/devboards/platform.c
+++ b/arch/mips/alchemy/devboards/platform.c
@@ -11,6 +11,7 @@
11#include <linux/pm.h> 11#include <linux/pm.h>
12 12
13#include <asm/bootinfo.h> 13#include <asm/bootinfo.h>
14#include <asm/idle.h>
14#include <asm/reboot.h> 15#include <asm/reboot.h>
15#include <asm/mach-au1x00/au1000.h> 16#include <asm/mach-au1x00/au1000.h>
16#include <asm/mach-db1x00/bcsr.h> 17#include <asm/mach-db1x00/bcsr.h>
@@ -53,6 +54,8 @@ static void db1x_power_off(void)
53{ 54{
54 bcsr_write(BCSR_RESETS, 0); 55 bcsr_write(BCSR_RESETS, 0);
55 bcsr_write(BCSR_SYSTEM, BCSR_SYSTEM_PWROFF | BCSR_SYSTEM_RESET); 56 bcsr_write(BCSR_SYSTEM, BCSR_SYSTEM_PWROFF | BCSR_SYSTEM_RESET);
57 while (1) /* sit and spin */
58 cpu_wait();
56} 59}
57 60
58static void db1x_reset(char *c) 61static void db1x_reset(char *c)
diff --git a/arch/mips/boot/.gitignore b/arch/mips/boot/.gitignore
index a73d6e2c4f64..d3962cd5ce0c 100644
--- a/arch/mips/boot/.gitignore
+++ b/arch/mips/boot/.gitignore
@@ -5,3 +5,4 @@ zImage
5zImage.tmp 5zImage.tmp
6calc_vmlinuz_load_addr 6calc_vmlinuz_load_addr
7uImage 7uImage
8*.dtb
diff --git a/arch/mips/boot/dts/Makefile b/arch/mips/boot/dts/Makefile
new file mode 100644
index 000000000000..ca9c90e2cabf
--- /dev/null
+++ b/arch/mips/boot/dts/Makefile
@@ -0,0 +1,20 @@
1dtb-$(CONFIG_CAVIUM_OCTEON_SOC) += octeon_3xxx.dtb octeon_68xx.dtb
2dtb-$(CONFIG_DT_EASY50712) += easy50712.dtb
3dtb-$(CONFIG_DT_XLP_EVP) += xlp_evp.dtb
4dtb-$(CONFIG_DT_XLP_SVP) += xlp_svp.dtb
5dtb-$(CONFIG_DT_XLP_FVP) += xlp_fvp.dtb
6dtb-$(CONFIG_DT_XLP_GVP) += xlp_gvp.dtb
7dtb-$(CONFIG_DTB_RT2880_EVAL) += rt2880_eval.dtb
8dtb-$(CONFIG_DTB_RT305X_EVAL) += rt3052_eval.dtb
9dtb-$(CONFIG_DTB_RT3883_EVAL) += rt3883_eval.dtb
10dtb-$(CONFIG_DTB_MT7620A_EVAL) += mt7620a_eval.dtb
11dtb-$(CONFIG_MIPS_SEAD3) += sead3.dtb
12
13obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y))
14
15targets += dtbs
16targets += $(dtb-y)
17
18dtbs: $(addprefix $(obj)/, $(dtb-y))
19
20clean-files += *.dtb *.dtb.S
diff --git a/arch/mips/lantiq/dts/danube.dtsi b/arch/mips/boot/dts/danube.dtsi
index d4c59e003708..d4c59e003708 100644
--- a/arch/mips/lantiq/dts/danube.dtsi
+++ b/arch/mips/boot/dts/danube.dtsi
diff --git a/arch/mips/lantiq/dts/easy50712.dts b/arch/mips/boot/dts/easy50712.dts
index 143b8a37b5e4..143b8a37b5e4 100644
--- a/arch/mips/lantiq/dts/easy50712.dts
+++ b/arch/mips/boot/dts/easy50712.dts
diff --git a/arch/mips/ralink/dts/mt7620a.dtsi b/arch/mips/boot/dts/mt7620a.dtsi
index 08bf24fefe9f..08bf24fefe9f 100644
--- a/arch/mips/ralink/dts/mt7620a.dtsi
+++ b/arch/mips/boot/dts/mt7620a.dtsi
diff --git a/arch/mips/ralink/dts/mt7620a_eval.dts b/arch/mips/boot/dts/mt7620a_eval.dts
index 709f58132f5c..709f58132f5c 100644
--- a/arch/mips/ralink/dts/mt7620a_eval.dts
+++ b/arch/mips/boot/dts/mt7620a_eval.dts
diff --git a/arch/mips/cavium-octeon/octeon_3xxx.dts b/arch/mips/boot/dts/octeon_3xxx.dts
index fa33115bde33..fa33115bde33 100644
--- a/arch/mips/cavium-octeon/octeon_3xxx.dts
+++ b/arch/mips/boot/dts/octeon_3xxx.dts
diff --git a/arch/mips/cavium-octeon/octeon_68xx.dts b/arch/mips/boot/dts/octeon_68xx.dts
index 79b46fcb0a11..79b46fcb0a11 100644
--- a/arch/mips/cavium-octeon/octeon_68xx.dts
+++ b/arch/mips/boot/dts/octeon_68xx.dts
diff --git a/arch/mips/ralink/dts/rt2880.dtsi b/arch/mips/boot/dts/rt2880.dtsi
index 182afde2f2e1..182afde2f2e1 100644
--- a/arch/mips/ralink/dts/rt2880.dtsi
+++ b/arch/mips/boot/dts/rt2880.dtsi
diff --git a/arch/mips/ralink/dts/rt2880_eval.dts b/arch/mips/boot/dts/rt2880_eval.dts
index 0a685db093d4..0a685db093d4 100644
--- a/arch/mips/ralink/dts/rt2880_eval.dts
+++ b/arch/mips/boot/dts/rt2880_eval.dts
diff --git a/arch/mips/ralink/dts/rt3050.dtsi b/arch/mips/boot/dts/rt3050.dtsi
index e3203d414fee..e3203d414fee 100644
--- a/arch/mips/ralink/dts/rt3050.dtsi
+++ b/arch/mips/boot/dts/rt3050.dtsi
diff --git a/arch/mips/ralink/dts/rt3052_eval.dts b/arch/mips/boot/dts/rt3052_eval.dts
index ec9e9a035541..ec9e9a035541 100644
--- a/arch/mips/ralink/dts/rt3052_eval.dts
+++ b/arch/mips/boot/dts/rt3052_eval.dts
diff --git a/arch/mips/ralink/dts/rt3883.dtsi b/arch/mips/boot/dts/rt3883.dtsi
index 3b131dd0d5ac..3b131dd0d5ac 100644
--- a/arch/mips/ralink/dts/rt3883.dtsi
+++ b/arch/mips/boot/dts/rt3883.dtsi
diff --git a/arch/mips/ralink/dts/rt3883_eval.dts b/arch/mips/boot/dts/rt3883_eval.dts
index e8df21a5d10d..e8df21a5d10d 100644
--- a/arch/mips/ralink/dts/rt3883_eval.dts
+++ b/arch/mips/boot/dts/rt3883_eval.dts
diff --git a/arch/mips/mti-sead3/sead3.dts b/arch/mips/boot/dts/sead3.dts
index e4b317d414f1..e4b317d414f1 100644
--- a/arch/mips/mti-sead3/sead3.dts
+++ b/arch/mips/boot/dts/sead3.dts
diff --git a/arch/mips/netlogic/dts/xlp_evp.dts b/arch/mips/boot/dts/xlp_evp.dts
index 89ad04808c02..89ad04808c02 100644
--- a/arch/mips/netlogic/dts/xlp_evp.dts
+++ b/arch/mips/boot/dts/xlp_evp.dts
diff --git a/arch/mips/netlogic/dts/xlp_fvp.dts b/arch/mips/boot/dts/xlp_fvp.dts
index 63e62b7bd758..63e62b7bd758 100644
--- a/arch/mips/netlogic/dts/xlp_fvp.dts
+++ b/arch/mips/boot/dts/xlp_fvp.dts
diff --git a/arch/mips/netlogic/dts/xlp_gvp.dts b/arch/mips/boot/dts/xlp_gvp.dts
index bb4ecd1d47fc..bb4ecd1d47fc 100644
--- a/arch/mips/netlogic/dts/xlp_gvp.dts
+++ b/arch/mips/boot/dts/xlp_gvp.dts
diff --git a/arch/mips/netlogic/dts/xlp_svp.dts b/arch/mips/boot/dts/xlp_svp.dts
index 1ebd00edaacc..1ebd00edaacc 100644
--- a/arch/mips/netlogic/dts/xlp_svp.dts
+++ b/arch/mips/boot/dts/xlp_svp.dts
diff --git a/arch/mips/cavium-octeon/.gitignore b/arch/mips/cavium-octeon/.gitignore
deleted file mode 100644
index 39c968605ff6..000000000000
--- a/arch/mips/cavium-octeon/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
1*.dtb.S
2*.dtb
diff --git a/arch/mips/cavium-octeon/Makefile b/arch/mips/cavium-octeon/Makefile
index 4e952043c922..42f5f1a4b40a 100644
--- a/arch/mips/cavium-octeon/Makefile
+++ b/arch/mips/cavium-octeon/Makefile
@@ -20,13 +20,3 @@ obj-y += executive/
20obj-$(CONFIG_MTD) += flash_setup.o 20obj-$(CONFIG_MTD) += flash_setup.o
21obj-$(CONFIG_SMP) += smp.o 21obj-$(CONFIG_SMP) += smp.o
22obj-$(CONFIG_OCTEON_ILM) += oct_ilm.o 22obj-$(CONFIG_OCTEON_ILM) += oct_ilm.o
23
24DTS_FILES = octeon_3xxx.dts octeon_68xx.dts
25DTB_FILES = $(patsubst %.dts, %.dtb, $(DTS_FILES))
26
27obj-y += $(patsubst %.dts, %.dtb.o, $(DTS_FILES))
28
29# Let's keep the .dtb files around in case we want to look at them.
30.SECONDARY: $(addprefix $(obj)/, $(DTB_FILES))
31
32clean-files += $(DTB_FILES) $(patsubst %.dtb, %.dtb.S, $(DTB_FILES))
diff --git a/arch/mips/configs/sead3_defconfig b/arch/mips/configs/sead3_defconfig
index 0abe681c11a0..dae9354b6256 100644
--- a/arch/mips/configs/sead3_defconfig
+++ b/arch/mips/configs/sead3_defconfig
@@ -31,8 +31,8 @@ CONFIG_IP_PNP_BOOTP=y
31# CONFIG_IPV6 is not set 31# CONFIG_IPV6 is not set
32# CONFIG_WIRELESS is not set 32# CONFIG_WIRELESS is not set
33CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 33CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
34CONFIG_DEVTMPFS=y
34CONFIG_MTD=y 35CONFIG_MTD=y
35CONFIG_MTD_CHAR=y
36CONFIG_MTD_BLOCK=y 36CONFIG_MTD_BLOCK=y
37CONFIG_MTD_CFI=y 37CONFIG_MTD_CFI=y
38CONFIG_MTD_CFI_INTELEXT=y 38CONFIG_MTD_CFI_INTELEXT=y
diff --git a/arch/mips/configs/sead3micro_defconfig b/arch/mips/configs/sead3micro_defconfig
index 2a0da5bf4b64..cd91a775c74e 100644
--- a/arch/mips/configs/sead3micro_defconfig
+++ b/arch/mips/configs/sead3micro_defconfig
@@ -32,8 +32,8 @@ CONFIG_IP_PNP_BOOTP=y
32# CONFIG_IPV6 is not set 32# CONFIG_IPV6 is not set
33# CONFIG_WIRELESS is not set 33# CONFIG_WIRELESS is not set
34CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 34CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
35CONFIG_DEVTMPFS=y
35CONFIG_MTD=y 36CONFIG_MTD=y
36CONFIG_MTD_CHAR=y
37CONFIG_MTD_BLOCK=y 37CONFIG_MTD_BLOCK=y
38CONFIG_MTD_CFI=y 38CONFIG_MTD_CFI=y
39CONFIG_MTD_CFI_INTELEXT=y 39CONFIG_MTD_CFI_INTELEXT=y
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
index 57012ef1f51e..72e1cf1cab00 100644
--- a/arch/mips/include/asm/Kbuild
+++ b/arch/mips/include/asm/Kbuild
@@ -1,6 +1,7 @@
1# MIPS headers 1# MIPS headers
2generic-y += cputime.h 2generic-y += cputime.h
3generic-y += current.h 3generic-y += current.h
4generic-y += dma-contiguous.h
4generic-y += emergency-restart.h 5generic-y += emergency-restart.h
5generic-y += hash.h 6generic-y += hash.h
6generic-y += irq_work.h 7generic-y += irq_work.h
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index e079598ae051..3325f3eb248c 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -231,6 +231,16 @@
231#define cpu_has_clo_clz cpu_has_mips_r 231#define cpu_has_clo_clz cpu_has_mips_r
232#endif 232#endif
233 233
234/*
235 * MIPS32 R2, MIPS64 R2, Loongson 3A and Octeon have WSBH.
236 * MIPS64 R2, Loongson 3A and Octeon have WSBH, DSBH and DSHD.
237 * This indicates the availability of WSBH and in case of 64 bit CPUs also
238 * DSBH and DSHD.
239 */
240#ifndef cpu_has_wsbh
241#define cpu_has_wsbh cpu_has_mips_r2
242#endif
243
234#ifndef cpu_has_dsp 244#ifndef cpu_has_dsp
235#define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP) 245#define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP)
236#endif 246#endif
diff --git a/arch/mips/include/asm/cpu-info.h b/arch/mips/include/asm/cpu-info.h
index d5f42c168001..a6c9ccb33c5c 100644
--- a/arch/mips/include/asm/cpu-info.h
+++ b/arch/mips/include/asm/cpu-info.h
@@ -79,6 +79,11 @@ struct cpuinfo_mips {
79#define NUM_WATCH_REGS 4 79#define NUM_WATCH_REGS 4
80 u16 watch_reg_masks[NUM_WATCH_REGS]; 80 u16 watch_reg_masks[NUM_WATCH_REGS];
81 unsigned int kscratch_mask; /* Usable KScratch mask. */ 81 unsigned int kscratch_mask; /* Usable KScratch mask. */
82 /*
83 * Cache Coherency attribute for write-combine memory writes.
84 * (shifted by _CACHE_SHIFT)
85 */
86 unsigned int writecombine;
82} __attribute__((aligned(SMP_CACHE_BYTES))); 87} __attribute__((aligned(SMP_CACHE_BYTES)));
83 88
84extern struct cpuinfo_mips cpu_data[]; 89extern struct cpuinfo_mips cpu_data[];
diff --git a/arch/mips/include/asm/mach-au1x00/cpu-feature-overrides.h b/arch/mips/include/asm/mach-au1x00/cpu-feature-overrides.h
index 09f45e6afade..c5b6eef0efa7 100644
--- a/arch/mips/include/asm/mach-au1x00/cpu-feature-overrides.h
+++ b/arch/mips/include/asm/mach-au1x00/cpu-feature-overrides.h
@@ -8,6 +8,12 @@
8#define __ASM_MACH_AU1X00_CPU_FEATURE_OVERRIDES_H 8#define __ASM_MACH_AU1X00_CPU_FEATURE_OVERRIDES_H
9 9
10#define cpu_has_tlb 1 10#define cpu_has_tlb 1
11#define cpu_has_tlbinv 0
12#define cpu_has_segments 0
13#define cpu_has_eva 0
14#define cpu_has_htw 0
15#define cpu_has_rixiex 0
16#define cpu_has_maar 0
11#define cpu_has_4kex 1 17#define cpu_has_4kex 1
12#define cpu_has_3k_cache 0 18#define cpu_has_3k_cache 0
13#define cpu_has_4k_cache 1 19#define cpu_has_4k_cache 1
@@ -28,6 +34,8 @@
28#define cpu_has_mdmx 0 34#define cpu_has_mdmx 0
29#define cpu_has_mips3d 0 35#define cpu_has_mips3d 0
30#define cpu_has_smartmips 0 36#define cpu_has_smartmips 0
37#define cpu_has_rixi 0
38#define cpu_has_mmips 0
31#define cpu_has_vtag_icache 0 39#define cpu_has_vtag_icache 0
32#define cpu_has_dc_aliases 0 40#define cpu_has_dc_aliases 0
33#define cpu_has_ic_fills_f_dc 1 41#define cpu_has_ic_fills_f_dc 1
@@ -50,4 +58,8 @@
50#define cpu_dcache_line_size() 32 58#define cpu_dcache_line_size() 32
51#define cpu_icache_line_size() 32 59#define cpu_icache_line_size() 32
52 60
61#define cpu_has_perf_cntr_intr_bit 0
62#define cpu_has_vz 0
63#define cpu_has_msa 0
64
53#endif /* __ASM_MACH_AU1X00_CPU_FEATURE_OVERRIDES_H */ 65#endif /* __ASM_MACH_AU1X00_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h b/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h
index cf8022872892..fa1f3cfbae8d 100644
--- a/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h
+++ b/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h
@@ -57,6 +57,7 @@
57#define cpu_has_vint 0 57#define cpu_has_vint 0
58#define cpu_has_veic 0 58#define cpu_has_veic 0
59#define cpu_hwrena_impl_bits 0xc0000000 59#define cpu_hwrena_impl_bits 0xc0000000
60#define cpu_has_wsbh 1
60 61
61#define cpu_has_rixi (cpu_data[0].cputype != CPU_CAVIUM_OCTEON) 62#define cpu_has_rixi (cpu_data[0].cputype != CPU_CAVIUM_OCTEON)
62 63
diff --git a/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h b/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
index c0f3ef45c2c1..7d28f95b0512 100644
--- a/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
+++ b/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
@@ -59,4 +59,6 @@
59#define cpu_has_watch 1 59#define cpu_has_watch 1
60#define cpu_has_local_ebase 0 60#define cpu_has_local_ebase 0
61 61
62#define cpu_has_wsbh IS_ENABLED(CONFIG_CPU_LOONGSON3)
63
62#endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */ 64#endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/pgtable-bits.h b/arch/mips/include/asm/pgtable-bits.h
index e592f3687d6f..e747bfa0be7e 100644
--- a/arch/mips/include/asm/pgtable-bits.h
+++ b/arch/mips/include/asm/pgtable-bits.h
@@ -224,38 +224,52 @@ static inline uint64_t pte_to_entrylo(unsigned long pte_val)
224#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) 224#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
225 225
226#define _CACHE_CACHABLE_NONCOHERENT 0 226#define _CACHE_CACHABLE_NONCOHERENT 0
227#define _CACHE_UNCACHED_ACCELERATED _CACHE_UNCACHED
227 228
228#elif defined(CONFIG_CPU_SB1) 229#elif defined(CONFIG_CPU_SB1)
229 230
230/* No penalty for being coherent on the SB1, so just 231/* No penalty for being coherent on the SB1, so just
231 use it for "noncoherent" spaces, too. Shouldn't hurt. */ 232 use it for "noncoherent" spaces, too. Shouldn't hurt. */
232 233
233#define _CACHE_UNCACHED (2<<_CACHE_SHIFT)
234#define _CACHE_CACHABLE_COW (5<<_CACHE_SHIFT)
235#define _CACHE_CACHABLE_NONCOHERENT (5<<_CACHE_SHIFT) 234#define _CACHE_CACHABLE_NONCOHERENT (5<<_CACHE_SHIFT)
236#define _CACHE_UNCACHED_ACCELERATED (7<<_CACHE_SHIFT)
237 235
238#elif defined(CONFIG_CPU_LOONGSON3) 236#elif defined(CONFIG_CPU_LOONGSON3)
239 237
240/* Using COHERENT flag for NONCOHERENT doesn't hurt. */ 238/* Using COHERENT flag for NONCOHERENT doesn't hurt. */
241 239
242#define _CACHE_UNCACHED (2<<_CACHE_SHIFT) /* LOONGSON */
243#define _CACHE_CACHABLE_NONCOHERENT (3<<_CACHE_SHIFT) /* LOONGSON */ 240#define _CACHE_CACHABLE_NONCOHERENT (3<<_CACHE_SHIFT) /* LOONGSON */
244#define _CACHE_CACHABLE_COHERENT (3<<_CACHE_SHIFT) /* LOONGSON-3 */ 241#define _CACHE_CACHABLE_COHERENT (3<<_CACHE_SHIFT) /* LOONGSON-3 */
245#define _CACHE_UNCACHED_ACCELERATED (7<<_CACHE_SHIFT) /* LOONGSON */
246 242
247#else 243#elif defined(CONFIG_MACH_JZ4740)
244
245/* Ingenic uses the WA bit to achieve write-combine memory writes */
246#define _CACHE_UNCACHED_ACCELERATED (1<<_CACHE_SHIFT)
248 247
249#define _CACHE_CACHABLE_NO_WA (0<<_CACHE_SHIFT) /* R4600 only */ 248#endif
250#define _CACHE_CACHABLE_WA (1<<_CACHE_SHIFT) /* R4600 only */
251#define _CACHE_UNCACHED (2<<_CACHE_SHIFT) /* R4[0246]00 */
252#define _CACHE_CACHABLE_NONCOHERENT (3<<_CACHE_SHIFT) /* R4[0246]00 */
253#define _CACHE_CACHABLE_CE (4<<_CACHE_SHIFT) /* R4[04]00MC only */
254#define _CACHE_CACHABLE_COW (5<<_CACHE_SHIFT) /* R4[04]00MC only */
255#define _CACHE_CACHABLE_COHERENT (5<<_CACHE_SHIFT) /* MIPS32R2 CMP */
256#define _CACHE_CACHABLE_CUW (6<<_CACHE_SHIFT) /* R4[04]00MC only */
257#define _CACHE_UNCACHED_ACCELERATED (7<<_CACHE_SHIFT) /* R10000 only */
258 249
250#ifndef _CACHE_CACHABLE_NO_WA
251#define _CACHE_CACHABLE_NO_WA (0<<_CACHE_SHIFT)
252#endif
253#ifndef _CACHE_CACHABLE_WA
254#define _CACHE_CACHABLE_WA (1<<_CACHE_SHIFT)
255#endif
256#ifndef _CACHE_UNCACHED
257#define _CACHE_UNCACHED (2<<_CACHE_SHIFT)
258#endif
259#ifndef _CACHE_CACHABLE_NONCOHERENT
260#define _CACHE_CACHABLE_NONCOHERENT (3<<_CACHE_SHIFT)
261#endif
262#ifndef _CACHE_CACHABLE_CE
263#define _CACHE_CACHABLE_CE (4<<_CACHE_SHIFT)
264#endif
265#ifndef _CACHE_CACHABLE_COW
266#define _CACHE_CACHABLE_COW (5<<_CACHE_SHIFT)
267#endif
268#ifndef _CACHE_CACHABLE_CUW
269#define _CACHE_CACHABLE_CUW (6<<_CACHE_SHIFT)
270#endif
271#ifndef _CACHE_UNCACHED_ACCELERATED
272#define _CACHE_UNCACHED_ACCELERATED (7<<_CACHE_SHIFT)
259#endif 273#endif
260 274
261#define __READABLE (_PAGE_SILENT_READ | _PAGE_ACCESSED | (cpu_has_rixi ? 0 : _PAGE_READ)) 275#define __READABLE (_PAGE_SILENT_READ | _PAGE_ACCESSED | (cpu_has_rixi ? 0 : _PAGE_READ))
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index df49a308085c..d6d1928539b1 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -366,6 +366,16 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot)
366 return __pgprot(prot); 366 return __pgprot(prot);
367} 367}
368 368
369static inline pgprot_t pgprot_writecombine(pgprot_t _prot)
370{
371 unsigned long prot = pgprot_val(_prot);
372
373 /* cpu_data[0].writecombine is already shifted by _CACHE_SHIFT */
374 prot = (prot & ~_CACHE_MASK) | cpu_data[0].writecombine;
375
376 return __pgprot(prot);
377}
378
369/* 379/*
370 * Conversion functions: convert a page and protection to a page entry, 380 * Conversion functions: convert a page and protection to a page entry,
371 * and a page entry and page directory to the page they refer to. 381 * and a page entry and page directory to the page they refer to.
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
index cdf68b33bd65..bb7963753730 100644
--- a/arch/mips/include/asm/syscall.h
+++ b/arch/mips/include/asm/syscall.h
@@ -129,7 +129,7 @@ extern const unsigned long sysn32_call_table[];
129 129
130static inline int syscall_get_arch(void) 130static inline int syscall_get_arch(void)
131{ 131{
132 int arch = EM_MIPS; 132 int arch = AUDIT_ARCH_MIPS;
133#ifdef CONFIG_64BIT 133#ifdef CONFIG_64BIT
134 if (!test_thread_flag(TIF_32BIT_REGS)) { 134 if (!test_thread_flag(TIF_32BIT_REGS)) {
135 arch |= __AUDIT_ARCH_64BIT; 135 arch |= __AUDIT_ARCH_64BIT;
diff --git a/arch/mips/include/uapi/asm/swab.h b/arch/mips/include/uapi/asm/swab.h
index ac9a8f9cd1fb..8f2d184dbe9f 100644
--- a/arch/mips/include/uapi/asm/swab.h
+++ b/arch/mips/include/uapi/asm/swab.h
@@ -13,12 +13,16 @@
13 13
14#define __SWAB_64_THRU_32__ 14#define __SWAB_64_THRU_32__
15 15
16#if defined(__mips_isa_rev) && (__mips_isa_rev >= 2) 16#if (defined(__mips_isa_rev) && (__mips_isa_rev >= 2)) || \
17 defined(_MIPS_ARCH_LOONGSON3A)
17 18
18static inline __attribute_const__ __u16 __arch_swab16(__u16 x) 19static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
19{ 20{
20 __asm__( 21 __asm__(
22 " .set push \n"
23 " .set arch=mips32r2 \n"
21 " wsbh %0, %1 \n" 24 " wsbh %0, %1 \n"
25 " .set pop \n"
22 : "=r" (x) 26 : "=r" (x)
23 : "r" (x)); 27 : "r" (x));
24 28
@@ -29,8 +33,11 @@ static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
29static inline __attribute_const__ __u32 __arch_swab32(__u32 x) 33static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
30{ 34{
31 __asm__( 35 __asm__(
36 " .set push \n"
37 " .set arch=mips32r2 \n"
32 " wsbh %0, %1 \n" 38 " wsbh %0, %1 \n"
33 " rotr %0, %0, 16 \n" 39 " rotr %0, %0, 16 \n"
40 " .set pop \n"
34 : "=r" (x) 41 : "=r" (x)
35 : "r" (x)); 42 : "r" (x));
36 43
@@ -46,8 +53,11 @@ static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
46static inline __attribute_const__ __u64 __arch_swab64(__u64 x) 53static inline __attribute_const__ __u64 __arch_swab64(__u64 x)
47{ 54{
48 __asm__( 55 __asm__(
49 " dsbh %0, %1\n" 56 " .set push \n"
50 " dshd %0, %0" 57 " .set arch=mips64r2 \n"
58 " dsbh %0, %1 \n"
59 " dshd %0, %0 \n"
60 " .set pop \n"
51 : "=r" (x) 61 : "=r" (x)
52 : "r" (x)); 62 : "r" (x));
53 63
@@ -55,5 +65,5 @@ static inline __attribute_const__ __u64 __arch_swab64(__u64 x)
55} 65}
56#define __arch_swab64 __arch_swab64 66#define __arch_swab64 __arch_swab64
57#endif /* __mips64 */ 67#endif /* __mips64 */
58#endif /* MIPS R2 or newer */ 68#endif /* MIPS R2 or newer or Loongson 3A */
59#endif /* _ASM_SWAB_H */ 69#endif /* _ASM_SWAB_H */
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index e34b10be782e..94c4a0c0a577 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -27,6 +27,7 @@
27#include <asm/msa.h> 27#include <asm/msa.h>
28#include <asm/watch.h> 28#include <asm/watch.h>
29#include <asm/elf.h> 29#include <asm/elf.h>
30#include <asm/pgtable-bits.h>
30#include <asm/spram.h> 31#include <asm/spram.h>
31#include <asm/uaccess.h> 32#include <asm/uaccess.h>
32 33
@@ -764,6 +765,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
764 break; 765 break;
765 case PRID_REV_LOONGSON3A: 766 case PRID_REV_LOONGSON3A:
766 c->cputype = CPU_LOONGSON3; 767 c->cputype = CPU_LOONGSON3;
768 c->writecombine = _CACHE_UNCACHED_ACCELERATED;
767 __cpu_name[cpu] = "ICT Loongson-3"; 769 __cpu_name[cpu] = "ICT Loongson-3";
768 set_elf_platform(cpu, "loongson3a"); 770 set_elf_platform(cpu, "loongson3a");
769 break; 771 break;
@@ -798,67 +800,83 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
798 800
799static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu) 801static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
800{ 802{
803 c->writecombine = _CACHE_UNCACHED_ACCELERATED;
801 switch (c->processor_id & PRID_IMP_MASK) { 804 switch (c->processor_id & PRID_IMP_MASK) {
802 case PRID_IMP_4KC: 805 case PRID_IMP_4KC:
803 c->cputype = CPU_4KC; 806 c->cputype = CPU_4KC;
807 c->writecombine = _CACHE_UNCACHED;
804 __cpu_name[cpu] = "MIPS 4Kc"; 808 __cpu_name[cpu] = "MIPS 4Kc";
805 break; 809 break;
806 case PRID_IMP_4KEC: 810 case PRID_IMP_4KEC:
807 case PRID_IMP_4KECR2: 811 case PRID_IMP_4KECR2:
808 c->cputype = CPU_4KEC; 812 c->cputype = CPU_4KEC;
813 c->writecombine = _CACHE_UNCACHED;
809 __cpu_name[cpu] = "MIPS 4KEc"; 814 __cpu_name[cpu] = "MIPS 4KEc";
810 break; 815 break;
811 case PRID_IMP_4KSC: 816 case PRID_IMP_4KSC:
812 case PRID_IMP_4KSD: 817 case PRID_IMP_4KSD:
813 c->cputype = CPU_4KSC; 818 c->cputype = CPU_4KSC;
819 c->writecombine = _CACHE_UNCACHED;
814 __cpu_name[cpu] = "MIPS 4KSc"; 820 __cpu_name[cpu] = "MIPS 4KSc";
815 break; 821 break;
816 case PRID_IMP_5KC: 822 case PRID_IMP_5KC:
817 c->cputype = CPU_5KC; 823 c->cputype = CPU_5KC;
824 c->writecombine = _CACHE_UNCACHED;
818 __cpu_name[cpu] = "MIPS 5Kc"; 825 __cpu_name[cpu] = "MIPS 5Kc";
819 break; 826 break;
820 case PRID_IMP_5KE: 827 case PRID_IMP_5KE:
821 c->cputype = CPU_5KE; 828 c->cputype = CPU_5KE;
829 c->writecombine = _CACHE_UNCACHED;
822 __cpu_name[cpu] = "MIPS 5KE"; 830 __cpu_name[cpu] = "MIPS 5KE";
823 break; 831 break;
824 case PRID_IMP_20KC: 832 case PRID_IMP_20KC:
825 c->cputype = CPU_20KC; 833 c->cputype = CPU_20KC;
834 c->writecombine = _CACHE_UNCACHED;
826 __cpu_name[cpu] = "MIPS 20Kc"; 835 __cpu_name[cpu] = "MIPS 20Kc";
827 break; 836 break;
828 case PRID_IMP_24K: 837 case PRID_IMP_24K:
829 c->cputype = CPU_24K; 838 c->cputype = CPU_24K;
839 c->writecombine = _CACHE_UNCACHED;
830 __cpu_name[cpu] = "MIPS 24Kc"; 840 __cpu_name[cpu] = "MIPS 24Kc";
831 break; 841 break;
832 case PRID_IMP_24KE: 842 case PRID_IMP_24KE:
833 c->cputype = CPU_24K; 843 c->cputype = CPU_24K;
844 c->writecombine = _CACHE_UNCACHED;
834 __cpu_name[cpu] = "MIPS 24KEc"; 845 __cpu_name[cpu] = "MIPS 24KEc";
835 break; 846 break;
836 case PRID_IMP_25KF: 847 case PRID_IMP_25KF:
837 c->cputype = CPU_25KF; 848 c->cputype = CPU_25KF;
849 c->writecombine = _CACHE_UNCACHED;
838 __cpu_name[cpu] = "MIPS 25Kc"; 850 __cpu_name[cpu] = "MIPS 25Kc";
839 break; 851 break;
840 case PRID_IMP_34K: 852 case PRID_IMP_34K:
841 c->cputype = CPU_34K; 853 c->cputype = CPU_34K;
854 c->writecombine = _CACHE_UNCACHED;
842 __cpu_name[cpu] = "MIPS 34Kc"; 855 __cpu_name[cpu] = "MIPS 34Kc";
843 break; 856 break;
844 case PRID_IMP_74K: 857 case PRID_IMP_74K:
845 c->cputype = CPU_74K; 858 c->cputype = CPU_74K;
859 c->writecombine = _CACHE_UNCACHED;
846 __cpu_name[cpu] = "MIPS 74Kc"; 860 __cpu_name[cpu] = "MIPS 74Kc";
847 break; 861 break;
848 case PRID_IMP_M14KC: 862 case PRID_IMP_M14KC:
849 c->cputype = CPU_M14KC; 863 c->cputype = CPU_M14KC;
864 c->writecombine = _CACHE_UNCACHED;
850 __cpu_name[cpu] = "MIPS M14Kc"; 865 __cpu_name[cpu] = "MIPS M14Kc";
851 break; 866 break;
852 case PRID_IMP_M14KEC: 867 case PRID_IMP_M14KEC:
853 c->cputype = CPU_M14KEC; 868 c->cputype = CPU_M14KEC;
869 c->writecombine = _CACHE_UNCACHED;
854 __cpu_name[cpu] = "MIPS M14KEc"; 870 __cpu_name[cpu] = "MIPS M14KEc";
855 break; 871 break;
856 case PRID_IMP_1004K: 872 case PRID_IMP_1004K:
857 c->cputype = CPU_1004K; 873 c->cputype = CPU_1004K;
874 c->writecombine = _CACHE_UNCACHED;
858 __cpu_name[cpu] = "MIPS 1004Kc"; 875 __cpu_name[cpu] = "MIPS 1004Kc";
859 break; 876 break;
860 case PRID_IMP_1074K: 877 case PRID_IMP_1074K:
861 c->cputype = CPU_1074K; 878 c->cputype = CPU_1074K;
879 c->writecombine = _CACHE_UNCACHED;
862 __cpu_name[cpu] = "MIPS 1074Kc"; 880 __cpu_name[cpu] = "MIPS 1074Kc";
863 break; 881 break;
864 case PRID_IMP_INTERAPTIV_UP: 882 case PRID_IMP_INTERAPTIV_UP:
@@ -932,6 +950,7 @@ static inline void cpu_probe_sibyte(struct cpuinfo_mips *c, unsigned int cpu)
932{ 950{
933 decode_configs(c); 951 decode_configs(c);
934 952
953 c->writecombine = _CACHE_UNCACHED_ACCELERATED;
935 switch (c->processor_id & PRID_IMP_MASK) { 954 switch (c->processor_id & PRID_IMP_MASK) {
936 case PRID_IMP_SB1: 955 case PRID_IMP_SB1:
937 c->cputype = CPU_SB1; 956 c->cputype = CPU_SB1;
@@ -1063,6 +1082,7 @@ static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu)
1063 switch (c->processor_id & PRID_IMP_MASK) { 1082 switch (c->processor_id & PRID_IMP_MASK) {
1064 case PRID_IMP_JZRISC: 1083 case PRID_IMP_JZRISC:
1065 c->cputype = CPU_JZRISC; 1084 c->cputype = CPU_JZRISC;
1085 c->writecombine = _CACHE_UNCACHED_ACCELERATED;
1066 __cpu_name[cpu] = "Ingenic JZRISC"; 1086 __cpu_name[cpu] = "Ingenic JZRISC";
1067 break; 1087 break;
1068 default: 1088 default:
@@ -1169,6 +1189,7 @@ void cpu_probe(void)
1169 c->processor_id = PRID_IMP_UNKNOWN; 1189 c->processor_id = PRID_IMP_UNKNOWN;
1170 c->fpu_id = FPIR_IMP_NONE; 1190 c->fpu_id = FPIR_IMP_NONE;
1171 c->cputype = CPU_UNKNOWN; 1191 c->cputype = CPU_UNKNOWN;
1192 c->writecombine = _CACHE_UNCACHED;
1172 1193
1173 c->processor_id = read_c0_prid(); 1194 c->processor_id = read_c0_prid();
1174 switch (c->processor_id & PRID_COMP_MASK) { 1195 switch (c->processor_id & PRID_COMP_MASK) {
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index f7aac5b57b4b..9d1487d83293 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -780,9 +780,7 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall)
780 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 780 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
781 trace_sys_enter(regs, regs->regs[2]); 781 trace_sys_enter(regs, regs->regs[2]);
782 782
783 audit_syscall_entry(syscall_get_arch(), 783 audit_syscall_entry(syscall, regs->regs[4], regs->regs[5],
784 syscall,
785 regs->regs[4], regs->regs[5],
786 regs->regs[6], regs->regs[7]); 784 regs->regs[6], regs->regs[7]);
787 return syscall; 785 return syscall;
788} 786}
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 7c1fe2b42d40..b3b8f0d9d4a7 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -24,6 +24,8 @@
24#include <linux/debugfs.h> 24#include <linux/debugfs.h>
25#include <linux/kexec.h> 25#include <linux/kexec.h>
26#include <linux/sizes.h> 26#include <linux/sizes.h>
27#include <linux/device.h>
28#include <linux/dma-contiguous.h>
27 29
28#include <asm/addrspace.h> 30#include <asm/addrspace.h>
29#include <asm/bootinfo.h> 31#include <asm/bootinfo.h>
@@ -476,6 +478,7 @@ static void __init bootmem_init(void)
476 * o bootmem_init() 478 * o bootmem_init()
477 * o sparse_init() 479 * o sparse_init()
478 * o paging_init() 480 * o paging_init()
481 * o dma_continguous_reserve()
479 * 482 *
480 * At this stage the bootmem allocator is ready to use. 483 * At this stage the bootmem allocator is ready to use.
481 * 484 *
@@ -609,6 +612,7 @@ static void __init request_crashkernel(struct resource *res)
609 612
610static void __init arch_mem_init(char **cmdline_p) 613static void __init arch_mem_init(char **cmdline_p)
611{ 614{
615 struct memblock_region *reg;
612 extern void plat_mem_setup(void); 616 extern void plat_mem_setup(void);
613 617
614 /* call board setup routine */ 618 /* call board setup routine */
@@ -675,6 +679,11 @@ static void __init arch_mem_init(char **cmdline_p)
675 sparse_init(); 679 sparse_init();
676 plat_swiotlb_setup(); 680 plat_swiotlb_setup();
677 paging_init(); 681 paging_init();
682
683 dma_contiguous_reserve(PFN_PHYS(max_low_pfn));
684 /* Tell bootmem about cma reserved memblock section */
685 for_each_memblock(reserved, reg)
686 reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT);
678} 687}
679 688
680static void __init resource_init(void) 689static void __init resource_init(void)
diff --git a/arch/mips/lantiq/Kconfig b/arch/mips/lantiq/Kconfig
index c0021912131e..e10d33342b30 100644
--- a/arch/mips/lantiq/Kconfig
+++ b/arch/mips/lantiq/Kconfig
@@ -30,6 +30,7 @@ choice
30config DT_EASY50712 30config DT_EASY50712
31 bool "Easy50712" 31 bool "Easy50712"
32 depends on SOC_XWAY 32 depends on SOC_XWAY
33 select BUILTIN_DTB
33endchoice 34endchoice
34 35
35config PCI_LANTIQ 36config PCI_LANTIQ
diff --git a/arch/mips/lantiq/Makefile b/arch/mips/lantiq/Makefile
index d6bdc579419f..690257ab86d6 100644
--- a/arch/mips/lantiq/Makefile
+++ b/arch/mips/lantiq/Makefile
@@ -6,8 +6,6 @@
6 6
7obj-y := irq.o clk.o prom.o 7obj-y := irq.o clk.o prom.o
8 8
9obj-y += dts/
10
11obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 9obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
12 10
13obj-$(CONFIG_SOC_TYPE_XWAY) += xway/ 11obj-$(CONFIG_SOC_TYPE_XWAY) += xway/
diff --git a/arch/mips/lantiq/dts/Makefile b/arch/mips/lantiq/dts/Makefile
deleted file mode 100644
index 6fa72dd641b2..000000000000
--- a/arch/mips/lantiq/dts/Makefile
+++ /dev/null
@@ -1 +0,0 @@
1obj-$(CONFIG_DT_EASY50712) := easy50712.dtb.o
diff --git a/arch/mips/lib/csum_partial.S b/arch/mips/lib/csum_partial.S
index 9901237563c5..4c721e247ac9 100644
--- a/arch/mips/lib/csum_partial.S
+++ b/arch/mips/lib/csum_partial.S
@@ -277,9 +277,12 @@ LEAF(csum_partial)
277#endif 277#endif
278 278
279 /* odd buffer alignment? */ 279 /* odd buffer alignment? */
280#ifdef CONFIG_CPU_MIPSR2 280#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_LOONGSON3)
281 .set push
282 .set arch=mips32r2
281 wsbh v1, sum 283 wsbh v1, sum
282 movn sum, v1, t7 284 movn sum, v1, t7
285 .set pop
283#else 286#else
284 beqz t7, 1f /* odd buffer alignment? */ 287 beqz t7, 1f /* odd buffer alignment? */
285 lui v1, 0x00ff 288 lui v1, 0x00ff
@@ -726,9 +729,12 @@ LEAF(csum_partial)
726 addu sum, v1 729 addu sum, v1
727#endif 730#endif
728 731
729#ifdef CONFIG_CPU_MIPSR2 732#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_LOONGSON3)
733 .set push
734 .set arch=mips32r2
730 wsbh v1, sum 735 wsbh v1, sum
731 movn sum, v1, odd 736 movn sum, v1, odd
737 .set pop
732#else 738#else
733 beqz odd, 1f /* odd buffer alignment? */ 739 beqz odd, 1f /* odd buffer alignment? */
734 lui v1, 0x00ff 740 lui v1, 0x00ff
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index 44b6dff5aba2..33ba3c558fe4 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -16,6 +16,7 @@
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/gfp.h> 17#include <linux/gfp.h>
18#include <linux/highmem.h> 18#include <linux/highmem.h>
19#include <linux/dma-contiguous.h>
19 20
20#include <asm/cache.h> 21#include <asm/cache.h>
21#include <asm/cpu-type.h> 22#include <asm/cpu-type.h>
@@ -128,23 +129,30 @@ static void *mips_dma_alloc_coherent(struct device *dev, size_t size,
128 dma_addr_t * dma_handle, gfp_t gfp, struct dma_attrs *attrs) 129 dma_addr_t * dma_handle, gfp_t gfp, struct dma_attrs *attrs)
129{ 130{
130 void *ret; 131 void *ret;
132 struct page *page = NULL;
133 unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT;
131 134
132 if (dma_alloc_from_coherent(dev, size, dma_handle, &ret)) 135 if (dma_alloc_from_coherent(dev, size, dma_handle, &ret))
133 return ret; 136 return ret;
134 137
135 gfp = massage_gfp_flags(dev, gfp); 138 gfp = massage_gfp_flags(dev, gfp);
136 139
137 ret = (void *) __get_free_pages(gfp, get_order(size)); 140 if (IS_ENABLED(CONFIG_DMA_CMA) && !(gfp & GFP_ATOMIC))
138 141 page = dma_alloc_from_contiguous(dev,
139 if (ret) { 142 count, get_order(size));
140 memset(ret, 0, size); 143 if (!page)
141 *dma_handle = plat_map_dma_mem(dev, ret, size); 144 page = alloc_pages(gfp, get_order(size));
142 145
143 if (!plat_device_is_coherent(dev)) { 146 if (!page)
144 dma_cache_wback_inv((unsigned long) ret, size); 147 return NULL;
145 if (!hw_coherentio) 148
146 ret = UNCAC_ADDR(ret); 149 ret = page_address(page);
147 } 150 memset(ret, 0, size);
151 *dma_handle = plat_map_dma_mem(dev, ret, size);
152 if (!plat_device_is_coherent(dev)) {
153 dma_cache_wback_inv((unsigned long) ret, size);
154 if (!hw_coherentio)
155 ret = UNCAC_ADDR(ret);
148 } 156 }
149 157
150 return ret; 158 return ret;
@@ -164,6 +172,8 @@ static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr,
164{ 172{
165 unsigned long addr = (unsigned long) vaddr; 173 unsigned long addr = (unsigned long) vaddr;
166 int order = get_order(size); 174 int order = get_order(size);
175 unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT;
176 struct page *page = NULL;
167 177
168 if (dma_release_from_coherent(dev, order, vaddr)) 178 if (dma_release_from_coherent(dev, order, vaddr))
169 return; 179 return;
@@ -173,7 +183,10 @@ static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr,
173 if (!plat_device_is_coherent(dev) && !hw_coherentio) 183 if (!plat_device_is_coherent(dev) && !hw_coherentio)
174 addr = CAC_ADDR(addr); 184 addr = CAC_ADDR(addr);
175 185
176 free_pages(addr, get_order(size)); 186 page = virt_to_page((void *) addr);
187
188 if (!dma_release_from_contiguous(dev, page, count))
189 __free_pages(page, get_order(size));
177} 190}
178 191
179static inline void __dma_sync_virtual(void *addr, size_t size, 192static inline void __dma_sync_virtual(void *addr, size_t size,
diff --git a/arch/mips/mti-sead3/Makefile b/arch/mips/mti-sead3/Makefile
index 071786fa234b..febf4334545e 100644
--- a/arch/mips/mti-sead3/Makefile
+++ b/arch/mips/mti-sead3/Makefile
@@ -19,9 +19,5 @@ obj-y += sead3-i2c-dev.o sead3-i2c.o \
19 19
20obj-$(CONFIG_EARLY_PRINTK) += sead3-console.o 20obj-$(CONFIG_EARLY_PRINTK) += sead3-console.o
21obj-$(CONFIG_USB_EHCI_HCD) += sead3-ehci.o 21obj-$(CONFIG_USB_EHCI_HCD) += sead3-ehci.o
22obj-$(CONFIG_OF) += sead3.dtb.o
23 22
24CFLAGS_sead3-setup.o = -I$(src)/../../../scripts/dtc/libfdt 23CFLAGS_sead3-setup.o = -I$(src)/../../../scripts/dtc/libfdt
25
26$(obj)/%.dtb: $(obj)/%.dts
27 $(call if_changed,dtc)
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
index 7edc08398c4a..9b55143d19db 100644
--- a/arch/mips/net/bpf_jit.c
+++ b/arch/mips/net/bpf_jit.c
@@ -163,6 +163,19 @@ do { \
163 (ctx)->idx++; \ 163 (ctx)->idx++; \
164} while (0) 164} while (0)
165 165
166/*
167 * Similar to emit_instr but it must be used when we need to emit
168 * 32-bit or 64-bit instructions
169 */
170#define emit_long_instr(ctx, func, ...) \
171do { \
172 if ((ctx)->target != NULL) { \
173 u32 *p = &(ctx)->target[ctx->idx]; \
174 UASM_i_##func(&p, ##__VA_ARGS__); \
175 } \
176 (ctx)->idx++; \
177} while (0)
178
166/* Determine if immediate is within the 16-bit signed range */ 179/* Determine if immediate is within the 16-bit signed range */
167static inline bool is_range16(s32 imm) 180static inline bool is_range16(s32 imm)
168{ 181{
@@ -218,13 +231,6 @@ static inline void emit_ori(unsigned int dst, unsigned src, u32 imm,
218 } 231 }
219} 232}
220 233
221
222static inline void emit_daddu(unsigned int dst, unsigned int src1,
223 unsigned int src2, struct jit_ctx *ctx)
224{
225 emit_instr(ctx, daddu, dst, src1, src2);
226}
227
228static inline void emit_daddiu(unsigned int dst, unsigned int src, 234static inline void emit_daddiu(unsigned int dst, unsigned int src,
229 int imm, struct jit_ctx *ctx) 235 int imm, struct jit_ctx *ctx)
230{ 236{
@@ -283,11 +289,7 @@ static inline void emit_xori(ptr dst, ptr src, u32 imm, struct jit_ctx *ctx)
283 289
284static inline void emit_stack_offset(int offset, struct jit_ctx *ctx) 290static inline void emit_stack_offset(int offset, struct jit_ctx *ctx)
285{ 291{
286 if (config_enabled(CONFIG_64BIT)) 292 emit_long_instr(ctx, ADDIU, r_sp, r_sp, offset);
287 emit_instr(ctx, daddiu, r_sp, r_sp, offset);
288 else
289 emit_instr(ctx, addiu, r_sp, r_sp, offset);
290
291} 293}
292 294
293static inline void emit_subu(unsigned int dst, unsigned int src1, 295static inline void emit_subu(unsigned int dst, unsigned int src1,
@@ -365,10 +367,7 @@ static inline void emit_store_stack_reg(ptr reg, ptr base,
365 unsigned int offset, 367 unsigned int offset,
366 struct jit_ctx *ctx) 368 struct jit_ctx *ctx)
367{ 369{
368 if (config_enabled(CONFIG_64BIT)) 370 emit_long_instr(ctx, SW, reg, offset, base);
369 emit_instr(ctx, sd, reg, offset, base);
370 else
371 emit_instr(ctx, sw, reg, offset, base);
372} 371}
373 372
374static inline void emit_store(ptr reg, ptr base, unsigned int offset, 373static inline void emit_store(ptr reg, ptr base, unsigned int offset,
@@ -381,10 +380,7 @@ static inline void emit_load_stack_reg(ptr reg, ptr base,
381 unsigned int offset, 380 unsigned int offset,
382 struct jit_ctx *ctx) 381 struct jit_ctx *ctx)
383{ 382{
384 if (config_enabled(CONFIG_64BIT)) 383 emit_long_instr(ctx, LW, reg, offset, base);
385 emit_instr(ctx, ld, reg, offset, base);
386 else
387 emit_instr(ctx, lw, reg, offset, base);
388} 384}
389 385
390static inline void emit_load(unsigned int reg, unsigned int base, 386static inline void emit_load(unsigned int reg, unsigned int base,
@@ -458,10 +454,7 @@ static inline void emit_load_ptr(unsigned int dst, unsigned int src,
458 int imm, struct jit_ctx *ctx) 454 int imm, struct jit_ctx *ctx)
459{ 455{
460 /* src contains the base addr of the 32/64-pointer */ 456 /* src contains the base addr of the 32/64-pointer */
461 if (config_enabled(CONFIG_64BIT)) 457 emit_long_instr(ctx, LW, dst, imm, src);
462 emit_instr(ctx, ld, dst, imm, src);
463 else
464 emit_instr(ctx, lw, dst, imm, src);
465} 458}
466 459
467/* load a function pointer to register */ 460/* load a function pointer to register */
@@ -483,10 +476,7 @@ static inline void emit_load_func(unsigned int reg, ptr imm,
483/* Move to real MIPS register */ 476/* Move to real MIPS register */
484static inline void emit_reg_move(ptr dst, ptr src, struct jit_ctx *ctx) 477static inline void emit_reg_move(ptr dst, ptr src, struct jit_ctx *ctx)
485{ 478{
486 if (config_enabled(CONFIG_64BIT)) 479 emit_long_instr(ctx, ADDU, dst, src, r_zero);
487 emit_daddu(dst, src, r_zero, ctx);
488 else
489 emit_addu(dst, src, r_zero, ctx);
490} 480}
491 481
492/* Move to JIT (32-bit) register */ 482/* Move to JIT (32-bit) register */
@@ -623,10 +613,7 @@ static void save_bpf_jit_regs(struct jit_ctx *ctx, unsigned offset)
623 if (ctx->flags & SEEN_MEM) { 613 if (ctx->flags & SEEN_MEM) {
624 if (real_off % (RSIZE * 2)) 614 if (real_off % (RSIZE * 2))
625 real_off += RSIZE; 615 real_off += RSIZE;
626 if (config_enabled(CONFIG_64BIT)) 616 emit_long_instr(ctx, ADDIU, r_M, r_sp, real_off);
627 emit_daddiu(r_M, r_sp, real_off, ctx);
628 else
629 emit_addiu(r_M, r_sp, real_off, ctx);
630 } 617 }
631} 618}
632 619
@@ -1241,7 +1228,7 @@ jmp_cmp:
1241 emit_half_load(r_A, r_skb, off, ctx); 1228 emit_half_load(r_A, r_skb, off, ctx);
1242#ifdef CONFIG_CPU_LITTLE_ENDIAN 1229#ifdef CONFIG_CPU_LITTLE_ENDIAN
1243 /* This needs little endian fixup */ 1230 /* This needs little endian fixup */
1244 if (cpu_has_mips_r2) { 1231 if (cpu_has_wsbh) {
1245 /* R2 and later have the wsbh instruction */ 1232 /* R2 and later have the wsbh instruction */
1246 emit_wsbh(r_A, r_A, ctx); 1233 emit_wsbh(r_A, r_A, ctx);
1247 } else { 1234 } else {
diff --git a/arch/mips/netlogic/Kconfig b/arch/mips/netlogic/Kconfig
index 4eb683aef7d7..0823321c10e0 100644
--- a/arch/mips/netlogic/Kconfig
+++ b/arch/mips/netlogic/Kconfig
@@ -4,6 +4,7 @@ if NLM_XLP_BOARD
4config DT_XLP_EVP 4config DT_XLP_EVP
5 bool "Built-in device tree for XLP EVP boards" 5 bool "Built-in device tree for XLP EVP boards"
6 default y 6 default y
7 select BUILTIN_DTB
7 help 8 help
8 Add an FDT blob for XLP EVP boards into the kernel. 9 Add an FDT blob for XLP EVP boards into the kernel.
9 This DTB will be used if the firmware does not pass in a DTB 10 This DTB will be used if the firmware does not pass in a DTB
@@ -13,6 +14,7 @@ config DT_XLP_EVP
13config DT_XLP_SVP 14config DT_XLP_SVP
14 bool "Built-in device tree for XLP SVP boards" 15 bool "Built-in device tree for XLP SVP boards"
15 default y 16 default y
17 select BUILTIN_DTB
16 help 18 help
17 Add an FDT blob for XLP VP boards into the kernel. 19 Add an FDT blob for XLP VP boards into the kernel.
18 This DTB will be used if the firmware does not pass in a DTB 20 This DTB will be used if the firmware does not pass in a DTB
@@ -22,6 +24,7 @@ config DT_XLP_SVP
22config DT_XLP_FVP 24config DT_XLP_FVP
23 bool "Built-in device tree for XLP FVP boards" 25 bool "Built-in device tree for XLP FVP boards"
24 default y 26 default y
27 select BUILTIN_DTB
25 help 28 help
26 Add an FDT blob for XLP FVP board into the kernel. 29 Add an FDT blob for XLP FVP board into the kernel.
27 This DTB will be used if the firmware does not pass in a DTB 30 This DTB will be used if the firmware does not pass in a DTB
@@ -31,6 +34,7 @@ config DT_XLP_FVP
31config DT_XLP_GVP 34config DT_XLP_GVP
32 bool "Built-in device tree for XLP GVP boards" 35 bool "Built-in device tree for XLP GVP boards"
33 default y 36 default y
37 select BUILTIN_DTB
34 help 38 help
35 Add an FDT blob for XLP GVP board into the kernel. 39 Add an FDT blob for XLP GVP board into the kernel.
36 This DTB will be used if the firmware does not pass in a DTB 40 This DTB will be used if the firmware does not pass in a DTB
diff --git a/arch/mips/netlogic/Makefile b/arch/mips/netlogic/Makefile
index 7602d1386614..36d169b2ca6d 100644
--- a/arch/mips/netlogic/Makefile
+++ b/arch/mips/netlogic/Makefile
@@ -1,4 +1,3 @@
1obj-$(CONFIG_NLM_COMMON) += common/ 1obj-$(CONFIG_NLM_COMMON) += common/
2obj-$(CONFIG_CPU_XLR) += xlr/ 2obj-$(CONFIG_CPU_XLR) += xlr/
3obj-$(CONFIG_CPU_XLP) += xlp/ 3obj-$(CONFIG_CPU_XLP) += xlp/
4obj-$(CONFIG_CPU_XLP) += dts/
diff --git a/arch/mips/netlogic/dts/Makefile b/arch/mips/netlogic/dts/Makefile
deleted file mode 100644
index 25c8e873ee25..000000000000
--- a/arch/mips/netlogic/dts/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
1obj-$(CONFIG_DT_XLP_EVP) := xlp_evp.dtb.o
2obj-$(CONFIG_DT_XLP_SVP) += xlp_svp.dtb.o
3obj-$(CONFIG_DT_XLP_FVP) += xlp_fvp.dtb.o
4obj-$(CONFIG_DT_XLP_GVP) += xlp_gvp.dtb.o
diff --git a/arch/mips/ralink/Kconfig b/arch/mips/ralink/Kconfig
index 4a296655f446..77e8a9620e18 100644
--- a/arch/mips/ralink/Kconfig
+++ b/arch/mips/ralink/Kconfig
@@ -42,18 +42,22 @@ choice
42 config DTB_RT2880_EVAL 42 config DTB_RT2880_EVAL
43 bool "RT2880 eval kit" 43 bool "RT2880 eval kit"
44 depends on SOC_RT288X 44 depends on SOC_RT288X
45 select BUILTIN_DTB
45 46
46 config DTB_RT305X_EVAL 47 config DTB_RT305X_EVAL
47 bool "RT305x eval kit" 48 bool "RT305x eval kit"
48 depends on SOC_RT305X 49 depends on SOC_RT305X
50 select BUILTIN_DTB
49 51
50 config DTB_RT3883_EVAL 52 config DTB_RT3883_EVAL
51 bool "RT3883 eval kit" 53 bool "RT3883 eval kit"
52 depends on SOC_RT3883 54 depends on SOC_RT3883
55 select BUILTIN_DTB
53 56
54 config DTB_MT7620A_EVAL 57 config DTB_MT7620A_EVAL
55 bool "MT7620A eval kit" 58 bool "MT7620A eval kit"
56 depends on SOC_MT7620 59 depends on SOC_MT7620
60 select BUILTIN_DTB
57 61
58endchoice 62endchoice
59 63
diff --git a/arch/mips/ralink/Makefile b/arch/mips/ralink/Makefile
index 98ae349827be..2c09c8aa0ae2 100644
--- a/arch/mips/ralink/Makefile
+++ b/arch/mips/ralink/Makefile
@@ -16,5 +16,3 @@ obj-$(CONFIG_SOC_RT3883) += rt3883.o
16obj-$(CONFIG_SOC_MT7620) += mt7620.o 16obj-$(CONFIG_SOC_MT7620) += mt7620.o
17 17
18obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 18obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
19
20obj-y += dts/
diff --git a/arch/mips/ralink/dts/Makefile b/arch/mips/ralink/dts/Makefile
deleted file mode 100644
index 18194fa93e80..000000000000
--- a/arch/mips/ralink/dts/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
1obj-$(CONFIG_DTB_RT2880_EVAL) := rt2880_eval.dtb.o
2obj-$(CONFIG_DTB_RT305X_EVAL) := rt3052_eval.dtb.o
3obj-$(CONFIG_DTB_RT3883_EVAL) := rt3883_eval.dtb.o
4obj-$(CONFIG_DTB_MT7620A_EVAL) := mt7620a_eval.dtb.o
diff --git a/arch/mips/ralink/timer.c b/arch/mips/ralink/timer.c
index e38692a44e69..5bb29b3790ff 100644
--- a/arch/mips/ralink/timer.c
+++ b/arch/mips/ralink/timer.c
@@ -58,7 +58,7 @@ static irqreturn_t rt_timer_irq(int irq, void *_rt)
58 58
59static int rt_timer_request(struct rt_timer *rt) 59static int rt_timer_request(struct rt_timer *rt)
60{ 60{
61 int err = request_irq(rt->irq, rt_timer_irq, IRQF_DISABLED, 61 int err = request_irq(rt->irq, rt_timer_irq, 0,
62 dev_name(rt->dev), rt); 62 dev_name(rt->dev), rt);
63 if (err) { 63 if (err) {
64 dev_err(rt->dev, "failed to request irq\n"); 64 dev_err(rt->dev, "failed to request irq\n");
diff --git a/arch/openrisc/include/asm/syscall.h b/arch/openrisc/include/asm/syscall.h
index b752bb67891d..2db9f1cf0694 100644
--- a/arch/openrisc/include/asm/syscall.h
+++ b/arch/openrisc/include/asm/syscall.h
@@ -19,6 +19,7 @@
19#ifndef __ASM_OPENRISC_SYSCALL_H__ 19#ifndef __ASM_OPENRISC_SYSCALL_H__
20#define __ASM_OPENRISC_SYSCALL_H__ 20#define __ASM_OPENRISC_SYSCALL_H__
21 21
22#include <uapi/linux/audit.h>
22#include <linux/err.h> 23#include <linux/err.h>
23#include <linux/sched.h> 24#include <linux/sched.h>
24 25
@@ -71,4 +72,8 @@ syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
71 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0])); 72 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
72} 73}
73 74
75static inline int syscall_get_arch(void)
76{
77 return AUDIT_ARCH_OPENRISC;
78}
74#endif 79#endif
diff --git a/arch/openrisc/include/uapi/asm/elf.h b/arch/openrisc/include/uapi/asm/elf.h
index f02ea5830420..88842760e66f 100644
--- a/arch/openrisc/include/uapi/asm/elf.h
+++ b/arch/openrisc/include/uapi/asm/elf.h
@@ -55,9 +55,8 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
55/* A placeholder; OR32 does not have fp support yes, so no fp regs for now. */ 55/* A placeholder; OR32 does not have fp support yes, so no fp regs for now. */
56typedef unsigned long elf_fpregset_t; 56typedef unsigned long elf_fpregset_t;
57 57
58/* This should be moved to include/linux/elf.h */ 58/* EM_OPENRISC is defined in linux/elf-em.h */
59#define EM_OR32 0x8472 59#define EM_OR32 0x8472
60#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
61 60
62/* 61/*
63 * These are used to set parameters in the core dumps. 62 * These are used to set parameters in the core dumps.
diff --git a/arch/openrisc/kernel/ptrace.c b/arch/openrisc/kernel/ptrace.c
index 71a2a0c34c65..4f59fa4e34e5 100644
--- a/arch/openrisc/kernel/ptrace.c
+++ b/arch/openrisc/kernel/ptrace.c
@@ -187,8 +187,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
187 */ 187 */
188 ret = -1L; 188 ret = -1L;
189 189
190 audit_syscall_entry(AUDIT_ARCH_OPENRISC, regs->gpr[11], 190 audit_syscall_entry(regs->gpr[11], regs->gpr[3], regs->gpr[4],
191 regs->gpr[3], regs->gpr[4],
192 regs->gpr[5], regs->gpr[6]); 191 regs->gpr[5], regs->gpr[6]);
193 192
194 return ret ? : regs->gpr[11]; 193 return ret ? : regs->gpr[11];
diff --git a/arch/parisc/include/asm/syscall.h b/arch/parisc/include/asm/syscall.h
index 8bdfd2c8c39f..a5eba95d87fe 100644
--- a/arch/parisc/include/asm/syscall.h
+++ b/arch/parisc/include/asm/syscall.h
@@ -3,6 +3,8 @@
3#ifndef _ASM_PARISC_SYSCALL_H_ 3#ifndef _ASM_PARISC_SYSCALL_H_
4#define _ASM_PARISC_SYSCALL_H_ 4#define _ASM_PARISC_SYSCALL_H_
5 5
6#include <uapi/linux/audit.h>
7#include <linux/compat.h>
6#include <linux/err.h> 8#include <linux/err.h>
7#include <asm/ptrace.h> 9#include <asm/ptrace.h>
8 10
@@ -37,4 +39,13 @@ static inline void syscall_get_arguments(struct task_struct *tsk,
37 } 39 }
38} 40}
39 41
42static inline int syscall_get_arch(void)
43{
44 int arch = AUDIT_ARCH_PARISC;
45#ifdef CONFIG_64BIT
46 if (!is_compat_task())
47 arch = AUDIT_ARCH_PARISC64;
48#endif
49 return arch;
50}
40#endif /*_ASM_PARISC_SYSCALL_H_*/ 51#endif /*_ASM_PARISC_SYSCALL_H_*/
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c
index 92438c21d453..9585c81f755f 100644
--- a/arch/parisc/kernel/ptrace.c
+++ b/arch/parisc/kernel/ptrace.c
@@ -280,14 +280,11 @@ long do_syscall_trace_enter(struct pt_regs *regs)
280 280
281#ifdef CONFIG_64BIT 281#ifdef CONFIG_64BIT
282 if (!is_compat_task()) 282 if (!is_compat_task())
283 audit_syscall_entry(AUDIT_ARCH_PARISC64, 283 audit_syscall_entry(regs->gr[20], regs->gr[26], regs->gr[25],
284 regs->gr[20], 284 regs->gr[24], regs->gr[23]);
285 regs->gr[26], regs->gr[25],
286 regs->gr[24], regs->gr[23]);
287 else 285 else
288#endif 286#endif
289 audit_syscall_entry(AUDIT_ARCH_PARISC, 287 audit_syscall_entry(regs->gr[20] & 0xffffffff,
290 regs->gr[20] & 0xffffffff,
291 regs->gr[26] & 0xffffffff, 288 regs->gr[26] & 0xffffffff,
292 regs->gr[25] & 0xffffffff, 289 regs->gr[25] & 0xffffffff,
293 regs->gr[24] & 0xffffffff, 290 regs->gr[24] & 0xffffffff,
diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h
index b54b2add07be..6fa2708da153 100644
--- a/arch/powerpc/include/asm/syscall.h
+++ b/arch/powerpc/include/asm/syscall.h
@@ -13,7 +13,9 @@
13#ifndef _ASM_SYSCALL_H 13#ifndef _ASM_SYSCALL_H
14#define _ASM_SYSCALL_H 1 14#define _ASM_SYSCALL_H 1
15 15
16#include <uapi/linux/audit.h>
16#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/thread_info.h>
17 19
18/* ftrace syscalls requires exporting the sys_call_table */ 20/* ftrace syscalls requires exporting the sys_call_table */
19#ifdef CONFIG_FTRACE_SYSCALLS 21#ifdef CONFIG_FTRACE_SYSCALLS
@@ -86,4 +88,8 @@ static inline void syscall_set_arguments(struct task_struct *task,
86 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0])); 88 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
87} 89}
88 90
91static inline int syscall_get_arch(void)
92{
93 return is_32bit_task() ? AUDIT_ARCH_PPC : AUDIT_ARCH_PPC64;
94}
89#endif /* _ASM_SYSCALL_H */ 95#endif /* _ASM_SYSCALL_H */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index bd70a51d5747..e5dad9a9edc0 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -747,7 +747,11 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose,
747 break; 747 break;
748 } 748 }
749 if (res != NULL) { 749 if (res != NULL) {
750 of_pci_range_to_resource(&range, dev, res); 750 res->name = dev->full_name;
751 res->flags = range.flags;
752 res->start = range.cpu_addr;
753 res->end = range.cpu_addr + range.size - 1;
754 res->parent = res->child = res->sibling = NULL;
751 } 755 }
752 } 756 }
753} 757}
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index cdb404ea3468..f21897b42057 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1788,14 +1788,11 @@ long do_syscall_trace_enter(struct pt_regs *regs)
1788 1788
1789#ifdef CONFIG_PPC64 1789#ifdef CONFIG_PPC64
1790 if (!is_32bit_task()) 1790 if (!is_32bit_task())
1791 audit_syscall_entry(AUDIT_ARCH_PPC64, 1791 audit_syscall_entry(regs->gpr[0], regs->gpr[3], regs->gpr[4],
1792 regs->gpr[0],
1793 regs->gpr[3], regs->gpr[4],
1794 regs->gpr[5], regs->gpr[6]); 1792 regs->gpr[5], regs->gpr[6]);
1795 else 1793 else
1796#endif 1794#endif
1797 audit_syscall_entry(AUDIT_ARCH_PPC, 1795 audit_syscall_entry(regs->gpr[0],
1798 regs->gpr[0],
1799 regs->gpr[3] & 0xffffffff, 1796 regs->gpr[3] & 0xffffffff,
1800 regs->gpr[4] & 0xffffffff, 1797 regs->gpr[4] & 0xffffffff,
1801 regs->gpr[5] & 0xffffffff, 1798 regs->gpr[5] & 0xffffffff,
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index f537e937a988..99a567b70d16 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -834,9 +834,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
834 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 834 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
835 trace_sys_enter(regs, regs->gprs[2]); 835 trace_sys_enter(regs, regs->gprs[2]);
836 836
837 audit_syscall_entry(is_compat_task() ? 837 audit_syscall_entry(regs->gprs[2], regs->orig_gpr2,
838 AUDIT_ARCH_S390 : AUDIT_ARCH_S390X,
839 regs->gprs[2], regs->orig_gpr2,
840 regs->gprs[3], regs->gprs[4], 838 regs->gprs[3], regs->gprs[4],
841 regs->gprs[5]); 839 regs->gprs[5]);
842out: 840out:
diff --git a/arch/sh/include/asm/syscall_32.h b/arch/sh/include/asm/syscall_32.h
index 7d80df4f09cb..95be3b0ce0ac 100644
--- a/arch/sh/include/asm/syscall_32.h
+++ b/arch/sh/include/asm/syscall_32.h
@@ -1,6 +1,7 @@
1#ifndef __ASM_SH_SYSCALL_32_H 1#ifndef __ASM_SH_SYSCALL_32_H
2#define __ASM_SH_SYSCALL_32_H 2#define __ASM_SH_SYSCALL_32_H
3 3
4#include <uapi/linux/audit.h>
4#include <linux/kernel.h> 5#include <linux/kernel.h>
5#include <linux/sched.h> 6#include <linux/sched.h>
6#include <linux/err.h> 7#include <linux/err.h>
@@ -93,4 +94,13 @@ static inline void syscall_set_arguments(struct task_struct *task,
93 } 94 }
94} 95}
95 96
97static inline int syscall_get_arch(void)
98{
99 int arch = AUDIT_ARCH_SH;
100
101#ifdef CONFIG_CPU_LITTLE_ENDIAN
102 arch |= __AUDIT_ARCH_LE;
103#endif
104 return arch;
105}
96#endif /* __ASM_SH_SYSCALL_32_H */ 106#endif /* __ASM_SH_SYSCALL_32_H */
diff --git a/arch/sh/include/asm/syscall_64.h b/arch/sh/include/asm/syscall_64.h
index c3561ca72bee..c6a797b90b80 100644
--- a/arch/sh/include/asm/syscall_64.h
+++ b/arch/sh/include/asm/syscall_64.h
@@ -1,6 +1,7 @@
1#ifndef __ASM_SH_SYSCALL_64_H 1#ifndef __ASM_SH_SYSCALL_64_H
2#define __ASM_SH_SYSCALL_64_H 2#define __ASM_SH_SYSCALL_64_H
3 3
4#include <uapi/linux/audit.h>
4#include <linux/kernel.h> 5#include <linux/kernel.h>
5#include <linux/sched.h> 6#include <linux/sched.h>
6#include <asm/ptrace.h> 7#include <asm/ptrace.h>
@@ -61,4 +62,17 @@ static inline void syscall_set_arguments(struct task_struct *task,
61 memcpy(&regs->regs[2 + i], args, n * sizeof(args[0])); 62 memcpy(&regs->regs[2 + i], args, n * sizeof(args[0]));
62} 63}
63 64
65static inline int syscall_get_arch(void)
66{
67 int arch = AUDIT_ARCH_SH;
68
69#ifdef CONFIG_64BIT
70 arch |= __AUDIT_ARCH_64BIT;
71#endif
72#ifdef CONFIG_CPU_LITTLE_ENDIAN
73 arch |= __AUDIT_ARCH_LE;
74#endif
75
76 return arch;
77}
64#endif /* __ASM_SH_SYSCALL_64_H */ 78#endif /* __ASM_SH_SYSCALL_64_H */
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index 668c81631c08..c1a6b89bfe70 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -484,17 +484,6 @@ long arch_ptrace(struct task_struct *child, long request,
484 return ret; 484 return ret;
485} 485}
486 486
487static inline int audit_arch(void)
488{
489 int arch = EM_SH;
490
491#ifdef CONFIG_CPU_LITTLE_ENDIAN
492 arch |= __AUDIT_ARCH_LE;
493#endif
494
495 return arch;
496}
497
498asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) 487asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
499{ 488{
500 long ret = 0; 489 long ret = 0;
@@ -513,8 +502,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
513 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 502 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
514 trace_sys_enter(regs, regs->regs[0]); 503 trace_sys_enter(regs, regs->regs[0]);
515 504
516 audit_syscall_entry(audit_arch(), regs->regs[3], 505 audit_syscall_entry(regs->regs[3], regs->regs[4], regs->regs[5],
517 regs->regs[4], regs->regs[5],
518 regs->regs[6], regs->regs[7]); 506 regs->regs[6], regs->regs[7]);
519 507
520 return ret ?: regs->regs[0]; 508 return ret ?: regs->regs[0];
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index af90339dadcd..5cea973a65b2 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -504,20 +504,6 @@ asmlinkage int sh64_ptrace(long request, long pid,
504 return sys_ptrace(request, pid, addr, data); 504 return sys_ptrace(request, pid, addr, data);
505} 505}
506 506
507static inline int audit_arch(void)
508{
509 int arch = EM_SH;
510
511#ifdef CONFIG_64BIT
512 arch |= __AUDIT_ARCH_64BIT;
513#endif
514#ifdef CONFIG_CPU_LITTLE_ENDIAN
515 arch |= __AUDIT_ARCH_LE;
516#endif
517
518 return arch;
519}
520
521asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs) 507asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs)
522{ 508{
523 long long ret = 0; 509 long long ret = 0;
@@ -536,8 +522,7 @@ asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs)
536 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 522 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
537 trace_sys_enter(regs, regs->regs[9]); 523 trace_sys_enter(regs, regs->regs[9]);
538 524
539 audit_syscall_entry(audit_arch(), regs->regs[1], 525 audit_syscall_entry(regs->regs[1], regs->regs[2], regs->regs[3],
540 regs->regs[2], regs->regs[3],
541 regs->regs[4], regs->regs[5]); 526 regs->regs[4], regs->regs[5]);
542 527
543 return ret ?: regs->regs[9]; 528 return ret ?: regs->regs[9];
diff --git a/arch/sparc/include/asm/syscall.h b/arch/sparc/include/asm/syscall.h
index 025a02ad2e31..49f71fd5b56e 100644
--- a/arch/sparc/include/asm/syscall.h
+++ b/arch/sparc/include/asm/syscall.h
@@ -1,9 +1,11 @@
1#ifndef __ASM_SPARC_SYSCALL_H 1#ifndef __ASM_SPARC_SYSCALL_H
2#define __ASM_SPARC_SYSCALL_H 2#define __ASM_SPARC_SYSCALL_H
3 3
4#include <uapi/linux/audit.h>
4#include <linux/kernel.h> 5#include <linux/kernel.h>
5#include <linux/sched.h> 6#include <linux/sched.h>
6#include <asm/ptrace.h> 7#include <asm/ptrace.h>
8#include <asm/thread_info.h>
7 9
8/* 10/*
9 * The syscall table always contains 32 bit pointers since we know that the 11 * The syscall table always contains 32 bit pointers since we know that the
@@ -124,4 +126,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
124 regs->u_regs[UREG_I0 + i + j] = args[j]; 126 regs->u_regs[UREG_I0 + i + j] = args[j];
125} 127}
126 128
129static inline int syscall_get_arch(void)
130{
131 return is_32bit_task() ? AUDIT_ARCH_SPARC : AUDIT_ARCH_SPARC64;
132}
133
127#endif /* __ASM_SPARC_SYSCALL_H */ 134#endif /* __ASM_SPARC_SYSCALL_H */
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h
index 96efa7adc223..025c98446b1e 100644
--- a/arch/sparc/include/asm/thread_info_32.h
+++ b/arch/sparc/include/asm/thread_info_32.h
@@ -130,6 +130,8 @@ register struct thread_info *current_thread_info_reg asm("g6");
130#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \ 130#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \
131 _TIF_SIGPENDING) 131 _TIF_SIGPENDING)
132 132
133#define is_32bit_task() (1)
134
133#endif /* __KERNEL__ */ 135#endif /* __KERNEL__ */
134 136
135#endif /* _ASM_THREAD_INFO_H */ 137#endif /* _ASM_THREAD_INFO_H */
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
index f85dc8512ab3..798f0279a4b5 100644
--- a/arch/sparc/include/asm/thread_info_64.h
+++ b/arch/sparc/include/asm/thread_info_64.h
@@ -63,7 +63,8 @@ struct thread_info {
63 struct pt_regs *kern_una_regs; 63 struct pt_regs *kern_una_regs;
64 unsigned int kern_una_insn; 64 unsigned int kern_una_insn;
65 65
66 unsigned long fpregs[0] __attribute__ ((aligned(64))); 66 unsigned long fpregs[(7 * 256) / sizeof(unsigned long)]
67 __attribute__ ((aligned(64)));
67}; 68};
68 69
69#endif /* !(__ASSEMBLY__) */ 70#endif /* !(__ASSEMBLY__) */
@@ -220,6 +221,8 @@ register struct thread_info *current_thread_info_reg asm("g6");
220 _TIF_NEED_RESCHED) 221 _TIF_NEED_RESCHED)
221#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING) 222#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING)
222 223
224#define is_32bit_task() (test_thread_flag(TIF_32BIT))
225
223/* 226/*
224 * Thread-synchronous status. 227 * Thread-synchronous status.
225 * 228 *
diff --git a/arch/sparc/include/asm/visasm.h b/arch/sparc/include/asm/visasm.h
index b26673759283..1f0aa2024e94 100644
--- a/arch/sparc/include/asm/visasm.h
+++ b/arch/sparc/include/asm/visasm.h
@@ -39,6 +39,14 @@
39297: wr %o5, FPRS_FEF, %fprs; \ 39297: wr %o5, FPRS_FEF, %fprs; \
40298: 40298:
41 41
42#define VISEntryHalfFast(fail_label) \
43 rd %fprs, %o5; \
44 andcc %o5, FPRS_FEF, %g0; \
45 be,pt %icc, 297f; \
46 nop; \
47 ba,a,pt %xcc, fail_label; \
48297: wr %o5, FPRS_FEF, %fprs;
49
42#define VISExitHalf \ 50#define VISExitHalf \
43 wr %o5, 0, %fprs; 51 wr %o5, 0, %fprs;
44 52
diff --git a/arch/sparc/kernel/dtlb_prot.S b/arch/sparc/kernel/dtlb_prot.S
index b2c2c5be281c..d668ca149e64 100644
--- a/arch/sparc/kernel/dtlb_prot.S
+++ b/arch/sparc/kernel/dtlb_prot.S
@@ -24,11 +24,11 @@
24 mov TLB_TAG_ACCESS, %g4 ! For reload of vaddr 24 mov TLB_TAG_ACCESS, %g4 ! For reload of vaddr
25 25
26/* PROT ** ICACHE line 2: More real fault processing */ 26/* PROT ** ICACHE line 2: More real fault processing */
27 ldxa [%g4] ASI_DMMU, %g5 ! Put tagaccess in %g5
27 bgu,pn %xcc, winfix_trampoline ! Yes, perform winfixup 28 bgu,pn %xcc, winfix_trampoline ! Yes, perform winfixup
28 ldxa [%g4] ASI_DMMU, %g5 ! Put tagaccess in %g5
29 ba,pt %xcc, sparc64_realfault_common ! Nope, normal fault
30 mov FAULT_CODE_DTLB | FAULT_CODE_WRITE, %g4 29 mov FAULT_CODE_DTLB | FAULT_CODE_WRITE, %g4
31 nop 30 ba,pt %xcc, sparc64_realfault_common ! Nope, normal fault
31 nop
32 nop 32 nop
33 nop 33 nop
34 nop 34 nop
diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c
index c13c9f25d83a..9ddc4928a089 100644
--- a/arch/sparc/kernel/ptrace_64.c
+++ b/arch/sparc/kernel/ptrace_64.c
@@ -1076,13 +1076,8 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
1076 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 1076 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
1077 trace_sys_enter(regs, regs->u_regs[UREG_G1]); 1077 trace_sys_enter(regs, regs->u_regs[UREG_G1]);
1078 1078
1079 audit_syscall_entry((test_thread_flag(TIF_32BIT) ? 1079 audit_syscall_entry(regs->u_regs[UREG_G1], regs->u_regs[UREG_I0],
1080 AUDIT_ARCH_SPARC : 1080 regs->u_regs[UREG_I1], regs->u_regs[UREG_I2],
1081 AUDIT_ARCH_SPARC64),
1082 regs->u_regs[UREG_G1],
1083 regs->u_regs[UREG_I0],
1084 regs->u_regs[UREG_I1],
1085 regs->u_regs[UREG_I2],
1086 regs->u_regs[UREG_I3]); 1081 regs->u_regs[UREG_I3]);
1087 1082
1088 return ret; 1083 return ret;
diff --git a/arch/sparc/kernel/tsb.S b/arch/sparc/kernel/tsb.S
index 14158d40ba76..be98685c14c6 100644
--- a/arch/sparc/kernel/tsb.S
+++ b/arch/sparc/kernel/tsb.S
@@ -162,10 +162,10 @@ tsb_miss_page_table_walk_sun4v_fastpath:
162 nop 162 nop
163 .previous 163 .previous
164 164
165 rdpr %tl, %g3 165 rdpr %tl, %g7
166 cmp %g3, 1 166 cmp %g7, 1
167 bne,pn %xcc, winfix_trampoline 167 bne,pn %xcc, winfix_trampoline
168 nop 168 mov %g3, %g4
169 ba,pt %xcc, etrap 169 ba,pt %xcc, etrap
170 rd %pc, %g7 170 rd %pc, %g7
171 call hugetlb_setup 171 call hugetlb_setup
diff --git a/arch/sparc/lib/NG4memcpy.S b/arch/sparc/lib/NG4memcpy.S
index 9cf2ee01cee3..140527a20e7d 100644
--- a/arch/sparc/lib/NG4memcpy.S
+++ b/arch/sparc/lib/NG4memcpy.S
@@ -41,6 +41,10 @@
41#endif 41#endif
42#endif 42#endif
43 43
44#if !defined(EX_LD) && !defined(EX_ST)
45#define NON_USER_COPY
46#endif
47
44#ifndef EX_LD 48#ifndef EX_LD
45#define EX_LD(x) x 49#define EX_LD(x) x
46#endif 50#endif
@@ -197,9 +201,13 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
197 mov EX_RETVAL(%o3), %o0 201 mov EX_RETVAL(%o3), %o0
198 202
199.Llarge_src_unaligned: 203.Llarge_src_unaligned:
204#ifdef NON_USER_COPY
205 VISEntryHalfFast(.Lmedium_vis_entry_fail)
206#else
207 VISEntryHalf
208#endif
200 andn %o2, 0x3f, %o4 209 andn %o2, 0x3f, %o4
201 sub %o2, %o4, %o2 210 sub %o2, %o4, %o2
202 VISEntryHalf
203 alignaddr %o1, %g0, %g1 211 alignaddr %o1, %g0, %g1
204 add %o1, %o4, %o1 212 add %o1, %o4, %o1
205 EX_LD(LOAD(ldd, %g1 + 0x00, %f0)) 213 EX_LD(LOAD(ldd, %g1 + 0x00, %f0))
@@ -240,6 +248,10 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
240 nop 248 nop
241 ba,a,pt %icc, .Lmedium_unaligned 249 ba,a,pt %icc, .Lmedium_unaligned
242 250
251#ifdef NON_USER_COPY
252.Lmedium_vis_entry_fail:
253 or %o0, %o1, %g2
254#endif
243.Lmedium: 255.Lmedium:
244 LOAD(prefetch, %o1 + 0x40, #n_reads_strong) 256 LOAD(prefetch, %o1 + 0x40, #n_reads_strong)
245 andcc %g2, 0x7, %g0 257 andcc %g2, 0x7, %g0
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
index 694d551c8899..62435ef003d9 100644
--- a/arch/um/kernel/ptrace.c
+++ b/arch/um/kernel/ptrace.c
@@ -165,8 +165,7 @@ static void send_sigtrap(struct task_struct *tsk, struct uml_pt_regs *regs,
165 */ 165 */
166void syscall_trace_enter(struct pt_regs *regs) 166void syscall_trace_enter(struct pt_regs *regs)
167{ 167{
168 audit_syscall_entry(HOST_AUDIT_ARCH, 168 audit_syscall_entry(UPT_SYSCALL_NR(&regs->regs),
169 UPT_SYSCALL_NR(&regs->regs),
170 UPT_SYSCALL_ARG1(&regs->regs), 169 UPT_SYSCALL_ARG1(&regs->regs),
171 UPT_SYSCALL_ARG2(&regs->regs), 170 UPT_SYSCALL_ARG2(&regs->regs),
172 UPT_SYSCALL_ARG3(&regs->regs), 171 UPT_SYSCALL_ARG3(&regs->regs),
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 711de084ab57..8ffba18395c8 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -198,12 +198,12 @@ sysexit_from_sys_call:
198 198
199#ifdef CONFIG_AUDITSYSCALL 199#ifdef CONFIG_AUDITSYSCALL
200 .macro auditsys_entry_common 200 .macro auditsys_entry_common
201 movl %esi,%r9d /* 6th arg: 4th syscall arg */ 201 movl %esi,%r8d /* 5th arg: 4th syscall arg */
202 movl %edx,%r8d /* 5th arg: 3rd syscall arg */ 202 movl %ecx,%r9d /*swap with edx*/
203 /* (already in %ecx) 4th arg: 2nd syscall arg */ 203 movl %edx,%ecx /* 4th arg: 3rd syscall arg */
204 movl %ebx,%edx /* 3rd arg: 1st syscall arg */ 204 movl %r9d,%edx /* 3rd arg: 2nd syscall arg */
205 movl %eax,%esi /* 2nd arg: syscall number */ 205 movl %ebx,%esi /* 2nd arg: 1st syscall arg */
206 movl $AUDIT_ARCH_I386,%edi /* 1st arg: audit arch */ 206 movl %eax,%edi /* 1st arg: syscall number */
207 call __audit_syscall_entry 207 call __audit_syscall_entry
208 movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */ 208 movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */
209 cmpq $(IA32_NR_syscalls-1),%rax 209 cmpq $(IA32_NR_syscalls-1),%rax
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index 3bf000fab0ae..d55a210a49bf 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -6,6 +6,7 @@ genhdr-y += unistd_x32.h
6 6
7generic-y += clkdev.h 7generic-y += clkdev.h
8generic-y += cputime.h 8generic-y += cputime.h
9generic-y += dma-contiguous.h
9generic-y += early_ioremap.h 10generic-y += early_ioremap.h
10generic-y += mcs_spinlock.h 11generic-y += mcs_spinlock.h
11generic-y += scatterlist.h 12generic-y += scatterlist.h
diff --git a/arch/x86/include/asm/dma-contiguous.h b/arch/x86/include/asm/dma-contiguous.h
deleted file mode 100644
index b4b38bacb404..000000000000
--- a/arch/x86/include/asm/dma-contiguous.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef ASMX86_DMA_CONTIGUOUS_H
2#define ASMX86_DMA_CONTIGUOUS_H
3
4#ifdef __KERNEL__
5
6#include <linux/types.h>
7
8static inline void
9dma_contiguous_early_fixup(phys_addr_t base, unsigned long size) { }
10
11#endif
12#endif
diff --git a/arch/x86/include/asm/kprobes.h b/arch/x86/include/asm/kprobes.h
index 53cdfb2857ab..4421b5da409d 100644
--- a/arch/x86/include/asm/kprobes.h
+++ b/arch/x86/include/asm/kprobes.h
@@ -27,7 +27,6 @@
27#include <asm/insn.h> 27#include <asm/insn.h>
28 28
29#define __ARCH_WANT_KPROBES_INSN_SLOT 29#define __ARCH_WANT_KPROBES_INSN_SLOT
30#define ARCH_SUPPORTS_KPROBES_ON_FTRACE
31 30
32struct pt_regs; 31struct pt_regs;
33struct kprobe; 32struct kprobe;
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 4b0e1dfa2226..b553ed89e5f5 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -449,12 +449,11 @@ sysenter_audit:
449 jnz syscall_trace_entry 449 jnz syscall_trace_entry
450 addl $4,%esp 450 addl $4,%esp
451 CFI_ADJUST_CFA_OFFSET -4 451 CFI_ADJUST_CFA_OFFSET -4
452 /* %esi already in 8(%esp) 6th arg: 4th syscall arg */ 452 movl %esi,4(%esp) /* 5th arg: 4th syscall arg */
453 /* %edx already in 4(%esp) 5th arg: 3rd syscall arg */ 453 movl %edx,(%esp) /* 4th arg: 3rd syscall arg */
454 /* %ecx already in 0(%esp) 4th arg: 2nd syscall arg */ 454 /* %ecx already in %ecx 3rd arg: 2nd syscall arg */
455 movl %ebx,%ecx /* 3rd arg: 1st syscall arg */ 455 movl %ebx,%edx /* 2nd arg: 1st syscall arg */
456 movl %eax,%edx /* 2nd arg: syscall number */ 456 /* %eax already in %eax 1st arg: syscall number */
457 movl $AUDIT_ARCH_I386,%eax /* 1st arg: audit arch */
458 call __audit_syscall_entry 457 call __audit_syscall_entry
459 pushl_cfi %ebx 458 pushl_cfi %ebx
460 movl PT_EAX(%esp),%eax /* reload syscall number */ 459 movl PT_EAX(%esp),%eax /* reload syscall number */
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 29576c244699..749b0e423419 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1445,12 +1445,12 @@ static void do_audit_syscall_entry(struct pt_regs *regs, u32 arch)
1445{ 1445{
1446#ifdef CONFIG_X86_64 1446#ifdef CONFIG_X86_64
1447 if (arch == AUDIT_ARCH_X86_64) { 1447 if (arch == AUDIT_ARCH_X86_64) {
1448 audit_syscall_entry(arch, regs->orig_ax, regs->di, 1448 audit_syscall_entry(regs->orig_ax, regs->di,
1449 regs->si, regs->dx, regs->r10); 1449 regs->si, regs->dx, regs->r10);
1450 } else 1450 } else
1451#endif 1451#endif
1452 { 1452 {
1453 audit_syscall_entry(arch, regs->orig_ax, regs->bx, 1453 audit_syscall_entry(regs->orig_ax, regs->bx,
1454 regs->cx, regs->dx, regs->si); 1454 regs->cx, regs->dx, regs->si);
1455 } 1455 }
1456} 1456}
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index d9dcfa27aa84..0acac81f198b 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -472,6 +472,7 @@ struct vcpu_vmx {
472 int gs_ldt_reload_needed; 472 int gs_ldt_reload_needed;
473 int fs_reload_needed; 473 int fs_reload_needed;
474 u64 msr_host_bndcfgs; 474 u64 msr_host_bndcfgs;
475 unsigned long vmcs_host_cr4; /* May not match real cr4 */
475 } host_state; 476 } host_state;
476 struct { 477 struct {
477 int vm86_active; 478 int vm86_active;
@@ -4267,11 +4268,16 @@ static void vmx_set_constant_host_state(struct vcpu_vmx *vmx)
4267 u32 low32, high32; 4268 u32 low32, high32;
4268 unsigned long tmpl; 4269 unsigned long tmpl;
4269 struct desc_ptr dt; 4270 struct desc_ptr dt;
4271 unsigned long cr4;
4270 4272
4271 vmcs_writel(HOST_CR0, read_cr0() & ~X86_CR0_TS); /* 22.2.3 */ 4273 vmcs_writel(HOST_CR0, read_cr0() & ~X86_CR0_TS); /* 22.2.3 */
4272 vmcs_writel(HOST_CR4, read_cr4()); /* 22.2.3, 22.2.5 */
4273 vmcs_writel(HOST_CR3, read_cr3()); /* 22.2.3 FIXME: shadow tables */ 4274 vmcs_writel(HOST_CR3, read_cr3()); /* 22.2.3 FIXME: shadow tables */
4274 4275
4276 /* Save the most likely value for this task's CR4 in the VMCS. */
4277 cr4 = read_cr4();
4278 vmcs_writel(HOST_CR4, cr4); /* 22.2.3, 22.2.5 */
4279 vmx->host_state.vmcs_host_cr4 = cr4;
4280
4275 vmcs_write16(HOST_CS_SELECTOR, __KERNEL_CS); /* 22.2.4 */ 4281 vmcs_write16(HOST_CS_SELECTOR, __KERNEL_CS); /* 22.2.4 */
4276#ifdef CONFIG_X86_64 4282#ifdef CONFIG_X86_64
4277 /* 4283 /*
@@ -7514,7 +7520,7 @@ static void atomic_switch_perf_msrs(struct vcpu_vmx *vmx)
7514static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) 7520static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
7515{ 7521{
7516 struct vcpu_vmx *vmx = to_vmx(vcpu); 7522 struct vcpu_vmx *vmx = to_vmx(vcpu);
7517 unsigned long debugctlmsr; 7523 unsigned long debugctlmsr, cr4;
7518 7524
7519 /* Record the guest's net vcpu time for enforced NMI injections. */ 7525 /* Record the guest's net vcpu time for enforced NMI injections. */
7520 if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked)) 7526 if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked))
@@ -7540,6 +7546,12 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
7540 if (test_bit(VCPU_REGS_RIP, (unsigned long *)&vcpu->arch.regs_dirty)) 7546 if (test_bit(VCPU_REGS_RIP, (unsigned long *)&vcpu->arch.regs_dirty))
7541 vmcs_writel(GUEST_RIP, vcpu->arch.regs[VCPU_REGS_RIP]); 7547 vmcs_writel(GUEST_RIP, vcpu->arch.regs[VCPU_REGS_RIP]);
7542 7548
7549 cr4 = read_cr4();
7550 if (unlikely(cr4 != vmx->host_state.vmcs_host_cr4)) {
7551 vmcs_writel(HOST_CR4, cr4);
7552 vmx->host_state.vmcs_host_cr4 = cr4;
7553 }
7554
7543 /* When single-stepping over STI and MOV SS, we must clear the 7555 /* When single-stepping over STI and MOV SS, we must clear the
7544 * corresponding interruptibility bits in the guest state. Otherwise 7556 * corresponding interruptibility bits in the guest state. Otherwise
7545 * vmentry fails as it then expects bit 14 (BS) in pending debug 7557 * vmentry fails as it then expects bit 14 (BS) in pending debug
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index d56cd1f515bd..3f627345d51c 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -182,12 +182,17 @@ struct jit_context {
182 bool seen_ld_abs; 182 bool seen_ld_abs;
183}; 183};
184 184
185/* maximum number of bytes emitted while JITing one eBPF insn */
186#define BPF_MAX_INSN_SIZE 128
187#define BPF_INSN_SAFETY 64
188
185static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, 189static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image,
186 int oldproglen, struct jit_context *ctx) 190 int oldproglen, struct jit_context *ctx)
187{ 191{
188 struct bpf_insn *insn = bpf_prog->insnsi; 192 struct bpf_insn *insn = bpf_prog->insnsi;
189 int insn_cnt = bpf_prog->len; 193 int insn_cnt = bpf_prog->len;
190 u8 temp[64]; 194 bool seen_ld_abs = ctx->seen_ld_abs | (oldproglen == 0);
195 u8 temp[BPF_MAX_INSN_SIZE + BPF_INSN_SAFETY];
191 int i; 196 int i;
192 int proglen = 0; 197 int proglen = 0;
193 u8 *prog = temp; 198 u8 *prog = temp;
@@ -225,7 +230,7 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image,
225 EMIT2(0x31, 0xc0); /* xor eax, eax */ 230 EMIT2(0x31, 0xc0); /* xor eax, eax */
226 EMIT3(0x4D, 0x31, 0xED); /* xor r13, r13 */ 231 EMIT3(0x4D, 0x31, 0xED); /* xor r13, r13 */
227 232
228 if (ctx->seen_ld_abs) { 233 if (seen_ld_abs) {
229 /* r9d : skb->len - skb->data_len (headlen) 234 /* r9d : skb->len - skb->data_len (headlen)
230 * r10 : skb->data 235 * r10 : skb->data
231 */ 236 */
@@ -685,7 +690,7 @@ xadd: if (is_imm8(insn->off))
685 case BPF_JMP | BPF_CALL: 690 case BPF_JMP | BPF_CALL:
686 func = (u8 *) __bpf_call_base + imm32; 691 func = (u8 *) __bpf_call_base + imm32;
687 jmp_offset = func - (image + addrs[i]); 692 jmp_offset = func - (image + addrs[i]);
688 if (ctx->seen_ld_abs) { 693 if (seen_ld_abs) {
689 EMIT2(0x41, 0x52); /* push %r10 */ 694 EMIT2(0x41, 0x52); /* push %r10 */
690 EMIT2(0x41, 0x51); /* push %r9 */ 695 EMIT2(0x41, 0x51); /* push %r9 */
691 /* need to adjust jmp offset, since 696 /* need to adjust jmp offset, since
@@ -699,7 +704,7 @@ xadd: if (is_imm8(insn->off))
699 return -EINVAL; 704 return -EINVAL;
700 } 705 }
701 EMIT1_off32(0xE8, jmp_offset); 706 EMIT1_off32(0xE8, jmp_offset);
702 if (ctx->seen_ld_abs) { 707 if (seen_ld_abs) {
703 EMIT2(0x41, 0x59); /* pop %r9 */ 708 EMIT2(0x41, 0x59); /* pop %r9 */
704 EMIT2(0x41, 0x5A); /* pop %r10 */ 709 EMIT2(0x41, 0x5A); /* pop %r10 */
705 } 710 }
@@ -804,7 +809,8 @@ emit_jmp:
804 goto common_load; 809 goto common_load;
805 case BPF_LD | BPF_ABS | BPF_W: 810 case BPF_LD | BPF_ABS | BPF_W:
806 func = CHOOSE_LOAD_FUNC(imm32, sk_load_word); 811 func = CHOOSE_LOAD_FUNC(imm32, sk_load_word);
807common_load: ctx->seen_ld_abs = true; 812common_load:
813 ctx->seen_ld_abs = seen_ld_abs = true;
808 jmp_offset = func - (image + addrs[i]); 814 jmp_offset = func - (image + addrs[i]);
809 if (!func || !is_simm32(jmp_offset)) { 815 if (!func || !is_simm32(jmp_offset)) {
810 pr_err("unsupported bpf func %d addr %p image %p\n", 816 pr_err("unsupported bpf func %d addr %p image %p\n",
@@ -878,6 +884,11 @@ common_load: ctx->seen_ld_abs = true;
878 } 884 }
879 885
880 ilen = prog - temp; 886 ilen = prog - temp;
887 if (ilen > BPF_MAX_INSN_SIZE) {
888 pr_err("bpf_jit_compile fatal insn size error\n");
889 return -EFAULT;
890 }
891
881 if (image) { 892 if (image) {
882 if (unlikely(proglen + ilen > oldproglen)) { 893 if (unlikely(proglen + ilen > oldproglen)) {
883 pr_err("bpf_jit_compile fatal error\n"); 894 pr_err("bpf_jit_compile fatal error\n");
@@ -934,9 +945,11 @@ void bpf_int_jit_compile(struct bpf_prog *prog)
934 goto out; 945 goto out;
935 } 946 }
936 if (image) { 947 if (image) {
937 if (proglen != oldproglen) 948 if (proglen != oldproglen) {
938 pr_err("bpf_jit: proglen=%d != oldproglen=%d\n", 949 pr_err("bpf_jit: proglen=%d != oldproglen=%d\n",
939 proglen, oldproglen); 950 proglen, oldproglen);
951 goto out;
952 }
940 break; 953 break;
941 } 954 }
942 if (proglen == oldproglen) { 955 if (proglen == oldproglen) {
diff --git a/arch/x86/um/asm/ptrace.h b/arch/x86/um/asm/ptrace.h
index 54f8102ccde5..e59eef20647b 100644
--- a/arch/x86/um/asm/ptrace.h
+++ b/arch/x86/um/asm/ptrace.h
@@ -47,8 +47,6 @@ struct user_desc;
47 47
48#ifdef CONFIG_X86_32 48#ifdef CONFIG_X86_32
49 49
50#define HOST_AUDIT_ARCH AUDIT_ARCH_I386
51
52extern int ptrace_get_thread_area(struct task_struct *child, int idx, 50extern int ptrace_get_thread_area(struct task_struct *child, int idx,
53 struct user_desc __user *user_desc); 51 struct user_desc __user *user_desc);
54 52
@@ -57,8 +55,6 @@ extern int ptrace_set_thread_area(struct task_struct *child, int idx,
57 55
58#else 56#else
59 57
60#define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64
61
62#define PT_REGS_R8(r) UPT_R8(&(r)->regs) 58#define PT_REGS_R8(r) UPT_R8(&(r)->regs)
63#define PT_REGS_R9(r) UPT_R9(&(r)->regs) 59#define PT_REGS_R9(r) UPT_R9(&(r)->regs)
64#define PT_REGS_R10(r) UPT_R10(&(r)->regs) 60#define PT_REGS_R10(r) UPT_R10(&(r)->regs)
diff --git a/arch/x86/um/asm/syscall.h b/arch/x86/um/asm/syscall.h
new file mode 100644
index 000000000000..9fe77b7b5a0e
--- /dev/null
+++ b/arch/x86/um/asm/syscall.h
@@ -0,0 +1,15 @@
1#ifndef __UM_ASM_SYSCALL_H
2#define __UM_ASM_SYSCALL_H
3
4#include <uapi/linux/audit.h>
5
6static inline int syscall_get_arch(void)
7{
8#ifdef CONFIG_X86_32
9 return AUDIT_ARCH_I386;
10#else
11 return AUDIT_ARCH_X86_64;
12#endif
13}
14
15#endif /* __UM_ASM_SYSCALL_H */
diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c
index 562fac664751..4d54b481123b 100644
--- a/arch/xtensa/kernel/ptrace.c
+++ b/arch/xtensa/kernel/ptrace.c
@@ -342,7 +342,7 @@ void do_syscall_trace_enter(struct pt_regs *regs)
342 do_syscall_trace(); 342 do_syscall_trace();
343 343
344#if 0 344#if 0
345 audit_syscall_entry(current, AUDIT_ARCH_XTENSA..); 345 audit_syscall_entry(...);
346#endif 346#endif
347} 347}
348 348