Skip to content

Commit 65738c6

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Catalin Marinas: "arm64 and perf fixes: - build error when accessing MPIDR_HWID_BITMASK from .S - fix CTR_EL0 field definitions - remove/disable some kernel messages on user faults (unhandled signals, unimplemented syscalls) - fix kernel page fault in unwind_frame() with function graph tracing - fix perf sleeping while atomic errors when booting with ACPI" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: fix unwind_frame() for filtered out fn for function graph tracing arm64: Enforce BBM for huge IO/VMAP mappings arm64: perf: correct PMUVer probing arm_pmu: acpi: request IRQs up-front arm_pmu: note IRQs and PMUs per-cpu arm_pmu: explicitly enable/disable SPIs at hotplug arm_pmu: acpi: check for mismatched PPIs arm_pmu: add armpmu_alloc_atomic() arm_pmu: fold platform helpers into platform code arm_pmu: kill arm_pmu_platdata ARM: ux500: remove PMU IRQ bouncer arm64: __show_regs: Only resolve kernel symbols when running at EL1 arm64: Remove unimplemented syscall log message arm64: Disable unhandled signal log messages by default arm64: cpufeature: Fix CTR_EL0 field definitions arm64: uaccess: Formalise types for access_ok() arm64: Fix compilation error while accessing MPIDR_HWID_BITMASK from .S files
2 parents 2bd06ce + 9f41631 commit 65738c6

File tree

17 files changed

+183
-184
lines changed

17 files changed

+183
-184
lines changed

arch/arm/mach-ux500/cpu-db8500.c

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <linux/of.h>
2424
#include <linux/of_address.h>
2525
#include <linux/of_platform.h>
26-
#include <linux/perf/arm_pmu.h>
2726
#include <linux/regulator/machine.h>
2827

2928
#include <asm/outercache.h>
@@ -112,37 +111,6 @@ static void ux500_restart(enum reboot_mode mode, const char *cmd)
112111
prcmu_system_reset(0);
113112
}
114113

115-
/*
116-
* The PMU IRQ lines of two cores are wired together into a single interrupt.
117-
* Bounce the interrupt to the other core if it's not ours.
118-
*/
119-
static irqreturn_t db8500_pmu_handler(int irq, void *dev, irq_handler_t handler)
120-
{
121-
irqreturn_t ret = handler(irq, dev);
122-
int other = !smp_processor_id();
123-
124-
if (ret == IRQ_NONE && cpu_online(other))
125-
irq_set_affinity(irq, cpumask_of(other));
126-
127-
/*
128-
* We should be able to get away with the amount of IRQ_NONEs we give,
129-
* while still having the spurious IRQ detection code kick in if the
130-
* interrupt really starts hitting spuriously.
131-
*/
132-
return ret;
133-
}
134-
135-
static struct arm_pmu_platdata db8500_pmu_platdata = {
136-
.handle_irq = db8500_pmu_handler,
137-
.irq_flags = IRQF_NOBALANCING | IRQF_NO_THREAD,
138-
};
139-
140-
static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
141-
/* Requires call-back bindings. */
142-
OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata),
143-
{},
144-
};
145-
146114
static struct of_dev_auxdata u8540_auxdata_lookup[] __initdata = {
147115
OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu", NULL),
148116
{},
@@ -165,9 +133,6 @@ static void __init u8500_init_machine(void)
165133
if (of_machine_is_compatible("st-ericsson,u8540"))
166134
of_platform_populate(NULL, u8500_local_bus_nodes,
167135
u8540_auxdata_lookup, NULL);
168-
else
169-
of_platform_populate(NULL, u8500_local_bus_nodes,
170-
u8500_auxdata_lookup, NULL);
171136
}
172137

