aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/scatterlist/linux/mm.h
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-10-12 10:20:03 +1000
committerDave Airlie <airlied@redhat.com>2017-10-12 10:20:03 +1000
commitc5c7bc71a0e6bc382744497e45c6c70503f9d7e6 (patch)
tree35a00018aa6165ce0c17e2e2d4aa398ffea119bc /tools/testing/scatterlist/linux/mm.h
parentdrm: Pass struct drm_file * to __drm_mode_object_find [v2] (diff)
parentdrm/i915: Update DRIVER_DATE to 20170929 (diff)
downloadlinux-dev-c5c7bc71a0e6bc382744497e45c6c70503f9d7e6.tar.xz
linux-dev-c5c7bc71a0e6bc382744497e45c6c70503f9d7e6.zip
Merge tag 'drm-intel-next-2017-09-29' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
2nd batch of v4.15 features: - lib/scatterlist updates, use for userptr allocations (Tvrtko) - Fixed point wrapper cleanup (Mahesh) - Gen9+ transition watermarks, watermark optimization and fixes (Mahesh) - Display IPC (Isochronous Priority Control) support (Mahesh) - GEM workaround fixes (Oscar) - GVT: PCI config sanitize series (Changbin) - GVT: Workload submission error handling series (Fred) - PSR fixes and refactoring (Rodrigo) - HWSP based optimizations (Chris) - Private PAT management (Zhi) - IRQ handling fixes and refactoring (Ville) - Module parameter refactoring and variable name clash fix (Michal) - Execlist refactoring, incomplete request unwinding on reset (Chris) - GuC scheduling improvements (Michal) - OA updates (Lionel) - Coffeelake out of alpha support (Rodrigo) - seqno fixes (Chris) - Execlist refactoring (Mika) - DP and DP MST cleanups (Dhinakaran) - Cannonlake slice/sublice config (Ben) - Numerous fixes all around (Everyone) * tag 'drm-intel-next-2017-09-29' of git://anongit.freedesktop.org/drm/drm-intel: (168 commits) drm/i915: Update DRIVER_DATE to 20170929 drm/i915: Use memset64() to prefill the GTT page drm/i915: Also discard second CRC on gen8+ platforms. drm/i915/psr: Set frames before SU entry for psr2 drm/dp: Add defines for latency in sink drm/i915: Allow optimized platform checks drm/i915: Avoid using dev_priv->info.gen directly. i915: Use %pS printk format for direct addresses drm/i915/execlists: Notify context-out for lost requests drm/i915/cnl: Add support slice/subslice/eu configs drm/i915: Compact device info access by a small re-ordering drm/i915: Add IS_PLATFORM macro drm/i915/selftests: Try to recover from a wedged GPU during reset tests drm/i915/huc: Reorganize HuC authentication drm/i915: Fix default values of some modparams drm/i915: Extend I915_PARAMS_FOR_EACH with default member value drm/i915: Make I915_PARAMS_FOR_EACH macro more flexible drm/i915: Enable scanline read based on frame timestamps drm/i915/execlists: Microoptimise execlists_cancel_port_request() drm/i915: Don't rmw PIPESTAT enable bits ...
Diffstat (limited to 'tools/testing/scatterlist/linux/mm.h')
-rw-r--r--tools/testing/scatterlist/linux/mm.h125
1 files changed, 125 insertions, 0 deletions
diff --git a/tools/testing/scatterlist/linux/mm.h b/tools/testing/scatterlist/linux/mm.h
new file mode 100644
index 000000000000..6f9ac14aa800
--- /dev/null
+++ b/tools/testing/scatterlist/linux/mm.h
@@ -0,0 +1,125 @@
+#ifndef _LINUX_MM_H
+#define _LINUX_MM_H
+
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+
+typedef unsigned long dma_addr_t;
+
+#define unlikely
+
+#define BUG_ON(x) assert(!(x))
+
+#define WARN_ON(condition) ({ \
+ int __ret_warn_on = !!(condition); \
+ unlikely(__ret_warn_on); \
+})
+
+#define WARN_ON_ONCE(condition) ({ \
+ int __ret_warn_on = !!(condition); \
+ if (unlikely(__ret_warn_on)) \
+ assert(0); \
+ unlikely(__ret_warn_on); \
+})
+
+#define PAGE_SIZE (4096)
+#define PAGE_SHIFT (12)
+#define PAGE_MASK (~(PAGE_SIZE-1))
+
+#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
+#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
+#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
+
+#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
+
+#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
+
+#define virt_to_page(x) ((void *)x)
+#define page_address(x) ((void *)x)
+
+static inline unsigned long page_to_phys(struct page *page)
+{
+ assert(0);
+
+ return 0;
+}
+
+#define page_to_pfn(page) ((unsigned long)(page) / PAGE_SIZE)
+#define pfn_to_page(pfn) (void *)((pfn) * PAGE_SIZE)
+#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
+
+#define __min(t1, t2, min1, min2, x, y) ({ \
+ t1 min1 = (x); \
+ t2 min2 = (y); \
+ (void) (&min1 == &min2); \
+ min1 < min2 ? min1 : min2; })
+
+#define ___PASTE(a,b) a##b
+#define __PASTE(a,b) ___PASTE(a,b)
+
+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
+
+#define min(x, y) \
+ __min(typeof(x), typeof(y), \
+ __UNIQUE_ID(min1_), __UNIQUE_ID(min2_), \
+ x, y)
+
+#define min_t(type, x, y) \
+ __min(type, type, \
+ __UNIQUE_ID(min1_), __UNIQUE_ID(min2_), \
+ x, y)
+
+#define preemptible() (1)
+
+static inline void *kmap(struct page *page)
+{
+ assert(0);
+
+ return NULL;
+}
+
+static inline void *kmap_atomic(struct page *page)
+{
+ assert(0);
+
+ return NULL;
+}
+
+static inline void kunmap(void *addr)
+{
+ assert(0);
+}
+
+static inline void kunmap_atomic(void *addr)
+{
+ assert(0);
+}
+
+static inline unsigned long __get_free_page(unsigned int flags)
+{
+ return (unsigned long)malloc(PAGE_SIZE);
+}
+
+static inline void free_page(unsigned long page)
+{
+ free((void *)page);
+}
+
+static inline void *kmalloc(unsigned int size, unsigned int flags)
+{
+ return malloc(size);
+}
+
+#define kfree(x) free(x)
+
+#define kmemleak_alloc(a, b, c, d)
+#define kmemleak_free(a)
+
+#define PageSlab(p) (0)
+#define flush_kernel_dcache_page(p)
+
+#endif