Skip to content

Commit 5289851

Browse files
committed
Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 updates from Catalin Marinas: "Apart from some new arm64 features and clean-ups, this also contains the core mmu_gather changes for tracking the levels of the page table being cleared and a minor update to the generic compat_sys_sigaltstack() introducing COMPAT_SIGMINSKSZ. Summary: - Core mmu_gather changes which allow tracking the levels of page-table being cleared together with the arm64 low-level flushing routines - Support for the new ARMv8.5 PSTATE.SSBS bit which can be used to mitigate Spectre-v4 dynamically without trapping to EL3 firmware - Introduce COMPAT_SIGMINSTKSZ for use in compat_sys_sigaltstack - Optimise emulation of MRS instructions to ID_* registers on ARMv8.4 - Support for Common Not Private (CnP) translations allowing threads of the same CPU to share the TLB entries - Accelerated crc32 routines - Move swapper_pg_dir to the rodata section - Trap WFI instruction executed in user space - ARM erratum 1188874 workaround (arch_timer) - Miscellaneous fixes and clean-ups" * tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (78 commits) arm64: KVM: Guests can skip __install_bp_hardening_cb()s HYP work arm64: cpufeature: Trap CTR_EL0 access only where it is necessary arm64: cpufeature: Fix handling of CTR_EL0.IDC field arm64: cpufeature: ctr: Fix cpu capability check for late CPUs Documentation/arm64: HugeTLB page implementation arm64: mm: Use __pa_symbol() for set_swapper_pgd() arm64: Add silicon-errata.txt entry for ARM erratum 1188873 Revert "arm64: uaccess: implement unsafe accessors" arm64: mm: Drop the unused cpu parameter MAINTAINERS: fix bad sdei paths arm64: mm: Use #ifdef for the __PAGETABLE_P?D_FOLDED defines arm64: Fix typo in a comment in arch/arm64/mm/kasan_init.c arm64: xen: Use existing helper to check interrupt status arm64: Use daifflag_restore after bp_hardening arm64: daifflags: Use irqflags functions for daifflags arm64: arch_timer: avoid unused function warning arm64: Trap WFI executed in userspace arm64: docs: Document SSBS HWCAP arm64: docs: Fix typos in ELF hwcaps arm64/kprobes: remove an extra semicolon in arch_prepare_kprobe ...
2 parents 84df952 + 4debef5 commit 5289851

71 files changed

Lines changed: 1511 additions & 591 deletions

Some content is hidden

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

‎Documentation/arm64/elf_hwcaps.txt‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ HWCAP_EVTSTRM
7878

7979
HWCAP_AES
8080

81-
Functionality implied by ID_AA64ISAR1_EL1.AES == 0b0001.
81+
Functionality implied by ID_AA64ISAR0_EL1.AES == 0b0001.
8282

8383
HWCAP_PMULL
8484

85-
Functionality implied by ID_AA64ISAR1_EL1.AES == 0b0010.
85+
Functionality implied by ID_AA64ISAR0_EL1.AES == 0b0010.
8686

8787
HWCAP_SHA1
8888

@@ -153,7 +153,7 @@ HWCAP_ASIMDDP
153153

154154
HWCAP_SHA512
155155

156-
Functionality implied by ID_AA64ISAR0_EL1.SHA2 == 0b0002.
156+
Functionality implied by ID_AA64ISAR0_EL1.SHA2 == 0b0010.
157157

158158
HWCAP_SVE
159159

@@ -173,8 +173,12 @@ HWCAP_USCAT
173173

174174
HWCAP_ILRCPC
175175

176-
Functionality implied by ID_AA64ISR1_EL1.LRCPC == 0b0002.
176+
Functionality implied by ID_AA64ISAR1_EL1.LRCPC == 0b0010.
177177

178178
HWCAP_FLAGM
179179

