aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-02-09 14:12:43 +0000
committerPeter Maydell <peter.maydell@linaro.org>2021-02-09 14:12:43 +0000
commit3ea2b27fb6caaf44dbd0f25dc75290ebccad1854 (patch)
treec320b013a94fb066c4292ba24ca774f8cd4094f6
parent41d306ec7d9885752fec434904df08b9c1aa3add (diff)
downloadqemu-arm-3ea2b27fb6caaf44dbd0f25dc75290ebccad1854.tar.gz
s390-ccw: Add virtio barrierss390-barriers
-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 */
}