Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 Jul 2019 04:08:34 +0000 (21:08 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 Jul 2019 04:08:34 +0000 (21:08 -0700)
Pull ARM updates from Russell King:

 - Add a "cut here" to make it clearer where oops dumps should be cut
   from - we already have a marker for the end of the dumps.

 - Add logging severity to show_pte()

 - Drop unnecessary common-page-size linker flag

 - Errata workarounds for Cortex A12 857271, Cortex A17 857272 and
   Cortex A7 814220.

 - Remove some unused variables that had started to provoke a compiler
   warning.

* tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
  ARM: 8863/1: stm32: select ARM errata 814220
  ARM: 8862/1: errata: 814220-B-Cache maintenance by set/way operations can execute out of order
  ARM: 8865/1: mm: remove unused variables
  ARM: 8864/1: Add workaround for I-Cache line size mismatch between CPU cores
  ARM: 8861/1: errata: Workaround errata A12 857271 / A17 857272
  ARM: 8860/1: VDSO: Drop implicit common-page-size linker flag
  ARM: arrange show_pte() to issue severity-based messages
  ARM: add "8<--- cut here ---" to kernel dumps

1  2 
arch/arm/include/asm/cacheflush.h
arch/arm/kernel/smp.c
arch/arm/kernel/traps.c
arch/arm/mm/cache-v7.S
arch/arm/mm/fault.c
arch/arm/mm/init.c
arch/arm/mm/proc-v7.S

index d6667b8cfca5616434e743f36be2f2192a5e31ab,ec4fd2e2dd60ceee12213b3a544a59de215336a4..7114b9aa46b875c5a506332102bce1c722ea7468
@@@ -1,8 -1,11 +1,8 @@@
 +/* SPDX-License-Identifier: GPL-2.0-only */
  /*
   *  arch/arm/include/asm/cacheflush.h
   *
   *  Copyright (C) 1999-2002 Russell King
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
   */
  #ifndef _ASMARM_CACHEFLUSH_H
  #define _ASMARM_CACHEFLUSH_H
@@@ -476,4 -479,11 +476,11 @@@ static inline void __sync_cache_range_r
  void flush_uprobe_xol_access(struct page *page, unsigned long uaddr,
                             void *kaddr, unsigned long len);
  
+ #ifdef CONFIG_CPU_ICACHE_MISMATCH_WORKAROUND
+ void check_cpu_icache_size(int cpuid);
+ #else
+ static inline void check_cpu_icache_size(int cpuid) { }
+ #endif
  #endif
diff --combined arch/arm/kernel/smp.c
index a137608cd1970737a5a571b5ff2b375d3d01aaae,12cf7c4324a9bf52f5b72d12ff6b6ee4030aaf45..aab8ba40ce38d6884f103d05e4a24eedfd923cb7
@@@ -1,8 -1,11 +1,8 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   *  linux/arch/arm/kernel/smp.c
   *
   *  Copyright (C) 2002 ARM Limited, All Rights Reserved.
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
   */
  #include <linux/module.h>
  #include <linux/delay.h>
@@@ -372,6 -375,7 +372,7 @@@ static void smp_store_cpu_info(unsigne
        cpu_info->cpuid = read_cpuid_id();
  
        store_cpu_topology(cpuid);
+       check_cpu_icache_size(cpuid);
  }
  
  /*
diff --combined arch/arm/kernel/traps.c
index 7e2f1cba84e5370d9bc673c52fb8f7224a01159e,3d7b48de2aea543d13882da67a719b264c4401db..b6d6b1a6f1566135c5c54ab176e673b5cba4ec77
@@@ -1,10 -1,13 +1,10 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   *  linux/arch/arm/kernel/traps.c
   *
   *  Copyright (C) 1995-2009 Russell King
   *  Fragments that appear the same as linux/arch/i386/kernel/traps.c (C) Linus Torvalds
   *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
 - *
   *  'traps.c' handles hardware exceptions after we have saved some state in
   *  'linux/arch/arm/lib/traps.S'.  Mostly a debugging aid, but will probably
   *  kill the offending process.
@@@ -722,10 -725,11 +722,11 @@@ baddataabort(int code, unsigned long in
  
  #ifdef CONFIG_DEBUG_USER
        if (user_debug & UDBG_BADABORT) {
+               pr_err("8<--- cut here ---\n");
                pr_err("[%d] %s: bad data abort: code %d instr 0x%08lx\n",
                       task_pid_nr(current), current->comm, code, instr);
                dump_instr(KERN_ERR, regs);
-               show_pte(current->mm, addr);
+               show_pte(KERN_ERR, current->mm, addr);
        }
  #endif
  
diff --combined arch/arm/mm/cache-v7.S
index 8c83b458688323c6730e65668fe0bb046aaca9ac,ea05d6fd53a116dad8e386daaca21829b0b2c920..0ee8fc4b4672c6d2123c231a47b61cb870ec6052
@@@ -1,10 -1,13 +1,10 @@@
 +/* SPDX-License-Identifier: GPL-2.0-only */
  /*
   *  linux/arch/arm/mm/cache-v7.S
   *
   *  Copyright (C) 2001 Deep Blue Solutions Ltd.
   *  Copyright (C) 2005 ARM Ltd.
   *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
 - *
   *  This is the "shell" of the ARMv7 processor support.
   */
  #include <linux/linkage.h>
  
  #include "proc-macros.S"
  
+ #ifdef CONFIG_CPU_ICACHE_MISMATCH_WORKAROUND
+ .globl icache_size
+       .data
+       .align  2
+ icache_size:
+       .long   64
+       .text
+ #endif
  /*
   * The secondary kernel init calls v7_flush_dcache_all before it enables
   * the L1; however, the L1 comes out of reset in an undefined state, so
@@@ -160,6 -171,9 +168,9 @@@ loop2
  skip:
        add     r10, r10, #2                    @ increment cache number
        cmp     r3, r10
+ #ifdef CONFIG_ARM_ERRATA_814220
+       dsb
+ #endif
        bgt     flush_levels
  finished:
        mov     r10, #0                         @ switch back to cache level 0
@@@ -281,7 -295,12 +292,12 @@@ ENTRY(v7_coherent_user_range
        cmp     r12, r1
        blo     1b
        dsb     ishst
+ #ifdef CONFIG_CPU_ICACHE_MISMATCH_WORKAROUND
+       ldr     r3, =icache_size
+       ldr     r2, [r3, #0]
+ #else
        icache_line_size r2, r3
+ #endif
        sub     r3, r2, #1
        bic     r12, r0, r3
  2:
diff --combined arch/arm/mm/fault.c
index 0048eadd0681a137bc2f0ed6097041fbe539840b,b4cade58ed7bef732b5b2212c9a5d0db3877577c..ec83c8fca62da1cd60794763874219fa01c3ada9
@@@ -1,9 -1,12 +1,9 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   *  linux/arch/arm/mm/fault.c
   *
   *  Copyright (C) 1995  Linus Torvalds
   *  Modifications for ARM processor (c) 1995-2004 Russell King
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
   */
  #include <linux/extable.h>
  #include <linux/signal.h>
@@@ -53,17 -56,16 +53,16 @@@ static inline int notify_page_fault(str
   * This is useful to dump out the page tables associated with
   * 'addr' in mm 'mm'.
   */
- void show_pte(struct mm_struct *mm, unsigned long addr)
+ void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr)
  {
        pgd_t *pgd;
  
        if (!mm)
                mm = &init_mm;
  
-       pr_alert("pgd = %p\n", mm->pgd);
+       printk("%spgd = %p\n", lvl, mm->pgd);
        pgd = pgd_offset(mm, addr);
-       pr_alert("[%08lx] *pgd=%08llx",
-                       addr, (long long)pgd_val(*pgd));
+       printk("%s[%08lx] *pgd=%08llx", lvl, addr, (long long)pgd_val(*pgd));
  
        do {
                pud_t *pud;
        pr_cont("\n");
  }
  #else                                 /* CONFIG_MMU */
- void show_pte(struct mm_struct *mm, unsigned long addr)
+ void show_pte(const char *lvl, struct mm_struct *mm, unsigned long addr)
  { }
  #endif                                        /* CONFIG_MMU */
  
@@@ -139,11 -141,12 +138,12 @@@ __do_kernel_fault(struct mm_struct *mm
         * No handler, we'll have to terminate things with extreme prejudice.
         */
        bust_spinlocks(1);
+       pr_alert("8<--- cut here ---\n");
        pr_alert("Unable to handle kernel %s at virtual address %08lx\n",
                 (addr < PAGE_SIZE) ? "NULL pointer dereference" :
                 "paging request", addr);
  
-       show_pte(mm, addr);
+       show_pte(KERN_ALERT, mm, addr);
        die("Oops", regs, fsr);
        bust_spinlocks(0);
        do_exit(SIGKILL);
@@@ -164,9 -167,10 +164,10 @@@ __do_user_fault(struct task_struct *tsk
  #ifdef CONFIG_DEBUG_USER
        if (((user_debug & UDBG_SEGV) && (sig == SIGSEGV)) ||
            ((user_debug & UDBG_BUS)  && (sig == SIGBUS))) {
-               printk(KERN_DEBUG "%s: unhandled page fault (%d) at 0x%08lx, code 0x%03x\n",
+               pr_err("8<--- cut here ---\n");
+               pr_err("%s: unhandled page fault (%d) at 0x%08lx, code 0x%03x\n",
                       tsk->comm, sig, addr, fsr);
-               show_pte(tsk->mm, addr);
+               show_pte(KERN_ERR, tsk->mm, addr);
                show_regs(regs);
        }
  #endif
@@@ -553,9 -557,10 +554,10 @@@ do_DataAbort(unsigned long addr, unsign
        if (!inf->fn(addr, fsr & ~FSR_LNX_PF, regs))
                return;
  
+       pr_alert("8<--- cut here ---\n");
        pr_alert("Unhandled fault: %s (0x%03x) at 0x%08lx\n",
                inf->name, fsr, addr);
-       show_pte(current->mm, addr);
+       show_pte(KERN_ALERT, current->mm, addr);
  
        arm_notify_die("", regs, inf->sig, inf->code, (void __user *)addr,
                       fsr, 0);
diff --combined arch/arm/mm/init.c
index 749a5a6f61433ef733102231cb96b7ab8d905cc9,581c6ffc30565ae590cd142736c4a99d994ffb13..4920a206dce936fe9ab601bfd569f0133c3d757c
@@@ -1,8 -1,11 +1,8 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   *  linux/arch/arm/mm/init.c
   *
   *  Copyright (C) 1995-2005 Russell King
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
   */
  #include <linux/kernel.h>
  #include <linux/errno.h>
@@@ -239,6 -242,22 +239,22 @@@ static void __init arm_initrd_init(void
  #endif
  }
  
+ #ifdef CONFIG_CPU_ICACHE_MISMATCH_WORKAROUND
+ void check_cpu_icache_size(int cpuid)
+ {
+       u32 size, ctr;
+       asm("mrc p15, 0, %0, c0, c0, 1" : "=r" (ctr));
+       size = 1 << ((ctr & 0xf) + 2);
+       if (cpuid != 0 && icache_size != size)
+               pr_info("CPU%u: detected I-Cache line size mismatch, workaround enabled\n",
+                       cpuid);
+       if (icache_size > size)
+               icache_size = size;
+ }
+ #endif
  void __init arm_memblock_init(const struct machine_desc *mdesc)
  {
        /* Register the kernel text, kernel data and initrd with memblock. */
@@@ -447,12 -466,6 +463,6 @@@ static void __init free_highpages(void
   */
  void __init mem_init(void)
  {
- #ifdef CONFIG_HAVE_TCM
-       /* These pointers are filled in on TCM detection */
-       extern u32 dtcm_end;
-       extern u32 itcm_end;
- #endif
        set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
  
        /* this will put all unused low memory onto the freelists */
diff --combined arch/arm/mm/proc-v7.S
index 83741c31757d659ea9d45f318739bd678eb1d184,2966086d8a45f92fef00af1b1f645f9e2ce7a224..c4e8006a1a8cdd13ae3e622007e7c5b34883393a
@@@ -1,9 -1,12 +1,9 @@@
 +/* SPDX-License-Identifier: GPL-2.0-only */
  /*
   *  linux/arch/arm/mm/proc-v7.S
   *
   *  Copyright (C) 2001 Deep Blue Solutions Ltd.
   *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
 - *
   *  This is the "shell" of the ARMv7 processor support.
   */
  #include <linux/arm-smccc.h>
@@@ -388,6 -391,11 +388,11 @@@ __ca12_errata
        mrc     p15, 0, r10, c15, c0, 1         @ read diagnostic register
        orr     r10, r10, #1 << 24              @ set bit #24
        mcr     p15, 0, r10, c15, c0, 1         @ write diagnostic register
+ #endif
+ #ifdef CONFIG_ARM_ERRATA_857271
+       mrc     p15, 0, r10, c15, c0, 1         @ read diagnostic register
+       orr     r10, r10, #3 << 10              @ set bits #10 and #11
+       mcr     p15, 0, r10, c15, c0, 1         @ write diagnostic register
  #endif
        b       __errata_finish
  
@@@ -403,6 -411,11 +408,11 @@@ __ca17_errata
        mrcle   p15, 0, r10, c15, c0, 1         @ read diagnostic register
        orrle   r10, r10, #1 << 12              @ set bit #12
        mcrle   p15, 0, r10, c15, c0, 1         @ write diagnostic register
+ #endif
+ #ifdef CONFIG_ARM_ERRATA_857272
+       mrc     p15, 0, r10, c15, c0, 1         @ read diagnostic register
+       orr     r10, r10, #3 << 10              @ set bits #10 and #11
+       mcr     p15, 0, r10, c15, c0, 1         @ write diagnostic register
  #endif
        b       __errata_finish