150-virtio-revert_dma_wmb_rmb_weak_barriers.patch 951 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
  2. index 8e50888..67e06fe 100644
  3. --- a/include/linux/virtio_ring.h
  4. +++ b/include/linux/virtio_ring.h
  5. @@ -21,20 +21,19 @@
  6. * actually quite cheap.
  7. */
  8. +#ifdef CONFIG_SMP
  9. static inline void virtio_mb(bool weak_barriers)
  10. {
  11. -#ifdef CONFIG_SMP
  12. if (weak_barriers)
  13. smp_mb();
  14. else
  15. -#endif
  16. mb();
  17. }
  18. static inline void virtio_rmb(bool weak_barriers)
  19. {
  20. if (weak_barriers)
  21. - dma_rmb();
  22. + smp_rmb();
  23. else
  24. rmb();
  25. }
  26. @@ -42,10 +41,26 @@ static inline void virtio_rmb(bool weak_barriers)
  27. static inline void virtio_wmb(bool weak_barriers)
  28. {
  29. if (weak_barriers)
  30. - dma_wmb();
  31. + smp_wmb();
  32. else
  33. wmb();
  34. }
  35. +#else
  36. +static inline void virtio_mb(bool weak_barriers)
  37. +{
  38. + mb();
  39. +}
  40. +
  41. +static inline void virtio_rmb(bool weak_barriers)
  42. +{
  43. + rmb();
  44. +}
  45. +
  46. +static inline void virtio_wmb(bool weak_barriers)
  47. +{
  48. + wmb();
  49. +}
  50. +#endif
  51. struct virtio_device;
  52. struct virtqueue;