virtio_ring: use virt_store_mb
[cascardo/linux.git] / include / linux / virtio_ring.h
index 8e50888..a156e2b 100644 (file)
@@ -12,7 +12,7 @@
  * anyone care?
  *
  * For virtio_pci on SMP, we don't need to order with respect to MMIO
- * accesses through relaxed memory I/O windows, so smp_mb() et al are
+ * accesses through relaxed memory I/O windows, so virt_mb() et al are
  * sufficient.
  *
  * For using virtio to talk to real devices (eg. other heterogeneous
 
 static inline void virtio_mb(bool weak_barriers)
 {
-#ifdef CONFIG_SMP
        if (weak_barriers)
-               smp_mb();
+               virt_mb();
        else
-#endif
                mb();
 }
 
 static inline void virtio_rmb(bool weak_barriers)
 {
        if (weak_barriers)
-               dma_rmb();
+               virt_rmb();
        else
                rmb();
 }
@@ -42,11 +40,22 @@ static inline void virtio_rmb(bool weak_barriers)
 static inline void virtio_wmb(bool weak_barriers)
 {
        if (weak_barriers)
-               dma_wmb();
+               virt_wmb();
        else
                wmb();
 }
 
+static inline void virtio_store_mb(bool weak_barriers,
+                                  __virtio16 *p, __virtio16 v)
+{
+       if (weak_barriers) {
+               virt_store_mb(*p, v);
+       } else {
+               WRITE_ONCE(*p, v);
+               mb();
+       }
+}
+
 struct virtio_device;
 struct virtqueue;