Skip to contentSkip to conversation

tools/virtio: add dma barrier stubs

PATCH In review Michael S. Tsirkin 2 participants 6 messages Jul 25, 2018 – Jul 30, 2018 virtio core

lore
Share & tools
lore
author maintainer
#1 lore raw

PATCH 2/2 tools/virtio: add kmalloc_array stub

In reply to Michael S. Tsirkin
Fixes 6da2ec56059 ("treewide: kmalloc() -> kmalloc_array()")
---
 tools/virtio/linux/kernel.h | 5 +++++
 1 file changed, 5 insertions(+)
tools/virtio/linux/kernel.h +5 -0
index fca8381bbe04..fb22bccfbc8a 100644
@@ -52,6 +52,11 @@ static inline void *kmalloc(size_t s, gfp_t gfp)
 		return __kmalloc_fake;
 	return malloc(s);
 }
+static inline void *kmalloc_array(unsigned n, size_t s, gfp_t gfp)
+{
+	return kmalloc(n * s, gfp);
+}
+
 static inline void *kzalloc(size_t s, gfp_t gfp)
 {
 	void *p = kmalloc(s, gfp);
Signature · 1 line
MST

Michael S. Tsirkin

author maintainer
#0 lore raw

PATCH 1/2 tools/virtio: add dma barrier stubs

Fixes 55e49dc43a8 ("virtio_ring: switch to dma_XX barriers for rpmsg")
---
 tools/virtio/asm/barrier.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/virtio/asm/barrier.h +2 -2
index 0ac3caf90877..d0351f83aebe 100644
@@ -13,8 +13,8 @@
 } while (0);
 /* Weak barriers should be used. If not - it's a bug */
 # define mb() abort()
-# define rmb() abort()
-# define wmb() abort()
+# define dma_rmb() abort()
+# define dma_wmb() abort()
 #else
 #error Please fill in barrier macros
 #endif
Signature · 1 line
MST
author maintainer
#2 lore raw

PATCH 2/2 tools/virtio: add kmalloc_array stub

Fixes 6da2ec56059 ("treewide: kmalloc() -> kmalloc_array()")
---
 tools/virtio/linux/kernel.h | 5 +++++
 1 file changed, 5 insertions(+)
tools/virtio/linux/kernel.h +5 -0
index fca8381bbe04..fb22bccfbc8a 100644
@@ -52,6 +52,11 @@ static inline void *kmalloc(size_t s, gfp_t gfp)
 		return __kmalloc_fake;
 	return malloc(s);
 }
+static inline void *kmalloc_array(unsigned n, size_t s, gfp_t gfp)
+{
+	return kmalloc(n * s, gfp);
+}
+
 static inline void *kzalloc(size_t s, gfp_t gfp)
 {
 	void *p = kmalloc(s, gfp);
Signature · 1 line
MST
Reviewed-by on v1 1/2
#5 lore raw
In reply to Michael S. Tsirkin
Quoted 11 lines · Michael S. Tsirkin
Fixes 55e49dc43a8 ("virtio_ring: switch to dma_XX barriers for rpmsg")
---
  tools/virtio/asm/barrier.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
tools/virtio/asm/barrier.h +0 -0
index 0ac3caf90877..d0351f83aebe 100644

tools/virtio/asm/barrier.h line 20

Quoted 10 lines
tools/virtio/asm/barrier.h +2 -2
@@ -13,8 +13,8 @@
  } while (0);
  /* Weak barriers should be used. If not - it's a bug */
  # define mb() abort()
-# define rmb() abort()
-# define wmb() abort()
+# define dma_rmb() abort()
+# define dma_wmb() abort()
  #else
  #error Please fill in barrier macros
  #endif

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reviewed-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] tools/virtio: add kmalloc_array stub

In reply to Michael S. Tsirkin
Quoted 12 lines · Michael S. Tsirkin
Fixes 6da2ec56059 ("treewide: kmalloc() -> kmalloc_array()")
---
  tools/virtio/linux/kernel.h | 5 +++++
  1 file changed, 5 insertions(+)
tools/virtio/linux/kernel.h +0 -0
index fca8381bbe04..fb22bccfbc8a 100644
@@ -52,6 +52,11 @@ static inline void *kmalloc(size_t s, gfp_t gfp)
  		return __kmalloc_fake;

tools/virtio/linux/kernel.h static inline void *kmalloc(size_t s, gfp_t gfp) · line 62

Quoted 10 lines
tools/virtio/linux/kernel.h +5 -0
  	return malloc(s);
  }
+static inline void *kmalloc_array(unsigned n, size_t s, gfp_t gfp)
+{
+	return kmalloc(n * s, gfp);
+}
+
  static inline void *kzalloc(size_t s, gfp_t gfp)
  {
  	void *p = kmalloc(s, gfp);

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] tools/virtio: add kmalloc_array stub

In reply to Michael S. Tsirkin
Quoted 12 lines · Michael S. Tsirkin
Fixes 6da2ec56059 ("treewide: kmalloc() -> kmalloc_array()")
---
  tools/virtio/linux/kernel.h | 5 +++++
  1 file changed, 5 insertions(+)
tools/virtio/linux/kernel.h +0 -0
index fca8381bbe04..fb22bccfbc8a 100644
@@ -52,6 +52,11 @@ static inline void *kmalloc(size_t s, gfp_t gfp)
  		return __kmalloc_fake;

tools/virtio/linux/kernel.h static inline void *kmalloc(size_t s, gfp_t gfp) · line 62

Quoted 10 lines
tools/virtio/linux/kernel.h +5 -0
  	return malloc(s);
  }
+static inline void *kmalloc_array(unsigned n, size_t s, gfp_t gfp)
+{
+	return kmalloc(n * s, gfp);
+}
+
  static inline void *kzalloc(size_t s, gfp_t gfp)
  {
  	void *p = kmalloc(s, gfp);