aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-06-18 20:01:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-06-18 20:01:01 -0400
commitb3ee4edd8a18a5ff7c077b6b112692f1d6e9dd16 (patch)
tree0b63e604976eb32a999b81a39fb55bd00c7e83fc
parentedf9364d3f924aff6f77176b8e52a4b68e5c30d6 (diff)
parentbcd7c45e0d5a82be9a64b90050f0e09d41a50758 (diff)
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS fixes from Ralf Baechle: - Three highmem fixes: + Fixed mapping initialization + Adjust the pkmap location + Ensure we use at most one page for PTEs - Fix makefile dependencies for .its targets to depend on vmlinux - Fix reversed condition in BNEZC and JIALC software branch emulation - Only flush initialized flush_insn_slot to avoid NULL pointer dereference - perf: Remove incorrect odd/even counter handling for I6400 - ftrace: Fix init functions tracing * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: MIPS: .its targets depend on vmlinux MIPS: Fix bnezc/jialc return address calculation MIPS: kprobes: flush_insn_slot should flush only if probe initialised MIPS: ftrace: fix init functions tracing MIPS: mm: adjust PKMAP location MIPS: highmem: ensure that we don't use more than one page for PTEs MIPS: mm: fixed mappings: correct initialisation MIPS: perf: Remove incorrect odd/even counter handling for I6400
-rw-r--r--arch/mips/boot/Makefile10
-rw-r--r--arch/mips/include/asm/highmem.h5
-rw-r--r--arch/mips/include/asm/kprobes.h3
-rw-r--r--arch/mips/include/asm/pgtable-32.h7
-rw-r--r--arch/mips/kernel/branch.c4
-rw-r--r--arch/mips/kernel/ftrace.c24
-rw-r--r--arch/mips/kernel/perf_event_mipsxx.c6
-rw-r--r--arch/mips/mm/pgtable-32.c6
8 files changed, 34 insertions, 31 deletions
diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
index 2728a9a9c7c5..145b5ce8eb7e 100644
--- a/arch/mips/boot/Makefile
+++ b/arch/mips/boot/Makefile
@@ -128,19 +128,19 @@ quiet_cmd_cpp_its_S = ITS $@
128 -DADDR_BITS=$(ADDR_BITS) \ 128 -DADDR_BITS=$(ADDR_BITS) \
129 -DADDR_CELLS=$(itb_addr_cells) 129 -DADDR_CELLS=$(itb_addr_cells)
130 130
131$(obj)/vmlinux.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE 131$(obj)/vmlinux.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE
132 $(call if_changed_dep,cpp_its_S,none,vmlinux.bin) 132 $(call if_changed_dep,cpp_its_S,none,vmlinux.bin)
133 133
134$(obj)/vmlinux.gz.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE 134$(obj)/vmlinux.gz.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE
135 $(call if_changed_dep,cpp_its_S,gzip,vmlinux.bin.gz) 135 $(call if_changed_dep,cpp_its_S,gzip,vmlinux.bin.gz)
136 136
137$(obj)/vmlinux.bz2.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE 137$(obj)/vmlinux.bz2.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE
138 $(call if_changed_dep,cpp_its_S,bzip2,vmlinux.bin.bz2) 138 $(call if_changed_dep,cpp_its_S,bzip2,vmlinux.bin.bz2)
139 139
140$(obj)/vmlinux.lzma.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE 140$(obj)/vmlinux.lzma.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE
141 $(call if_changed_dep,cpp_its_S,lzma,vmlinux.bin.lzma) 141 $(call if_changed_dep,cpp_its_S,lzma,vmlinux.bin.lzma)
142 142
143$(obj)/vmlinux.lzo.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S FORCE 143$(obj)/vmlinux.lzo.its: $(srctree)/arch/mips/$(PLATFORM)/vmlinux.its.S $(VMLINUX) FORCE
144 $(call if_changed_dep,cpp_its_S,lzo,vmlinux.bin.lzo) 144 $(call if_changed_dep,cpp_its_S,lzo,vmlinux.bin.lzo)
145 145
146quiet_cmd_itb-image = ITB $@ 146quiet_cmd_itb-image = ITB $@
diff --git a/arch/mips/include/asm/highmem.h b/arch/mips/include/asm/highmem.h
index d34536e7653f..279b6d14ffeb 100644
--- a/arch/mips/include/asm/highmem.h
+++ b/arch/mips/include/asm/highmem.h
@@ -35,7 +35,12 @@ extern pte_t *pkmap_page_table;
35 * easily, subsequent pte tables have to be allocated in one physical 35 * easily, subsequent pte tables have to be allocated in one physical
36 * chunk of RAM. 36 * chunk of RAM.
37 */ 37 */
38#ifdef CONFIG_PHYS_ADDR_T_64BIT
39#define LAST_PKMAP 512
40#else
38#define LAST_PKMAP 1024 41#define LAST_PKMAP 1024
42#endif
43
39#define LAST_PKMAP_MASK (LAST_PKMAP-1) 44#define LAST_PKMAP_MASK (LAST_PKMAP-1)
40#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) 45#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT)
41#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) 46#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
diff --git a/arch/mips/include/asm/kprobes.h b/arch/mips/include/asm/kprobes.h
index 291846d9ba83..ad1a99948f27 100644
--- a/arch/mips/include/asm/kprobes.h
+++ b/arch/mips/include/asm/kprobes.h
@@ -43,7 +43,8 @@ typedef union mips_instruction kprobe_opcode_t;
43 43
44#define flush_insn_slot(p) \ 44#define flush_insn_slot(p) \
45do { \ 45do { \
46 flush_icache_range((unsigned long)p->addr, \ 46 if (p->addr) \
47 flush_icache_range((unsigned long)p->addr, \
47 (unsigned long)p->addr + \ 48 (unsigned long)p->addr + \
48 (MAX_INSN_SIZE * sizeof(kprobe_opcode_t))); \ 49 (MAX_INSN_SIZE * sizeof(kprobe_opcode_t))); \
49} while (0) 50} while (0)
diff --git a/arch/mips/include/asm/pgtable-32.h b/arch/mips/include/asm/pgtable-32.h
index 6f94bed571c4..74afe8c76bdd 100644
--- a/arch/mips/include/asm/pgtable-32.h
+++ b/arch/mips/include/asm/pgtable-32.h
@@ -19,6 +19,10 @@
19#define __ARCH_USE_5LEVEL_HACK 19#define __ARCH_USE_5LEVEL_HACK
20#include <asm-generic/pgtable-nopmd.h> 20#include <asm-generic/pgtable-nopmd.h>
21 21
22#ifdef CONFIG_HIGHMEM
23#include <asm/highmem.h>
24#endif
25
22extern int temp_tlb_entry; 26extern int temp_tlb_entry;
23 27
24/* 28/*
@@ -62,7 +66,8 @@ extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
62 66
63#define VMALLOC_START MAP_BASE 67#define VMALLOC_START MAP_BASE
64 68
65#define PKMAP_BASE (0xfe000000UL) 69#define PKMAP_END ((FIXADDR_START) & ~((LAST_PKMAP << PAGE_SHIFT)-1))
70#define PKMAP_BASE (PKMAP_END - PAGE_SIZE * LAST_PKMAP)
66 71
67#ifdef CONFIG_HIGHMEM 72#ifdef CONFIG_HIGHMEM
68# define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE) 73# define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE)
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c
index b11facd11c9d..f702a459a830 100644
--- a/arch/mips/kernel/branch.c
+++ b/arch/mips/kernel/branch.c
@@ -804,8 +804,10 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
804 break; 804 break;
805 } 805 }
806 /* Compact branch: BNEZC || JIALC */ 806 /* Compact branch: BNEZC || JIALC */
807 if (insn.i_format.rs) 807 if (!insn.i_format.rs) {
808 /* JIALC: set $31/ra */
808 regs->regs[31] = epc + 4; 809 regs->regs[31] = epc + 4;
810 }
809 regs->cp0_epc += 8; 811 regs->cp0_epc += 8;
810 break; 812 break;
811#endif 813#endif
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index 30a3b75e88eb..9d9b8fbae202 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -38,20 +38,6 @@ void arch_ftrace_update_code(int command)
38 38
39#endif 39#endif
40 40
41/*
42 * Check if the address is in kernel space
43 *
44 * Clone core_kernel_text() from kernel/extable.c, but doesn't call
45 * init_kernel_text() for Ftrace doesn't trace functions in init sections.
46 */
47static inline int in_kernel_space(unsigned long ip)
48{
49 if (ip >= (unsigned long)_stext &&
50 ip <= (unsigned long)_etext)
51 return 1;
52 return 0;
53}
54
55#ifdef CONFIG_DYNAMIC_FTRACE 41#ifdef CONFIG_DYNAMIC_FTRACE
56 42
57#define JAL 0x0c000000 /* jump & link: ip --> ra, jump to target */ 43#define JAL 0x0c000000 /* jump & link: ip --> ra, jump to target */
@@ -198,7 +184,7 @@ int ftrace_make_nop(struct module *mod,
198 * If ip is in kernel space, no long call, otherwise, long call is 184 * If ip is in kernel space, no long call, otherwise, long call is
199 * needed. 185 * needed.
200 */ 186 */
201 new = in_kernel_space(ip) ? INSN_NOP : INSN_B_1F; 187 new = core_kernel_text(ip) ? INSN_NOP : INSN_B_1F;
202#ifdef CONFIG_64BIT 188#ifdef CONFIG_64BIT
203 return ftrace_modify_code(ip, new); 189 return ftrace_modify_code(ip, new);
204#else 190#else
@@ -218,12 +204,12 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
218 unsigned int new; 204 unsigned int new;
219 unsigned long ip = rec->ip; 205 unsigned long ip = rec->ip;
220 206
221 new = in_kernel_space(ip) ? insn_jal_ftrace_caller : insn_la_mcount[0]; 207 new = core_kernel_text(ip) ? insn_jal_ftrace_caller : insn_la_mcount[0];
222 208
223#ifdef CONFIG_64BIT 209#ifdef CONFIG_64BIT
224 return ftrace_modify_code(ip, new); 210 return ftrace_modify_code(ip, new);
225#else 211#else
226 return ftrace_modify_code_2r(ip, new, in_kernel_space(ip) ? 212 return ftrace_modify_code_2r(ip, new, core_kernel_text(ip) ?
227 INSN_NOP : insn_la_mcount[1]); 213 INSN_NOP : insn_la_mcount[1]);
228#endif 214#endif
229} 215}
@@ -289,7 +275,7 @@ unsigned long ftrace_get_parent_ra_addr(unsigned long self_ra, unsigned long
289 * instruction "lui v1, hi_16bit_of_mcount"(offset is 24), but for 275 * instruction "lui v1, hi_16bit_of_mcount"(offset is 24), but for
290 * kernel, move after the instruction "move ra, at"(offset is 16) 276 * kernel, move after the instruction "move ra, at"(offset is 16)
291 */ 277 */
292 ip = self_ra - (in_kernel_space(self_ra) ? 16 : 24); 278 ip = self_ra - (core_kernel_text(self_ra) ? 16 : 24);
293 279
294 /* 280 /*
295 * search the text until finding the non-store instruction or "s{d,w} 281 * search the text until finding the non-store instruction or "s{d,w}
@@ -394,7 +380,7 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra,
394 * entries configured through the tracing/set_graph_function interface. 380 * entries configured through the tracing/set_graph_function interface.
395 */ 381 */
396 382
397 insns = in_kernel_space(self_ra) ? 2 : MCOUNT_OFFSET_INSNS + 1; 383 insns = core_kernel_text(self_ra) ? 2 : MCOUNT_OFFSET_INSNS + 1;
398 trace.func = self_ra - (MCOUNT_INSN_SIZE * insns); 384 trace.func = self_ra - (MCOUNT_INSN_SIZE * insns);
399 385
400 /* Only trace if the calling function expects to */ 386 /* Only trace if the calling function expects to */
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
index 313a88b2973f..f3e301f95aef 100644
--- a/arch/mips/kernel/perf_event_mipsxx.c
+++ b/arch/mips/kernel/perf_event_mipsxx.c
@@ -1597,7 +1597,6 @@ static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config)
1597 break; 1597 break;
1598 case CPU_P5600: 1598 case CPU_P5600:
1599 case CPU_P6600: 1599 case CPU_P6600:
1600 case CPU_I6400:
1601 /* 8-bit event numbers */ 1600 /* 8-bit event numbers */
1602 raw_id = config & 0x1ff; 1601 raw_id = config & 0x1ff;
1603 base_id = raw_id & 0xff; 1602 base_id = raw_id & 0xff;
@@ -1610,6 +1609,11 @@ static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config)
1610 raw_event.range = P; 1609 raw_event.range = P;
1611#endif 1610#endif
1612 break; 1611 break;
1612 case CPU_I6400:
1613 /* 8-bit event numbers */
1614 base_id = config & 0xff;
1615 raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD;
1616 break;
1613 case CPU_1004K: 1617 case CPU_1004K:
1614 if (IS_BOTH_COUNTERS_1004K_EVENT(base_id)) 1618 if (IS_BOTH_COUNTERS_1004K_EVENT(base_id))
1615 raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD; 1619 raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD;
diff --git a/arch/mips/mm/pgtable-32.c b/arch/mips/mm/pgtable-32.c
index adc6911ba748..b19a3c506b1e 100644
--- a/arch/mips/mm/pgtable-32.c
+++ b/arch/mips/mm/pgtable-32.c
@@ -51,15 +51,15 @@ void __init pagetable_init(void)
51 /* 51 /*
52 * Fixed mappings: 52 * Fixed mappings:
53 */ 53 */
54 vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK; 54 vaddr = __fix_to_virt(__end_of_fixed_addresses - 1);
55 fixrange_init(vaddr, vaddr + FIXADDR_SIZE, pgd_base); 55 fixrange_init(vaddr & PMD_MASK, vaddr + FIXADDR_SIZE, pgd_base);
56 56
57#ifdef CONFIG_HIGHMEM 57#ifdef CONFIG_HIGHMEM
58 /* 58 /*
59 * Permanent kmaps: 59 * Permanent kmaps:
60 */ 60 */
61 vaddr = PKMAP_BASE; 61 vaddr = PKMAP_BASE;
62 fixrange_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base); 62 fixrange_init(vaddr & PMD_MASK, vaddr + PAGE_SIZE*LAST_PKMAP, pgd_base);
63 63
64 pgd = swapper_pg_dir + __pgd_offset(vaddr); 64 pgd = swapper_pg_dir + __pgd_offset(vaddr);
65 pud = pud_offset(pgd, vaddr); 65 pud = pud_offset(pgd, vaddr);