summaryrefslogtreecommitdiffstats
path: root/tools/virtio
diff options
context:
space:
mode:
authorHalil Pasic <pasic@linux.vnet.ibm.com>2016-09-02 17:59:36 +0200
committerMichael S. Tsirkin <mst@redhat.com>2017-01-19 22:46:32 +0100
commit47a4c49af6cc1982ce613c8ee79aab459d04c44c (patch)
tree5be8c4aa8ac2c32d6ac76f3fed2b4cd92a5863fa /tools/virtio
parenttools/virtio/ringtest: fix run-on-all.sh for offline cpus (diff)
downloadlinux-47a4c49af6cc1982ce613c8ee79aab459d04c44c.tar.xz
linux-47a4c49af6cc1982ce613c8ee79aab459d04c44c.zip
tools/virtio/ringtest: tweaks for s390
Make ringtest work on s390 too. Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com> Acked-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'tools/virtio')
-rw-r--r--tools/virtio/ringtest/main.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/virtio/ringtest/main.h b/tools/virtio/ringtest/main.h
index 34e63cc4c572..14142faf040b 100644
--- a/tools/virtio/ringtest/main.h
+++ b/tools/virtio/ringtest/main.h
@@ -26,6 +26,16 @@ static inline void wait_cycles(unsigned long long cycles)
#define VMEXIT_CYCLES 500
#define VMENTRY_CYCLES 500
+#elif defined(__s390x__)
+static inline void wait_cycles(unsigned long long cycles)
+{
+ asm volatile("0: brctg %0,0b" : : "d" (cycles));
+}
+
+/* tweak me */
+#define VMEXIT_CYCLES 200
+#define VMENTRY_CYCLES 200
+
#else
static inline void wait_cycles(unsigned long long cycles)
{
@@ -81,6 +91,8 @@ extern unsigned ring_size;
/* Is there a portable way to do this? */
#if defined(__x86_64__) || defined(__i386__)
#define cpu_relax() asm ("rep; nop" ::: "memory")
+#elif defined(__s390x__)
+#define cpu_relax() barrier()
#else
#define cpu_relax() assert(0)
#endif