Skip to content

Commit c706c7e

Browse files
committed
Merge branch 'for-linus' of git://ftp.arm.linux.org.uk/~rmk/linux-arm
Pull ARM development updates from Russell King: "Included in this update: - moving PSCI code from ARM64/ARM to drivers/ - removal of some architecture internals from global kernel view - addition of software based "privileged no access" support using the old domains register to turn off the ability for kernel loads/stores to access userspace. Only the proper accessors will be usable. - addition of early fixup support for early console - re-addition (and reimplementation) of OMAP special interconnect barrier - removal of finish_arch_switch() - only expose cpuX/online in sysfs if hotpluggable - a number of code cleanups" * 'for-linus' of git://ftp.arm.linux.org.uk/~rmk/linux-arm: (41 commits) ARM: software-based priviledged-no-access support ARM: entry: provide uaccess assembly macro hooks ARM: entry: get rid of multiple macro definitions ARM: 8421/1: smp: Collapse arch_cpu_idle_dead() into cpu_die() ARM: uaccess: provide uaccess_save_and_enable() and uaccess_restore() ARM: mm: improve do_ldrd_abort macro ARM: entry: ensure that IRQs are enabled when calling syscall_trace_exit() ARM: entry: efficiency cleanups ARM: entry: get rid of asm_trace_hardirqs_on_cond ARM: uaccess: simplify user access assembly ARM: domains: remove DOMAIN_TABLE ARM: domains: keep vectors in separate domain ARM: domains: get rid of manager mode for user domain ARM: domains: move initial domain setting value to asm/domains.h ARM: domains: provide domain_mask() ARM: domains: switch to keeping domain value in register ARM: 8419/1: dma-mapping: harmonize definition of DMA_ERROR_CODE ARM: 8417/1: refactor bitops functions with BIT_MASK() and BIT_WORD() ARM: 8416/1: Feroceon: use of_iomap() to map register base ARM: 8415/1: early fixmap support for earlycon ...
2 parents 79b0691 + 3ff32a0 commit c706c7e

96 files changed

Lines changed: 1457 additions & 1114 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/devicetree/bindings/arm/l2cc.txt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ Optional properties:
6767
disable if zero.
6868
- arm,prefetch-offset : Override prefetch offset value. Valid values are
6969
0-7, 15, 23, and 31.
70+
- arm,shared-override : The default behavior of the pl310 cache controller with
71+
respect to the shareable attribute is to transform "normal memory
72+
non-cacheable transactions" into "cacheable no allocate" (for reads) or
73+
"write through no write allocate" (for writes).
74+
On systems where this may cause DMA buffer corruption, this property must be
75+
specified to indicate that such transforms are precluded.
7076
- prefetch-data : Data prefetch. Value: <0> (forcibly disable), <1>
7177
(forcibly enable), property absent (retain settings set by firmware)
7278
- prefetch-instr : Instruction prefetch. Value: <0> (forcibly disable),

‎Documentation/devicetree/bindings/arm/pmu.txt‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,19 @@ Required properties:
2626

2727
Optional properties:
2828

29-
- interrupt-affinity : Valid only when using SPIs, specifies a list of phandles
30-
to CPU nodes corresponding directly to the affinity of
29+
- interrupt-affinity : When using SPIs, specifies a list of phandles to CPU
30+
nodes corresponding directly to the affinity of
3131
the SPIs listed in the interrupts property.
3232

33-
This property should be present when there is more than
33+
When using a PPI, specifies a list of phandles to CPU
34+
nodes corresponding to the set of CPUs which have
35+
a PMU of this type signalling the PPI listed in the
36+
interrupts property.
37+
38+
This property should be present when there is more than
3439
a single SPI.
3540

41+
3642
- qcom,no-pc-write : Indicates that this PMU doesn't support the 0xc and 0xd
3743
events.
3844

‎MAINTAINERS‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,11 +806,13 @@ F: arch/arm/include/asm/floppy.h
806806
ARM PMU PROFILING AND DEBUGGING
807807
M: Will Deacon <will.deacon@arm.com>
808808
S: Maintained
809-
F: arch/arm/kernel/perf_event*
809+
F: arch/arm/kernel/perf_*
810810
F: arch/arm/oprofile/common.c
811-
F: arch/arm/include/asm/pmu.h
812811
F: arch/arm/kernel/hw_breakpoint.c
813812
F: arch/arm/include/asm/hw_breakpoint.h
813+
F: arch/arm/include/asm/perf_event.h
814+
F: drivers/perf/arm_pmu.c
815+
F: include/linux/perf/arm_pmu.h
814816

