Skip to content

Commit d192f53

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Will Deacon: "I've picked up a handful of arm64 fixes while Catalin's been away, so here they are. Below is the usual summary, but we have basically have two cleanups, a fix for an SME crash and a fix for hibernation: - Fix saving of SME state after SVE vector length is changed - Fix sparse warnings for missing vDSO function prototypes - Fix hibernation resume path when kfence is enabled - Fix field names for the HFGxTR_EL2 register" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64/fpsimd: Ensure SME storage is allocated after SVE VL changes arm64: vdso: Clear common make C=2 warnings arm64: mm: Make hibernation aware of KFENCE arm64: Fix HFGxTR_EL2 field naming
2 parents 892d7c1 + d4d5be9 commit d192f53

File tree

4 files changed

+38
-15
lines changed

4 files changed

+38
-15
lines changed

arch/arm64/kernel/fpsimd.c

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,8 @@ void sve_sync_from_fpsimd_zeropad(struct task_struct *task)
847847
int vec_set_vector_length(struct task_struct *task, enum vec_type type,
848848
unsigned long vl, unsigned long flags)
849849
{
850+
bool free_sme = false;
851+
850852
if (flags & ~(unsigned long)(PR_SVE_VL_INHERIT |
851853
PR_SVE_SET_VL_ONEXEC))
852854
return -EINVAL;
@@ -897,21 +899,36 @@ int vec_set_vector_length(struct task_struct *task, enum vec_type type,
897899
task->thread.fp_type = FP_STATE_FPSIMD;
898900
}
899901

900-
if (system_supports_sme() && type == ARM64_VEC_SME) {
901-
task->thread.svcr &= ~(SVCR_SM_MASK |
902-
SVCR_ZA_MASK);
903-
clear_thread_flag(TIF_SME);
902+
if (system_supports_sme()) {
903+
if (type == ARM64_VEC_SME ||
904+
!(task->thread.svcr & (SVCR_SM_MASK | SVCR_ZA_MASK))) {
905+
/*
906+
* We are changing the SME VL or weren't using
907+
* SME anyway, discard the state and force a
908+
* reallocation.
909+
*/
910+
task->thread.svcr &= ~(SVCR_SM_MASK |
911+
SVCR_ZA_MASK);
912+
clear_thread_flag(TIF_SME);
913+
free_sme = true;
914+
}
904915
}
905916

906917
if (task == current)
907918
put_cpu_fpsimd_context();
908919

909920
/*
910-
* Force reallocation of task SVE and SME state to the correct
911-
* size on next use:
921+
* Free the changed states if they are not in use, SME will be
922+
* reallocated to the correct size on next use and we just
923+
* allocate SVE now in case it is needed for use in streaming
924+
* mode.
912925
*/
913-
sve_free(task);
914-
if (system_supports_sme() && type == ARM64_VEC_SME)
926+
if (system_supports_sve()) {
927+
sve_free(task);
928+
sve_alloc(task, true);
929+
}
930+
931+
if (free_sme)
915932
sme_free(task);
916933

917934
task_set_vl(task, type, vl);

arch/arm64/kernel/vdso/vgettimeofday.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
*
77
*/
88

9+
int __kernel_clock_gettime(clockid_t clock, struct __kernel_timespec *ts);
10+
int __kernel_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz);
11+
int __kernel_clock_getres(clockid_t clock_id, struct __kernel_timespec *res);
12+
913
int __kernel_clock_gettime(clockid_t clock,
1014
struct __kernel_timespec *ts)
1115
{

arch/arm64/mm/trans_pgd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/bug.h>
2525
#include <linux/mm.h>
2626
#include <linux/mmzone.h>
27+
#include <linux/kfence.h>
2728

2829
static void *trans_alloc(struct trans_pgd_info *info)
2930
{
@@ -41,7 +42,8 @@ static void _copy_pte(pte_t *dst_ptep, pte_t *src_ptep, unsigned long addr)
4142
* the temporary mappings we use during restore.
4243
*/
4344
set_pte(dst_ptep, pte_mkwrite(pte));
44-
} else if (debug_pagealloc_enabled() && !pte_none(pte)) {
45+
} else if ((debug_pagealloc_enabled() ||
46+
is_kfence_address((void *)addr)) && !pte_none(pte)) {
4547
/*
4648
* debug_pagealloc will removed the PTE_VALID bit if
4749
* the page isn't in use by the resume kernel. It may have

arch/arm64/tools/sysreg

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,7 +2017,7 @@ Field 0 SM
20172017
EndSysreg
20182018

20192019
SysregFields HFGxTR_EL2
2020-
Field 63 nAMIAIR2_EL1
2020+
Field 63 nAMAIR2_EL1
20212021
Field 62 nMAIR2_EL1
20222022
Field 61 nS2POR_EL1
20232023
Field 60 nPOR_EL1
@@ -2032,9 +2032,9 @@ Field 52 nGCS_EL0
20322032
Res0 51
20332033
Field 50 nACCDATA_EL1
20342034
Field 49 ERXADDR_EL1
2035-
Field 48 EXRPFGCDN_EL1
2036-
Field 47 EXPFGCTL_EL1
2037-
Field 46 EXPFGF_EL1
2035+
Field 48 ERXPFGCDN_EL1
2036+
Field 47 ERXPFGCTL_EL1
2037+
Field 46 ERXPFGF_EL1
20382038
Field 45 ERXMISCn_EL1
20392039
Field 44 ERXSTATUS_EL1
20402040
Field 43 ERXCTLR_EL1
@@ -2049,8 +2049,8 @@ Field 35 TPIDR_EL0
20492049
Field 34 TPIDRRO_EL0
20502050
Field 33 TPIDR_EL1
20512051
Field 32 TCR_EL1
2052-
Field 31 SCTXNUM_EL0
2053-
Field 30 SCTXNUM_EL1
2052+
Field 31 SCXTNUM_EL0
2053+
Field 30 SCXTNUM_EL1
20542054
Field 29 SCTLR_EL1
20552055
Field 28 REVIDR_EL1
20562056
Field 27 PAR_EL1

0 commit comments

Comments
 (0)