173138
static const char * stericsson_dt_platform_compat[] = {

arch/arm64/include/asm/cputype.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#define MPIDR_UP_BITMASK (0x1 << 30)
2222
#define MPIDR_MT_BITMASK (0x1 << 24)
23-
#define MPIDR_HWID_BITMASK 0xff00ffffffUL
23+
#define MPIDR_HWID_BITMASK UL(0xff00ffffff)
2424

2525
#define MPIDR_LEVEL_BITS_SHIFT 3
2626
#define MPIDR_LEVEL_BITS (1 << MPIDR_LEVEL_BITS_SHIFT)

arch/arm64/include/asm/stacktrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct stackframe {
2828
unsigned long fp;
2929
unsigned long pc;
3030
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
31-
unsigned int graph;
31+
int graph;
3232
#endif
3333
};
3434

arch/arm64/include/asm/uaccess.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ static inline void set_fs(mm_segment_t fs)
7272
* This is equivalent to the following test:
7373
* (u65)addr + (u65)size <= (u65)current->addr_limit + 1
7474
*/
75-
static inline unsigned long __range_ok(unsigned long addr, unsigned long size)
75+
static inline unsigned long __range_ok(const void __user *addr, unsigned long size)
7676
{
77-
unsigned long limit = current_thread_info()->addr_limit;
77+
unsigned long ret, limit = current_thread_info()->addr_limit;
7878

7979
__chk_user_ptr(addr);
8080
asm volatile(
8181
// A + B <= C + 1 for all A,B,C, in four easy steps:
8282
// 1: X = A + B; X' = X % 2^64
83-
" adds %0, %0, %2\n"
83+
" adds %0, %3, %2\n"
8484
// 2: Set C = 0 if X > 2^64, to guarantee X' > C in step 4
8585
" csel %1, xzr, %1, hi\n"
8686
// 3: Set X' = ~0 if X >= 2^64. For X == 2^64, this decrements X'
@@ -92,9 +92,9 @@ static inline unsigned long __range_ok(unsigned long addr, unsigned long size)
9292
// testing X' - C == 0, subject to the previous adjustments.
9393
" sbcs xzr, %0, %1\n"
9494
" cset %0, ls\n"
95-
: "+r" (addr), "+r" (limit) : "Ir" (size) : "cc");
95+
: "=&r" (ret), "+r" (limit) : "Ir" (size), "0" (addr) : "cc");
9696

97-
return addr;
97+
return ret;
9898
}
9999

100100
/*
@@ -104,7 +104,7 @@ static inline unsigned long __range_ok(unsigned long addr, unsigned long size)
104104
*/
105105
#define untagged_addr(addr) sign_extend64(addr, 55)
106106

107-
#define access_ok(type, addr, size) __range_ok((unsigned long)(addr), size)
107+
#define access_ok(type, addr, size) __range_ok(addr, size)
108108
#define user_addr_max get_fs
109109

110110
#define _ASM_EXTABLE(from, to) \

arch/arm64/kernel/armv8_deprecated.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ static unsigned int __kprobes aarch32_check_condition(u32 opcode, u32 psr)
370370
static int swp_handler(struct pt_regs *regs, u32 instr)
371371
{
372372
u32 destreg, data, type, address = 0;
373+
const void __user *user_ptr;
373374
int rn, rt2, res = 0;
374375

375376
perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, regs->pc);
@@ -401,7 +402,8 @@ static int swp_handler(struct pt_regs *regs, u32 instr)
401402
aarch32_insn_extract_reg_num(instr, A32_RT2_OFFSET), data);
402403

