[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[UNIKRAFT PATCH RFCv3 25/32] plat/virtio: Use better iormb/iowmb on arm64



This replace better mb with the old rmb/wmb

Signed-off-by: Jia He <justin.he@xxxxxxx>
---
 plat/drivers/include/virtio/virtio_config.h | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/plat/drivers/include/virtio/virtio_config.h 
b/plat/drivers/include/virtio/virtio_config.h
index b80f26a..84421b4 100644
--- a/plat/drivers/include/virtio/virtio_config.h
+++ b/plat/drivers/include/virtio/virtio_config.h
@@ -115,8 +115,18 @@ static inline void _virtio_cread_bytes(const void *addr, 
const __u8 offset,
 #else  /* __X86_64__ */
 
 /* IO barriers */
-#define __iormb()              rmb()
-#define __iowmb()              wmb()
+#define __iormb(v)                                                     \
+({                                                                     \
+       unsigned long tmp;                                              \
+       dmb(oshld);                                                     \
+                                                                       \
+       asm volatile("eor       %0, %1, %1\n"                           \
+                    "cbnz      %0, ."                                  \
+                    : "=r" (tmp) : "r" ((unsigned long)(v))            \
+                    : "memory");                                       \
+})
+
+#define __iowmb()              dmb(oshst)
 
 static inline void _virtio_cwrite_bytes(const void *addr, const __u8 offset,
                                        const void *buf, int len, int type_len)
@@ -168,7 +178,7 @@ static inline void _virtio_cread_bytes(const void *addr, 
const __u8 offset,
                default:
                        UK_CRASH("Unsupported virtio read operation\n");
                }
-               __iormb();
+               __iormb(io_addr);
        }
 }
 
-- 
2.17.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.