Skip to content

Commit f455fb6

Browse files
committed
Merge branch 'for-next/errata' into for-next/core
* for-next/errata: arm64: errata: Workaround possible Cortex-A715 [ESR|FAR]_ELx corruption arm64: Add Cortex-715 CPU part definition
2 parents f6ffa4c + 44ecda7 commit f455fb6

File tree

9 files changed

+88
-0
lines changed

9 files changed

+88
-0
lines changed

Documentation/arm64/silicon-errata.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ stable kernels.
120120
+----------------+-----------------+-----------------+-----------------------------+
121121
| ARM | Cortex-A710 | #2224489 | ARM64_ERRATUM_2224489 |
122122
+----------------+-----------------+-----------------+-----------------------------+
123+
| ARM | Cortex-A715 | #2645198 | ARM64_ERRATUM_2645198 |
124+
+----------------+-----------------+-----------------+-----------------------------+
123125
| ARM | Cortex-X2 | #2119858 | ARM64_ERRATUM_2119858 |
124126
+----------------+-----------------+-----------------+-----------------------------+
125127
| ARM | Cortex-X2 | #2224489 | ARM64_ERRATUM_2224489 |

arch/arm64/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,22 @@ config ARM64_ERRATUM_2457168
968968

969969
If unsure, say Y.
970970

971+
config ARM64_ERRATUM_2645198
972+
bool "Cortex-A715: 2645198: Workaround possible [ESR|FAR]_ELx corruption"
973+
default y
974+
help
975+
This option adds the workaround for ARM Cortex-A715 erratum 2645198.
976+
977+
If a Cortex-A715 cpu sees a page mapping permissions change from executable
978+
to non-executable, it may corrupt the ESR_ELx and FAR_ELx registers on the
979+
next instruction abort caused by permission fault.
980+
981+
Only user-space does executable to non-executable permission transition via
982+
mprotect() system call. Workaround the problem by doing a break-before-make
983+
TLB invalidation, for all changes to executable user space mappings.
984+
985+
If unsure, say Y.
986+
971987
config CAVIUM_ERRATUM_22375
972988
bool "Cavium erratum 22375, 24313"
973989
default y

arch/arm64/include/asm/cputype.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
#define ARM_CPU_PART_CORTEX_X1 0xD44
8181
#define ARM_CPU_PART_CORTEX_A510 0xD46
8282
#define ARM_CPU_PART_CORTEX_A710 0xD47
83+
#define ARM_CPU_PART_CORTEX_A715 0xD4D
8384
#define ARM_CPU_PART_CORTEX_X2 0xD48
8485
#define ARM_CPU_PART_NEOVERSE_N2 0xD49
8586
#define ARM_CPU_PART_CORTEX_A78C 0xD4B
@@ -142,6 +143,7 @@
142143
#define MIDR_CORTEX_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1)
143144
#define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510)
144145
#define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710)
146+
#define MIDR_CORTEX_A715 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A715)
145147
#define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2)
146148
#define MIDR_NEOVERSE_N2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N2)
147149
#define MIDR_CORTEX_A78C MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78C)

arch/arm64/include/asm/hugetlb.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ extern pte_t huge_ptep_get(pte_t *ptep);
4949

5050
void __init arm64_hugetlb_cma_reserve(void);
5151

52+
#define huge_ptep_modify_prot_start huge_ptep_modify_prot_start
53+
extern pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma,
54+
unsigned long addr, pte_t *ptep);
55+
56+
#define huge_ptep_modify_prot_commit huge_ptep_modify_prot_commit
57+
extern void huge_ptep_modify_prot_commit(struct vm_area_struct *vma,
58+
unsigned long addr, pte_t *ptep,
59+
pte_t old_pte, pte_t new_pte);
60+
5261
#include <asm-generic/hugetlb.h>
5362

5463
#endif /* __ASM_HUGETLB_H */

arch/arm64/include/asm/pgtable.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,15 @@ static inline bool pud_sect_supported(void)
10961096
}
10971097