180180
Functionality implied by ID_AA64ISAR0_EL1.TS == 0b0001.
181+
182+
HWCAP_SSBS
183+
184+
Functionality implied by ID_AA64PFR1_EL1.SSBS == 0b0010.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
HugeTLBpage on ARM64
2+
====================
3+
4+
Hugepage relies on making efficient use of TLBs to improve performance of
5+
address translations. The benefit depends on both -
6+
7+
- the size of hugepages
8+
- size of entries supported by the TLBs
9+
10+
The ARM64 port supports two flavours of hugepages.
11+
12+
1) Block mappings at the pud/pmd level
13+
--------------------------------------
14+
15+
These are regular hugepages where a pmd or a pud page table entry points to a
16+
block of memory. Regardless of the supported size of entries in TLB, block
17+
mappings reduce the depth of page table walk needed to translate hugepage
18+
addresses.
19+
20+
2) Using the Contiguous bit
21+
---------------------------
22+
23+
The architecture provides a contiguous bit in the translation table entries
24+
(D4.5.3, ARM DDI 0487C.a) that hints to the MMU to indicate that it is one of a
25+
contiguous set of entries that can be cached in a single TLB entry.
26+
27+
The contiguous bit is used in Linux to increase the mapping size at the pmd and
28+
pte (last) level. The number of supported contiguous entries varies by page size
29+
and level of the page table.
30+
31+
32+
The following hugepage sizes are supported -
33+
34+
CONT PTE PMD CONT PMD PUD
35+
-------- --- -------- ---
36+
4K: 64K 2M 32M 1G
37+
16K: 2M 32M 1G
38+
64K: 2M 512M 16G

‎Documentation/arm64/silicon-errata.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ stable kernels.
5656
| ARM | Cortex-A72 | #853709 | N/A |
5757
| ARM | Cortex-A73 | #858921 | ARM64_ERRATUM_858921 |
5858
| ARM | Cortex-A55 | #1024718 | ARM64_ERRATUM_1024718 |
59+
| ARM | Cortex-A76 | #1188873 | ARM64_ERRATUM_1188873 |
5960
| ARM | MMU-500 | #841119,#826419 | N/A |
6061
| | | | |
6162
| Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 |

‎MAINTAINERS‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9712,6 +9712,19 @@ S: Maintained
97129712
F: arch/arm/boot/dts/mmp*
97139713
F: arch/arm/mach-mmp/
97149714

9715+
MMU GATHER AND TLB INVALIDATION
9716+
M: Will Deacon <will.deacon@arm.com>
9717+
M: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
9718+
M: Andrew Morton <akpm@linux-foundation.org>
9719+
M: Nick Piggin <npiggin@gmail.com>
9720+
M: Peter Zijlstra <peterz@infradead.org>
9721+
L: linux-arch@vger.kernel.org
9722+
L: linux-mm@kvack.org
9723+
S: Maintained
9724+
F: arch/*/include/asm/tlb.h
9725+
F: include/asm-generic/tlb.h
9726+
F: mm/mmu_gather.c
9727+
97159728
MN88472 MEDIA DRIVER
97169729
M: Antti Palosaari <crope@iki.fi>
97179730
L: linux-media@vger.kernel.org
@@ -13502,8 +13515,8 @@ L: linux-arm-kernel@lists.infradead.org
1350213515
S: Maintained
1350313516
F: Documentation/devicetree/bindings/arm/firmware/sdei.txt
1350413517
F: drivers/firmware/arm_sdei.c
13505-
F: include/linux/sdei.h
13506-
F: include/uapi/linux/sdei.h
13518+
F: include/linux/arm_sdei.h
13519+
F: include/uapi/linux/arm_sdei.h
1350713520

1350813521
SOFTWARE RAID (Multiple Disks) SUPPORT
1350913522
M: Shaohua Li <shli@kernel.org>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
#else
162162
#define VTTBR_X (5 - KVM_T0SZ)
163163
#endif
164+
#define VTTBR_CNP_BIT _AC(1, UL)
164165
#define VTTBR_BADDR_MASK (((_AC(1, ULL) << (40 - VTTBR_X)) - 1) << VTTBR_X)
165166
#define VTTBR_VMID_SHIFT _AC(48, ULL)
166167
#define VTTBR_VMID_MASK(size) (_AT(u64, (1 << size) - 1) << VTTBR_VMID_SHIFT)

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,11 @@ static inline int hyp_map_aux_data(void)
355355

356356
#define kvm_phys_to_vttbr(addr) (addr)
357357

358+
static inline bool kvm_cpu_has_cnp(void)
359+
{
360+
return false;
361+
}
362+
358363
#endif /* !__ASSEMBLY__ */
359364

