summaryrefslogtreecommitdiff
path: root/tools/virtio/linux/kernel.h
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2016-08-15 04:50:55 +0300
committerMichael S. Tsirkin <mst@redhat.com>2016-08-15 05:05:51 +0300
commit6be3ffaa0e15c64f560904b025f5c50bef5886f9 (patch)
tree73aab67c5d66b71b6e6ca0a9f38dd37e031b0049 /tools/virtio/linux/kernel.h
parent446374d7c7f89603d8151b56824e2cac85ed8e0d (diff)
downloadlinux-6be3ffaa0e15c64f560904b025f5c50bef5886f9.tar.xz
tools/virtio: add dma stubs
Fixes build after recent IOMMU-related changes, mustly by adding more stubs. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'tools/virtio/linux/kernel.h')
-rw-r--r--tools/virtio/linux/kernel.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/virtio/linux/kernel.h b/tools/virtio/linux/kernel.h
index 033849948215..d9554fc3f340 100644
--- a/tools/virtio/linux/kernel.h
+++ b/tools/virtio/linux/kernel.h
@@ -20,7 +20,9 @@
#define PAGE_SIZE getpagesize()
#define PAGE_MASK (~(PAGE_SIZE-1))
+#define PAGE_ALIGN(x) ((x + PAGE_SIZE - 1) & PAGE_MASK)
+typedef unsigned long long phys_addr_t;
typedef unsigned long long dma_addr_t;
typedef size_t __kernel_size_t;
typedef unsigned int __wsum;
@@ -57,6 +59,11 @@ static inline void *kzalloc(size_t s, gfp_t gfp)
return p;
}
+static inline void *alloc_pages_exact(size_t s, gfp_t gfp)
+{
+ return kmalloc(s, gfp);
+}
+
static inline void kfree(void *p)
{
if (p >= __kfree_ignore_start && p < __kfree_ignore_end)
@@ -64,6 +71,11 @@ static inline void kfree(void *p)
free(p);
}
+static inline void free_pages_exact(void *p, size_t s)
+{
+ kfree(p);
+}
+
static inline void *krealloc(void *p, size_t s, gfp_t gfp)
{
return realloc(p, s);
@@ -105,6 +117,8 @@ static inline void free_page(unsigned long addr)
#define dev_err(dev, format, ...) fprintf (stderr, format, ## __VA_ARGS__)
#define dev_warn(dev, format, ...) fprintf (stderr, format, ## __VA_ARGS__)
+#define WARN_ON_ONCE(cond) ((cond) && fprintf (stderr, "WARNING\n"))
+
#define min(x, y) ({ \
typeof(x) _min1 = (x); \
typeof(y) _min2 = (y); \