All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/i915: Add stub mmio read/write routines to mock device
@ 2017-04-11 23:44 Chris Wilson
  2017-04-11 23:44 ` [PATCH 2/3] drm/i915: Pretend the engine is always idle when mocking Chris Wilson
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Chris Wilson @ 2017-04-11 23:44 UTC (permalink / raw)
  To: intel-gfx

Provide dummy function pointers for the mock device in case we do hit
mmio during testing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_uncore.c              |  1 +
 drivers/gpu/drm/i915/selftests/mock_gem_device.c |  2 +
 drivers/gpu/drm/i915/selftests/mock_uncore.c     | 52 ++++++++++++++++++++++++
 drivers/gpu/drm/i915/selftests/mock_uncore.h     | 30 ++++++++++++++
 4 files changed, 85 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/selftests/mock_uncore.c
 create mode 100644 drivers/gpu/drm/i915/selftests/mock_uncore.h

diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index fb38c7692fc2..b08466b9b73a 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -1900,5 +1900,6 @@ intel_uncore_forcewake_for_reg(struct drm_i915_private *dev_priv,
 }
 
 #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+#include "selftests/mock_uncore.c"
 #include "selftests/intel_uncore.c"
 #endif
diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
index 6a8258eacdcb..f321bdfe0b5b 100644
--- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
@@ -30,6 +30,7 @@
 #include "mock_gem_device.h"
 #include "mock_gem_object.h"
 #include "mock_gtt.h"
+#include "mock_uncore.h"
 
 void mock_device_flush(struct drm_i915_private *i915)
 {
@@ -143,6 +144,7 @@ struct drm_i915_private *mock_gem_device(void)
 	mkwrite_device_info(i915)->gen = -1;
 
 	spin_lock_init(&i915->mm.object_stat_lock);
+	mock_uncore_init(i915);
 
 	init_waitqueue_head(&i915->gpu_error.wait_queue);
 	init_waitqueue_head(&i915->gpu_error.reset_queue);
diff --git a/drivers/gpu/drm/i915/selftests/mock_uncore.c b/drivers/gpu/drm/i915/selftests/mock_uncore.c
new file mode 100644
index 000000000000..c7ae6f9a000e
--- /dev/null
+++ b/drivers/gpu/drm/i915/selftests/mock_uncore.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include "mock_uncore.h"
+
+#define __nop_write(x) \
+static void \
+nop_write##x(struct drm_i915_private *dev_priv, i915_reg_t reg, u##x val, bool trace) { }
+__nop_write(8)
+__nop_write(16)
+__nop_write(32)
+
+#define __nop_read(x) \
+static u##x \
+nop_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { return 0; }
+__nop_read(8)
+__nop_read(16)
+__nop_read(32)
+__nop_read(64)
+
+void mock_uncore_init(struct drm_i915_private *i915)
+{
+	i915->uncore.funcs.mmio_writeb = nop_write8;
+	i915->uncore.funcs.mmio_writew = nop_write16;
+	i915->uncore.funcs.mmio_writel = nop_write32;
+
+	i915->uncore.funcs.mmio_readb = nop_read8;
+	i915->uncore.funcs.mmio_readw = nop_read16;
+	i915->uncore.funcs.mmio_readl = nop_read32;
+	i915->uncore.funcs.mmio_readq = nop_read64;
+}
diff --git a/drivers/gpu/drm/i915/selftests/mock_uncore.h b/drivers/gpu/drm/i915/selftests/mock_uncore.h
new file mode 100644
index 000000000000..d79aa3ca4d51
--- /dev/null
+++ b/drivers/gpu/drm/i915/selftests/mock_uncore.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#ifndef __MOCK_UNCORE_H
+#define __MOCK_UNCORE_H
+
+void mock_uncore_init(struct drm_i915_private *i915);
+
+#endif /* !__MOCK_UNCORE_H */
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/3] drm/i915: Pretend the engine is always idle when mocking
  2017-04-11 23:44 [PATCH 1/3] drm/i915: Add stub mmio read/write routines to mock device Chris Wilson
@ 2017-04-11 23:44 ` Chris Wilson
  2017-04-12  8:49   ` Joonas Lahtinen
  2017-04-11 23:44 ` [PATCH 3/3] drm/i915: Wake device for emitting request during selftest Chris Wilson
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Chris Wilson @ 2017-04-11 23:44 UTC (permalink / raw)
  To: intel-gfx

