From 3eaed73131565d4b1feb79238497144cb14792f7 Mon Sep 17 00:00:00 2001 From: Mike Belopuhov Date: Tue, 26 Jan 2016 15:23:12 +0000 Subject: 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 , thanks! --- sys/dev/pv/xen.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'sys/dev') 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 #include -#include #include #include #include @@ -36,6 +35,17 @@ #include #include +/* Xen requires locked atomic operations */ +#ifndef MULTIPROCESSOR +#define _XENMPATOMICS +#define MULTIPROCESSOR +#endif +#include +#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++) { -- cgit v1.2.3