Commit 955837d8f50ecc6f552aaa243f84736f2407d2c0

Authored by Linus Torvalds

Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull more arm64 fixes from Will Deacon:
 "Another handful of arm64 fixes here.  They address some issues found
  by running smatch on the arch code (ignoring the false positives) and
  also stop 32-bit Android from losing track of its stack.

  There's one additional irq migration fix in the pipeline, but it came
  in after I'd tagged and tested this set.

   - a few fixes for real issues found by smatch (after Dan's talk at KS)

   - revert the /proc/cpuinfo changes merged during the merge window.
     We've opened a can of worms here, so we need to find out where we
     stand before we change this interface.

   - implement KSTK_ESP for compat tasks, otherwise 32-bit Android gets
     confused wondering where its [stack] has gone

   - misc fixes (fpsimd context handling, crypto, ...)"

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
  Revert "arm64: cpuinfo: print info for all CPUs"
  arm64: fix bug for reloading FPSIMD state after cpu power off
  arm64: report correct stack pointer in KSTK_ESP for compat tasks
  arm64: Add brackets around user_stack_pointer()
  arm64: perf: don't rely on layout of pt_regs when grabbing sp or pc
  arm64: ptrace: fix compat reg getter/setter return values
  arm64: ptrace: fix compat hardware watchpoint reporting
  arm64: Remove unused variable in head.S
  arm64/crypto: remove redundant update of data

Showing 9 changed files Side-by-side Diff

arch/arm64/crypto/sha2-ce-glue.c
... ... @@ -150,7 +150,6 @@
150 150 kernel_neon_begin_partial(28);
151 151 sha2_ce_transform(blocks, data, sctx->state, NULL, len);
152 152 kernel_neon_end();
153   - data += blocks * SHA256_BLOCK_SIZE;
154 153 }
155 154  
156 155 static int sha224_finup(struct shash_desc *desc, const u8 *data,
arch/arm64/include/asm/hw_breakpoint.h
... ... @@ -79,7 +79,6 @@
79 79 */
80 80 #define ARM_MAX_BRP 16
81 81 #define ARM_MAX_WRP 16
82   -#define ARM_MAX_HBP_SLOTS (ARM_MAX_BRP + ARM_MAX_WRP)
83 82  
84 83 /* Virtual debug register bases. */
85 84 #define AARCH64_DBG_REG_BVR 0
arch/arm64/include/asm/processor.h
... ... @@ -139,7 +139,7 @@
139 139 ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
140 140  
141 141 #define KSTK_EIP(tsk) ((unsigned long)task_pt_regs(tsk)->pc)
142   -#define KSTK_ESP(tsk) ((unsigned long)task_pt_regs(tsk)->sp)
  142 +#define KSTK_ESP(tsk) user_stack_pointer(task_pt_regs(tsk))
143 143  
144 144 /*
145 145 * Prefetching support
arch/arm64/include/asm/ptrace.h
... ... @@ -137,7 +137,7 @@
137 137 (!((regs)->pstate & PSR_F_BIT))
138 138  
139 139 #define user_stack_pointer(regs) \
140   - (!compat_user_mode(regs)) ? ((regs)->sp) : ((regs)->compat_sp)
  140 + (!compat_user_mode(regs) ? (regs)->sp : (regs)->compat_sp)
141 141  
142 142 static inline unsigned long regs_return_value(struct pt_regs *regs)
143 143 {
arch/arm64/kernel/fpsimd.c
... ... @@ -270,6 +270,7 @@
270 270 case CPU_PM_ENTER:
271 271 if (current->mm && !test_thread_flag(TIF_FOREIGN_FPSTATE))
272 272 fpsimd_save_state(&current->thread.fpsimd_state);
  273 + this_cpu_write(fpsimd_last_state, NULL);
273 274 break;
274 275 case CPU_PM_EXIT:
275 276 if (current->mm)
arch/arm64/kernel/head.S
... ... @@ -373,10 +373,6 @@
373 373 .long 0
374 374 .popsection
375 375  
376   - .align 3
377   -2: .quad .
378   - .quad PAGE_OFFSET
379   -
380 376 #ifdef CONFIG_SMP
381 377 .align 3
382 378 1: .quad .
arch/arm64/kernel/perf_regs.c
... ... @@ -24,6 +24,12 @@
24 24 return regs->compat_lr;
25 25 }
26 26  
  27 + if ((u32)idx == PERF_REG_ARM64_SP)
  28 + return regs->sp;
  29 +
  30 + if ((u32)idx == PERF_REG_ARM64_PC)
  31 + return regs->pc;
  32 +
27 33 return regs->regs[idx];
28 34 }
29 35  
arch/arm64/kernel/ptrace.c
... ... @@ -87,7 +87,8 @@
87 87 break;
88 88 }
89 89 }
90   - for (i = ARM_MAX_BRP; i < ARM_MAX_HBP_SLOTS && !bp; ++i) {
  90 +
  91 + for (i = 0; i < ARM_MAX_WRP; ++i) {
91 92 if (current->thread.debug.hbp_watch[i] == bp) {
92 93 info.si_errno = -((i << 1) + 1);
93 94 break;
94 95  
... ... @@ -662,8 +663,10 @@
662 663 kbuf += sizeof(reg);
663 664 } else {
664 665 ret = copy_to_user(ubuf, &reg, sizeof(reg));
665   - if (ret)
  666 + if (ret) {
  667 + ret = -EFAULT;
666 668 break;
  669 + }
667 670  
668 671 ubuf += sizeof(reg);
669 672 }
... ... @@ -701,8 +704,10 @@
701 704 kbuf += sizeof(reg);
702 705 } else {
703 706 ret = copy_from_user(&reg, ubuf, sizeof(reg));
704   - if (ret)
705   - return ret;
  707 + if (ret) {
  708 + ret = -EFAULT;
  709 + break;
  710 + }
706 711  
707 712 ubuf += sizeof(reg);
708 713 }
arch/arm64/kernel/setup.c
... ... @@ -78,6 +78,7 @@
78 78 #endif
79 79  
80 80 static const char *cpu_name;
  81 +static const char *machine_name;
81 82 phys_addr_t __fdt_pointer __initdata;
82 83  
83 84 /*
... ... @@ -309,6 +310,8 @@
309 310 while (true)
310 311 cpu_relax();
311 312 }
  313 +
  314 + machine_name = of_flat_dt_get_machine_name();
312 315 }
313 316  
314 317 /*
315 318  
... ... @@ -447,21 +450,10 @@
447 450 {
448 451 int i;
449 452  
450   - /*
451   - * Dump out the common processor features in a single line. Userspace
452   - * should read the hwcaps with getauxval(AT_HWCAP) rather than
453   - * attempting to parse this.
454   - */
455   - seq_puts(m, "features\t:");
456   - for (i = 0; hwcap_str[i]; i++)
457   - if (elf_hwcap & (1 << i))
458   - seq_printf(m, " %s", hwcap_str[i]);
459   - seq_puts(m, "\n\n");
  453 + seq_printf(m, "Processor\t: %s rev %d (%s)\n",
  454 + cpu_name, read_cpuid_id() & 15, ELF_PLATFORM);
460 455  
461 456 for_each_online_cpu(i) {
462   - struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i);
463   - u32 midr = cpuinfo->reg_midr;
464   -
465 457 /*
466 458 * glibc reads /proc/cpuinfo to determine the number of
467 459 * online processors, looking for lines beginning with
468 460  
... ... @@ -470,12 +462,24 @@
470 462 #ifdef CONFIG_SMP
471 463 seq_printf(m, "processor\t: %d\n", i);
472 464 #endif
473   - seq_printf(m, "implementer\t: 0x%02x\n",
474   - MIDR_IMPLEMENTOR(midr));
475   - seq_printf(m, "variant\t\t: 0x%x\n", MIDR_VARIANT(midr));
476   - seq_printf(m, "partnum\t\t: 0x%03x\n", MIDR_PARTNUM(midr));
477   - seq_printf(m, "revision\t: 0x%x\n\n", MIDR_REVISION(midr));
478 465 }
  466 +
  467 + /* dump out the processor features */
  468 + seq_puts(m, "Features\t: ");
  469 +
  470 + for (i = 0; hwcap_str[i]; i++)
  471 + if (elf_hwcap & (1 << i))
  472 + seq_printf(m, "%s ", hwcap_str[i]);
  473 +
  474 + seq_printf(m, "\nCPU implementer\t: 0x%02x\n", read_cpuid_id() >> 24);
  475 + seq_printf(m, "CPU architecture: AArch64\n");
  476 + seq_printf(m, "CPU variant\t: 0x%x\n", (read_cpuid_id() >> 20) & 15);
  477 + seq_printf(m, "CPU part\t: 0x%03x\n", (read_cpuid_id() >> 4) & 0xfff);
  478 + seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15);
  479 +
  480 + seq_puts(m, "\n");
  481 +
  482 + seq_printf(m, "Hardware\t: %s\n", machine_name);
479 483  
480 484 return 0;
481 485 }