If we have a mock engine and it has no more requests in flight, report
it as idle as there is no hardware to contradict us! Otherwise we
attempt to query the hw that doesn't exist and find that the hw hasn't
set its idle bit and we get upset.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_engine_cs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
index ee87ca7420de..402769d9d840 100644
--- a/drivers/gpu/drm/i915/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/intel_engine_cs.c
@@ -1140,6 +1140,9 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)
 			       intel_engine_last_submit(engine)))
 		return false;
 
+	if (I915_SELFTEST_ONLY(engine->breadcrumbs.mock))
+		return true;
+
 	/* Interrupt/tasklet pending? */
 	if (test_bit(ENGINE_IRQ_EXECLIST, &engine->irq_posted))
 		return false;
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/3] drm/i915: Wake device for emitting request during selftest
  2017-04-11 23:44 [PATCH 1/3] drm/i915: Add stub mmio read/write routines to mock device Chris Wilson
  2017-04-11 23:44 ` [PATCH 2/3] drm/i915: Pretend the engine is always idle when mocking Chris Wilson
@ 2017-04-11 23:44 ` Chris Wilson
  2017-04-12  8:50   ` Joonas Lahtinen
  2017-04-12  0:01 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Add stub mmio read/write routines to mock device Patchwork
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Chris Wilson @ 2017-04-11 23:44 UTC (permalink / raw)
  To: intel-gfx

igt_mmap_offset_exhaustion() selftest was using live requests to make an
object busy, but we did not hold a runtime pm wakeref for submitting the
requests. Acquire it to avoid triggering "RPM wakelock ref not held
during HW access" warnings.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/selftests/i915_gem_object.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_object.c b/drivers/gpu/drm/i915/selftests/i915_gem_object.c
index 67d82bf1407f..33cc514f9fe8 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_object.c
@@ -545,7 +545,9 @@ static int igt_mmap_offset_exhaustion(void *arg)
 		}
 
 		mutex_lock(&i915->drm.struct_mutex);
+		intel_runtime_pm_get(i915);
 		err = make_obj_busy(obj);
+		intel_runtime_pm_put(i915);
 		mutex_unlock(&i915->drm.struct_mutex);
 		if (err) {
 			pr_err("[loop %d] Failed to busy the object\n", loop);
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Add stub mmio read/write routines to mock device
  2017-04-11 23:44 [PATCH 1/3] drm/i915: Add stub mmio read/write routines to mock device Chris Wilson
  2017-04-11 23:44 ` [PATCH 2/3] drm/i915: Pretend the engine is always idle when mocking Chris Wilson
  2017-04-11 23:44 ` [PATCH 3/3] drm/i915: Wake device for emitting request during selftest Chris Wilson
@ 2017-04-12  0:01 ` Patchwork
  2017-04-12  8:48 ` [PATCH 1/3] " Joonas Lahtinen
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2017-04-12  0:01 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/3] drm/i915: Add stub mmio read/write routines to mock device
URL   : https://patchwork.freedesktop.org/series/22891/
State : success

== Summary ==

Series 22891v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/22891/revisions/1/mbox/

Test gem_exec_suspend:
        Subgroup basic-s4-devices:
                dmesg-warn -> PASS       (fi-snb-2600) fdo#100125
                pass       -> DMESG-WARN (fi-kbl-7560u) fdo#100125

fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:430s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:428s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time:589s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:507s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:493s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:483s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:411s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:411s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:423s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:487s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:461s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:456s
fi-kbl-7560u     total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  time:570s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:450s
fi-skl-6700hq    total:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  time:572s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:464s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:497s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:433s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:535s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time:414s

f27f076a9b505b7d16bc743af16c3b7b142fcdc3 drm-tip: 2017y-04m-11d-19h-50m-43s UTC integration manifest
0e52f5e drm/i915: Wake device for emitting request during selftest
a6bdfd7 drm/i915: Pretend the engine is always idle when mocking
4f5ab3a drm/i915: Add stub mmio read/write routines to mock device

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4482/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] drm/i915: Add stub mmio read/write routines to mock device
  2017-04-11 23:44 [PATCH 1/3] drm/i915: Add stub mmio read/write routines to mock device Chris Wilson
                   ` (2 preceding siblings ...)
  2017-04-12  0:01 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Add stub mmio read/write routines to mock device Patchwork
