diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2016-01-26 15:23:12 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2016-01-26 15:23:12 +0000 |
commit | 3eaed73131565d4b1feb79238497144cb14792f7 (patch) | |
tree | 247e9efa45b83c655aa3cf9e17b3b0f236e9357b /sys/dev | |
parent | 2ad7153b610cde8aab71ed6e895212ab6913488f (diff) |
Make sure to use locked atomic operations even on the SP kernel
When executed under the hypervisor we need to make sure that CAS
and other atomic operations are executed while locking the bus.
Problem reported by Imre Oolberg <imre at auul ! pri ! ee>, thanks!
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pv/xen.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/dev/pv/xen.c b/sys/dev/pv/xen.c index 209b1ab6035..e78ba640f93 100644 --- a/sys/dev/pv/xen.c +++ b/sys/dev/pv/xen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xen.c,v 1.35 2016/01/25 15:22:56 mikeb Exp $ */ +/* $OpenBSD: xen.c,v 1.36 2016/01/26 15:23:11 mikeb Exp $ */ /* * Copyright (c) 2015 Mike Belopuhov @@ -18,7 +18,6 @@ #include <sys/param.h> #include <sys/systm.h> -#include <sys/atomic.h> #include <sys/malloc.h> #include <sys/kernel.h> #include <sys/device.h> @@ -36,6 +35,17 @@ #include <dev/pv/xenreg.h> #include <dev/pv/xenvar.h> +/* Xen requires locked atomic operations */ +#ifndef MULTIPROCESSOR +#define _XENMPATOMICS +#define MULTIPROCESSOR +#endif +#include <sys/atomic.h> +#ifdef _XENMPATOMICS +#undef MULTIPROCESSOR +#undef _XENMPATOMICS +#endif + struct xen_softc *xen_sc; int xen_init_hypercall(struct xen_softc *); @@ -1106,8 +1116,7 @@ xen_probe_devices(struct xen_softc *sc) xst.xst_sc = sc->sc_xs; xst.xst_flags |= XST_POLL; - if ((error = xs_cmd(&xst, XS_LIST, "device", &iovp1, - &iov1_cnt)) != 0) + if ((error = xs_cmd(&xst, XS_LIST, "device", &iovp1, &iov1_cnt)) != 0) return (error); for (i = 0; i < iov1_cnt; i++) { |