Commit 955837d8 authored by Linus Torvalds's avatar 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
parents f16c15a0 5e39977e
...@@ -150,7 +150,6 @@ static void sha2_finup(struct shash_desc *desc, const u8 *data, ...@@ -150,7 +150,6 @@ static void sha2_finup(struct shash_desc *desc, const u8 *data,
kernel_neon_begin_partial(28); kernel_neon_begin_partial(28);
sha2_ce_transform(blocks, data, sctx->state, NULL, len); sha2_ce_transform(blocks, data, sctx->state, NULL, len);
kernel_neon_end(); kernel_neon_end();
data += blocks * SHA256_BLOCK_SIZE;
} }
static int sha224_finup(struct shash_desc *desc, const u8 *data, static int sha224_finup(struct shash_desc *desc, const u8 *data,
......
...@@ -79,7 +79,6 @@ static inline void decode_ctrl_reg(u32 reg, ...@@ -79,7 +79,6 @@ static inline void decode_ctrl_reg(u32 reg,
*/ */
#define ARM_MAX_BRP 16 #define ARM_MAX_BRP 16
#define ARM_MAX_WRP 16 #define ARM_MAX_WRP 16
#define ARM_MAX_HBP_SLOTS (ARM_MAX_BRP + ARM_MAX_WRP)
/* Virtual debug register bases. */ /* Virtual debug register bases. */
#define AARCH64_DBG_REG_BVR 0 #define AARCH64_DBG_REG_BVR 0
......
...@@ -139,7 +139,7 @@ extern struct task_struct *cpu_switch_to(struct task_struct *prev, ...@@ -139,7 +139,7 @@ extern struct task_struct *cpu_switch_to(struct task_struct *prev,
((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1) ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
#define KSTK_EIP(tsk) ((unsigned long)task_pt_regs(tsk)->pc) #define KSTK_EIP(tsk) ((unsigned long)task_pt_regs(tsk)->pc)
#define KSTK_ESP(tsk) ((unsigned long)task_pt_regs(tsk)->sp) #define KSTK_ESP(tsk) user_stack_pointer(task_pt_regs(tsk))
/* /*
* Prefetching support * Prefetching support
......
...@@ -137,7 +137,7 @@ struct pt_regs { ...@@ -137,7 +137,7 @@ struct pt_regs {
(!((regs)->pstate & PSR_F_BIT)) (!((regs)->pstate & PSR_F_BIT))
#define user_stack_pointer(regs) \ #define user_stack_pointer(regs) \
(!compat_user_mode(regs)) ? ((regs)->sp) : ((regs)->compat_sp) (!compat_user_mode(regs) ? (regs)->sp : (regs)->compat_sp)
static inline unsigned long regs_return_value(struct pt_regs *regs) static inline unsigned long regs_return_value(struct pt_regs *regs)
{ {
......
...@@ -270,6 +270,7 @@ static int fpsimd_cpu_pm_notifier(struct notifier_block *self, ...@@ -270,6 +270,7 @@ static int fpsimd_cpu_pm_notifier(struct notifier_block *self,
case CPU_PM_ENTER: case CPU_PM_ENTER:
if (current->mm && !test_thread_flag(TIF_FOREIGN_FPSTATE)) if (current->mm && !test_thread_flag(TIF_FOREIGN_FPSTATE))
fpsimd_save_state(&current->thread.fpsimd_state); fpsimd_save_state(&current->thread.fpsimd_state);
this_cpu_write(fpsimd_last_state, NULL);
break; break;
case CPU_PM_EXIT: case CPU_PM_EXIT:
if (current->mm) if (current->mm)
......
...@@ -373,10 +373,6 @@ ENTRY(__boot_cpu_mode) ...@@ -373,10 +373,6 @@ ENTRY(__boot_cpu_mode)
.long 0 .long 0
.popsection .popsection
.align 3
2: .quad .
.quad PAGE_OFFSET
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
.align 3 .align 3
1: .quad . 1: .quad .
......
...@@ -24,6 +24,12 @@ u64 perf_reg_value(struct pt_regs *regs, int idx) ...@@ -24,6 +24,12 @@ u64 perf_reg_value(struct pt_regs *regs, int idx)
return regs->compat_lr; return regs->compat_lr;
} }
if ((u32)idx == PERF_REG_ARM64_SP)
return regs->sp;
if ((u32)idx == PERF_REG_ARM64_PC)
return regs->pc;
return regs->regs[idx]; return regs->regs[idx];
} }
......
...@@ -87,7 +87,8 @@ static void ptrace_hbptriggered(struct perf_event *bp, ...@@ -87,7 +87,8 @@ static void ptrace_hbptriggered(struct perf_event *bp,
break; break;
} }
} }
for (i = ARM_MAX_BRP; i < ARM_MAX_HBP_SLOTS && !bp; ++i) {
for (i = 0; i < ARM_MAX_WRP; ++i) {
if (current->thread.debug.hbp_watch[i] == bp) { if (current->thread.debug.hbp_watch[i] == bp) {
info.si_errno = -((i << 1) + 1); info.si_errno = -((i << 1) + 1);
break; break;
...@@ -662,8 +663,10 @@ static int compat_gpr_get(struct task_struct *target, ...@@ -662,8 +663,10 @@ static int compat_gpr_get(struct task_struct *target,
kbuf += sizeof(reg); kbuf += sizeof(reg);
} else { } else {
ret = copy_to_user(ubuf, &reg, sizeof(reg)); ret = copy_to_user(ubuf, &reg, sizeof(reg));
if (ret) if (ret) {
ret = -EFAULT;
break; break;
}
ubuf += sizeof(reg); ubuf += sizeof(reg);
} }
...@@ -701,8 +704,10 @@ static int compat_gpr_set(struct task_struct *target, ...@@ -701,8 +704,10 @@ static int compat_gpr_set(struct task_struct *target,
kbuf += sizeof(reg); kbuf += sizeof(reg);
} else { } else {
ret = copy_from_user(&reg, ubuf, sizeof(reg)); ret = copy_from_user(&reg, ubuf, sizeof(reg));
if (ret) if (ret) {
return ret; ret = -EFAULT;
break;
}
ubuf += sizeof(reg); ubuf += sizeof(reg);
} }
......
...@@ -78,6 +78,7 @@ unsigned int compat_elf_hwcap2 __read_mostly; ...@@ -78,6 +78,7 @@ unsigned int compat_elf_hwcap2 __read_mostly;
#endif #endif
static const char *cpu_name; static const char *cpu_name;
static const char *machine_name;
phys_addr_t __fdt_pointer __initdata; phys_addr_t __fdt_pointer __initdata;
/* /*
...@@ -309,6 +310,8 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys) ...@@ -309,6 +310,8 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys)
while (true) while (true)
cpu_relax(); cpu_relax();
} }
machine_name = of_flat_dt_get_machine_name();
} }
/* /*
...@@ -447,21 +450,10 @@ static int c_show(struct seq_file *m, void *v) ...@@ -447,21 +450,10 @@ static int c_show(struct seq_file *m, void *v)
{ {
int i; int i;
/* seq_printf(m, "Processor\t: %s rev %d (%s)\n",
* Dump out the common processor features in a single line. Userspace cpu_name, read_cpuid_id() & 15, ELF_PLATFORM);
* should read the hwcaps with getauxval(AT_HWCAP) rather than
* attempting to parse this.
*/
seq_puts(m, "features\t:");
for (i = 0; hwcap_str[i]; i++)
if (elf_hwcap & (1 << i))
seq_printf(m, " %s", hwcap_str[i]);
seq_puts(m, "\n\n");
for_each_online_cpu(i) { for_each_online_cpu(i) {
struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i);
u32 midr = cpuinfo->reg_midr;
/* /*
* glibc reads /proc/cpuinfo to determine the number of * glibc reads /proc/cpuinfo to determine the number of
* online processors, looking for lines beginning with * online processors, looking for lines beginning with
...@@ -470,13 +462,25 @@ static int c_show(struct seq_file *m, void *v) ...@@ -470,13 +462,25 @@ static int c_show(struct seq_file *m, void *v)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
seq_printf(m, "processor\t: %d\n", i); seq_printf(m, "processor\t: %d\n", i);
#endif #endif
seq_printf(m, "implementer\t: 0x%02x\n",
MIDR_IMPLEMENTOR(midr));
seq_printf(m, "variant\t\t: 0x%x\n", MIDR_VARIANT(midr));
seq_printf(m, "partnum\t\t: 0x%03x\n", MIDR_PARTNUM(midr));
seq_printf(m, "revision\t: 0x%x\n\n", MIDR_REVISION(midr));
} }
/* dump out the processor features */
seq_puts(m, "Features\t: ");
for (i = 0; hwcap_str[i]; i++)
if (elf_hwcap & (1 << i))
seq_printf(m, "%s ", hwcap_str[i]);
seq_printf(m, "\nCPU implementer\t: 0x%02x\n", read_cpuid_id() >> 24);
seq_printf(m, "CPU architecture: AArch64\n");
seq_printf(m, "CPU variant\t: 0x%x\n", (read_cpuid_id() >> 20) & 15);
seq_printf(m, "CPU part\t: 0x%03x\n", (read_cpuid_id() >> 4) & 0xfff);
seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15);
seq_puts(m, "\n");
seq_printf(m, "Hardware\t: %s\n", machine_name);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment