summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2021-11-22 19:23:00 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2021-11-22 19:23:00 +0000
commit97b39fd50c0d150e28ca9449518c501a7499b9b9 (patch)
tree0a514045f23b340242e95bea5b6bc61616cfb0bb /sys
parent4aa80a8fe8c9f479bfc1e32dda517f68cbdd07aa (diff)
Hack alert! Apple M1 systems still don't work with an MP kernel.
In order to make progress (and protect myself from things dumping cores left and right when I run sysupgrade) abuse the hw.smt mechanism to only schedule processes on the primary CPU. ok deraadt@, patrick@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/arm64/arm64/cpu.c7
-rw-r--r--sys/arch/arm64/include/cpu.h7
2 files changed, 12 insertions, 2 deletions
diff --git a/sys/arch/arm64/arm64/cpu.c b/sys/arch/arm64/arm64/cpu.c
index 8d1618419a7..45694108c29 100644
--- a/sys/arch/arm64/arm64/cpu.c
+++ b/sys/arch/arm64/arm64/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.56 2021/10/24 17:52:28 mpi Exp $ */
+/* $OpenBSD: cpu.c,v 1.57 2021/11/22 19:22:59 kettenis Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
@@ -605,6 +605,7 @@ cpu_attach(struct device *parent, struct device *dev, void *aux)
struct fdt_attach_args *faa = aux;
struct cpu_info *ci;
uint64_t mpidr = READ_SPECIALREG(mpidr_el1);
+ uint64_t midr = READ_SPECIALREG(midr_el1);
uint64_t id_aa64mmfr1, sctlr;
uint32_t opp;
@@ -643,6 +644,10 @@ cpu_attach(struct device *parent, struct device *dev, void *aux)
int timeout = 10000;
int len;
+ /* XXX SMP on Apple CPUs is busted. */
+ if (CPU_IMPL(midr) == CPU_IMPL_APPLE)
+ ci->ci_smt_id = 1;
+
len = OF_getprop(ci->ci_node, "enable-method",
buf, sizeof(buf));
if (strcmp(buf, "psci") == 0) {
diff --git a/sys/arch/arm64/include/cpu.h b/sys/arch/arm64/include/cpu.h
index 9f9e4761aae..109dd9c1141 100644
--- a/sys/arch/arm64/include/cpu.h
+++ b/sys/arch/arm64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.22 2021/07/06 09:34:06 kettenis Exp $ */
+/* $OpenBSD: cpu.h,v 1.23 2021/11/22 19:22:59 kettenis Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
*
@@ -92,6 +92,11 @@ struct cpu_info {
int ci_node;
struct cpu_info *ci_self;
+#define __HAVE_CPU_TOPOLOGY
+ u_int32_t ci_smt_id;
+ u_int32_t ci_core_id;
+ u_int32_t ci_pkg_id;
+
struct proc *ci_curproc;
struct pmap *ci_curpm;
struct proc *ci_fpuproc;