815817
ARM PORT
816818
M: Russell King <linux@arm.linux.org.uk>
@@ -8120,6 +8122,15 @@ F: include/linux/power_supply.h
81208122
F: drivers/power/
81218123
X: drivers/power/avs/
81228124

8125+
POWER STATE COORDINATION INTERFACE (PSCI)
8126+
M: Mark Rutland <mark.rutland@arm.com>
8127+
M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
8128+
L: linux-arm-kernel@lists.infradead.org
8129+
S: Maintained
8130+
F: drivers/firmware/psci.c
8131+
F: include/linux/psci.h
8132+
F: include/uapi/linux/psci.h
8133+
81238134
PNP SUPPORT
81248135
M: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
81258136
S: Maintained

‎arch/arm/Kconfig‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ config ARCH_HAS_ILOG2_U64
188188
config ARCH_HAS_BANDGAP
189189
bool
190190

191+
config FIX_EARLYCON_MEM
192+
def_bool y if MMU
193+
191194
config GENERIC_HWEIGHT
192195
bool
193196
default y
@@ -1496,6 +1499,7 @@ config HOTPLUG_CPU
14961499
config ARM_PSCI
14971500
bool "Support for the ARM Power State Coordination Interface (PSCI)"
14981501
depends on CPU_V7
1502+
select ARM_PSCI_FW
14991503
help
15001504
Say Y here if you want Linux to communicate with system firmware
15011505
implementing the PSCI specification for CPU-centric power
@@ -1700,13 +1704,24 @@ config HIGHPTE
17001704
consumed by page tables. Setting this option will allow
17011705
user-space 2nd level page tables to reside in high memory.
17021706

1703-
config HW_PERF_EVENTS
1704-
bool "Enable hardware performance counter support for perf events"
1705-
depends on PERF_EVENTS
1707+
config CPU_SW_DOMAIN_PAN
1708+
bool "Enable use of CPU domains to implement privileged no-access"
1709+
depends on MMU && !ARM_LPAE
17061710
default y
17071711
help
1708-
Enable hardware performance counter support for perf events. If
1709-
disabled, perf events will use software events only.
1712+
Increase kernel security by ensuring that normal kernel accesses
1713+
are unable to access userspace addresses. This can help prevent
1714+
use-after-free bugs becoming an exploitable privilege escalation
1715+
by ensuring that magic values (such as LIST_POISON) will always
1716+
fault when dereferenced.
1717+
1718+
CPUs with low-vector mappings use a best-efforts implementation.
1719+
Their lower 1MB needs to remain accessible for the vectors, but
1720+
the remainder of userspace will become appropriately inaccessible.
1721+
1722+
config HW_PERF_EVENTS
1723+
def_bool y
1724+
depends on ARM_PMU
17101725

17111726
config SYS_SUPPORTS_HUGETLBFS
17121727
def_bool y

‎arch/arm/common/mcpm_platsmp.c‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,10 @@ static int mcpm_cpu_kill(unsigned int cpu)
6565
return !mcpm_wait_for_cpu_powerdown(pcpu, pcluster);
6666
}
6767

68-
static int mcpm_cpu_disable(unsigned int cpu)
68+
static bool mcpm_cpu_can_disable(unsigned int cpu)
6969
{
70-
/*
71-
* We assume all CPUs may be shut down.
72-
* This would be the hook to use for eventual Secure
73-
* OS migration requests as described in the PSCI spec.
74-
*/
75-
return 0;
70+
/* We assume all CPUs may be shut down. */
71+
return true;
7672
}
7773

7874
static void mcpm_cpu_die(unsigned int cpu)
@@ -92,7 +88,7 @@ static struct smp_operations __initdata mcpm_smp_ops = {
9288
.smp_secondary_init = mcpm_secondary_init,
9389
#ifdef CONFIG_HOTPLUG_CPU
9490
.cpu_kill = mcpm_cpu_kill,
95-
.cpu_disable = mcpm_cpu_disable,
91+
.cpu_can_disable = mcpm_cpu_can_disable,
9692
.cpu_die = mcpm_cpu_die,
9793
#endif
9894
};