@ 2017-04-12  8:48 ` Joonas Lahtinen
  2017-04-12  9:21 ` [PATCH v2] " Chris Wilson
  2017-04-12 10:30 ` ✓ Fi.CI.BAT: success for series starting with [v2] drm/i915: Add stub mmio read/write routines to mock device (rev2) Patchwork
  5 siblings, 0 replies; 12+ messages in thread
From: Joonas Lahtinen @ 2017-04-12  8:48 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On ke, 2017-04-12 at 00:44 +0100, Chris Wilson wrote:
> Provide dummy function pointers for the mock device in case we do hit
> mmio during testing.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] drm/i915: Pretend the engine is always idle when mocking
  2017-04-11 23:44 ` [PATCH 2/3] drm/i915: Pretend the engine is always idle when mocking Chris Wilson
@ 2017-04-12  8:49   ` Joonas Lahtinen
  0 siblings, 0 replies; 12+ messages in thread
From: Joonas Lahtinen @ 2017-04-12  8:49 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On ke, 2017-04-12 at 00:44 +0100, Chris Wilson wrote:
> If we have a mock engine and it has no more requests in flight, report
> it as idle as there is no hardware to contradict us! Otherwise we
> attempt to query the hw that doesn't exist and find that the hw hasn't
> set its idle bit and we get upset.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] drm/i915: Wake device for emitting request during selftest
  2017-04-11 23:44 ` [PATCH 3/3] drm/i915: Wake device for emitting request during selftest Chris Wilson
