aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/kernel
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-20 06:27:18 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-20 06:27:18 -0400
commit4958134df54c2c84e9c22ea042761d439164d26e (patch)
tree503177afab11f7d25b12a84ce25b481d305c51ba /arch/parisc/kernel
parentc4f528795d1add8b63652673f7262729f679c6c1 (diff)
parentc698ca5278934c0ae32297a8725ced2e27585d7f (diff)
Merge 4.16-rc6 into tty-next
We want the serial/tty fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/parisc/kernel')
-rw-r--r--arch/parisc/kernel/cache.c88
-rw-r--r--arch/parisc/kernel/head.S18
-rw-r--r--arch/parisc/kernel/pacache.S22
-rw-r--r--arch/parisc/kernel/smp.c7
-rw-r--r--arch/parisc/kernel/time.c11
5 files changed, 104 insertions, 42 deletions
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index 19c0c141bc3f..e3b45546d589 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -465,10 +465,10 @@ EXPORT_SYMBOL(copy_user_page);
465int __flush_tlb_range(unsigned long sid, unsigned long start, 465int __flush_tlb_range(unsigned long sid, unsigned long start,
466 unsigned long end) 466 unsigned long end)
467{ 467{
468 unsigned long flags, size; 468 unsigned long flags;
469 469
470 size = (end - start); 470 if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) &&
471 if (size >= parisc_tlb_flush_threshold) { 471 end - start >= parisc_tlb_flush_threshold) {
472 flush_tlb_all(); 472 flush_tlb_all();
473 return 1; 473 return 1;
474 } 474 }
@@ -539,13 +539,12 @@ void flush_cache_mm(struct mm_struct *mm)
539 struct vm_area_struct *vma; 539 struct vm_area_struct *vma;
540 pgd_t *pgd; 540 pgd_t *pgd;
541 541
542 /* Flush the TLB to avoid speculation if coherency is required. */
543 if (parisc_requires_coherency())
544 flush_tlb_all();
545
546 /* Flushing the whole cache on each cpu takes forever on 542 /* Flushing the whole cache on each cpu takes forever on
547 rp3440, etc. So, avoid it if the mm isn't too big. */ 543 rp3440, etc. So, avoid it if the mm isn't too big. */
548 if (mm_total_size(mm) >= parisc_cache_flush_threshold) { 544 if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) &&
545 mm_total_size(mm) >= parisc_cache_flush_threshold) {
546 if (mm->context)
547 flush_tlb_all();
549 flush_cache_all(); 548 flush_cache_all();
550 return; 549 return;
551 } 550 }
@@ -553,9 +552,9 @@ void flush_cache_mm(struct mm_struct *mm)
553 if (mm->context == mfsp(3)) { 552 if (mm->context == mfsp(3)) {
554 for (vma = mm->mmap; vma; vma = vma->vm_next) { 553 for (vma = mm->mmap; vma; vma = vma->vm_next) {
555 flush_user_dcache_range_asm(vma->vm_start, vma->vm_end); 554 flush_user_dcache_range_asm(vma->vm_start, vma->vm_end);
556 if ((vma->vm_flags & VM_EXEC) == 0) 555 if (vma->vm_flags & VM_EXEC)
557 continue; 556 flush_user_icache_range_asm(vma->vm_start, vma->vm_end);
558 flush_user_icache_range_asm(vma->vm_start, vma->vm_end); 557 flush_tlb_range(vma, vma->vm_start, vma->vm_end);
559 } 558 }
560 return; 559 return;
561 } 560 }
@@ -573,6 +572,8 @@ void flush_cache_mm(struct mm_struct *mm)
573 pfn = pte_pfn(*ptep); 572 pfn = pte_pfn(*ptep);
574 if (!pfn_valid(pfn)) 573 if (!pfn_valid(pfn))
575 continue; 574 continue;
575 if (unlikely(mm->context))
576 flush_tlb_page(vma, addr);
576 __flush_cache_page(vma, addr, PFN_PHYS(pfn)); 577 __flush_cache_page(vma, addr, PFN_PHYS(pfn));
577 } 578 }
578 } 579 }
@@ -581,30 +582,45 @@ void flush_cache_mm(struct mm_struct *mm)
581void flush_cache_range(struct vm_area_struct *vma, 582void flush_cache_range(struct vm_area_struct *vma,
582 unsigned long start, unsigned long end) 583 unsigned long start, unsigned long end)
583{ 584{
584 BUG_ON(!vma->vm_mm->context); 585 pgd_t *pgd;
585 586 unsigned long addr;
586 /* Flush the TLB to avoid speculation if coherency is required. */
587 if (parisc_requires_coherency())
588 flush_tlb_range(vma, start, end);
589 587
590 if ((end - start) >= parisc_cache_flush_threshold 588 if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) &&
591 || vma->vm_mm->context != mfsp(3)) { 589 end - start >= parisc_cache_flush_threshold) {
590 if (vma->vm_mm->context)
591 flush_tlb_range(vma, start, end);
592 flush_cache_all(); 592 flush_cache_all();
593 return; 593 return;
594 } 594 }
595 595
596 flush_user_dcache_range_asm(start, end); 596 if (vma->vm_mm->context == mfsp(3)) {
597 if (vma->vm_flags & VM_EXEC) 597 flush_user_dcache_range_asm(start, end);
598 flush_user_icache_range_asm(start, end); 598 if (vma->vm_flags & VM_EXEC)
599 flush_user_icache_range_asm(start, end);
600 flush_tlb_range(vma, start, end);
601 return;
602 }
603
604 pgd = vma->vm_mm->pgd;
605 for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) {
606 unsigned long pfn;
607 pte_t *ptep = get_ptep(pgd, addr);
608 if (!ptep)
609 continue;
610 pfn = pte_pfn(*ptep);
611 if (pfn_valid(pfn)) {
612 if (unlikely(vma->vm_mm->context))
613 flush_tlb_page(vma, addr);
614 __flush_cache_page(vma, addr, PFN_PHYS(pfn));
615 }
616 }
599} 617}
600 618
601void 619void
602flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn) 620flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn)
603{ 621{
604 BUG_ON(!vma->vm_mm->context);
605
606 if (pfn_valid(pfn)) { 622 if (pfn_valid(pfn)) {
607 if (parisc_requires_coherency()) 623 if (likely(vma->vm_mm->context))
608 flush_tlb_page(vma, vmaddr); 624 flush_tlb_page(vma, vmaddr);
609 __flush_cache_page(vma, vmaddr, PFN_PHYS(pfn)); 625 __flush_cache_page(vma, vmaddr, PFN_PHYS(pfn));
610 } 626 }
@@ -613,21 +629,33 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long
613void flush_kernel_vmap_range(void *vaddr, int size) 629void flush_kernel_vmap_range(void *vaddr, int size)
614{ 630{
615 unsigned long start = (unsigned long)vaddr; 631 unsigned long start = (unsigned long)vaddr;
632 unsigned long end = start + size;
616 633
617 if ((unsigned long)size > parisc_cache_flush_threshold) 634 if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) &&
635 (unsigned long)size >= parisc_cache_flush_threshold) {
636 flush_tlb_kernel_range(start, end);
618 flush_data_cache(); 637 flush_data_cache();
619 else 638 return;
620 flush_kernel_dcache_range_asm(start, start + size); 639 }
640
641 flush_kernel_dcache_range_asm(start, end);
642 flush_tlb_kernel_range(start, end);
621} 643}
622EXPORT_SYMBOL(flush_kernel_vmap_range); 644EXPORT_SYMBOL(flush_kernel_vmap_range);
623 645
624void invalidate_kernel_vmap_range(void *vaddr, int size) 646void invalidate_kernel_vmap_range(void *vaddr, int size)
625{ 647{
626 unsigned long start = (unsigned long)vaddr; 648 unsigned long start = (unsigned long)vaddr;
649 unsigned long end = start + size;
627 650
628 if ((unsigned long)size > parisc_cache_flush_threshold) 651 if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) &&
652 (unsigned long)size >= parisc_cache_flush_threshold) {
653 flush_tlb_kernel_range(start, end);
629 flush_data_cache(); 654 flush_data_cache();
630 else 655 return;
631 flush_kernel_dcache_range_asm(start, start + size); 656 }
657
658 purge_kernel_dcache_range_asm(start, end);
659 flush_tlb_kernel_range(start, end);
632} 660}
633EXPORT_SYMBOL(invalidate_kernel_vmap_range); 661EXPORT_SYMBOL(invalidate_kernel_vmap_range);
diff --git a/arch/parisc/kernel/head.S b/arch/parisc/kernel/head.S
index bbbe360b458f..fbb4e43fda05 100644
--- a/arch/parisc/kernel/head.S
+++ b/arch/parisc/kernel/head.S
@@ -138,6 +138,16 @@ $pgt_fill_loop:
138 std %dp,0x18(%r10) 138 std %dp,0x18(%r10)
139#endif 139#endif
140 140
141#ifdef CONFIG_64BIT
142 /* Get PDCE_PROC for monarch CPU. */
143#define MEM_PDC_LO 0x388
144#define MEM_PDC_HI 0x35C
145 ldw MEM_PDC_LO(%r0),%r3
146 ldw MEM_PDC_HI(%r0),%r10
147 depd %r10, 31, 32, %r3 /* move to upper word */
148#endif
149
150
141#ifdef CONFIG_SMP 151#ifdef CONFIG_SMP
142 /* Set the smp rendezvous address into page zero. 152 /* Set the smp rendezvous address into page zero.
143 ** It would be safer to do this in init_smp_config() but 153 ** It would be safer to do this in init_smp_config() but
@@ -196,12 +206,6 @@ common_stext:
196 ** Someday, palo might not do this for the Monarch either. 206 ** Someday, palo might not do this for the Monarch either.
197 */ 207 */
1982: 2082:
199#define MEM_PDC_LO 0x388
200#define MEM_PDC_HI 0x35C
201 ldw MEM_PDC_LO(%r0),%r3
202 ldw MEM_PDC_HI(%r0),%r6
203 depd %r6, 31, 32, %r3 /* move to upper word */
204
205 mfctl %cr30,%r6 /* PCX-W2 firmware bug */ 209 mfctl %cr30,%r6 /* PCX-W2 firmware bug */
206 210
207 ldo PDC_PSW(%r0),%arg0 /* 21 */ 211 ldo PDC_PSW(%r0),%arg0 /* 21 */
@@ -268,6 +272,8 @@ $install_iva:
268aligned_rfi: 272aligned_rfi:
269 pcxt_ssm_bug 273 pcxt_ssm_bug
270 274
275 copy %r3, %arg0 /* PDCE_PROC for smp_callin() */
276
271 rsm PSW_SM_QUIET,%r0 /* off troublesome PSW bits */ 277 rsm PSW_SM_QUIET,%r0 /* off troublesome PSW bits */
272 /* Don't need NOPs, have 8 compliant insn before rfi */ 278 /* Don't need NOPs, have 8 compliant insn before rfi */
273 279
diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S
index 2d40c4ff3f69..67b0f7532e83 100644
--- a/arch/parisc/kernel/pacache.S
+++ b/arch/parisc/kernel/pacache.S
@@ -1110,6 +1110,28 @@ ENTRY_CFI(flush_kernel_dcache_range_asm)
1110 .procend 1110 .procend
1111ENDPROC_CFI(flush_kernel_dcache_range_asm) 1111ENDPROC_CFI(flush_kernel_dcache_range_asm)
1112 1112
1113ENTRY_CFI(purge_kernel_dcache_range_asm)
1114 .proc
1115 .callinfo NO_CALLS
1116 .entry
1117
1118 ldil L%dcache_stride, %r1
1119 ldw R%dcache_stride(%r1), %r23
1120 ldo -1(%r23), %r21
1121 ANDCM %r26, %r21, %r26
1122
11231: cmpb,COND(<<),n %r26, %r25,1b
1124 pdc,m %r23(%r26)
1125
1126 sync
1127 syncdma
1128 bv %r0(%r2)
1129 nop
1130 .exit
1131
1132 .procend
1133ENDPROC_CFI(purge_kernel_dcache_range_asm)
1134
1113ENTRY_CFI(flush_user_icache_range_asm) 1135ENTRY_CFI(flush_user_icache_range_asm)
1114 .proc 1136 .proc
1115 .callinfo NO_CALLS 1137 .callinfo NO_CALLS
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
index 30c28ab14540..4065b5e48c9d 100644
--- a/arch/parisc/kernel/smp.c
+++ b/arch/parisc/kernel/smp.c
@@ -292,10 +292,15 @@ smp_cpu_init(int cpunum)
292 * Slaves start using C here. Indirectly called from smp_slave_stext. 292 * Slaves start using C here. Indirectly called from smp_slave_stext.
293 * Do what start_kernel() and main() do for boot strap processor (aka monarch) 293 * Do what start_kernel() and main() do for boot strap processor (aka monarch)
294 */ 294 */
295void __init smp_callin(void) 295void __init smp_callin(unsigned long pdce_proc)
296{ 296{
297 int slave_id = cpu_now_booting; 297 int slave_id = cpu_now_booting;
298 298
299#ifdef CONFIG_64BIT
300 WARN_ON(((unsigned long)(PAGE0->mem_pdc_hi) << 32
301 | PAGE0->mem_pdc) != pdce_proc);
302#endif
303
299 smp_cpu_init(slave_id); 304 smp_cpu_init(slave_id);
300 preempt_disable(); 305 preempt_disable();
301 306
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 4b8fd6dc22da..f7e684560186 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -76,10 +76,10 @@ irqreturn_t __irq_entry timer_interrupt(int irq, void *dev_id)
76 next_tick = cpuinfo->it_value; 76 next_tick = cpuinfo->it_value;
77 77
78 /* Calculate how many ticks have elapsed. */ 78 /* Calculate how many ticks have elapsed. */
79 now = mfctl(16);
79 do { 80 do {
80 ++ticks_elapsed; 81 ++ticks_elapsed;
81 next_tick += cpt; 82 next_tick += cpt;
82 now = mfctl(16);
83 } while (next_tick - now > cpt); 83 } while (next_tick - now > cpt);
84 84
85 /* Store (in CR16 cycles) up to when we are accounting right now. */ 85 /* Store (in CR16 cycles) up to when we are accounting right now. */
@@ -103,16 +103,17 @@ irqreturn_t __irq_entry timer_interrupt(int irq, void *dev_id)
103 * if one or the other wrapped. If "now" is "bigger" we'll end up 103 * if one or the other wrapped. If "now" is "bigger" we'll end up
104 * with a very large unsigned number. 104 * with a very large unsigned number.
105 */ 105 */
106 while (next_tick - mfctl(16) > cpt) 106 now = mfctl(16);
107 while (next_tick - now > cpt)
107 next_tick += cpt; 108 next_tick += cpt;
108 109
109 /* Program the IT when to deliver the next interrupt. 110 /* Program the IT when to deliver the next interrupt.
110 * Only bottom 32-bits of next_tick are writable in CR16! 111 * Only bottom 32-bits of next_tick are writable in CR16!
111 * Timer interrupt will be delivered at least a few hundred cycles 112 * Timer interrupt will be delivered at least a few hundred cycles
112 * after the IT fires, so if we are too close (<= 500 cycles) to the 113 * after the IT fires, so if we are too close (<= 8000 cycles) to the
113 * next cycle, simply skip it. 114 * next cycle, simply skip it.
114 */ 115 */
115 if (next_tick - mfctl(16) <= 500) 116 if (next_tick - now <= 8000)
116 next_tick += cpt; 117 next_tick += cpt;
117 mtctl(next_tick, 16); 118 mtctl(next_tick, 16);
118 119
@@ -248,7 +249,7 @@ static int __init init_cr16_clocksource(void)
248 * different sockets, so mark them unstable and lower rating on 249 * different sockets, so mark them unstable and lower rating on
249 * multi-socket SMP systems. 250 * multi-socket SMP systems.
250 */ 251 */
251 if (num_online_cpus() > 1) { 252 if (num_online_cpus() > 1 && !running_on_qemu) {
252 int cpu; 253 int cpu;
253 unsigned long cpu0_loc; 254 unsigned long cpu0_loc;
254 cpu0_loc = per_cpu(cpu_data, 0).cpu_loc; 255 cpu0_loc = per_cpu(cpu_data, 0).cpu_loc;