‎arch/arm/include/asm/Kbuild‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ generic-y += irq_regs.h
1212
generic-y += kdebug.h
1313
generic-y += local.h
1414
generic-y += local64.h
15-
generic-y += mcs_spinlock.h
1615
generic-y += mm-arch-hooks.h
1716
generic-y += msgbuf.h
1817
generic-y += param.h

‎arch/arm/include/asm/assembler.h‎

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,33 +108,37 @@
108108
.endm
109109
#endif
110110

111-
.macro asm_trace_hardirqs_off
111+
.macro asm_trace_hardirqs_off, save=1
112112
#if defined(CONFIG_TRACE_IRQFLAGS)
113+
.if \save
113114
stmdb sp!, {r0-r3, ip, lr}
115+
.endif
114116
bl trace_hardirqs_off
117+
.if \save
115118
ldmia sp!, {r0-r3, ip, lr}
119+
.endif
116120
#endif
117121
.endm
118122

119-
.macro asm_trace_hardirqs_on_cond, cond
123+
.macro asm_trace_hardirqs_on, cond=al, save=1
120124
#if defined(CONFIG_TRACE_IRQFLAGS)
121125
/*
122126
* actually the registers should be pushed and pop'd conditionally, but
123127
* after bl the flags are certainly clobbered
124128
*/
129+
.if \save
125130
stmdb sp!, {r0-r3, ip, lr}
131+
.endif
126132
bl\cond trace_hardirqs_on
133+
.if \save
127134
ldmia sp!, {r0-r3, ip, lr}
135+
.endif
128136
#endif
129137
.endm
130138

131-
.macro asm_trace_hardirqs_on
132-
asm_trace_hardirqs_on_cond al
133-
.endm
134-
135-
.macro disable_irq
139+
.macro disable_irq, save=1
136140
disable_irq_notrace
137-
asm_trace_hardirqs_off
141+
asm_trace_hardirqs_off \save
138142
.endm
139143

140144
.macro enable_irq
@@ -173,7 +177,7 @@
173177

174178
.macro restore_irqs, oldcpsr
175179
tst \oldcpsr, #PSR_I_BIT
176-
asm_trace_hardirqs_on_cond eq
180+
asm_trace_hardirqs_on cond=eq
177181
restore_irqs_notrace \oldcpsr
178182
.endm
179183