@ 2017-04-12  8:50   ` Joonas Lahtinen
  0 siblings, 0 replies; 12+ messages in thread
From: Joonas Lahtinen @ 2017-04-12  8:50 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On ke, 2017-04-12 at 00:44 +0100, Chris Wilson wrote:
> igt_mmap_offset_exhaustion() selftest was using live requests to make an
> object busy, but we did not hold a runtime pm wakeref for submitting the
> requests. Acquire it to avoid triggering "RPM wakelock ref not held
> during HW access" warnings.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2] drm/i915: Add stub mmio read/write routines to mock device
  2017-04-11 23:44 [PATCH 1/3] drm/i915: Add stub mmio read/write routines to mock device Chris Wilson
                   ` (3 preceding siblings ...)
  2017-04-12  8:48 ` [PATCH 1/3] " Joonas Lahtinen
@ 2017-04-12  9:21 ` Chris Wilson
  2017-04-12  9:36   ` Michal Wajdeczko
  2017-04-12 12:28   ` Joonas Lahtinen
  2017-04-12 10:30 ` ✓ Fi.CI.BAT: success for series starting with [v2] drm/i915: Add stub mmio read/write routines to mock device (rev2) Patchwork
  5 siblings, 2 replies; 12+ messages in thread
From: Chris Wilson @ 2017-04-12  9:21 UTC (permalink / raw)
  To: intel-gfx

Provide dummy function pointers for the mock device in case we do hit
mmio during testing.

v2: Use ASSIGN_READ/WRITE_MMIO_FUNCS macros

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> #v1
---
 drivers/gpu/drm/i915/intel_uncore.c              | 47 ++++++++++++------------
 drivers/gpu/drm/i915/selftests/mock_gem_device.c |  2 +
 drivers/gpu/drm/i915/selftests/mock_uncore.c     | 46 +++++++++++++++++++++++
 drivers/gpu/drm/i915/selftests/mock_uncore.h     | 30 +++++++++++++++
 4 files changed, 101 insertions(+), 24 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/selftests/mock_uncore.c
 create mode 100644 drivers/gpu/drm/i915/selftests/mock_uncore.h

diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index fb38c7692fc2..0cd56bf00650 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -1108,19 +1108,19 @@ __gen6_write(32)
 #undef GEN6_WRITE_FOOTER
 #undef GEN6_WRITE_HEADER
 
-#define ASSIGN_WRITE_MMIO_VFUNCS(x) \
+#define ASSIGN_WRITE_MMIO_VFUNCS(i915, x) \
 do { \
-	dev_priv->uncore.funcs.mmio_writeb = x##_write8; \
-	dev_priv->uncore.funcs.mmio_writew = x##_write16; \
-	dev_priv->uncore.funcs.mmio_writel = x##_write32; \
+	(i915)->uncore.funcs.mmio_writeb = x##_write8; \
+	(i915)->uncore.funcs.mmio_writew = x##_write16; \
+	(i915)->uncore.funcs.mmio_writel = x##_write32; \
 } while (0)
 
-#define ASSIGN_READ_MMIO_VFUNCS(x) \
+#define ASSIGN_READ_MMIO_VFUNCS(i915, x) \
 do { \
-	dev_priv->uncore.funcs.mmio_readb = x##_read8; \
-	dev_priv->uncore.funcs.mmio_readw = x##_read16; \
-	dev_priv->uncore.funcs.mmio_readl = x##_read32; \
-	dev_priv->uncore.funcs.mmio_readq = x##_read64; \
+	(i915)->uncore.funcs.mmio_readb = x##_read8; \
+	(i915)->uncore.funcs.mmio_readw = x##_read16; \
+	(i915)->uncore.funcs.mmio_readl = x##_read32; \
+	(i915)->uncore.funcs.mmio_readq = x##_read64; \
 } while (0)
 
 
@@ -1310,34 +1310,34 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 		i915_pmic_bus_access_notifier;
 
 	if (IS_GEN(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {
-		ASSIGN_WRITE_MMIO_VFUNCS(gen2);
-		ASSIGN_READ_MMIO_VFUNCS(gen2);
+		ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, gen2);
+		ASSIGN_READ_MMIO_VFUNCS(dev_priv, gen2);
 	} else if (IS_GEN5(dev_priv)) {
-		ASSIGN_WRITE_MMIO_VFUNCS(gen5);
-		ASSIGN_READ_MMIO_VFUNCS(gen5);
+		ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, gen5);
+		ASSIGN_READ_MMIO_VFUNCS(dev_priv, gen5);
 	} else if (IS_GEN(dev_priv, 6, 7)) {
-		ASSIGN_WRITE_MMIO_VFUNCS(gen6);
+		ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, gen6);
 
 		if (IS_VALLEYVIEW(dev_priv)) {
 			ASSIGN_FW_DOMAINS_TABLE(__vlv_fw_ranges);
-			ASSIGN_READ_MMIO_VFUNCS(fwtable);
+			ASSIGN_READ_MMIO_VFUNCS(dev_priv, fwtable);
 		} else {
-			ASSIGN_READ_MMIO_VFUNCS(gen6);
+			ASSIGN_READ_MMIO_VFUNCS(dev_priv, gen6);
 		}
 	} else if (IS_GEN8(dev_priv)) {
 		if (IS_CHERRYVIEW(dev_priv)) {
 			ASSIGN_FW_DOMAINS_TABLE(__chv_fw_ranges);
-			ASSIGN_WRITE_MMIO_VFUNCS(fwtable);
-			ASSIGN_READ_MMIO_VFUNCS(fwtable);
+			ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, fwtable);
+			ASSIGN_READ_MMIO_VFUNCS(dev_priv, fwtable);
 
 		} else {
-			ASSIGN_WRITE_MMIO_VFUNCS(gen8);
-			ASSIGN_READ_MMIO_VFUNCS(gen6);
+			ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, gen8);
+			ASSIGN_READ_MMIO_VFUNCS(dev_priv, gen6);
 		}
 	} else {
 		ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges);
-		ASSIGN_WRITE_MMIO_VFUNCS(fwtable);
-		ASSIGN_READ_MMIO_VFUNCS(fwtable);
+		ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, fwtable);
+		ASSIGN_READ_MMIO_VFUNCS(dev_priv, fwtable);
 		if (HAS_DECOUPLED_MMIO(dev_priv)) {
 			dev_priv->uncore.funcs.mmio_readl =
 						gen9_decoupled_read32;
@@ -1353,8 +1353,6 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 
 	i915_check_and_clear_faults(dev_priv);
 }
-#undef ASSIGN_WRITE_MMIO_VFUNCS
-#undef ASSIGN_READ_MMIO_VFUNCS
 
 void intel_uncore_fini(struct drm_i915_private *dev_priv)
 {
@@ -1900,5 +1898,6 @@ intel_uncore_forcewake_for_reg(struct drm_i915_private *dev_priv,
 }
 
 #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+#include "selftests/mock_uncore.c"
 #include "selftests/intel_uncore.c"
 #endif
diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
index 6a8258eacdcb..f321bdfe0b5b 100644
--- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
@@ -30,6 +30,7 @@
 #include "mock_gem_device.h"
 #include "mock_gem_object.h"
 #include "mock_gtt.h"
+#include "mock_uncore.h"
 
 void mock_device_flush(struct drm_i915_private *i915)
 {
@@ -143,6 +144,7 @@ struct drm_i915_private *mock_gem_device(void)
 	mkwrite_device_info(i915)->gen = -1;
 
 	spin_lock_init(&i915->mm.object_stat_lock);
+	mock_uncore_init(i915);
 
 	init_waitqueue_head(&i915->gpu_error.wait_queue);
 	init_waitqueue_head(&i915->gpu_error.reset_queue);
diff --git a/drivers/gpu/drm/i915/selftests/mock_uncore.c b/drivers/gpu/drm/i915/selftests/mock_uncore.c
new file mode 100644
index 000000000000..8ef14c7e5e38
--- /dev/null
+++ b/drivers/gpu/drm/i915/selftests/mock_uncore.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include "mock_uncore.h"
+
+#define __nop_write(x) \
+static void \
+nop_write##x(struct drm_i915_private *dev_priv, i915_reg_t reg, u##x val, bool trace) { }
+__nop_write(8)
+__nop_write(16)
+__nop_write(32)
+
+#define __nop_read(x) \
+static u##x \
+nop_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { return 0; }
+__nop_read(8)
+__nop_read(16)
+__nop_read(32)
+__nop_read(64)
+
+void mock_uncore_init(struct drm_i915_private *i915)
+{
+	ASSIGN_WRITE_MMIO_VFUNCS(i915, nop);
+	ASSIGN_READ_MMIO_VFUNCS(i915, nop);
+}
diff --git a/drivers/gpu/drm/i915/selftests/mock_uncore.h b/drivers/gpu/drm/i915/selftests/mock_uncore.h
new file mode 100644
index 000000000000..d79aa3ca4d51
--- /dev/null
+++ b/drivers/gpu/drm/i915/selftests/mock_uncore.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#ifndef __MOCK_UNCORE_H
+#define __MOCK_UNCORE_H
+
+void mock_uncore_init(struct drm_i915_private *i915);
+
+#endif /* !__MOCK_UNCORE_H */
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] drm/i915: Add stub mmio read/write routines to mock device
  2017-04-12  9:21 ` [PATCH v2] " Chris Wilson