360365
#endif /* __ARM_KVM_MMU_H__ */

‎arch/arm64/Kconfig‎

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ config ARM64
7575
select CLONE_BACKWARDS
7676
select COMMON_CLK
7777
select CPU_PM if (SUSPEND || CPU_IDLE)
78+
select CRC32
7879
select DCACHE_WORD_ACCESS
7980
select DMA_DIRECT_OPS
8081
select EDAC_SUPPORT
@@ -142,6 +143,7 @@ config ARM64
142143
select HAVE_PERF_USER_STACK_DUMP
143144
select HAVE_REGS_AND_STACK_ACCESS_API
144145
select HAVE_RCU_TABLE_FREE
146+
select HAVE_RCU_TABLE_INVALIDATE
145147
select HAVE_RSEQ
146148
select HAVE_STACKPROTECTOR
147149
select HAVE_SYSCALL_TRACEPOINTS
@@ -479,6 +481,19 @@ config ARM64_ERRATUM_1024718
479481

480482
If unsure, say Y.
481483

484+
config ARM64_ERRATUM_1188873
485+
bool "Cortex-A76: MRC read following MRRC read of specific Generic Timer in AArch32 might give incorrect result"
486+
default y
487+
select ARM_ARCH_TIMER_OOL_WORKAROUND
488+
help
489+
This option adds work arounds for ARM Cortex-A76 erratum 1188873
490+
491+
Affected Cortex-A76 cores (r0p0, r1p0, r2p0) could cause
492+
register corruption when accessing the timer registers from
493+
AArch32 userspace.
494+
495+
If unsure, say Y.
496+
482497
config CAVIUM_ERRATUM_22375
483498
bool "Cavium erratum 22375, 24313"
484499
default y
@@ -769,9 +784,6 @@ source kernel/Kconfig.hz
769784
config ARCH_SUPPORTS_DEBUG_PAGEALLOC
770785
def_bool y
771786

772-
config ARCH_HAS_HOLES_MEMORYMODEL
773-
def_bool y if SPARSEMEM
774-
775787
config ARCH_SPARSEMEM_ENABLE
776788
def_bool y
777789
select SPARSEMEM_VMEMMAP_ENABLE
@@ -786,7 +798,7 @@ config ARCH_FLATMEM_ENABLE
786798
def_bool !NUMA
787799

788800
config HAVE_ARCH_PFN_VALID
789-
def_bool ARCH_HAS_HOLES_MEMORYMODEL || !SPARSEMEM
801+
def_bool y
790802

791803
config HW_PERF_EVENTS
792804
def_bool y
@@ -1132,6 +1144,20 @@ config ARM64_RAS_EXTN
11321144
and access the new registers if the system supports the extension.
11331145
Platform RAS features may additionally depend on firmware support.
11341146

1147+
config ARM64_CNP
1148+
bool "Enable support for Common Not Private (CNP) translations"
1149+
default y
1150+
depends on ARM64_PAN || !ARM64_SW_TTBR0_PAN
1151+
help
1152+
Common Not Private (CNP) allows translation table entries to
1153+
be shared between different PEs in the same inner shareable
1154+
domain, so the hardware can use this fact to optimise the
1155+
caching of such entries in the TLB.
1156+
1157+
Selecting this option allows the CNP feature to be detected
1158+
at runtime, and does not affect PEs that do not implement
1159+
this feature.
1160+
11351161
endmenu
11361162

