diff options
Diffstat (limited to 'sys/arch/arm64')
-rw-r--r-- | sys/arch/arm64/arm64/autoconf.c | 4 | ||||
-rw-r--r-- | sys/arch/arm64/arm64/cpu.c | 36 | ||||
-rw-r--r-- | sys/arch/arm64/arm64/machdep.c | 25 | ||||
-rw-r--r-- | sys/arch/arm64/include/cpu.h | 5 |
4 files changed, 49 insertions, 21 deletions
diff --git a/sys/arch/arm64/arm64/autoconf.c b/sys/arch/arm64/arm64/autoconf.c index 207f50969cf..75ef6d7da52 100644 --- a/sys/arch/arm64/arm64/autoconf.c +++ b/sys/arch/arm64/arm64/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.14 2022/09/08 10:22:06 kn Exp $ */ +/* $OpenBSD: autoconf.c,v 1.15 2024/07/17 15:21:59 kettenis Exp $ */ /* * Copyright (c) 2009 Miodrag Vallat. * @@ -61,6 +61,8 @@ cpu_configure(void) unmap_startup(); + cpu_identify_cleanup(); + #ifdef CRYPTO if (arm64_has_aes) cryptox_setup(); diff --git a/sys/arch/arm64/arm64/cpu.c b/sys/arch/arm64/arm64/cpu.c index 69898059074..37383875d3e 100644 --- a/sys/arch/arm64/arm64/cpu.c +++ b/sys/arch/arm64/arm64/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.126 2024/07/14 09:48:48 jca Exp $ */ +/* $OpenBSD: cpu.c,v 1.127 2024/07/17 15:21:59 kettenis Exp $ */ /* * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com> @@ -1024,6 +1024,40 @@ cpu_identify(struct cpu_info *ci) #endif } +void +cpu_identify_cleanup(void) +{ + uint64_t value; + + /* ID_AA64ISAR0_EL1 */ + value = cpu_id_aa64isar0 & ID_AA64ISAR0_MASK; + value &= ~ID_AA64ISAR0_TLB_MASK; + cpu_id_aa64isar0 = value; + + /* ID_AA64ISAR1_EL1 */ + value = cpu_id_aa64isar1 &= ID_AA64ISAR1_MASK; + value &= ~ID_AA64ISAR1_SPECRES_MASK; + cpu_id_aa64isar1 = value; + + /* ID_AA64ISAR2_EL1 */ + value = cpu_id_aa64isar2 &= ID_AA64ISAR2_MASK; + value &= ~ID_AA64ISAR2_CLRBHB_MASK; + cpu_id_aa64isar2 = value; + + /* ID_AA64PFR0_EL1 */ + value = 0; + value |= cpu_id_aa64pfr0 & ID_AA64PFR0_FP_MASK; + value |= cpu_id_aa64pfr0 & ID_AA64PFR0_ADV_SIMD_MASK; + value |= cpu_id_aa64pfr0 & ID_AA64PFR0_DIT_MASK; + cpu_id_aa64pfr0 = value; + + /* ID_AA64PFR1_EL1 */ + value = 0; + value |= cpu_id_aa64pfr1 & ID_AA64PFR1_BT_MASK; + value |= cpu_id_aa64pfr1 & ID_AA64PFR1_SSBS_MASK; + cpu_id_aa64pfr1 = value; +} + void cpu_init(void); int cpu_start_secondary(struct cpu_info *ci, int, uint64_t); int cpu_clockspeed(int *); diff --git a/sys/arch/arm64/arm64/machdep.c b/sys/arch/arm64/arm64/machdep.c index 7b53ee1f446..c3605a01606 100644 --- a/sys/arch/arm64/arm64/machdep.c +++ b/sys/arch/arm64/arm64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.90 2024/07/03 21:04:04 kettenis Exp $ */ +/* $OpenBSD: machdep.c,v 1.91 2024/07/17 15:21:59 kettenis Exp $ */ /* * Copyright (c) 2014 Patrick Wildt <patrick@blueri.se> * Copyright (c) 2021 Mark Kettenis <kettenis@openbsd.org> @@ -332,7 +332,6 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, { char *compatible; int node, len, error; - uint64_t value; /* all sysctl names at this level are terminal */ if (namelen != 1) @@ -351,25 +350,15 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, free(compatible, M_TEMP, len); return error; case CPU_ID_AA64ISAR0: - value = cpu_id_aa64isar0 & ID_AA64ISAR0_MASK; - value &= ~ID_AA64ISAR0_TLB_MASK; - return sysctl_rdquad(oldp, oldlenp, newp, value); + return sysctl_rdquad(oldp, oldlenp, newp, cpu_id_aa64isar0); case CPU_ID_AA64ISAR1: - value = cpu_id_aa64isar1 & ID_AA64ISAR1_MASK; - value &= ~ID_AA64ISAR1_SPECRES_MASK; - return sysctl_rdquad(oldp, oldlenp, newp, value); + return sysctl_rdquad(oldp, oldlenp, newp, cpu_id_aa64isar1); + case CPU_ID_AA64ISAR2: + return sysctl_rdquad(oldp, oldlenp, newp, cpu_id_aa64isar2); case CPU_ID_AA64PFR0: - value = 0; - value |= cpu_id_aa64pfr0 & ID_AA64PFR0_FP_MASK; - value |= cpu_id_aa64pfr0 & ID_AA64PFR0_ADV_SIMD_MASK; - value |= cpu_id_aa64pfr0 & ID_AA64PFR0_DIT_MASK; - return sysctl_rdquad(oldp, oldlenp, newp, value); + return sysctl_rdquad(oldp, oldlenp, newp, cpu_id_aa64pfr0); case CPU_ID_AA64PFR1: - value = 0; - value |= cpu_id_aa64pfr1 & ID_AA64PFR1_BT_MASK; - value |= cpu_id_aa64pfr1 & ID_AA64PFR1_SSBS_MASK; - return sysctl_rdquad(oldp, oldlenp, newp, value); - case CPU_ID_AA64ISAR2: + return sysctl_rdquad(oldp, oldlenp, newp, cpu_id_aa64pfr1); case CPU_ID_AA64MMFR0: case CPU_ID_AA64MMFR1: case CPU_ID_AA64MMFR2: diff --git a/sys/arch/arm64/include/cpu.h b/sys/arch/arm64/include/cpu.h index c9b0e109160..33084f67c99 100644 --- a/sys/arch/arm64/include/cpu.h +++ b/sys/arch/arm64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.48 2024/07/10 11:01:24 kettenis Exp $ */ +/* $OpenBSD: cpu.h,v 1.49 2024/07/17 15:21:59 kettenis Exp $ */ /* * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com> * @@ -63,9 +63,12 @@ extern uint64_t cpu_id_aa64isar0; extern uint64_t cpu_id_aa64isar1; +extern uint64_t cpu_id_aa64isar2; extern uint64_t cpu_id_aa64pfr0; extern uint64_t cpu_id_aa64pfr1; +void cpu_identify_cleanup(void); + #include <machine/intr.h> #include <machine/frame.h> #include <machine/armreg.h> |