Skip to content

Commit 1202f4f

Browse files
committed
Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 updates from Will Deacon: "A bunch of good stuff in here. Worth noting is that we've pulled in the x86/mm branch from -tip so that we can make use of the core ioremap changes which allow us to put down huge mappings in the vmalloc area without screwing up the TLB. Much of the positive diffstat is because of the rseq selftest for arm64. Summary: - Wire up support for qspinlock, replacing our trusty ticket lock code - Add an IPI to flush_icache_range() to ensure that stale instructions fetched into the pipeline are discarded along with the I-cache lines - Support for the GCC "stackleak" plugin - Support for restartable sequences, plus an arm64 port for the selftest - Kexec/kdump support on systems booting with ACPI - Rewrite of our syscall entry code in C, which allows us to zero the GPRs on entry from userspace - Support for chained PMU counters, allowing 64-bit event counters to be constructed on current CPUs - Ensure scheduler topology information is kept up-to-date with CPU hotplug events - Re-enable support for huge vmalloc/IO mappings now that the core code has the correct hooks to use break-before-make sequences - Miscellaneous, non-critical fixes and cleanups" * tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (90 commits) arm64: alternative: Use true and false for boolean values arm64: kexec: Add comment to explain use of __flush_icache_range() arm64: sdei: Mark sdei stack helper functions as static arm64, kaslr: export offset in VMCOREINFO ELF notes arm64: perf: Add cap_user_time aarch64 efi/libstub: Only disable stackleak plugin for arm64 arm64: drop unused kernel_neon_begin_partial() macro arm64: kexec: machine_kexec should call __flush_icache_range arm64: svc: Ensure hardirq tracing is updated before return arm64: mm: Export __sync_icache_dcache() for xen-privcmd drivers/perf: arm-ccn: Use devm_ioremap_resource() to map memory arm64: Add support for STACKLEAK gcc plugin arm64: Add stack information to on_accessible_stack drivers/perf: hisi: update the sccl_id/ccl_id when MT is supported arm64: fix ACPI dependencies rseq/selftests: Add support for arm64 arm64: acpi: fix alignment fault in accessing ACPI efi/arm: map UEFI memory map even w/o runtime services enabled efi/arm: preserve early mapping of UEFI memory map longer for BGRT drivers: acpi: add dependency of EFI for arm64 ...
2 parents d0055f3 + 3c4d913 commit 1202f4f

91 files changed

Lines changed: 2154 additions & 1001 deletions

Some content is hidden

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

‎MAINTAINERS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,6 +2270,7 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
22702270
T: git git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git
22712271
S: Maintained
22722272
F: arch/arm64/
2273+
X: arch/arm64/boot/dts/
22732274
F: Documentation/arm64/
22742275

22752276
AS3645A LED FLASH CONTROLLER DRIVER

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
#include <asm/cputype.h>
2727

2828
/* arm64 compatibility macros */
29-
#define COMPAT_PSR_MODE_ABT ABT_MODE
30-
#define COMPAT_PSR_MODE_UND UND_MODE
31-
#define COMPAT_PSR_T_BIT PSR_T_BIT
32-
#define COMPAT_PSR_I_BIT PSR_I_BIT
33-
#define COMPAT_PSR_A_BIT PSR_A_BIT
34-
#define COMPAT_PSR_E_BIT PSR_E_BIT
35-
#define COMPAT_PSR_IT_MASK PSR_IT_MASK
29+
#define PSR_AA32_MODE_ABT ABT_MODE
30+
#define PSR_AA32_MODE_UND UND_MODE
31+
#define PSR_AA32_T_BIT PSR_T_BIT
32+
#define PSR_AA32_I_BIT PSR_I_BIT
33+
#define PSR_AA32_A_BIT PSR_A_BIT
34+
#define PSR_AA32_E_BIT PSR_E_BIT
35+
#define PSR_AA32_IT_MASK PSR_IT_MASK
3636

3737
unsigned long *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num);
3838

‎arch/arm/kernel/perf_event_v6.c‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ armv6_pmcr_counter_has_overflowed(unsigned long pmcr,
233233
return ret;
234234
}
235235

236-
static inline u32 armv6pmu_read_counter(struct perf_event *event)
236+
static inline u64 armv6pmu_read_counter(struct perf_event *event)
237237
{
238238
struct hw_perf_event *hwc = &event->hw;
239239
int counter = hwc->idx;
@@ -251,7 +251,7 @@ static inline u32 armv6pmu_read_counter(struct perf_event *event)
251251
return value;
252252
}
253253

