Merge branches 'misc', 'sa1100-for-next' and 'spectre' into for-linus
authorRussell King <rmk+kernel@armlinux.org.uk>
Wed, 2 Jan 2019 10:37:05 +0000 (10:37 +0000)
committerRussell King <rmk+kernel@armlinux.org.uk>
Wed, 2 Jan 2019 10:37:05 +0000 (10:37 +0000)
1  2  3 
arch/arm/include/asm/cputype.h
arch/arm/kernel/setup.c
arch/arm/kernel/smp.c
arch/arm/mach-pxa/Kconfig
arch/arm/mm/proc-v7.S
arch/arm/vfp/vfpmodule.c

index 0d289240b6ca110ab961a280ddd20fc1c567f2a4,0d289240b6ca110ab961a280ddd20fc1c567f2a4,f6df4bb4e543f72cb9ce77ef14c5ac059701d603..775cac3c02bb0a31facb970e16feef83f86c6632
@@@@ -2,6 -2,6 -2,9 +2,6 @@@@
   #ifndef __ASM_ARM_CPUTYPE_H
   #define __ASM_ARM_CPUTYPE_H
   
  -#include <linux/stringify.h>
  -#include <linux/kernel.h>
  -
   #define CPUID_ID     0
   #define CPUID_CACHETYPE      1
   #define CPUID_TCM    2
        ((mpidr >> (MPIDR_LEVEL_BITS * level)) & MPIDR_LEVEL_MASK)
   
   #define ARM_CPU_IMP_ARM                      0x41
  +#define ARM_CPU_IMP_BRCM             0x42
   #define ARM_CPU_IMP_DEC                      0x44
   #define ARM_CPU_IMP_INTEL            0x69
   
   #define ARM_CPU_PART_CORTEX_A75              0x4100d0a0
   #define ARM_CPU_PART_MASK            0xff00fff0
   
  -/* Broadcom cores */
  +/* Broadcom implemented processors */
   #define ARM_CPU_PART_BRAHMA_B15              0x420000f0
  +#define ARM_CPU_PART_BRAHMA_B53              0x42001000
   
   /* DEC implemented cores */
   #define ARM_CPU_PART_SA1100          0x4400a110
   /* Qualcomm implemented cores */
   #define ARM_CPU_PART_SCORPION                0x510002d0
   
  +#ifndef __ASSEMBLY__
  +
  +#include <linux/stringify.h>
  +#include <linux/kernel.h>
  +
   extern unsigned int processor_id;
++ struct proc_info_list *lookup_processor(u32 midr);
   
   #ifdef CONFIG_CPU_CP15
   #define read_cpuid(reg)                                                      \
@@@@ -338,6 -338,6 -335,4 +339,6 @@@@ static inline int __attribute_const__ c
   #define cpuid_feature_extract(reg, field) \
        cpuid_feature_extract_field(read_cpuid_ext(reg), field)
   
  +#endif /* __ASSEMBLY__ */
  +
   #endif
diff --combined arch/arm/kernel/setup.c
index ac7e08886863cfa74855e5b91c4f436e85da1e0a,ac7e08886863cfa74855e5b91c4f436e85da1e0a,cd46a595422cf2ce37917c1b1933c14ae79dea9d..375b13f7e780663eddb3f04e632751064a6b5bfd
   #include <linux/utsname.h>
   #include <linux/initrd.h>
   #include <linux/console.h>
  -#include <linux/bootmem.h>
   #include <linux/seq_file.h>
   #include <linux/screen_info.h>
   #include <linux/of_platform.h>
@@@@ -114,6 -114,6 -115,11 +114,11 @@@@ EXPORT_SYMBOL(elf_hwcap2)
   
   #ifdef MULTI_CPU
   struct processor processor __ro_after_init;
++ #if defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR)
++ struct processor *cpu_vtable[NR_CPUS] = {
++      [0] = &processor,
++ };
++ #endif
   #endif
   #ifdef MULTI_TLB
   struct cpu_tlb_fns cpu_tlb __ro_after_init;
@@@@ -666,28 -666,28 -672,33 +671,33 @@@@ static void __init smp_build_mpidr_hash
   }
   #endif
   