403404
/* Check access in reasonable access range for both SWP and SWPB */
404-
if (!access_ok(VERIFY_WRITE, (address & ~3), 4)) {
405+
user_ptr = (const void __user *)(unsigned long)(address & ~3);
406+
if (!access_ok(VERIFY_WRITE, user_ptr, 4)) {
405407
pr_debug("SWP{B} emulation: access to 0x%08x not allowed!\n",
406408
address);
407409
goto fault;

arch/arm64/kernel/cpufeature.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,11 @@ static const struct arm64_ftr_bits ftr_id_aa64mmfr2[] = {
199199
};
200200

201201
static const struct arm64_ftr_bits ftr_ctr[] = {
202-
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_EXACT, 31, 1, 1), /* RAO */
202+
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_EXACT, 31, 1, 1), /* RES1 */
203+
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, 29, 1, 1), /* DIC */
204+
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, 28, 1, 1), /* IDC */
203205
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_HIGHER_SAFE, 24, 4, 0), /* CWG */
204-
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, 20, 4, 0), /* ERG */
206+
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_HIGHER_SAFE, 20, 4, 0), /* ERG */
205207
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, 16, 4, 1), /* DminLine */
206208
/*
207209
* Linux can handle differing I-cache policies. Userspace JITs will

arch/arm64/kernel/perf_event.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,9 +908,9 @@ static void __armv8pmu_probe_pmu(void *info)
908908
int pmuver;
909909

910910
dfr0 = read_sysreg(id_aa64dfr0_el1);
911-
pmuver = cpuid_feature_extract_signed_field(dfr0,
911+
pmuver = cpuid_feature_extract_unsigned_field(dfr0,
912912
ID_AA64DFR0_PMUVER_SHIFT);
913-
if (pmuver < 1)
913+
if (pmuver == 0xf || pmuver == 0)
914914
return;
915915

916916
probe->present = true;

arch/arm64/kernel/process.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,15 @@ void __show_regs(struct pt_regs *regs)
220220

221221
show_regs_print_info(KERN_DEFAULT);
222222
print_pstate(regs);
223-
printk("pc : %pS\n", (void *)regs->pc);
224-
printk("lr : %pS\n", (void *)lr);
223+
224+
if (!user_mode(regs)) {
225+
printk("pc : %pS\n", (void *)regs->pc);
226+
printk("lr : %pS\n", (void *)lr);
227+
} else {
228+
printk("pc : %016llx\n", regs->pc);
229+
printk("lr : %016llx\n", lr);
230+
}
231+
225232
printk("sp : %016llx\n", sp);
226233

227234
i = top_reg;

arch/arm64/kernel/stacktrace.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame)
5959
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
6060
if (tsk->ret_stack &&
6161
(frame->pc == (unsigned long)return_to_handler)) {
62+
if (WARN_ON_ONCE(frame->graph == -1))
63+
return -EINVAL;
64+
if (frame->graph < -1)
65+
frame->graph += FTRACE_NOTRACE_DEPTH;
66+
6267
/*
6368
* This is a case where function graph tracer has
6469
* modified a return address (LR) in a stack frame

arch/arm64/kernel/sys_compat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ do_compat_cache_op(unsigned long start, unsigned long end, int flags)
5757
if (end < start || flags)
5858
return -EINVAL;
5959

60-
if (!access_ok(VERIFY_READ, start, end - start))
60+
if (!access_ok(VERIFY_READ, (const void __user *)start, end - start))
6161
return -EFAULT;
6262

6363
return __do_compat_cache_op(start, end);

arch/arm64/kernel/time.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ unsigned long profile_pc(struct pt_regs *regs)
5252
frame.fp = regs->regs[29];
5353
frame.pc = regs->pc;
5454
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
55-
frame.graph = -1; /* no task info */
55+
frame.graph = current->curr_ret_stack;
5656
#endif
5757
do {
5858
int ret = unwind_frame(NULL, &frame);

arch/arm64/kernel/traps.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static const char *handler[]= {
5757
"Error"
5858
};
5959

60-
int show_unhandled_signals = 1;
60+
int show_unhandled_signals = 0;
6161

6262
static void dump_backtrace_entry(unsigned long where)
6363
{
@@ -526,14 +526,6 @@ asmlinkage long do_ni_syscall(struct pt_regs *regs)
526526
}
527527
#endif
528528

529-
if (show_unhandled_signals_ratelimited()) {
530-
pr_info("%s[%d]: syscall %d\n", current->comm,
531-
task_pid_nr(current), regs->syscallno);
532-
dump_instr("", regs);
533-
if (user_mode(regs))
534-
__show_regs(regs);
535-
}
536-
537529
return sys_ni_syscall();
538530
}
539531

arch/arm64/mm/mmu.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,11 @@ int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot)
933933
{
934934
pgprot_t sect_prot = __pgprot(PUD_TYPE_SECT |
935935
pgprot_val(mk_sect_prot(prot)));
936+
937+
/* ioremap_page_range doesn't honour BBM */
938+
if (pud_present(READ_ONCE(*pudp)))
939+
return 0;
940+
936941
BUG_ON(phys & ~PUD_MASK);
937942
set_pud(pudp, pfn_pud(__phys_to_pfn(phys), sect_prot));
938943
return 1;
@@ -942,6 +947,11 @@ int pmd_set_huge(pmd_t *pmdp, phys_addr_t phys, pgprot_t prot)
942947
{
943948
pgprot_t sect_prot = __pgprot(PMD_TYPE_SECT |
944949
pgprot_val(mk_sect_prot(prot)));
950+
951+
/* ioremap_page_range doesn't honour BBM */
952+
if (pmd_present(READ_ONCE(*pmdp)))
953+
return 0;
954+
945955
BUG_ON(phys & ~PMD_MASK);
946956
set_pmd(pmdp, pfn_pmd(__phys_to_pfn(phys), sect_prot));
947957
return 1;

0 commit comments

Comments
 (0)