10981098

1099+
#define __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION
1100+
#define ptep_modify_prot_start ptep_modify_prot_start
1101+
extern pte_t ptep_modify_prot_start(struct vm_area_struct *vma,
1102+
unsigned long addr, pte_t *ptep);
1103+
1104+
#define ptep_modify_prot_commit ptep_modify_prot_commit
1105+
extern void ptep_modify_prot_commit(struct vm_area_struct *vma,
1106+
unsigned long addr, pte_t *ptep,
1107+
pte_t old_pte, pte_t new_pte);
10991108
#endif /* !__ASSEMBLY__ */
11001109

11011110
#endif /* __ASM_PGTABLE_H */

arch/arm64/kernel/cpu_errata.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,13 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
661661
CAP_MIDR_RANGE_LIST(trbe_write_out_of_range_cpus),
662662
},
663663
#endif
664+
#ifdef CONFIG_ARM64_ERRATUM_2645198
665+
{
666+
.desc = "ARM erratum 2645198",
667+
.capability = ARM64_WORKAROUND_2645198,
668+
ERRATA_MIDR_ALL_VERSIONS(MIDR_CORTEX_A715)
669+
},
670+
#endif
664671
#ifdef CONFIG_ARM64_ERRATUM_2077057
665672
{
666673
.desc = "ARM erratum 2077057",

arch/arm64/mm/hugetlbpage.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,3 +559,24 @@ bool __init arch_hugetlb_valid_size(unsigned long size)
559559
{
560560
return __hugetlb_valid_size(size);
561561
}
562+
563+
pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
564+
{
565+
if (IS_ENABLED(CONFIG_ARM64_WORKAROUND_2645198) &&
566+
cpus_have_const_cap(ARM64_WORKAROUND_2645198)) {
567+
/*
568+
* Break-before-make (BBM) is required for all user space mappings
569+
* when the permission changes from executable to non-executable
570+
* in cases where cpu is affected with errata #2645198.
571+
*/
572+
if (pte_user_exec(READ_ONCE(*ptep)))
573+
return huge_ptep_clear_flush(vma, addr, ptep);
574+
}
575+
return huge_ptep_get_and_clear(vma->vm_mm, addr, ptep);
576+
}
577+
578+
void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep,
579+
pte_t old_pte, pte_t pte)
580+
{
581+
set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
582+
}

arch/arm64/mm/mmu.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,3 +1702,24 @@ static int __init prevent_bootmem_remove_init(void)
17021702
}
17031703
early_initcall(prevent_bootmem_remove_init);
17041704
#endif
1705+
1706+
pte_t ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
1707+
{
1708+
if (IS_ENABLED(CONFIG_ARM64_WORKAROUND_2645198) &&
1709+
cpus_have_const_cap(ARM64_WORKAROUND_2645198)) {
1710+
/*
1711+
* Break-before-make (BBM) is required for all user space mappings
1712+
* when the permission changes from executable to non-executable
1713+
* in cases where cpu is affected with errata #2645198.
1714+
*/
1715+
if (pte_user_exec(READ_ONCE(*ptep)))
1716+
return ptep_clear_flush(vma, addr, ptep);
1717+
}
1718+
return ptep_get_and_clear(vma->vm_mm, addr, ptep);
1719+
}
1720+
1721+
void ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep,
1722+
pte_t old_pte, pte_t pte)
1723+
{
1724+
set_pte_at(vma->vm_mm, addr, ptep, pte);
1725+
}

arch/arm64/tools/cpucaps

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ WORKAROUND_2038923
7171
WORKAROUND_2064142
7272
WORKAROUND_2077057
7373
WORKAROUND_2457168
74+
WORKAROUND_2645198
7475
WORKAROUND_2658417
7576
WORKAROUND_TRBE_OVERWRITE_FILL_MODE
7677
WORKAROUND_TSB_FLUSH_FAILURE

0 commit comments

Comments
 (0)