254-
static inline void armv6pmu_write_counter(struct perf_event *event, u32 value)
254+
static inline void armv6pmu_write_counter(struct perf_event *event, u64 value)
255255
{
256256
struct hw_perf_event *hwc = &event->hw;
257257
int counter = hwc->idx;
@@ -411,6 +411,12 @@ armv6pmu_get_event_idx(struct pmu_hw_events *cpuc,
411411
}
412412
}
413413

414+
static void armv6pmu_clear_event_idx(struct pmu_hw_events *cpuc,
415+
struct perf_event *event)
416+
{
417+
clear_bit(event->hw.idx, cpuc->used_mask);
418+
}
419+
414420
static void armv6pmu_disable_event(struct perf_event *event)
415421
{
416422
unsigned long val, mask, evt, flags;
@@ -491,11 +497,11 @@ static void armv6pmu_init(struct arm_pmu *cpu_pmu)
491497
cpu_pmu->read_counter = armv6pmu_read_counter;
492498
cpu_pmu->write_counter = armv6pmu_write_counter;
493499
cpu_pmu->get_event_idx = armv6pmu_get_event_idx;
500+
cpu_pmu->clear_event_idx = armv6pmu_clear_event_idx;
494501
cpu_pmu->start = armv6pmu_start;
495502
cpu_pmu->stop = armv6pmu_stop;
496503
cpu_pmu->map_event = armv6_map_event;
497504
cpu_pmu->num_events = 3;
498-
cpu_pmu->max_period = (1LLU << 32) - 1;
499505
}
500506

501507
static int armv6_1136_pmu_init(struct arm_pmu *cpu_pmu)
@@ -542,11 +548,11 @@ static int armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu)
542548
cpu_pmu->read_counter = armv6pmu_read_counter;
543549
cpu_pmu->write_counter = armv6pmu_write_counter;
544550
cpu_pmu->get_event_idx = armv6pmu_get_event_idx;
551+
cpu_pmu->clear_event_idx = armv6pmu_clear_event_idx;
545552
cpu_pmu->start = armv6pmu_start;
546553
cpu_pmu->stop = armv6pmu_stop;
547554
cpu_pmu->map_event = armv6mpcore_map_event;
548555
cpu_pmu->num_events = 3;
549-
cpu_pmu->max_period = (1LLU << 32) - 1;
550556

551557
return 0;
552558
}

‎arch/arm/kernel/perf_event_v7.c‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ static inline void armv7_pmnc_select_counter(int idx)
743743
isb();
744744
}
745745

746-
static inline u32 armv7pmu_read_counter(struct perf_event *event)
746+
static inline u64 armv7pmu_read_counter(struct perf_event *event)
747747
{
748748
struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
749749
struct hw_perf_event *hwc = &event->hw;
@@ -763,7 +763,7 @@ static inline u32 armv7pmu_read_counter(struct perf_event *event)
763763
return value;
764764
}
765765

766-
static inline void armv7pmu_write_counter(struct perf_event *event, u32 value)
766+
static inline void armv7pmu_write_counter(struct perf_event *event, u64 value)
767767
{
768768
struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
769769
struct hw_perf_event *hwc = &event->hw;
@@ -1058,6 +1058,12 @@ static int armv7pmu_get_event_idx(struct pmu_hw_events *cpuc,
10581058
return -EAGAIN;
10591059
}
10601060

1061+
static void armv7pmu_clear_event_idx(struct pmu_hw_events *cpuc,
1062+
struct perf_event *event)
1063+
{
1064+
clear_bit(event->hw.idx, cpuc->used_mask);
1065+
}
1066+
10611067
/*
10621068
* Add an event filter to a given event. This will only work for PMUv2 PMUs.
10631069
*/
@@ -1167,10 +1173,10 @@ static void armv7pmu_init(struct arm_pmu *cpu_pmu)
11671173
cpu_pmu->read_counter = armv7pmu_read_counter;
11681174
cpu_pmu->write_counter = armv7pmu_write_counter;
11691175
cpu_pmu->get_event_idx = armv7pmu_get_event_idx;
1176+
cpu_pmu->clear_event_idx = armv7pmu_clear_event_idx;
11701177
cpu_pmu->start = armv7pmu_start;
11711178
cpu_pmu->stop = armv7pmu_stop;
11721179
cpu_pmu->reset = armv7pmu_reset;
1173-
cpu_pmu->max_period = (1LLU << 32) - 1;
11741180
};
11751181

