aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-12 15:56:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-12 15:56:02 -0400
commit763f96944c954ce0e00a10a7bdfe29adbe4f92eb (patch)
tree9ff48f1952b6b682845c195542fd55bf588271a1 /arch/mips/kernel
parentea8781e5e70c14a98d62bc2bd19b57e71e773717 (diff)
parent9ed8b56b80c11ef7c25230b93f2c486fe6b41c4d (diff)
Merge tag 'mips_4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
Pull MIPS updates from James Hogan: "These are the main MIPS changes for 4.18. Rough overview: - MAINTAINERS: Add Paul Burton as MIPS co-maintainer - Misc: Generic compiler intrinsics, Y2038 improvements, Perf+MT fixes - Platform support: Netgear WNR1000 V3, Microsemi Ocelot integrated switch, Ingenic watchdog cleanups More detailed summary: Maintainers: - Add Paul Burton as MIPS co-maintainer, as I soon won't have access to much MIPS hardware, nor enough time to properly maintain MIPS on my own. Miscellaneous: - Use generic GCC library routines from lib/ - Add notrace to generic ucmpdi2 implementation - Rename compiler intrinsic selects to GENERIC_LIB_* - vmlinuz: Use generic ashldi3 - y2038: Convert update/read_persistent_clock() to *_clock64() - sni: Remove read_persistent_clock() - perf: Fix perf with MT counting other threads - Probe for per-TC perf counters in cpu-probe.c - Use correct VPE ID for VPE tracing Minor cleanups: - Avoid unneeded built-in.a in DTS dirs - sc-debugfs: Re-use kstrtobool_from_user - memset.S: Reinstate delay slot indentation - VPE: Fix spelling "uneeded" -> "Unneeded" Platform support: BCM47xx: - Add support for Netgear WNR1000 V3 - firmware: Support small NVRAM partitions - Use __initdata for LEDs platform data Ingenic: - Watchdog driver & platform code improvements: - Disable clock after stopping counter - Use devm_* functions - Drop module remove function - Move platform reset code to restart handler in driver - JZ4740: Convert watchdog instantiation to DT - JZ4780: Fix watchdog DT node - qi_lb60_defconfig: Enable watchdog driver Microsemi: - Ocelot: Add support for integrated switch - pcb123: Connect phys to ports" * tag 'mips_4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (30 commits) MAINTAINERS: Add Paul Burton as MIPS co-maintainer MIPS: ptrace: Make FPU context layout comments match reality MIPS: memset.S: Reinstate delay slot indentation MIPS: perf: Fix perf with MT counting other threads MIPS: perf: Use correct VPE ID when setting up VPE tracing MIPS: perf: More robustly probe for the presence of per-tc counters MIPS: Probe for MIPS MT perf counters per TC MIPS: mscc: Connect phys to ports on ocelot_pcb123 MIPS: mscc: Add switch to ocelot MIPS: JZ4740: Drop old platform reset code MIPS: qi_lb60: Enable the jz4740-wdt driver MIPS: JZ4780: dts: Fix watchdog node MIPS: JZ4740: dts: Add bindings for the jz4740-wdt driver watchdog: JZ4740: Drop module remove function watchdog: JZ4740: Register a restart handler watchdog: JZ4740: Use devm_* functions watchdog: JZ4740: Disable clock after stopping counter MIPS: VPE: Fix spelling mistake: "uneeded" -> "unneeded" MIPS: Re-use kstrtobool_from_user() MIPS: Convert update_persistent_clock() to update_persistent_clock64() ...
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r--arch/mips/kernel/cpu-probe.c12
-rw-r--r--arch/mips/kernel/perf_event_mipsxx.c91
-rw-r--r--arch/mips/kernel/ptrace.c4
-rw-r--r--arch/mips/kernel/ptrace32.c4
-rw-r--r--arch/mips/kernel/time.c15
-rw-r--r--arch/mips/kernel/vpe.c2
6 files changed, 57 insertions, 71 deletions
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 6b07b739f914..b2509c19cfb5 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -414,6 +414,14 @@ static int __init ftlb_disable(char *s)
414 414
415__setup("noftlb", ftlb_disable); 415__setup("noftlb", ftlb_disable);
416 416
417/*
418 * Check if the CPU has per tc perf counters
419 */
420static inline void cpu_set_mt_per_tc_perf(struct cpuinfo_mips *c)
421{
422 if (read_c0_config7() & MTI_CONF7_PTC)
423 c->options |= MIPS_CPU_MT_PER_TC_PERF_COUNTERS;
424}
417 425
418static inline void check_errata(void) 426static inline void check_errata(void)
419{ 427{
@@ -1572,6 +1580,7 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
1572 c->cputype = CPU_34K; 1580 c->cputype = CPU_34K;
1573 c->writecombine = _CACHE_UNCACHED; 1581 c->writecombine = _CACHE_UNCACHED;
1574 __cpu_name[cpu] = "MIPS 34Kc"; 1582 __cpu_name[cpu] = "MIPS 34Kc";
1583 cpu_set_mt_per_tc_perf(c);
1575 break; 1584 break;
1576 case PRID_IMP_74K: 1585 case PRID_IMP_74K:
1577 c->cputype = CPU_74K; 1586 c->cputype = CPU_74K;
@@ -1592,6 +1601,7 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
1592 c->cputype = CPU_1004K; 1601 c->cputype = CPU_1004K;
1593 c->writecombine = _CACHE_UNCACHED; 1602 c->writecombine = _CACHE_UNCACHED;
1594 __cpu_name[cpu] = "MIPS 1004Kc"; 1603 __cpu_name[cpu] = "MIPS 1004Kc";
1604 cpu_set_mt_per_tc_perf(c);
1595 break; 1605 break;
1596 case PRID_IMP_1074K: 1606 case PRID_IMP_1074K:
1597 c->cputype = CPU_1074K; 1607 c->cputype = CPU_1074K;
@@ -1601,10 +1611,12 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
1601 case PRID_IMP_INTERAPTIV_UP: 1611 case PRID_IMP_INTERAPTIV_UP:
1602 c->cputype = CPU_INTERAPTIV; 1612 c->cputype = CPU_INTERAPTIV;
1603 __cpu_name[cpu] = "MIPS interAptiv"; 1613 __cpu_name[cpu] = "MIPS interAptiv";
1614 cpu_set_mt_per_tc_perf(c);
1604 break; 1615 break;
1605 case PRID_IMP_INTERAPTIV_MP: 1616 case PRID_IMP_INTERAPTIV_MP:
1606 c->cputype = CPU_INTERAPTIV; 1617 c->cputype = CPU_INTERAPTIV;
1607 __cpu_name[cpu] = "MIPS interAptiv (multi)"; 1618 __cpu_name[cpu] = "MIPS interAptiv (multi)";
1619 cpu_set_mt_per_tc_perf(c);
1608 break; 1620 break;
1609 case PRID_IMP_PROAPTIV_UP: 1621 case PRID_IMP_PROAPTIV_UP:
1610 c->cputype = CPU_PROAPTIV; 1622 c->cputype = CPU_PROAPTIV;
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
index ee73550f0b9a..413863508f6f 100644
--- a/arch/mips/kernel/perf_event_mipsxx.c
+++ b/arch/mips/kernel/perf_event_mipsxx.c
@@ -129,20 +129,14 @@ static struct mips_pmu mipspmu;
129 129
130 130
131#ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS 131#ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS
132static int cpu_has_mipsmt_pertccounters;
133
134static DEFINE_RWLOCK(pmuint_rwlock); 132static DEFINE_RWLOCK(pmuint_rwlock);
135 133
136#if defined(CONFIG_CPU_BMIPS5000) 134#if defined(CONFIG_CPU_BMIPS5000)
137#define vpe_id() (cpu_has_mipsmt_pertccounters ? \ 135#define vpe_id() (cpu_has_mipsmt_pertccounters ? \
138 0 : (smp_processor_id() & MIPS_CPUID_TO_COUNTER_MASK)) 136 0 : (smp_processor_id() & MIPS_CPUID_TO_COUNTER_MASK))
139#else 137#else
140/*
141 * FIXME: For VSMP, vpe_id() is redefined for Perf-events, because
142 * cpu_data[cpuid].vpe_id reports 0 for _both_ CPUs.
143 */
144#define vpe_id() (cpu_has_mipsmt_pertccounters ? \ 138#define vpe_id() (cpu_has_mipsmt_pertccounters ? \
145 0 : smp_processor_id()) 139 0 : cpu_vpe_id(&current_cpu_data))
146#endif 140#endif
147 141
148/* Copied from op_model_mipsxx.c */ 142/* Copied from op_model_mipsxx.c */
@@ -329,7 +323,11 @@ static int mipsxx_pmu_alloc_counter(struct cpu_hw_events *cpuc,
329 323
330static void mipsxx_pmu_enable_event(struct hw_perf_event *evt, int idx) 324static void mipsxx_pmu_enable_event(struct hw_perf_event *evt, int idx)
331{ 325{
326 struct perf_event *event = container_of(evt, struct perf_event, hw);
332 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); 327 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
328#ifdef CONFIG_MIPS_MT_SMP
329 unsigned int range = evt->event_base >> 24;
330#endif /* CONFIG_MIPS_MT_SMP */
333 331
334 WARN_ON(idx < 0 || idx >= mipspmu.num_counters); 332 WARN_ON(idx < 0 || idx >= mipspmu.num_counters);
335 333
@@ -337,11 +335,37 @@ static void mipsxx_pmu_enable_event(struct hw_perf_event *evt, int idx)
337 (evt->config_base & M_PERFCTL_CONFIG_MASK) | 335 (evt->config_base & M_PERFCTL_CONFIG_MASK) |
338 /* Make sure interrupt enabled. */ 336 /* Make sure interrupt enabled. */
339 MIPS_PERFCTRL_IE; 337 MIPS_PERFCTRL_IE;
340 if (IS_ENABLED(CONFIG_CPU_BMIPS5000)) 338
339#ifdef CONFIG_CPU_BMIPS5000
340 {
341 /* enable the counter for the calling thread */ 341 /* enable the counter for the calling thread */
342 cpuc->saved_ctrl[idx] |= 342 cpuc->saved_ctrl[idx] |=
343 (1 << (12 + vpe_id())) | BRCM_PERFCTRL_TC; 343 (1 << (12 + vpe_id())) | BRCM_PERFCTRL_TC;
344 }
345#else
346#ifdef CONFIG_MIPS_MT_SMP
347 if (range > V) {
348 /* The counter is processor wide. Set it up to count all TCs. */
349 pr_debug("Enabling perf counter for all TCs\n");
350 cpuc->saved_ctrl[idx] |= M_TC_EN_ALL;
351 } else
352#endif /* CONFIG_MIPS_MT_SMP */
353 {
354 unsigned int cpu, ctrl;
355
356 /*
357 * Set up the counter for a particular CPU when event->cpu is
358 * a valid CPU number. Otherwise set up the counter for the CPU
359 * scheduling this thread.
360 */
361 cpu = (event->cpu >= 0) ? event->cpu : smp_processor_id();
344 362
363 ctrl = M_PERFCTL_VPEID(cpu_vpe_id(&cpu_data[cpu]));
364 ctrl |= M_TC_EN_VPE;
365 cpuc->saved_ctrl[idx] |= ctrl;
366 pr_debug("Enabling perf counter for CPU%d\n", cpu);
367 }
368#endif /* CONFIG_CPU_BMIPS5000 */
345 /* 369 /*
346 * We do not actually let the counter run. Leave it until start(). 370 * We do not actually let the counter run. Leave it until start().
347 */ 371 */
@@ -655,13 +679,14 @@ static unsigned int mipspmu_perf_event_encode(const struct mips_perf_event *pev)
655 * event_id. 679 * event_id.
656 */ 680 */
657#ifdef CONFIG_MIPS_MT_SMP 681#ifdef CONFIG_MIPS_MT_SMP
658 return ((unsigned int)pev->range << 24) | 682 if (num_possible_cpus() > 1)
659 (pev->cntr_mask & 0xffff00) | 683 return ((unsigned int)pev->range << 24) |
660 (pev->event_id & 0xff); 684 (pev->cntr_mask & 0xffff00) |
661#else 685 (pev->event_id & 0xff);
662 return (pev->cntr_mask & 0xffff00) | 686 else
663 (pev->event_id & 0xff); 687#endif /* CONFIG_MIPS_MT_SMP */
664#endif 688 return ((pev->cntr_mask & 0xffff00) |
689 (pev->event_id & 0xff));
665} 690}
666 691
667static const struct mips_perf_event *mipspmu_map_general_event(int idx) 692static const struct mips_perf_event *mipspmu_map_general_event(int idx)
@@ -1265,37 +1290,6 @@ static const struct mips_perf_event xlp_cache_map
1265}, 1290},
1266}; 1291};
1267 1292
1268#ifdef CONFIG_MIPS_MT_SMP
1269static void check_and_calc_range(struct perf_event *event,
1270 const struct mips_perf_event *pev)
1271{
1272 struct hw_perf_event *hwc = &event->hw;
1273
1274 if (event->cpu >= 0) {
1275 if (pev->range > V) {
1276 /*
1277 * The user selected an event that is processor
1278 * wide, while expecting it to be VPE wide.
1279 */
1280 hwc->config_base |= M_TC_EN_ALL;
1281 } else {
1282 /*
1283 * FIXME: cpu_data[event->cpu].vpe_id reports 0
1284 * for both CPUs.
1285 */
1286 hwc->config_base |= M_PERFCTL_VPEID(event->cpu);
1287 hwc->config_base |= M_TC_EN_VPE;
1288 }
1289 } else
1290 hwc->config_base |= M_TC_EN_ALL;
1291}
1292#else
1293static void check_and_calc_range(struct perf_event *event,
1294 const struct mips_perf_event *pev)
1295{
1296}
1297#endif
1298
1299static int __hw_perf_event_init(struct perf_event *event) 1293static int __hw_perf_event_init(struct perf_event *event)
1300{ 1294{
1301 struct perf_event_attr *attr = &event->attr; 1295 struct perf_event_attr *attr = &event->attr;
@@ -1331,10 +1325,6 @@ static int __hw_perf_event_init(struct perf_event *event)
1331 */ 1325 */
1332 hwc->config_base = MIPS_PERFCTRL_IE; 1326 hwc->config_base = MIPS_PERFCTRL_IE;
1333 1327
1334 /* Calculate range bits and validate it. */
1335 if (num_possible_cpus() > 1)
1336 check_and_calc_range(event, pev);
1337
1338 hwc->event_base = mipspmu_perf_event_encode(pev); 1328 hwc->event_base = mipspmu_perf_event_encode(pev);
1339 if (PERF_TYPE_RAW == event->attr.type) 1329 if (PERF_TYPE_RAW == event->attr.type)
1340 mutex_unlock(&raw_event_mutex); 1330 mutex_unlock(&raw_event_mutex);
@@ -1723,7 +1713,6 @@ init_hw_perf_events(void)
1723 } 1713 }
1724 1714
1725#ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS 1715#ifdef CONFIG_MIPS_PERF_SHARED_TC_COUNTERS
1726 cpu_has_mipsmt_pertccounters = read_c0_config7() & (1<<19);
1727 if (!cpu_has_mipsmt_pertccounters) 1716 if (!cpu_has_mipsmt_pertccounters)
1728 counters = counters_total_to_per_cpu(counters); 1717 counters = counters_total_to_per_cpu(counters);
1729#endif 1718#endif
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 0c0c23c9c9f5..9f6c3f2aa2e2 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -811,7 +811,7 @@ long arch_ptrace(struct task_struct *child, long request,
811 /* 811 /*
812 * The odd registers are actually the high 812 * The odd registers are actually the high
813 * order bits of the values stored in the even 813 * order bits of the values stored in the even
814 * registers - unless we're using r2k_switch.S. 814 * registers.
815 */ 815 */
816 tmp = get_fpr32(&fregs[(addr & ~1) - FPR_BASE], 816 tmp = get_fpr32(&fregs[(addr & ~1) - FPR_BASE],
817 addr & 1); 817 addr & 1);
@@ -906,7 +906,7 @@ long arch_ptrace(struct task_struct *child, long request,
906 /* 906 /*
907 * The odd registers are actually the high 907 * The odd registers are actually the high
908 * order bits of the values stored in the even 908 * order bits of the values stored in the even
909 * registers - unless we're using r2k_switch.S. 909 * registers.
910 */ 910 */
911 set_fpr32(&fregs[(addr & ~1) - FPR_BASE], 911 set_fpr32(&fregs[(addr & ~1) - FPR_BASE],
912 addr & 1, data); 912 addr & 1, data);
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
index f30c381d3e1c..7edc629304c8 100644
--- a/arch/mips/kernel/ptrace32.c
+++ b/arch/mips/kernel/ptrace32.c
@@ -103,7 +103,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
103 /* 103 /*
104 * The odd registers are actually the high 104 * The odd registers are actually the high
105 * order bits of the values stored in the even 105 * order bits of the values stored in the even
106 * registers - unless we're using r2k_switch.S. 106 * registers.
107 */ 107 */
108 tmp = get_fpr32(&fregs[(addr & ~1) - FPR_BASE], 108 tmp = get_fpr32(&fregs[(addr & ~1) - FPR_BASE],
109 addr & 1); 109 addr & 1);
@@ -216,7 +216,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
216 /* 216 /*
217 * The odd registers are actually the high 217 * The odd registers are actually the high
218 * order bits of the values stored in the even 218 * order bits of the values stored in the even
219 * registers - unless we're using r2k_switch.S. 219 * registers.
220 */ 220 */
221 set_fpr32(&fregs[(addr & ~1) - FPR_BASE], 221 set_fpr32(&fregs[(addr & ~1) - FPR_BASE],
222 addr & 1, data); 222 addr & 1, data);
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index a6ebc8135112..bfe02ded25d1 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -34,21 +34,6 @@
34DEFINE_SPINLOCK(rtc_lock); 34DEFINE_SPINLOCK(rtc_lock);
35EXPORT_SYMBOL(rtc_lock); 35EXPORT_SYMBOL(rtc_lock);
36 36
37int __weak rtc_mips_set_time(unsigned long sec)
38{
39 return -ENODEV;
40}
41
42int __weak rtc_mips_set_mmss(unsigned long nowtime)
43{
44 return rtc_mips_set_time(nowtime);
45}
46
47int update_persistent_clock(struct timespec now)
48{
49 return rtc_mips_set_mmss(now.tv_sec);
50}
51
52static int null_perf_irq(void) 37static int null_perf_irq(void)
53{ 38{
54 return 0; 39 return 0;
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 544ea21bfef9..0bef238d2c0c 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -872,7 +872,7 @@ static ssize_t vpe_write(struct file *file, const char __user *buffer,
872 return -ENODEV; 872 return -ENODEV;
873 873
874 if ((count + v->len) > v->plen) { 874 if ((count + v->len) > v->plen) {
875 pr_warn("VPE loader: elf size too big. Perhaps strip uneeded symbols\n"); 875 pr_warn("VPE loader: elf size too big. Perhaps strip unneeded symbols\n");
876 return -ENOMEM; 876 return -ENOMEM;
877 } 877 }
878 878