11371163
config ARM64_SVE

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,11 @@ alternative_endif
286286
ldr \rd, [\rn, #MM_CONTEXT_ID]
287287
.endm
288288
/*
289-
* read_ctr - read CTR_EL0. If the system has mismatched
290-
* cache line sizes, provide the system wide safe value
291-
* from arm64_ftr_reg_ctrel0.sys_val
289+
* read_ctr - read CTR_EL0. If the system has mismatched register fields,
290+
* provide the system wide safe value from arm64_ftr_reg_ctrel0.sys_val
292291
*/
293292
.macro read_ctr, reg
294-
alternative_if_not ARM64_MISMATCHED_CACHE_LINE_SIZE
293+
alternative_if_not ARM64_MISMATCHED_CACHE_TYPE
295294
mrs \reg, ctr_el0 // read CTR
296295
nop
297296
alternative_else

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@
4040
#define L1_CACHE_SHIFT (6)
4141
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
4242

43+
44+
#define CLIDR_LOUU_SHIFT 27
45+
#define CLIDR_LOC_SHIFT 24
46+
#define CLIDR_LOUIS_SHIFT 21
47+
48+
#define CLIDR_LOUU(clidr) (((clidr) >> CLIDR_LOUU_SHIFT) & 0x7)
49+
#define CLIDR_LOC(clidr) (((clidr) >> CLIDR_LOC_SHIFT) & 0x7)
50+
#define CLIDR_LOUIS(clidr) (((clidr) >> CLIDR_LOUIS_SHIFT) & 0x7)
51+
4352
/*
4453
* Memory returned by kmalloc() may be used for DMA, so we must make
4554
* sure that all such allocations are cache aligned. Otherwise,
@@ -84,6 +93,37 @@ static inline int cache_line_size(void)
8493
return cwg ? 4 << cwg : ARCH_DMA_MINALIGN;
8594
}
8695

96+
/*
97+
* Read the effective value of CTR_EL0.
98+
*
99+
* According to ARM ARM for ARMv8-A (ARM DDI 0487C.a),
100+
* section D10.2.33 "CTR_EL0, Cache Type Register" :
101+
*
102+
* CTR_EL0.IDC reports the data cache clean requirements for
103+
* instruction to data coherence.
104+
*
105+
* 0 - dcache clean to PoU is required unless :
106+
* (CLIDR_EL1.LoC == 0) || (CLIDR_EL1.LoUIS == 0 && CLIDR_EL1.LoUU == 0)
107+
* 1 - dcache clean to PoU is not required for i-to-d coherence.
108+
*
109+
* This routine provides the CTR_EL0 with the IDC field updated to the
110+
* effective state.
111+
*/
112+
static inline u32 __attribute_const__ read_cpuid_effective_cachetype(void)
113+
{
114+
u32 ctr = read_cpuid_cachetype();
115+
116+
if (!(ctr & BIT(CTR_IDC_SHIFT))) {
117+
u64 clidr = read_sysreg(clidr_el1);
118+
119+
if (CLIDR_LOC(clidr) == 0 ||
120+
(CLIDR_LOUIS(clidr) == 0 && CLIDR_LOUU(clidr) == 0))
121+
ctr |= BIT(CTR_IDC_SHIFT);
122+
}
123+
124+
return ctr;
125+
}
126+
87127
#endif /* __ASSEMBLY__ */
88128

89129
#endif

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
159159
}
160160

161161
#define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current)))
162+
#define COMPAT_MINSIGSTKSZ 2048
162163

163164
static inline void __user *arch_compat_alloc_user_space(long len)
164165
{

0 commit comments

Comments
 (0)