From d9a6171acb5469c258797f6c715a1c8ab071b042 Mon Sep 17 00:00:00 2001 From: gkoehler Date: Thu, 28 Nov 2024 18:54:36 +0000 Subject: [PATCH] Move cpu_features to hwcap and cpu_features2 to hwcap2 ok jca@ --- sys/arch/powerpc64/include/cpu.h | 5 +---- sys/arch/powerpc64/powerpc64/cpu.c | 17 ++++++----------- sys/arch/powerpc64/powerpc64/pmap.c | 4 ++-- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/sys/arch/powerpc64/include/cpu.h b/sys/arch/powerpc64/include/cpu.h index d773d0bdc95..7a5a25a74b9 100644 --- a/sys/arch/powerpc64/include/cpu.h +++ b/sys/arch/powerpc64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.38 2024/07/21 16:49:26 jca Exp $ */ +/* $OpenBSD: cpu.h,v 1.39 2024/11/28 18:54:36 gkoehler Exp $ */ /* * Copyright (c) 2020 Mark Kettenis @@ -175,9 +175,6 @@ void signotify(struct proc *); #define curpcb curcpu()->ci_curpcb -extern uint32_t cpu_features; -extern uint32_t cpu_features2; - void cpu_init_features(void); void cpu_init(void); diff --git a/sys/arch/powerpc64/powerpc64/cpu.c b/sys/arch/powerpc64/powerpc64/cpu.c index 252356be0c6..de58bb2d84e 100644 --- a/sys/arch/powerpc64/powerpc64/cpu.c +++ b/sys/arch/powerpc64/powerpc64/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.29 2024/07/21 16:49:26 jca Exp $ */ +/* $OpenBSD: cpu.c,v 1.30 2024/11/28 18:54:36 gkoehler Exp $ */ /* * Copyright (c) 2020 Mark Kettenis @@ -58,8 +58,6 @@ struct cpu_version cpu_version[] = { }; char cpu_model[64]; -uint32_t cpu_features; -uint32_t cpu_features2; uint64_t tb_freq = 512000000; /* POWER8, POWER9 */ @@ -180,7 +178,7 @@ cpu_attach(struct device *parent, struct device *dev, void *aux) level++; } - if (CPU_IS_PRIMARY(ci) && (cpu_features2 & PPC_FEATURE2_DARN)) { + if (CPU_IS_PRIMARY(ci) && (hwcap2 & PPC_FEATURE2_DARN)) { timeout_set(&cpu_darn_to, cpu_darn, NULL); cpu_darn(NULL); } @@ -226,20 +224,17 @@ cpu_init_features(void) { uint32_t pvr = mfpvr(); - cpu_features = PPC_FEATURE_32 | PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU | + hwcap = PPC_FEATURE_32 | PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU | PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_VSX; switch (CPU_VERSION(pvr)) { case CPU_IBMPOWER9: case CPU_IBMPOWER9P: - cpu_features2 |= PPC_FEATURE2_ARCH_3_00; - cpu_features2 |= PPC_FEATURE2_DARN; + hwcap2 |= PPC_FEATURE2_ARCH_3_00; + hwcap2 |= PPC_FEATURE2_DARN; break; } - - hwcap = cpu_features; - hwcap2 = cpu_features2; } void @@ -247,7 +242,7 @@ cpu_init(void) { uint64_t lpcr = LPCR_LPES; - if (cpu_features2 & PPC_FEATURE2_ARCH_3_00) + if (hwcap2 & PPC_FEATURE2_ARCH_3_00) lpcr |= LPCR_PECE | LPCR_HVICE; mtlpcr(lpcr); diff --git a/sys/arch/powerpc64/powerpc64/pmap.c b/sys/arch/powerpc64/powerpc64/pmap.c index ba344f1ec10..7815a5cd401 100644 --- a/sys/arch/powerpc64/powerpc64/pmap.c +++ b/sys/arch/powerpc64/powerpc64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.63 2024/11/27 20:30:15 gkoehler Exp $ */ +/* $OpenBSD: pmap.c,v 1.64 2024/11/28 18:54:36 gkoehler Exp $ */ /* * Copyright (c) 2015 Martin Pieuchot @@ -1601,7 +1601,7 @@ pmap_bootstrap_cpu(void) /* Clear TLB. */ tlbia(); - if (cpu_features2 & PPC_FEATURE2_ARCH_3_00) { + if (hwcap2 & PPC_FEATURE2_ARCH_3_00) { /* Set partition table. */ mtptcr((paddr_t)pmap_pat | PATSIZE); } else {