]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
tools/virtio/ringtest: tweaks for s390
authorHalil Pasic <pasic@linux.vnet.ibm.com>
Fri, 2 Sep 2016 15:59:36 +0000 (17:59 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 19 Jan 2017 21:46:32 +0000 (23:46 +0200)
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>
tools/virtio/ringtest/main.h

index 34e63cc4c572bfcafe6fecb4784fc4ba5079bf8a..14142faf040b7e81a1c38a983aa76d9ae50ee4e1 100644 (file)
@@ -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