summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/drm/drm_linux.c
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2020-11-09 23:53:30 +0000
committerjsg <jsg@openbsd.org>2020-11-09 23:53:30 +0000
commitec70c0c793407a5ad26d9668fa94095c6b556058 (patch)
tree586e0d777bedb3ee2f00dd47b6ceac4d0bfda27f /sys/dev/pci/drm/drm_linux.c
parentSync libc syscall tests with changes in upstream NetBSD. Use #ifdef (diff)
downloadwireguard-openbsd-ec70c0c793407a5ad26d9668fa94095c6b556058.tar.xz
wireguard-openbsd-ec70c0c793407a5ad26d9668fa94095c6b556058.zip
use a single preinitialised mutex for atomic64 fallback path
Previously we would initialise a variable specific mutex in ATOMIC64_INIT() or atomic64_set() but the drm code in multiple places zeroes memory and later accesses it without calling these resulting in a mutex with IPL_NONE instead of IPL_HIGH. Fixes a 'locking against myself' panic reported by Anthony Richardby on macppc with PowerBook5,6 and RV350. ok kettenis@
Diffstat (limited to 'sys/dev/pci/drm/drm_linux.c')
-rw-r--r--sys/dev/pci/drm/drm_linux.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c
index 25282df374a..f5c165b4b38 100644
--- a/sys/dev/pci/drm/drm_linux.c
+++ b/sys/dev/pci/drm/drm_linux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_linux.c,v 1.65 2020/10/17 15:10:54 semarie Exp $ */
+/* $OpenBSD: drm_linux.c,v 1.66 2020/11/09 23:53:30 jsg Exp $ */
/*
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
@@ -68,6 +68,11 @@ tasklet_run(void *arg)
}
}
+/* 32 bit powerpc lacks 64 bit atomics */
+#if defined(__powerpc__) && !defined(__powerpc64__)
+struct mutex atomic64_mtx = MUTEX_INITIALIZER(IPL_HIGH);
+#endif
+
struct mutex sch_mtx = MUTEX_INITIALIZER(IPL_SCHED);
volatile struct proc *sch_proc;
volatile void *sch_ident;