Author: Vignesh R <vignesh.r@timesys.com>
Date: Thu, 7 Sep 2023 09:44:21 +0530

---
 benchmarks/gem_syslatency.c          |  4 ++++
 lib/nouveau/nvif/push.h              | 10 ++++++++++
 lib/tests/igt_assert.c               |  4 ++++
 tests/intel/gem_exec_latency.c        |  4 ++++
 tests/intel/gem_exec_schedule.c       |  4 ++++
 tests/intel/gem_userptr_blits.c       |  8 ++++++++
 tests/kms_cursor_legacy.c            |  4 ++++
 tools/i915-perf/i915_perf_recorder.c |  8 ++++++++
 8 files changed, 46 insertions(+)

diff --git a/benchmarks/gem_syslatency.c b/benchmarks/gem_syslatency.c
index 312c428..d2a0133 100644
--- a/benchmarks/gem_syslatency.c
+++ b/benchmarks/gem_syslatency.c
@@ -42,6 +42,10 @@
 #include <limits.h>
 #include "drm.h"
 
+#ifndef MADV_HUGEPAGE
+#define MADV_HUGEPAGE 14
+#endif
+
 #ifdef __linux__
 #include <linux/unistd.h>
 #endif
diff --git a/lib/nouveau/nvif/push.h b/lib/nouveau/nvif/push.h
index 7826ffc..8d8c5f4 100644
--- a/lib/nouveau/nvif/push.h
+++ b/lib/nouveau/nvif/push.h
@@ -77,12 +77,22 @@ PUSH_REFN(struct nouveau_pushbuf *push, struct nouveau_bo *bo, uint32_t flags)
 } while (0)
 
 #define PUSH_ASSERT_ON(a, b) igt_assert_f((a), "Pushbuffer assertion failed: %s (%s)\n", #a, b)
+
+#ifndef __USE_ISOC11
+#define PUSH_ASSERT(a, b) do {                                            \
+	_Static_assert(                                                    \
+		__builtin_choose_expr(__builtin_constant_p(a), (a), 1), b \
+	);                                                                \
+	PUSH_ASSERT_ON((a), b);                                           \
+} while (0)
+#else
 #define PUSH_ASSERT(a, b) do {                                            \
 	static_assert(                                                    \
 		__builtin_choose_expr(__builtin_constant_p(a), (a), 1), b \
 	);                                                                \
 	PUSH_ASSERT_ON((a), b);                                           \
 } while (0)
+#endif
 
 #define PUSH_DATA__(push, data, fmt, args...) do {                      \
 	struct nouveau_pushbuf *_push = (push);                         \
diff --git a/lib/tests/igt_assert.c b/lib/tests/igt_assert.c
index 3523a46..92747c7 100644
--- a/lib/tests/igt_assert.c
+++ b/lib/tests/igt_assert.c
@@ -80,7 +80,11 @@ static void test_cmpint_negative(void)
 	CHECK_NEG(igt_assert_eq_u64(0xfffffffffffeffffULL, 0xffffffffffffffffULL));
 
 	CHECK_NEG(igt_assert_eq_double(0.0, DBL_MAX));
+#ifdef __UCLIBC__
+	CHECK_NEG(igt_assert_eq_double(DBL_MAX, nextafter(DBL_MAX, 0.0)));
+#else
 	CHECK_NEG(igt_assert_eq_double(DBL_MAX, nexttoward(DBL_MAX, 0.0)));
+#endif
 
 	if (*exec_before != exec_total)
 		raise(SIGSEGV);
diff --git a/tests/intel/gem_exec_latency.c b/tests/intel/gem_exec_latency.c
index fcdf778..1acbbfe 100644
--- a/tests/intel/gem_exec_latency.c
+++ b/tests/intel/gem_exec_latency.c
@@ -55,6 +55,10 @@
 #define CORK 0x2
 #define PREEMPT 0x4
 
+#ifndef SCHED_RESET_ON_FORK
+#define SCHED_RESET_ON_FORK 0x40000000
+#endif
+
 static unsigned int ring_size;
 static double rcs_clock;
 static struct intel_mmio_data mmio_data;
diff --git a/tests/intel/gem_exec_schedule.c b/tests/intel/gem_exec_schedule.c
index 58b118c..ce2b80e 100644
--- a/tests/intel/gem_exec_schedule.c
+++ b/tests/intel/gem_exec_schedule.c
@@ -45,6 +45,10 @@
 #include "intel_ctx.h"
 #include "sw_sync.h"
 
+#ifndef SCHED_RESET_ON_FORK
+#define SCHED_RESET_ON_FORK 0x40000000
+#endif
+
 #define LO 0
 #define HI 1
 #define NOISE 2
diff --git a/tests/intel/gem_userptr_blits.c b/tests/intel/gem_userptr_blits.c
index 6985086..093cfd2 100644
--- a/tests/intel/gem_userptr_blits.c
+++ b/tests/intel/gem_userptr_blits.c
@@ -71,6 +71,14 @@
 #define PAGE_SIZE 4096
 #endif
 
+#ifndef MFD_HUGETLB
+#define MFD_HUGETLB 0x0004U
+#endif
+
+#ifndef MADV_HUGEPAGE
+#define MADV_HUGEPAGE 14
+#endif
+
 static uint32_t userptr_flags;
 
 #define WIDTH 512
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index f1e5590..732600c 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -31,6 +31,10 @@
 #include "igt_rand.h"
 #include "igt_stats.h"
 
+#ifndef SCHED_IDLE
+#define SCHED_IDLE 5
+#endif
+
 #if defined(__x86_64__) || defined(__i386__)
 #define cpu_relax()	__builtin_ia32_pause()
 #else
diff --git a/tools/i915-perf/i915_perf_recorder.c b/tools/i915-perf/i915_perf_recorder.c
index d16f154..72f1d73 100644
--- a/tools/i915-perf/i915_perf_recorder.c
+++ b/tools/i915-perf/i915_perf_recorder.c
@@ -55,6 +55,14 @@
 #define MAX(a,b) ((a) > (b) ? (a) : (b))
 #define MIN(a,b) ((a) < (b) ? (a) : (b))
 
+#ifndef CLOCK_BOOTTIME
+#define CLOCK_BOOTTIME 7
+#endif
+
+#ifndef CLOCK_MONOTONIC_RAW
+#define CLOCK_MONOTONIC_RAW 4
+#endif
+
 struct circular_buffer {
 	char   *data;
 	size_t  allocated_size;
-- 
2.25.1