@ 2017-04-12  9:36   ` Michal Wajdeczko
  2017-04-12 12:28   ` Joonas Lahtinen
  1 sibling, 0 replies; 12+ messages in thread
From: Michal Wajdeczko @ 2017-04-12  9:36 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Wed, Apr 12, 2017 at 10:21:43AM +0100, Chris Wilson wrote:
> Provide dummy function pointers for the mock device in case we do hit
> mmio during testing.
> 
> v2: Use ASSIGN_READ/WRITE_MMIO_FUNCS macros
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> #v1
> ---
>  drivers/gpu/drm/i915/intel_uncore.c              | 47 ++++++++++++------------
>  drivers/gpu/drm/i915/selftests/mock_gem_device.c |  2 +
>  drivers/gpu/drm/i915/selftests/mock_uncore.c     | 46 +++++++++++++++++++++++
>  drivers/gpu/drm/i915/selftests/mock_uncore.h     | 30 +++++++++++++++
>  4 files changed, 101 insertions(+), 24 deletions(-)
>  create mode 100644 drivers/gpu/drm/i915/selftests/mock_uncore.c
>  create mode 100644 drivers/gpu/drm/i915/selftests/mock_uncore.h
> 
> diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
> index fb38c7692fc2..0cd56bf00650 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.c
> +++ b/drivers/gpu/drm/i915/intel_uncore.c
> @@ -1108,19 +1108,19 @@ __gen6_write(32)
>  #undef GEN6_WRITE_FOOTER
>  #undef GEN6_WRITE_HEADER
>  
> -#define ASSIGN_WRITE_MMIO_VFUNCS(x) \
> +#define ASSIGN_WRITE_MMIO_VFUNCS(i915, x) \

Hmm, this seems to be little inconsistent with other macros:
we either use implicit "dev_priv" (like in I915_READ) or
use "dev_priv" as explicit param (like in IS_GEN).


>  do { \
> -	dev_priv->uncore.funcs.mmio_writeb = x##_write8; \
> -	dev_priv->uncore.funcs.mmio_writew = x##_write16; \
> -	dev_priv->uncore.funcs.mmio_writel = x##_write32; \
> +	(i915)->uncore.funcs.mmio_writeb = x##_write8; \
> +	(i915)->uncore.funcs.mmio_writew = x##_write16; \
> +	(i915)->uncore.funcs.mmio_writel = x##_write32; \
>  } while (0)
>  

<snip>

> +void mock_uncore_init(struct drm_i915_private *i915)
> +{
> +	ASSIGN_WRITE_MMIO_VFUNCS(i915, nop);
> +	ASSIGN_READ_MMIO_VFUNCS(i915, nop);
> +}

