Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/xen/include Remove mb(), rmb() and wmb() from the k...
details: https://anonhg.NetBSD.org/src/rev/72de04191c6d
branches: trunk
changeset: 838842:72de04191c6d
user: cherry <cherry%NetBSD.org@localhost>
date: Sat Feb 02 14:50:15 2019 +0000
description:
Remove mb(), rmb() and wmb() from the kernel namespace.
These are introduced by external/bsd/common/include/asm/barrier.h
The purpose of barrier.h is to bridge the use of linux API calls
within code which uses them, such as drm code. The XEN api implicitly
uses these calls which are linuxisms within io/ring.h
This diff undos the damage.
The correct fix is to modify io/ring.h to not assume that all OSs that
XEN runs on has these functions, and to appropriately conditionally via
#ifdef __NetBSD__/#endif use the appropriate NetBSD functions. These
changes then need to be pushed upstream.
diffstat:
sys/arch/xen/include/hypervisor.h | 16 ++++++++++++++--
sys/arch/xen/include/xenring.h | 25 ++++++++++++++++++++++---
2 files changed, 36 insertions(+), 5 deletions(-)
diffs (84 lines):
diff -r f1043cb0f915 -r 72de04191c6d sys/arch/xen/include/hypervisor.h
--- a/sys/arch/xen/include/hypervisor.h Sat Feb 02 12:40:31 2019 +0000
+++ b/sys/arch/xen/include/hypervisor.h Sat Feb 02 14:50:15 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.h,v 1.47 2019/02/02 12:32:55 cherry Exp $ */
+/* $NetBSD: hypervisor.h,v 1.48 2019/02/02 14:50:15 cherry Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -80,7 +80,7 @@
#define s32 int32_t
#define s64 int64_t
-#include <external/bsd/common/include/asm/barrier.h> /* Linux mb() and friends */
+#include <sys/atomic.h>
#include <xen/include/public/xen.h>
#include <xen/include/public/sched.h>
@@ -94,6 +94,18 @@
#include <xen/include/public/io/netif.h>
#include <xen/include/public/io/blkif.h>
+/* Undo namespace damage from xen/include/public/io/ring.h
+ * The proper fix is to get upstream to stop assuming that all OSs use
+ * mb(), rmb(), wmb().
+ */
+#undef xen_mb
+#undef xen_rmb
+#undef xen_wmb
+
+#define xen_mb() membar_sync()
+#define xen_rmb() membar_producer()
+#define xen_wmb() membar_consumer()
+
#include <machine/hypercalls.h>
#undef u8
diff -r f1043cb0f915 -r 72de04191c6d sys/arch/xen/include/xenring.h
--- a/sys/arch/xen/include/xenring.h Sat Feb 02 12:40:31 2019 +0000
+++ b/sys/arch/xen/include/xenring.h Sat Feb 02 14:50:15 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xenring.h,v 1.1 2019/02/02 12:32:55 cherry Exp $ */
+/* $NetBSD: xenring.h,v 1.2 2019/02/02 14:50:15 cherry Exp $ */
/*
* Glue goop for xbd ring request/response protocol structures.
@@ -10,10 +10,28 @@
#ifndef _XEN_RING_H
#define _XEN_RING_H
-#if __XEN_INTERFACE_VERSION__ >= 0x00030201
+#if (__XEN_INTERFACE_VERSION__ >= 0x00030201) &&
+ (__XEN_INTERFACE_VERSION < 0x00030208)
#include <xen/include/public/io/ring.h>
+/*
+ * Undo namespace damage from xen/include/public/io/ring.h
+ * The proper fix is to get upstream to stop assuming that all OSs use
+ * mb(), rmb(), wmb().
+ */
+#undef xen_mb
+#undef xen_rmb
+#undef xen_wmb
+
+#define xen_mb() membar_sync()
+#define xen_rmb() membar_producer()
+#define xen_wmb() membar_consumer()
+
+/*
+ * Define ring types. These were previously part of the public API.
+ * Not anymore.
+ */
DEFINE_RING_TYPES(blkif_x86_32, struct blkif_request, struct blkif_response);
DEFINE_RING_TYPES(blkif_x86_64, struct blkif_request, struct blkif_response);
@@ -30,5 +48,6 @@
};
typedef union blkif_back_ring_proto blkif_back_ring_proto_t;
-#endif /* __XEN_INTERFACE_VERSION__ >= 0x00030201 */
+#endif /* __XEN_INTERFACE_VERSION__ */
+
#endif /* _XEN_RING_H_ */
Home |
Main Index |
Thread Index |
Old Index