aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-02-01 19:56:30 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-02-01 19:56:30 -0500
commitcd984a5be21549273a3f13b52a8b7b84097b32a7 (patch)
tree1bb35da3cb6306657d07dbcd8bbb53e0f2eabc99
parent8b050fe42d8ad1a2219201ba6d773e5b0eff1a29 (diff)
parent25384ce5f9530def39421597b1457d9462df6455 (diff)
Merge tag 'xtensa-20190201' of git://github.com/jcmvbkbc/linux-xtensa
Pull xtensa fixes from Max Filippov: - fix ccount_timer_shutdown for secondary CPUs - fix secondary CPU initialization - fix secondary CPU reset vector clash with double exception vector - fix present CPUs when booting with 'maxcpus' parameter - limit possible CPUs by configured NR_CPUS - issue a warning if xtensa PIC is asked to retrigger anything other than software IRQ - fix masking/unmasking of the first two IRQs on xtensa MX PIC - fix typo in Kconfig description for user space unaligned access feature - fix Kconfig warning for selecting BUILTIN_DTB * tag 'xtensa-20190201' of git://github.com/jcmvbkbc/linux-xtensa: xtensa: SMP: limit number of possible CPUs by NR_CPUS xtensa: rename BUILTIN_DTB to BUILTIN_DTB_SOURCE xtensa: Fix typo use space=>user space drivers/irqchip: xtensa-mx: fix mask and unmask drivers/irqchip: xtensa: add warning to irq_retrigger xtensa: SMP: mark each possible CPU as present xtensa: smp_lx200_defconfig: fix vectors clash xtensa: SMP: fix secondary CPU initialization xtensa: SMP: fix ccount_timer_shutdown
-rw-r--r--arch/xtensa/Kconfig4
-rw-r--r--arch/xtensa/boot/dts/Makefile6
-rw-r--r--arch/xtensa/configs/audio_kc705_defconfig2
-rw-r--r--arch/xtensa/configs/cadence_csp_defconfig2
-rw-r--r--arch/xtensa/configs/generic_kc705_defconfig2
-rw-r--r--arch/xtensa/configs/nommu_kc705_defconfig2
-rw-r--r--arch/xtensa/configs/smp_lx200_defconfig3
-rw-r--r--arch/xtensa/kernel/head.S5
-rw-r--r--arch/xtensa/kernel/smp.c41
-rw-r--r--arch/xtensa/kernel/time.c2
-rw-r--r--drivers/irqchip/irq-xtensa-mx.c40
-rw-r--r--drivers/irqchip/irq-xtensa-pic.c6
12 files changed, 73 insertions, 42 deletions
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 20a0756f27ef..ce91682770cb 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -164,7 +164,7 @@ config XTENSA_FAKE_NMI
164 If unsure, say N. 164 If unsure, say N.
165 165
166config XTENSA_UNALIGNED_USER 166config XTENSA_UNALIGNED_USER
167 bool "Unaligned memory access in use space" 167 bool "Unaligned memory access in user space"
168 help 168 help
169 The Xtensa architecture currently does not handle unaligned 169 The Xtensa architecture currently does not handle unaligned
170 memory accesses in hardware but through an exception handler. 170 memory accesses in hardware but through an exception handler.
@@ -451,7 +451,7 @@ config USE_OF
451 help 451 help
452 Include support for flattened device tree machine descriptions. 452 Include support for flattened device tree machine descriptions.
453 453
454config BUILTIN_DTB 454config BUILTIN_DTB_SOURCE
455 string "DTB to build into the kernel image" 455 string "DTB to build into the kernel image"
456 depends on OF 456 depends on OF
457 457
diff --git a/arch/xtensa/boot/dts/Makefile b/arch/xtensa/boot/dts/Makefile
index f8052ba5aea8..0b8d00cdae7c 100644
--- a/arch/xtensa/boot/dts/Makefile
+++ b/arch/xtensa/boot/dts/Makefile
@@ -7,9 +7,9 @@
7# 7#
8# 8#
9 9
10BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB)).dtb.o 10BUILTIN_DTB_SOURCE := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o
11ifneq ($(CONFIG_BUILTIN_DTB),"") 11ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"")
12obj-$(CONFIG_OF) += $(BUILTIN_DTB) 12obj-$(CONFIG_OF) += $(BUILTIN_DTB_SOURCE)
13endif 13endif
14 14
15# for CONFIG_OF_ALL_DTBS test 15# for CONFIG_OF_ALL_DTBS test
diff --git a/arch/xtensa/configs/audio_kc705_defconfig b/arch/xtensa/configs/audio_kc705_defconfig
index 2bf964df37ba..f378e56f9ce6 100644
--- a/arch/xtensa/configs/audio_kc705_defconfig
+++ b/arch/xtensa/configs/audio_kc705_defconfig
@@ -34,7 +34,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y
34CONFIG_CMDLINE_BOOL=y 34CONFIG_CMDLINE_BOOL=y
35CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0" 35CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0"
36CONFIG_USE_OF=y 36CONFIG_USE_OF=y
37CONFIG_BUILTIN_DTB="kc705" 37CONFIG_BUILTIN_DTB_SOURCE="kc705"
38# CONFIG_COMPACTION is not set 38# CONFIG_COMPACTION is not set
39# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 39# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
40CONFIG_PM=y 40CONFIG_PM=y
diff --git a/arch/xtensa/configs/cadence_csp_defconfig b/arch/xtensa/configs/cadence_csp_defconfig
index 3221b7053fa3..62f32a902568 100644
--- a/arch/xtensa/configs/cadence_csp_defconfig
+++ b/arch/xtensa/configs/cadence_csp_defconfig
@@ -38,7 +38,7 @@ CONFIG_HIGHMEM=y
38# CONFIG_PCI is not set 38# CONFIG_PCI is not set
39CONFIG_XTENSA_PLATFORM_XTFPGA=y 39CONFIG_XTENSA_PLATFORM_XTFPGA=y
40CONFIG_USE_OF=y 40CONFIG_USE_OF=y
41CONFIG_BUILTIN_DTB="csp" 41CONFIG_BUILTIN_DTB_SOURCE="csp"
42# CONFIG_COMPACTION is not set 42# CONFIG_COMPACTION is not set
43CONFIG_XTFPGA_LCD=y 43CONFIG_XTFPGA_LCD=y
44# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 44# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
diff --git a/arch/xtensa/configs/generic_kc705_defconfig b/arch/xtensa/configs/generic_kc705_defconfig
index 985fa8546e4e..8bebe07f1060 100644
--- a/arch/xtensa/configs/generic_kc705_defconfig
+++ b/arch/xtensa/configs/generic_kc705_defconfig
@@ -33,7 +33,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y
33CONFIG_CMDLINE_BOOL=y 33CONFIG_CMDLINE_BOOL=y
34CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0" 34CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0"
35CONFIG_USE_OF=y 35CONFIG_USE_OF=y
36CONFIG_BUILTIN_DTB="kc705" 36CONFIG_BUILTIN_DTB_SOURCE="kc705"
37# CONFIG_COMPACTION is not set 37# CONFIG_COMPACTION is not set
38# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 38# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
39CONFIG_NET=y 39CONFIG_NET=y
diff --git a/arch/xtensa/configs/nommu_kc705_defconfig b/arch/xtensa/configs/nommu_kc705_defconfig
index f3fc4f970ca8..933ab2adf434 100644
--- a/arch/xtensa/configs/nommu_kc705_defconfig
+++ b/arch/xtensa/configs/nommu_kc705_defconfig
@@ -39,7 +39,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y
39CONFIG_CMDLINE_BOOL=y 39CONFIG_CMDLINE_BOOL=y
40CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0x9d050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=256M@0x60000000" 40CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0x9d050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=256M@0x60000000"
41CONFIG_USE_OF=y 41CONFIG_USE_OF=y
42CONFIG_BUILTIN_DTB="kc705_nommu" 42CONFIG_BUILTIN_DTB_SOURCE="kc705_nommu"
43CONFIG_BINFMT_FLAT=y 43CONFIG_BINFMT_FLAT=y
44CONFIG_NET=y 44CONFIG_NET=y
45CONFIG_PACKET=y 45CONFIG_PACKET=y
diff --git a/arch/xtensa/configs/smp_lx200_defconfig b/arch/xtensa/configs/smp_lx200_defconfig
index 11fed6c06a7c..e29c5b179a5b 100644
--- a/arch/xtensa/configs/smp_lx200_defconfig
+++ b/arch/xtensa/configs/smp_lx200_defconfig
@@ -33,11 +33,12 @@ CONFIG_SMP=y
33CONFIG_HOTPLUG_CPU=y 33CONFIG_HOTPLUG_CPU=y
34# CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is not set 34# CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is not set
35# CONFIG_PCI is not set 35# CONFIG_PCI is not set
36CONFIG_VECTORS_OFFSET=0x00002000
36CONFIG_XTENSA_PLATFORM_XTFPGA=y 37CONFIG_XTENSA_PLATFORM_XTFPGA=y
37CONFIG_CMDLINE_BOOL=y 38CONFIG_CMDLINE_BOOL=y
38CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=96M@0" 39CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=96M@0"
39CONFIG_USE_OF=y 40CONFIG_USE_OF=y
40CONFIG_BUILTIN_DTB="lx200mx" 41CONFIG_BUILTIN_DTB_SOURCE="lx200mx"
41# CONFIG_COMPACTION is not set 42# CONFIG_COMPACTION is not set
42# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 43# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
43CONFIG_NET=y 44CONFIG_NET=y
diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S
index da08e75100ab..7f009719304e 100644
--- a/arch/xtensa/kernel/head.S
+++ b/arch/xtensa/kernel/head.S
@@ -276,12 +276,13 @@ should_never_return:
276 276
277 movi a2, cpu_start_ccount 277 movi a2, cpu_start_ccount
2781: 2781:
279 memw
279 l32i a3, a2, 0 280 l32i a3, a2, 0
280 beqi a3, 0, 1b 281 beqi a3, 0, 1b
281 movi a3, 0 282 movi a3, 0
282 s32i a3, a2, 0 283 s32i a3, a2, 0
283 memw
2841: 2841:
285 memw
285 l32i a3, a2, 0 286 l32i a3, a2, 0
286 beqi a3, 0, 1b 287 beqi a3, 0, 1b
287 wsr a3, ccount 288 wsr a3, ccount
@@ -317,11 +318,13 @@ ENTRY(cpu_restart)
317 rsr a0, prid 318 rsr a0, prid
318 neg a2, a0 319 neg a2, a0
319 movi a3, cpu_start_id 320 movi a3, cpu_start_id
321 memw
320 s32i a2, a3, 0 322 s32i a2, a3, 0
321#if XCHAL_DCACHE_IS_WRITEBACK 323#if XCHAL_DCACHE_IS_WRITEBACK
322 dhwbi a3, 0 324 dhwbi a3, 0
323#endif 325#endif
3241: 3261:
327 memw
325 l32i a2, a3, 0 328 l32i a2, a3, 0
326 dhi a3, 0 329 dhi a3, 0
327 bne a2, a0, 1b 330 bne a2, a0, 1b
diff --git a/arch/xtensa/kernel/smp.c b/arch/xtensa/kernel/smp.c
index 932d64689bac..be1f280c322c 100644
--- a/arch/xtensa/kernel/smp.c
+++ b/arch/xtensa/kernel/smp.c
@@ -83,7 +83,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
83{ 83{
84 unsigned i; 84 unsigned i;
85 85
86 for (i = 0; i < max_cpus; ++i) 86 for_each_possible_cpu(i)
87 set_cpu_present(i, true); 87 set_cpu_present(i, true);
88} 88}
89 89
@@ -96,6 +96,11 @@ void __init smp_init_cpus(void)
96 pr_info("%s: Core Count = %d\n", __func__, ncpus); 96 pr_info("%s: Core Count = %d\n", __func__, ncpus);
97 pr_info("%s: Core Id = %d\n", __func__, core_id); 97 pr_info("%s: Core Id = %d\n", __func__, core_id);
98 98
99 if (ncpus > NR_CPUS) {
100 ncpus = NR_CPUS;
101 pr_info("%s: limiting core count by %d\n", __func__, ncpus);
102 }
103
99 for (i = 0; i < ncpus; ++i) 104 for (i = 0; i < ncpus; ++i)
100 set_cpu_possible(i, true); 105 set_cpu_possible(i, true);
101} 106}
@@ -195,9 +200,11 @@ static int boot_secondary(unsigned int cpu, struct task_struct *ts)
195 int i; 200 int i;
196 201
197#ifdef CONFIG_HOTPLUG_CPU 202#ifdef CONFIG_HOTPLUG_CPU
198 cpu_start_id = cpu; 203 WRITE_ONCE(cpu_start_id, cpu);
199 system_flush_invalidate_dcache_range( 204 /* Pairs with the third memw in the cpu_restart */
200 (unsigned long)&cpu_start_id, sizeof(cpu_start_id)); 205 mb();
206 system_flush_invalidate_dcache_range((unsigned long)&cpu_start_id,
207 sizeof(cpu_start_id));
201#endif 208#endif
202 smp_call_function_single(0, mx_cpu_start, (void *)cpu, 1); 209 smp_call_function_single(0, mx_cpu_start, (void *)cpu, 1);
203 210
@@ -206,18 +213,21 @@ static int boot_secondary(unsigned int cpu, struct task_struct *ts)
206 ccount = get_ccount(); 213 ccount = get_ccount();
207 while (!ccount); 214 while (!ccount);
208 215
209 cpu_start_ccount = ccount; 216 WRITE_ONCE(cpu_start_ccount, ccount);
210 217
211 while (time_before(jiffies, timeout)) { 218 do {
219 /*
220 * Pairs with the first two memws in the
221 * .Lboot_secondary.
222 */
212 mb(); 223 mb();
213 if (!cpu_start_ccount) 224 ccount = READ_ONCE(cpu_start_ccount);
214 break; 225 } while (ccount && time_before(jiffies, timeout));
215 }
216 226
217 if (cpu_start_ccount) { 227 if (ccount) {
218 smp_call_function_single(0, mx_cpu_stop, 228 smp_call_function_single(0, mx_cpu_stop,
219 (void *)cpu, 1); 229 (void *)cpu, 1);
220 cpu_start_ccount = 0; 230 WRITE_ONCE(cpu_start_ccount, 0);
221 return -EIO; 231 return -EIO;
222 } 232 }
223 } 233 }
@@ -237,6 +247,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
237 pr_debug("%s: Calling wakeup_secondary(cpu:%d, idle:%p, sp: %08lx)\n", 247 pr_debug("%s: Calling wakeup_secondary(cpu:%d, idle:%p, sp: %08lx)\n",
238 __func__, cpu, idle, start_info.stack); 248 __func__, cpu, idle, start_info.stack);
239 249
250 init_completion(&cpu_running);
240 ret = boot_secondary(cpu, idle); 251 ret = boot_secondary(cpu, idle);
241 if (ret == 0) { 252 if (ret == 0) {
242 wait_for_completion_timeout(&cpu_running, 253 wait_for_completion_timeout(&cpu_running,
@@ -298,8 +309,10 @@ void __cpu_die(unsigned int cpu)
298 unsigned long timeout = jiffies + msecs_to_jiffies(1000); 309 unsigned long timeout = jiffies + msecs_to_jiffies(1000);
299 while (time_before(jiffies, timeout)) { 310 while (time_before(jiffies, timeout)) {
300 system_invalidate_dcache_range((unsigned long)&cpu_start_id, 311 system_invalidate_dcache_range((unsigned long)&cpu_start_id,
301 sizeof(cpu_start_id)); 312 sizeof(cpu_start_id));
302 if (cpu_start_id == -cpu) { 313 /* Pairs with the second memw in the cpu_restart */
314 mb();
315 if (READ_ONCE(cpu_start_id) == -cpu) {
303 platform_cpu_kill(cpu); 316 platform_cpu_kill(cpu);
304 return; 317 return;
305 } 318 }
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index fd524a54d2ab..378186b5eb40 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -89,7 +89,7 @@ static int ccount_timer_shutdown(struct clock_event_device *evt)
89 container_of(evt, struct ccount_timer, evt); 89 container_of(evt, struct ccount_timer, evt);
90 90
91 if (timer->irq_enabled) { 91 if (timer->irq_enabled) {
92 disable_irq(evt->irq); 92 disable_irq_nosync(evt->irq);
93 timer->irq_enabled = 0; 93 timer->irq_enabled = 0;
94 } 94 }
95 return 0; 95 return 0;
diff --git a/drivers/irqchip/irq-xtensa-mx.c b/drivers/irqchip/irq-xtensa-mx.c
index 5385f5768345..27933338f7b3 100644
--- a/drivers/irqchip/irq-xtensa-mx.c
+++ b/drivers/irqchip/irq-xtensa-mx.c
@@ -71,14 +71,17 @@ static void xtensa_mx_irq_mask(struct irq_data *d)
71 unsigned int mask = 1u << d->hwirq; 71 unsigned int mask = 1u << d->hwirq;
72 72
73 if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE | 73 if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE |
74 XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) { 74 XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) {
75 set_er(1u << (xtensa_get_ext_irq_no(d->hwirq) - 75 unsigned int ext_irq = xtensa_get_ext_irq_no(d->hwirq);
76 HW_IRQ_MX_BASE), MIENG); 76
77 } else { 77 if (ext_irq >= HW_IRQ_MX_BASE) {
78 mask = __this_cpu_read(cached_irq_mask) & ~mask; 78 set_er(1u << (ext_irq - HW_IRQ_MX_BASE), MIENG);
79 __this_cpu_write(cached_irq_mask, mask); 79 return;
80 xtensa_set_sr(mask, intenable); 80 }
81 } 81 }
82 mask = __this_cpu_read(cached_irq_mask) & ~mask;
83 __this_cpu_write(cached_irq_mask, mask);
84 xtensa_set_sr(mask, intenable);
82} 85}
83 86
84static void xtensa_mx_irq_unmask(struct irq_data *d) 87static void xtensa_mx_irq_unmask(struct irq_data *d)
@@ -86,14 +89,17 @@ static void xtensa_mx_irq_unmask(struct irq_data *d)
86 unsigned int mask = 1u << d->hwirq; 89 unsigned int mask = 1u << d->hwirq;
87 90
88 if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE | 91 if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE |
89 XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) { 92 XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) {
90 set_er(1u << (xtensa_get_ext_irq_no(d->hwirq) - 93 unsigned int ext_irq = xtensa_get_ext_irq_no(d->hwirq);
91 HW_IRQ_MX_BASE), MIENGSET); 94
92 } else { 95 if (ext_irq >= HW_IRQ_MX_BASE) {
93 mask |= __this_cpu_read(cached_irq_mask); 96 set_er(1u << (ext_irq - HW_IRQ_MX_BASE), MIENGSET);
94 __this_cpu_write(cached_irq_mask, mask); 97 return;
95 xtensa_set_sr(mask, intenable); 98 }
96 } 99 }
100 mask |= __this_cpu_read(cached_irq_mask);
101 __this_cpu_write(cached_irq_mask, mask);
102 xtensa_set_sr(mask, intenable);
97} 103}
98 104
99static void xtensa_mx_irq_enable(struct irq_data *d) 105static void xtensa_mx_irq_enable(struct irq_data *d)
@@ -113,7 +119,11 @@ static void xtensa_mx_irq_ack(struct irq_data *d)
113 119
114static int xtensa_mx_irq_retrigger(struct irq_data *d) 120static int xtensa_mx_irq_retrigger(struct irq_data *d)
115{ 121{
116 xtensa_set_sr(1 << d->hwirq, intset); 122 unsigned int mask = 1u << d->hwirq;
123
124 if (WARN_ON(mask & ~XCHAL_INTTYPE_MASK_SOFTWARE))
125 return 0;
126 xtensa_set_sr(mask, intset);
117 return 1; 127 return 1;
118} 128}
119 129
diff --git a/drivers/irqchip/irq-xtensa-pic.c b/drivers/irqchip/irq-xtensa-pic.c
index c200234dd2c9..ab12328be5ee 100644
--- a/drivers/irqchip/irq-xtensa-pic.c
+++ b/drivers/irqchip/irq-xtensa-pic.c
@@ -70,7 +70,11 @@ static void xtensa_irq_ack(struct irq_data *d)
70 70
71static int xtensa_irq_retrigger(struct irq_data *d) 71static int xtensa_irq_retrigger(struct irq_data *d)
72{ 72{
73 xtensa_set_sr(1 << d->hwirq, intset); 73 unsigned int mask = 1u << d->hwirq;
74
75 if (WARN_ON(mask & ~XCHAL_INTTYPE_MASK_SOFTWARE))
76 return 0;
77 xtensa_set_sr(mask, intset);
74 return 1; 78 return 1;
75} 79}
76 80