If you use "dev_priv" as name for the function param then
you can reuse existing ASSIGN_xxx_MMIO_VFUNC without any
change in their signature...

-Michal

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* ✓ Fi.CI.BAT: success for series starting with [v2] drm/i915: Add stub mmio read/write routines to mock device (rev2)
  2017-04-11 23:44 [PATCH 1/3] drm/i915: Add stub mmio read/write routines to mock device Chris Wilson
                   ` (4 preceding siblings ...)
  2017-04-12  9:21 ` [PATCH v2] " Chris Wilson
@ 2017-04-12 10:30 ` Patchwork
  2017-04-12 12:40   ` Chris Wilson
  5 siblings, 1 reply; 12+ messages in thread
From: Patchwork @ 2017-04-12 10:30 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [v2] drm/i915: Add stub mmio read/write routines to mock device (rev2)
URL   : https://patchwork.freedesktop.org/series/22891/
State : success

== Summary ==

Series 22891v2 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/22891/revisions/2/mbox/

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:431s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:425s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time:577s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:508s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:491s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:482s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:411s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:406s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:416s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:485s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:464s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:455s
fi-kbl-7560u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:570s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:458s
fi-skl-6700hq    total:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  time:572s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:465s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:491s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:438s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:530s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time:404s

02b830fd67a6a2681e7f64510c3256b51a85c21a drm-tip: 2017y-04m-12d-09h-19m-10s UTC integration manifest
1926747 drm/i915: Wake device for emitting request during selftest
573ce0e drm/i915: Pretend the engine is always idle when mocking
05a1b39 drm/i915: Add stub mmio read/write routines to mock device

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4486/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] drm/i915: Add stub mmio read/write routines to mock device
  2017-04-12  9:21 ` [PATCH v2] " Chris Wilson
  2017-04-12  9:36   ` Michal Wajdeczko
@ 2017-04-12 12:28   ` Joonas Lahtinen
  1 sibling, 0 replies; 12+ messages in thread
From: Joonas Lahtinen @ 2017-04-12 12:28 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On ke, 2017-04-12 at 10:21 +0100, Chris Wilson wrote:
> Provide dummy function pointers for the mock device in case we do hit
> mmio during testing.
> 
> v2: Use ASSIGN_READ/WRITE_MMIO_FUNCS macros
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> #v1

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: ✓ Fi.CI.BAT: success for series starting with [v2] drm/i915:  Add stub mmio read/write routines to mock device (rev2)
  2017-04-12 10:30 ` ✓ Fi.CI.BAT: success for series starting with [v2] drm/i915: Add stub mmio read/write routines to mock device (rev2) Patchwork
@ 2017-04-12 12:40   ` Chris Wilson
  0 siblings, 0 replies; 12+ messages in thread
From: Chris Wilson @ 2017-04-12 12:40 UTC (permalink / raw)
  To: intel-gfx

On Wed, Apr 12, 2017 at 10:30:10AM -0000, Patchwork wrote:
> == Series Details ==
> 
> Series: series starting with [v2] drm/i915: Add stub mmio read/write routines to mock device (rev2)
> URL   : https://patchwork.freedesktop.org/series/22891/
> State : success
> 
> == Summary ==
> 
> Series 22891v2 Series without cover letter
> https://patchwork.freedesktop.org/api/1.0/series/22891/revisions/2/mbox/

Thanks for the review. This is a good reminder that I need to pursue
getting the kselftests into BAT.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-04-12 12:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-11 23:44 [PATCH 1/3] drm/i915: Add stub mmio read/write routines to mock device Chris Wilson
2017-04-11 23:44 ` [PATCH 2/3] drm/i915: Pretend the engine is always idle when mocking Chris Wilson
2017-04-12  8:49   ` Joonas Lahtinen
2017-04-11 23:44 ` [PATCH 3/3] drm/i915: Wake device for emitting request during selftest Chris Wilson
2017-04-12  8:50   ` Joonas Lahtinen
2017-04-12  0:01 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Add stub mmio read/write routines to mock device Patchwork
2017-04-12  8:48 ` [PATCH 1/3] " Joonas Lahtinen
2017-04-12  9:21 ` [PATCH v2] " Chris Wilson
2017-04-12  9:36   ` Michal Wajdeczko
2017-04-12 12:28   ` Joonas Lahtinen
2017-04-12 10:30 ` ✓ Fi.CI.BAT: success for series starting with [v2] drm/i915: Add stub mmio read/write routines to mock device (rev2) Patchwork
2017-04-12 12:40   ` Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.