@@ -445,6 +449,53 @@ THUMB( orr \reg , \reg , #PSR_T_BIT )
445449
#endif
446450
.endm
447451

452+
.macro uaccess_disable, tmp, isb=1
453+
#ifdef CONFIG_CPU_SW_DOMAIN_PAN
454+
/*
455+
* Whenever we re-enter userspace, the domains should always be
456+
* set appropriately.
457+
*/
458+
mov \tmp, #DACR_UACCESS_DISABLE
459+
mcr p15, 0, \tmp, c3, c0, 0 @ Set domain register
460+
.if \isb
461+
instr_sync
462+
.endif
463+
#endif
464+
.endm
465+
466+
.macro uaccess_enable, tmp, isb=1
467+
#ifdef CONFIG_CPU_SW_DOMAIN_PAN
468+
/*
469+
* Whenever we re-enter userspace, the domains should always be
470+
* set appropriately.
471+
*/
472+
mov \tmp, #DACR_UACCESS_ENABLE
473+
mcr p15, 0, \tmp, c3, c0, 0
474+
.if \isb
475+
instr_sync
476+
.endif
477+
#endif
478+
.endm
479+
480+
.macro uaccess_save, tmp
481+
#ifdef CONFIG_CPU_SW_DOMAIN_PAN
482+
mrc p15, 0, \tmp, c3, c0, 0
483+
str \tmp, [sp, #S_FRAME_SIZE]
484+
#endif
485+
.endm
486+
487+
.macro uaccess_restore
488+
#ifdef CONFIG_CPU_SW_DOMAIN_PAN
489+
ldr r0, [sp, #S_FRAME_SIZE]
490+
mcr p15, 0, r0, c3, c0, 0
491+
#endif
492+
.endm
493+
494+
.macro uaccess_save_and_disable, tmp
495+
uaccess_save \tmp
496+
uaccess_disable \tmp
497+
.endm
498+
448499
.irp c,,eq,ne,cs,cc,mi,pl,vs,vc,hi,ls,ge,lt,gt,le,hs,lo
449500
.macro ret\c, reg
450501
#if __LINUX_ARM_ARCH__ < 6

‎arch/arm/include/asm/barrier.h‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define __ASM_BARRIER_H
33

44
#ifndef __ASSEMBLY__
5-
#include <asm/outercache.h>
65

76
#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
87

@@ -37,12 +36,20 @@
3736
#define dmb(x) __asm__ __volatile__ ("" : : : "memory")
3837
#endif
3938

39+
#ifdef CONFIG_ARM_HEAVY_MB
40+
extern void (*soc_mb)(void);
41+
extern void arm_heavy_mb(void);
42+
#define __arm_heavy_mb(x...) do { dsb(x); arm_heavy_mb(); } while (0)
43+
#else
44+
#define __arm_heavy_mb(x...) dsb(x)
45+
#endif
46+
4047
#ifdef CONFIG_ARCH_HAS_BARRIERS
4148
#include <mach/barriers.h>
4249
#elif defined(CONFIG_ARM_DMA_MEM_BUFFERABLE) || defined(CONFIG_SMP)
43-
#define mb() do { dsb(); outer_sync(); } while (0)
50+
#define mb() __arm_heavy_mb()
4451
#define rmb() dsb()
45-
#define wmb() do { dsb(st); outer_sync(); } while (0)
52+
#define wmb() __arm_heavy_mb(st)
4653
#define dma_rmb() dmb(osh)
4754
#define dma_wmb() dmb(oshst)
4855
#else

‎arch/arm/include/asm/bitops.h‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
static inline void ____atomic_set_bit(unsigned int bit, volatile unsigned long *p)
3636
{
3737
unsigned long flags;
38-
unsigned long mask = 1UL << (bit & 31);
38+
unsigned long mask = BIT_MASK(bit);
3939

40-
p += bit >> 5;
40+
p += BIT_WORD(bit);
4141

4242
raw_local_irq_save(flags);
4343
*p |= mask;
@@ -47,9 +47,9 @@ static inline void ____atomic_set_bit(unsigned int bit, volatile unsigned long *
4747
static inline void ____atomic_clear_bit(unsigned int bit, volatile unsigned long *p)
4848
{
4949
unsigned long flags;
50-
unsigned long mask = 1UL << (bit & 31);
50+
unsigned long mask = BIT_MASK(bit);
5151

52-
p += bit >> 5;
52+
p += BIT_WORD(bit);
5353

5454
raw_local_irq_save(flags);
5555
*p &= ~mask;
@@ -59,9 +59,9 @@ static inline void ____atomic_clear_bit(unsigned int bit, volatile unsigned long
5959
static inline void ____atomic_change_bit(unsigned int bit, volatile unsigned long *p)
6060
{
6161
unsigned long flags;
62-
unsigned long mask = 1UL << (bit & 31);
62+
unsigned long mask = BIT_MASK(bit);
6363

64-
p += bit >> 5;
64+
p += BIT_WORD(bit);
6565

6666
raw_local_irq_save(flags);
6767
*p ^= mask;
@@ -73,9 +73,9 @@ ____atomic_test_and_set_bit(unsigned int bit, volatile unsigned long *p)
7373
{
7474
unsigned long flags;
7575
unsigned int res;
76-
unsigned long mask = 1UL << (bit & 31);
76+
unsigned long mask = BIT_MASK(bit);
7777

78-
p += bit >> 5;
78+
p += BIT_WORD(bit);
7979

8080
raw_local_irq_save(flags);
8181
res = *p;
@@ -90,9 +90,9 @@ ____atomic_test_and_clear_bit(unsigned int bit, volatile unsigned long *p)
9090
{
9191
unsigned long flags;
9292
unsigned int res;
93-
unsigned long mask = 1UL << (bit & 31);
93+
unsigned long mask = BIT_MASK(bit);
9494

95-
p += bit >> 5;
95+
p += BIT_WORD(bit);
9696

9797
raw_local_irq_save(flags);
9898
res = *p;
@@ -107,9 +107,9 @@ ____atomic_test_and_change_bit(unsigned int bit, volatile unsigned long *p)
107107
{
108108
unsigned long flags;
109109
unsigned int res;
110-
unsigned long mask = 1UL << (bit & 31);
110+
unsigned long mask = BIT_MASK(bit);
111111

112-
p += bit >> 5;
112+
p += BIT_WORD(bit);
113113

114114
raw_local_irq_save(flags);
115115
res = *p;

0 commit comments

Comments
 (0)