diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-07-25 13:54:40 +1000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-07-25 13:54:40 +1000 |
commit | a0236ff1b112b24c355dd6e7bcf145530b4e73b1 (patch) | |
tree | d3aa4f22d777a837bf8ad93063ed41535edb9c6e /lib/libvirtio/virtio-blk.c | |
parent | 8751768a4894c64daa75135a4e0e0ba5e7360fef (diff) | |
download | SLOF-a0236ff1b112b24c355dd6e7bcf145530b4e73b1.zip SLOF-a0236ff1b112b24c355dd6e7bcf145530b4e73b1.tar.gz SLOF-a0236ff1b112b24c355dd6e7bcf145530b4e73b1.tar.bz2 |
Use a global definition of sync() and mb()
For memory barriers accross the board. Also move the compiler barrier
to cpu.h
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'lib/libvirtio/virtio-blk.c')
-rw-r--r-- | lib/libvirtio/virtio-blk.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libvirtio/virtio-blk.c b/lib/libvirtio/virtio-blk.c index e470968..6f21404 100644 --- a/lib/libvirtio/virtio-blk.c +++ b/lib/libvirtio/virtio-blk.c @@ -11,12 +11,10 @@ *****************************************************************************/ #include <stdio.h> +#include <cpu.h> #include "virtio.h" #include "virtio-blk.h" -#define sync() asm volatile (" sync \n" ::: "memory") - - /** * Initialize virtio-block device. * @param dev pointer to virtio device information @@ -140,7 +138,7 @@ virtioblk_read(struct virtio_device *dev, char *buf, long blocknum, long cnt) desc->next = 0; vq_avail->ring[vq_avail->idx % vq_size] = id; - sync(); + mb(); vq_avail->idx += 1; /* Tell HV that the queue is ready */ @@ -150,7 +148,7 @@ virtioblk_read(struct virtio_device *dev, char *buf, long blocknum, long cnt) i = 10000000; while (*current_used_idx == last_used_idx && i-- > 0) { // do something better - sync(); + mb(); } if (status == 0) |