11761182
static void armv7_read_num_pmnc_events(void *info)
@@ -1638,6 +1644,7 @@ static void krait_pmu_clear_event_idx(struct pmu_hw_events *cpuc,
16381644
bool venum_event = EVENT_VENUM(hwc->config_base);
16391645
bool krait_event = EVENT_CPU(hwc->config_base);
16401646

1647+
armv7pmu_clear_event_idx(cpuc, event);
16411648
if (venum_event || krait_event) {
16421649
bit = krait_event_to_bit(event, region, group);
16431650
clear_bit(bit, cpuc->used_mask);
@@ -1967,6 +1974,7 @@ static void scorpion_pmu_clear_event_idx(struct pmu_hw_events *cpuc,
19671974
bool venum_event = EVENT_VENUM(hwc->config_base);
19681975
bool scorpion_event = EVENT_CPU(hwc->config_base);
19691976

1977+
armv7pmu_clear_event_idx(cpuc, event);
19701978
if (venum_event || scorpion_event) {
19711979
bit = scorpion_event_to_bit(event, region, group);
19721980
clear_bit(bit, cpuc->used_mask);
@@ -2030,6 +2038,7 @@ static struct platform_driver armv7_pmu_driver = {
20302038
.driver = {
20312039
.name = "armv7-pmu",
20322040
.of_match_table = armv7_pmu_of_device_ids,
2041+
.suppress_bind_attrs = true,
20332042
},
20342043
.probe = armv7_pmu_device_probe,
20352044
};

‎arch/arm/kernel/perf_event_xscale.c‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,12 @@ xscale1pmu_get_event_idx(struct pmu_hw_events *cpuc,
292292
}
293293
}
294294

295+
static void xscalepmu_clear_event_idx(struct pmu_hw_events *cpuc,
296+
struct perf_event *event)
297+
{
298+
clear_bit(event->hw.idx, cpuc->used_mask);
299+
}
300+
295301
static void xscale1pmu_start(struct arm_pmu *cpu_pmu)
296302
{
297303
unsigned long flags, val;
@@ -316,7 +322,7 @@ static void xscale1pmu_stop(struct arm_pmu *cpu_pmu)
316322
raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
317323
}
318324

319-
static inline u32 xscale1pmu_read_counter(struct perf_event *event)
325+
static inline u64 xscale1pmu_read_counter(struct perf_event *event)
320326
{
321327
struct hw_perf_event *hwc = &event->hw;
322328
int counter = hwc->idx;
@@ -337,7 +343,7 @@ static inline u32 xscale1pmu_read_counter(struct perf_event *event)
337343
return val;
338344
}
339345

340-
static inline void xscale1pmu_write_counter(struct perf_event *event, u32 val)
346+
static inline void xscale1pmu_write_counter(struct perf_event *event, u64 val)
341347
{
342348
struct hw_perf_event *hwc = &event->hw;
343349
int counter = hwc->idx;
@@ -370,11 +376,11 @@ static int xscale1pmu_init(struct arm_pmu *cpu_pmu)
370376
cpu_pmu->read_counter = xscale1pmu_read_counter;
371377
cpu_pmu->write_counter = xscale1pmu_write_counter;
372378
cpu_pmu->get_event_idx = xscale1pmu_get_event_idx;
379+
cpu_pmu->clear_event_idx = xscalepmu_clear_event_idx;
373380
cpu_pmu->start = xscale1pmu_start;
374381
cpu_pmu->stop = xscale1pmu_stop;
375382
cpu_pmu->map_event = xscale_map_event;
376383
cpu_pmu->num_events = 3;
377-
cpu_pmu->max_period = (1LLU << 32) - 1;
378384

379385
return 0;
380386
}
@@ -679,7 +685,7 @@ static void xscale2pmu_stop(struct arm_pmu *cpu_pmu)
679685
raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
680686
}
681687

682-
static inline u32 xscale2pmu_read_counter(struct perf_event *event)
688+
static inline u64 xscale2pmu_read_counter(struct perf_event *event)
683689
{
684690
struct hw_perf_event *hwc = &event->hw;
685691
int counter = hwc->idx;
@@ -706,7 +712,7 @@ static inline u32 xscale2pmu_read_counter(struct perf_event *event)
706712
return val;
707713
}
708714

709-
static inline void xscale2pmu_write_counter(struct perf_event *event, u32 val)
715+
static inline void xscale2pmu_write_counter(struct perf_event *event, u64 val)
710716
{
711717
struct hw_perf_event *hwc = &event->hw;
712718
int counter = hwc->idx;
@@ -739,11 +745,11 @@ static int xscale2pmu_init(struct arm_pmu *cpu_pmu)
739745
cpu_pmu->read_counter = xscale2pmu_read_counter;
740746
cpu_pmu->write_counter = xscale2pmu_write_counter;
741747
cpu_pmu->get_event_idx = xscale2pmu_get_event_idx;
748+
cpu_pmu->clear_event_idx = xscalepmu_clear_event_idx;
742749
cpu_pmu->start = xscale2pmu_start;
743750
cpu_pmu->stop = xscale2pmu_stop;
744751
cpu_pmu->map_event = xscale_map_event;
745752
cpu_pmu->num_events = 5;
746-
cpu_pmu->max_period = (1LLU << 32) - 1;
747753

748754
return 0;
749755
}

‎arch/arm64/Kconfig‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ config ARM64
2424
select ARCH_HAS_SG_CHAIN
2525
select ARCH_HAS_STRICT_KERNEL_RWX
2626
select ARCH_HAS_STRICT_MODULE_RWX
27+
select ARCH_HAS_SYSCALL_WRAPPER
2728
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
2829
select ARCH_HAVE_NMI_SAFE_CMPXCHG
2930
select ARCH_INLINE_READ_LOCK if !PREEMPT
@@ -42,8 +43,19 @@ config ARM64
4243
select ARCH_INLINE_WRITE_UNLOCK_BH if !PREEMPT
4344
select ARCH_INLINE_WRITE_UNLOCK_IRQ if !PREEMPT
4445
select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE if !PREEMPT
46+
select ARCH_INLINE_SPIN_TRYLOCK if !PREEMPT
47+
select ARCH_INLINE_SPIN_TRYLOCK_BH if !PREEMPT
48+
select ARCH_INLINE_SPIN_LOCK if !PREEMPT
49+
select ARCH_INLINE_SPIN_LOCK_BH if !PREEMPT
50+
select ARCH_INLINE_SPIN_LOCK_IRQ if !PREEMPT
51+
select ARCH_INLINE_SPIN_LOCK_IRQSAVE if !PREEMPT
52+
select ARCH_INLINE_SPIN_UNLOCK if !PREEMPT
53+
select ARCH_INLINE_SPIN_UNLOCK_BH if !PREEMPT
54+
select ARCH_INLINE_SPIN_UNLOCK_IRQ if !PREEMPT
55+
select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE if !PREEMPT
4556
select ARCH_USE_CMPXCHG_LOCKREF
4657
select ARCH_USE_QUEUED_RWLOCKS
58+
select ARCH_USE_QUEUED_SPINLOCKS
4759
select ARCH_SUPPORTS_MEMORY_FAILURE
4860
select ARCH_SUPPORTS_ATOMIC_RMW
4961
select ARCH_SUPPORTS_INT128 if GCC_VERSION >= 50000 || CC_IS_CLANG
@@ -97,6 +109,7 @@ config ARM64
97109
select HAVE_ARCH_MMAP_RND_BITS
98110
select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
99111
select HAVE_ARCH_SECCOMP_FILTER
112+
select HAVE_ARCH_STACKLEAK
100113
select HAVE_ARCH_THREAD_STRUCT_WHITELIST
101114
select HAVE_ARCH_TRACEHOOK
102115
select HAVE_ARCH_TRANSPARENT_HUGEPAGE
@@ -128,6 +141,7 @@ config ARM64
128141
select HAVE_PERF_USER_STACK_DUMP
129142
select HAVE_REGS_AND_STACK_ACCESS_API
130143
select HAVE_RCU_TABLE_FREE
144+
select HAVE_RSEQ
131145
select HAVE_STACKPROTECTOR
132146
select HAVE_SYSCALL_TRACEPOINTS
133147
select HAVE_KPROBES
@@ -773,6 +787,9 @@ config ARCH_SPARSEMEM_DEFAULT
773787
config ARCH_SELECT_MEMORY_MODEL
774788
def_bool ARCH_SPARSEMEM_ENABLE
775789

790+
config ARCH_FLATMEM_ENABLE
791+
def_bool !NUMA
792+
776793
config HAVE_ARCH_PFN_VALID
777794
def_bool ARCH_HAS_HOLES_MEMORYMODEL || !SPARSEMEM
778795

@@ -1244,6 +1261,7 @@ config EFI
12441261
bool "UEFI runtime support"
12451262
depends on OF && !CPU_BIG_ENDIAN
12461263
depends on KERNEL_MODE_NEON
1264+
select ARCH_SUPPORTS_ACPI
12471265
select LIBFDT
12481266
select UCS2_STRING
12491267
select EFI_PARAMS_FROM_FDT

‎arch/arm64/Makefile‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,16 @@ ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
6060
KBUILD_CPPFLAGS += -mbig-endian
6161
CHECKFLAGS += -D__AARCH64EB__
6262
AS += -EB
63-
# We must use the linux target here, since distributions don't tend to package
64-
# the ELF linker scripts with binutils, and this results in a build failure.
65-
LDFLAGS += -EB -maarch64linuxb
63+
# Prefer the baremetal ELF build target, but not all toolchains include
64+
# it so fall back to the standard linux version if needed.
65+
LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb)
6666
UTS_MACHINE := aarch64_be
6767
else
6868
KBUILD_CPPFLAGS += -mlittle-endian
6969
CHECKFLAGS += -D__AARCH64EL__
7070
AS += -EL
71-
LDFLAGS += -EL -maarch64linux # See comment above
71+
# Same as above, prefer ELF but fall back to linux target if needed.
72+
LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux)
7273
UTS_MACHINE := aarch64
7374
endif
7475