-- static void __init setup_processor(void)
++ /*
++  * locate processor in the list of supported processor types.  The linker
++  * builds this table for us from the entries in arch/arm/mm/proc-*.S
++  */
++ struct proc_info_list *lookup_processor(u32 midr)
   {
--      struct proc_info_list *list;
++      struct proc_info_list *list = lookup_processor_type(midr);
   
--      /*
--       * locate processor in the list of supported processor
--       * types.  The linker builds this table for us from the
--       * entries in arch/arm/mm/proc-*.S
--       */
--      list = lookup_processor_type(read_cpuid_id());
        if (!list) {
--              pr_err("CPU configuration botched (ID %08x), unable to continue.\n",
--                     read_cpuid_id());
--              while (1);
++              pr_err("CPU%u: configuration botched (ID %08x), CPU halted\n",
++                     smp_processor_id(), midr);
++              while (1)
++              /* can't use cpu_relax() here as it may require MMU setup */;
        }
   
++      return list;
++ }
++ 
++ static void __init setup_processor(void)
++ {
++      unsigned int midr = read_cpuid_id();
++      struct proc_info_list *list = lookup_processor(midr);
++ 
        cpu_name = list->cpu_name;
        __cpu_architecture = __get_cpu_architecture();
   
-- #ifdef MULTI_CPU
--      processor = *list->proc;
-- #endif
++      init_proc_vtable(list->proc);
   #ifdef MULTI_TLB
        cpu_tlb = *list->tlb;
   #endif
   #endif
   
        pr_info("CPU: %s [%08x] revision %d (ARMv%s), cr=%08lx\n",
--              cpu_name, read_cpuid_id(), read_cpuid_id() & 15,
++              list->cpu_name, midr, midr & 15,
                proc_arch[cpu_architecture()], get_cr());
   
        snprintf(init_utsname()->machine, __NEW_UTS_LEN + 1, "%s%c",
@@@@ -753,7 -753,7 -764,7 +763,7 @@@@ int __init arm_add_memory(u64 start, u6
        else
                size -= aligned_start - start;
   
  -#ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT
  +#ifndef CONFIG_PHYS_ADDR_T_64BIT
        if (aligned_start > ULONG_MAX) {
                pr_crit("Ignoring memory at 0x%08llx outside 32-bit physical address space\n",
                        (long long)start);
@@@@ -856,7 -856,7 -867,7 +866,7 @@@@ static void __init request_standard_res
                 */
                boot_alias_start = phys_to_idmap(start);
                if (arm_has_idmap_alias() && boot_alias_start != IDMAP_INVALID_ADDR) {
  -                     res = memblock_virt_alloc(sizeof(*res), 0);
  +                     res = memblock_alloc(sizeof(*res), SMP_CACHE_BYTES);
                        res->name = "System RAM (boot alias)";
                        res->start = boot_alias_start;
                        res->end = phys_to_idmap(end);
                        request_resource(&iomem_resource, res);
                }
   
  -             res = memblock_virt_alloc(sizeof(*res), 0);
  +             res = memblock_alloc(sizeof(*res), SMP_CACHE_BYTES);
                res->name  = "System RAM";
                res->start = start;
                res->end = end;
@@@@ -1144,7 -1144,7 -1155,7 +1154,7 @@@@ void __init setup_arch(char **cmdline_p
   
        reserve_crashkernel();
   
  -#ifdef CONFIG_MULTI_IRQ_HANDLER
  +#ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER
        handle_arch_irq = mdesc->handle_irq;
   #endif
   
diff --combined arch/arm/kernel/smp.c
index f574a5e0d589fa6a43c082ac8d532495f50bb0a6,0978282d5fc27a7c4a5e6b0e274da8bfc4c14c8d,82b879db32ee4ca8d07454da7c2a0f7d73e9de85..3bf82232b1bed4bce829749ce6af885bbc43c191
   #include <asm/mmu_context.h>
   #include <asm/pgtable.h>
   #include <asm/pgalloc.h>
++ #include <asm/procinfo.h>
   #include <asm/processor.h>
   #include <asm/sections.h>
   #include <asm/tlbflush.h>
@@@@ -102,6 -102,6 -103,30 +103,30 @@@@ static unsigned long get_arch_pgd(pgd_
   #endif
   }
   
++ #if defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR)
++ static int secondary_biglittle_prepare(unsigned int cpu)
++ {
++      if (!cpu_vtable[cpu])
++              cpu_vtable[cpu] = kzalloc(sizeof(*cpu_vtable[cpu]), GFP_KERNEL);
++ 
++      return cpu_vtable[cpu] ? 0 : -ENOMEM;
++ }
++ 
++ static void secondary_biglittle_init(void)
++ {
++      init_proc_vtable(lookup_processor(read_cpuid_id())->proc);
++ }
++ #else
++ static int secondary_biglittle_prepare(unsigned int cpu)
++ {
++      return 0;
++ }
++ 
++ static void secondary_biglittle_init(void)
++ {
++ }
++ #endif
++ 
   int __cpu_up(unsigned int cpu, struct task_struct *idle)
   {
        int ret;
        if (!smp_ops.smp_boot_secondary)
                return -ENOSYS;
   
++      ret = secondary_biglittle_prepare(cpu);
++      if (ret)
++              return ret;
++ 
        /*
         * We need to tell the secondary core where to find
         * its stack and the page tables.
@@@@ -237,6 -237,6 -266,8 +266,6 @@@@ int __cpu_disable(void
        flush_cache_louis();
        local_flush_tlb_all();
   
  -     clear_tasks_mm_cpumask(cpu);
  -
        return 0;
   }
   
@@@@ -254,7 -254,7 -285,6 +283,7 @@@@ void __cpu_die(unsigned int cpu
        }
        pr_debug("CPU%u: shutdown\n", cpu);
   
  +     clear_tasks_mm_cpumask(cpu);
        /*
         * platform_cpu_kill() is generally expected to do the powering off
         * and/or cutting of clocks to the dying CPU.  Optionally, this may
@@@@ -359,6 -359,6 -389,8 +388,8 @@@@ asmlinkage void secondary_start_kernel(
        struct mm_struct *mm = &init_mm;
        unsigned int cpu;
   
++      secondary_biglittle_init();
++ 
        /*
         * The identity mapping is uncached (strongly ordered), so
         * switch away from it before attempting any exclusive accesses.
@@@@ -693,21 -693,6 -725,6 +724,21 @@@@ void smp_send_stop(void
                pr_warn("SMP: failed to stop secondary CPUs\n");
   }
   
 ++/* In case panic() and panic() called at the same time on CPU1 and CPU2,
 ++ * and CPU 1 calls panic_smp_self_stop() before crash_smp_send_stop()
 ++ * CPU1 can't receive the ipi irqs from CPU2, CPU1 will be always online,
 ++ * kdump fails. So split out the panic_smp_self_stop() and add
 ++ * set_cpu_online(smp_processor_id(), false).
 ++ */
 ++void panic_smp_self_stop(void)
 ++{
 ++     pr_debug("CPU %u will stop doing anything useful since another CPU has paniced\n",
 ++              smp_processor_id());
 ++     set_cpu_online(smp_processor_id(), false);
 ++     while (1)
 ++             cpu_relax();
 ++}
 ++
   /*
    * not supported here
    */
index 0853eb2818b73fe1038d2aba861b6f2abbd8eb8f,fd724a71c2e19b1ed2599699642eb78c10e5a566,a68b341831070873977e1be0fdce6bc981bb31ac..7298d07a9f71bc2e8a6fb00fb69468fcfc3c9df5
@@@@ -46,6 -46,7 -46,6 +46,7 @@@@ config ARCH_LUBBOC
   
   config MACH_MAINSTONE
        bool "Intel HCDDBBVA0 Development Platform (aka Mainstone)"
+ +     select GPIO_REG
        select PXA27x
   
   config MACH_ZYLONITE
@@@@ -551,6 -552,7 -551,7 +552,6 @@@@ config TOSA_B
   config TOSA_USE_EXT_KEYCODES
        bool "Tosa keyboard: use extended keycodes"
        depends on MACH_TOSA
 --     default n
        help
          Say Y here to enable the tosa keyboard driver to generate extended
          (>= 127) keycodes. Be aware, that they can't be correctly interpreted
diff --combined arch/arm/mm/proc-v7.S
index 6fe52819e0148c6f3f04b11c75e278cd0b04a1f9,6fe52819e0148c6f3f04b11c75e278cd0b04a1f9,fccd4d99f505edafdc875fb1043f4e4ca0614703..339eb17c9808e2c04a043485e42e5d29a49de347
@@@@ -112,7 -112,7 -112,7 +112,7 @@@@ ENTRY(cpu_v7_hvc_switch_mm
        hvc     #0
        ldmfd   sp!, {r0 - r3}
        b       cpu_v7_switch_mm
-- ENDPROC(cpu_v7_smc_switch_mm)
++ ENDPROC(cpu_v7_hvc_switch_mm)
   #endif
   ENTRY(cpu_v7_iciallu_switch_mm)
        mov     r3, #0
@@@@ -279,7 -279,7 -279,6 +279,7 @@@@ ENDPROC(cpu_pj4b_do_resume
   __v7_ca5mp_setup:
   __v7_ca9mp_setup:
   __v7_cr7mp_setup:
  +__v7_cr8mp_setup:
        mov     r10, #(1 << 0)                  @ Cache/TLB ops broadcasting
        b       1f
   __v7_ca7mp_setup:
@@@@ -716,16 -716,16 -715,6 +716,16 @@@@ __v7_cr7mp_proc_info
        __v7_proc __v7_cr7mp_proc_info, __v7_cr7mp_setup
        .size   __v7_cr7mp_proc_info, . - __v7_cr7mp_proc_info
   
  +     /*
  +      * ARM Ltd. Cortex R8 processor.
  +      */
  +     .type   __v7_cr8mp_proc_info, #object
  +__v7_cr8mp_proc_info:
  +     .long   0x410fc180
  +     .long   0xff0ffff0
  +     __v7_proc __v7_cr8mp_proc_info, __v7_cr8mp_setup
  +     .size   __v7_cr8mp_proc_info, . - __v7_cr8mp_proc_info
  +
        /*
         * ARM Ltd. Cortex A7 processor.
         */
diff --combined arch/arm/vfp/vfpmodule.c
index aff6e6eadc700f08241668e66c1235ea825217ce,aff6e6eadc700f08241668e66c1235ea825217ce,15bc3cf2a7fdc5edbb09ad7caa43714992da008f..ee7b07938dd59311f47fe5b385bcc27bfa4878f8
@@@@ -216,6 -216,6 -216,14 +216,6 @@@@ static struct notifier_block vfp_notifi
    */
   static void vfp_raise_sigfpe(unsigned int sicode, struct pt_regs *regs)
   {
  -     siginfo_t info;
  -
  -     memset(&info, 0, sizeof(info));
  -
  -     info.si_signo = SIGFPE;
  -     info.si_code = sicode;
  -     info.si_addr = (void __user *)(instruction_pointer(regs) - 4);
  -
        /*
         * This is the same as NWFPE, because it's not clear what
         * this is used for
        current->thread.error_code = 0;
        current->thread.trap_no = 6;
   
  -     send_sig_info(SIGFPE, &info, current);
  +     send_sig_fault(SIGFPE, sicode,
  +                    (void __user *)(instruction_pointer(regs) - 4),
  +                    current);
   }
   
   static void vfp_panic(char *reason, u32 inst)
@@@@ -251,7 -251,7 -257,7 +251,7 @@@@ static void vfp_raise_exceptions(u32 ex
   
        if (exceptions == VFP_EXCEPTION_ERROR) {
                vfp_panic("unhandled bounce", inst);
  -             vfp_raise_sigfpe(FPE_FIXME, regs);
  +             vfp_raise_sigfpe(FPE_FLTINV, regs);
                return;
        }
   
@@@@ -573,7 -573,7 -579,7 +573,7 @@@@ int vfp_preserve_user_clear_hwstate(str
         */
        ufp_exc->fpexc = hwstate->fpexc;
        ufp_exc->fpinst = hwstate->fpinst;
--      ufp_exc->fpinst2 = ufp_exc->fpinst2;
++      ufp_exc->fpinst2 = hwstate->fpinst2;
   
        /* Ensure that VFP is disabled. */
        vfp_flush_hwstate(thread);