lib: Disable MI_STORE_DATA_IMM for gen3 (i915g and i915gm)

The early gen3 machines inherited the MI block and restrictions from
gen2, and may only use physical addresses in conjunction with
MI_STORE_DATA_IMM -- that makes it unusable for us from userspace, where
we can only use virtual offsets.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index f2a94b5..c98f15f 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -22,11 +22,18 @@
  *
  */
 
-#include "igt.h"
-#include "igt_dummyload.h"
 #include <time.h>
 #include <signal.h>
-#include <sys/syscall.h>
+#include <pthread.h>
+
+#include <i915_drm.h>
+
+#include "igt_core.h"
+#include "igt_dummyload.h"
+#include "igt_gt.h"
+#include "intel_chipset.h"
+#include "intel_reg.h"
+#include "ioctl_wrappers.h"
 
 /**
  * SECTION:igt_dummyload
diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index d5e8b55..b3f3b38 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -557,6 +557,9 @@
 	if (gen <= 2) /* requires physical addresses */
 		return false;
 
+	if (gen == 3 && (info->is_grantsdale || info->is_alviso))
+		return false; /* only supports physical addresses */
+
 	if (gen == 6 && (engine & ~(3<<13)) == I915_EXEC_BSD)
 		return false; /* kills the machine! */
 
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index 8915edc..090c125 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -32,6 +32,7 @@
 
 #include <stdint.h>
 #include <stdbool.h>
+#include <sys/mman.h>
 #include <intel_bufmgr.h>
 #include <i915_drm.h>