diff options
author | Halil Pasic <pasic@linux.vnet.ibm.com> | 2016-09-02 11:59:36 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2017-01-19 16:46:32 -0500 |
commit | 47a4c49af6cc1982ce613c8ee79aab459d04c44c (patch) | |
tree | 5be8c4aa8ac2c32d6ac76f3fed2b4cd92a5863fa | |
parent | 21f5eda9b8671744539c8295b9df62991fffb2ce (diff) |
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>
-rw-r--r-- | tools/virtio/ringtest/main.h | 12 |
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) | |||
26 | #define VMEXIT_CYCLES 500 | 26 | #define VMEXIT_CYCLES 500 |
27 | #define VMENTRY_CYCLES 500 | 27 | #define VMENTRY_CYCLES 500 |
28 | 28 | ||
29 | #elif defined(__s390x__) | ||
30 | static inline void wait_cycles(unsigned long long cycles) | ||
31 | { | ||
32 | asm volatile("0: brctg %0,0b" : : "d" (cycles)); | ||
33 | } | ||
34 | |||
35 | /* tweak me */ | ||
36 | #define VMEXIT_CYCLES 200 | ||
37 | #define VMENTRY_CYCLES 200 | ||
38 | |||
29 | #else | 39 | #else |
30 | static inline void wait_cycles(unsigned long long cycles) | 40 | static inline void wait_cycles(unsigned long long cycles) |
31 | { | 41 | { |
@@ -81,6 +91,8 @@ extern unsigned ring_size; | |||
81 | /* Is there a portable way to do this? */ | 91 | /* Is there a portable way to do this? */ |
82 | #if defined(__x86_64__) || defined(__i386__) | 92 | #if defined(__x86_64__) || defined(__i386__) |
83 | #define cpu_relax() asm ("rep; nop" ::: "memory") | 93 | #define cpu_relax() asm ("rep; nop" ::: "memory") |
94 | #elif defined(__s390x__) | ||
95 | #define cpu_relax() barrier() | ||
84 | #else | 96 | #else |
85 | #define cpu_relax() assert(0) | 97 | #define cpu_relax() assert(0) |
86 | #endif | 98 | #endif |