Skip to content

Commit

Permalink
tools/virtio/ringtest: tweaks for s390
Browse files Browse the repository at this point in the history
Make ringtest work on s390 too.

Signed-off-by: Halil Pasic <[email protected]>
Acked-by: Sascha Silbe <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
  • Loading branch information
Halil Pasic authored and mstsirkin committed Jan 19, 2017
1 parent 21f5eda commit 47a4c49
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tools/virtio/ringtest/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 47a4c49

Please sign in to comment.