aboutsummaryrefslogtreecommitdiff
path: root/pc-bios/s390-ccw
diff options
context:
space:
mode:
Diffstat (limited to 'pc-bios/s390-ccw')
-rw-r--r--pc-bios/s390-ccw/virtio.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c
index ab49840db8..0af901264b 100644
--- a/pc-bios/s390-ccw/virtio.c
+++ b/pc-bios/s390-ccw/virtio.c
@@ -17,6 +17,12 @@
#include "helper.h"
#include "s390-time.h"
+#define membarrier() do { asm volatile("bcr 15,0\n" :: : "memory"); } while (0)
+
+#define __ASM_BARRIER "bcr 15,0\n"
+
+
+
#define VRING_WAIT_REPLY_TIMEOUT 30
static VRing block[VIRTIO_MAX_VQS];
@@ -154,12 +160,15 @@ void vring_send_buf(VRing *vr, void *p, int len, int flags)
/* Chains only have a single ID */
if (!(flags & VRING_DESC_F_NEXT)) {
+ membarrier();
vr->avail->idx++;
+ membarrier();
}
}
int vr_poll(VRing *vr)
{
+ membarrier();
if (vr->used->idx == vr->used_idx) {
vring_notify(vr);
yield();
@@ -169,7 +178,9 @@ int vr_poll(VRing *vr)
vr->used_idx = vr->used->idx;
vr->next_idx = 0;
vr->desc[0].len = 0;
+ membarrier();
vr->desc[0].flags = 0;
+ membarrier();
return 1; /* vr has been updated */
}