‎arch/arm64/include/asm/Kbuild‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ generic-y += mm-arch-hooks.h
1616
generic-y += msi.h
1717
generic-y += preempt.h
1818
generic-y += qrwlock.h
19+
generic-y += qspinlock.h
1920
generic-y += rwsem.h
2021
generic-y += segment.h
2122
generic-y += serial.h

‎arch/arm64/include/asm/acpi.h‎

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
#ifndef _ASM_ACPI_H
1313
#define _ASM_ACPI_H
1414

15+
#include <linux/efi.h>
1516
#include <linux/memblock.h>
1617
#include <linux/psci.h>
1718

1819
#include <asm/cputype.h>
20+
#include <asm/io.h>
1921
#include <asm/smp_plat.h>
2022
#include <asm/tlbflush.h>
2123

@@ -29,18 +31,22 @@
2931

3032
/* Basic configuration for ACPI */
3133
#ifdef CONFIG_ACPI
34+
pgprot_t __acpi_get_mem_attribute(phys_addr_t addr);
35+
3236
/* ACPI table mapping after acpi_permanent_mmap is set */
3337
static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
3438
acpi_size size)
3539
{
40+
/* For normal memory we already have a cacheable mapping. */
41+
if (memblock_is_map_memory(phys))
42+
return (void __iomem *)__phys_to_virt(phys);
43+
3644
/*
37-
* EFI's reserve_regions() call adds memory with the WB attribute
38-
* to memblock via early_init_dt_add_memory_arch().
45+
* We should still honor the memory's attribute here because
46+
* crash dump kernel possibly excludes some ACPI (reclaim)
47+
* regions from memblock list.
3948
*/
40-
if (!memblock_is_memory(phys))
41-
return ioremap(phys, size);
42-
43-
return ioremap_cache(phys, size);
49+
return __ioremap(phys, size, __acpi_get_mem_attribute(phys));
4450
}
4551
#define acpi_os_ioremap acpi_os_ioremap
4652

@@ -129,15 +135,20 @@ static inline const char *acpi_get_enable_method(int cpu)
129135
* for compatibility.
130136
*/
131137
#define acpi_disable_cmcff 1
132-
pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr);
138+
static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)
139+
{
140+
return __acpi_get_mem_attribute(addr);
141+
}
133142
#endif /* CONFIG_ACPI_APEI */
134143

135144
#ifdef CONFIG_ACPI_NUMA
136145
int arm64_acpi_numa_init(void);
137-
int acpi_numa_get_nid(unsigned int cpu, u64 hwid);
146+
int acpi_numa_get_nid(unsigned int cpu);
147+
void acpi_map_cpus_to_nodes(void);
138148
#else
139149
static inline int arm64_acpi_numa_init(void) { return -ENOSYS; }
140-
static inline int acpi_numa_get_nid(unsigned int cpu, u64 hwid) { return NUMA_NO_NODE; }
150+
static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; }
151+
static inline void acpi_map_cpus_to_nodes(void) { }
141152
#endif /* CONFIG_ACPI_NUMA */
142153

143154
#define ACPI_TABLE_UPGRADE_MAX_PHYS MEMBLOCK_ALLOC_ACCESSIBLE

0 commit comments

Comments
 (0)