Skip to contentSkip to conversation

test/gem_mocs_settings: Testing MOCS register settings

PATCH In review Peter Antoine 2 participants 2 messages Apr 11, 2016 – Apr 12, 2016 Library code

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 test/gem_mocs_settings: Testing MOCS register settings

The MOCS registers were added in Gen9 and define the caching policy. The registers are split into two sets. The first set controls the EDRAM policy and have a set for each engine, the second set controls the L3 policy. The two sets use the same index.

The RCS registers and the L3CC registers are stored in the RCS context.

The test checks that the registers are correct by checking the values by directly reading them via MMIO, then again it tests them by reading them from within a batch buffer. RCS engine is tested last as it programs the registers via a batch buffer and this will invalidate the test for workloads that don't use the render ring or don't run a render batch first.

v2: Reorganised the structure.
Added more tests. (Chris Wilson)
v3: Fixed a few bugs. (Chris Wilson)
v4: More Tidy-ups. (Chris Wilson)
SKL does does not have a snoop bit. (Peter Antoine)

---
 lib/ioctl_wrappers.c      |  13 ++
 lib/ioctl_wrappers.h      |   1 +
 tests/Makefile.sources    |   1 +
 tests/gem_mocs_settings.c | 573 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 588 insertions(+)
 create mode 100644 tests/gem_mocs_settings.c
lib/ioctl_wrappers.c +13 -0
index 076bce8..12912fe 100644
@@ -1382,6 +1382,19 @@ void gem_require_ring(int fd, unsigned ring)
 	igt_require(gem_has_ring(fd, ring));
 }
 
+/**
+ * gem_require_mocs:
+ * @fd: open i915 drm file descriptor
+ *
+ * Feature test macro to query whether the device has MOCS registers.
+ * These exist gen 9+.
+ */
+void gem_require_mocs(int fd)
+{
+	const int gen = intel_gen(intel_get_drm_devid(fd));
+	igt_require(gen >= 9);
+}
+
 /* prime */
 
 /**
lib/ioctl_wrappers.h +1 -0
index d986f61..1383062 100644
@@ -154,6 +154,7 @@ bool gem_has_softpin(int fd);
 void gem_require_caching(int fd);
 bool gem_has_ring(int fd, unsigned ring);
 void gem_require_ring(int fd, unsigned ring);
+void gem_require_mocs(int fd);
 
 /* prime */
 struct local_dma_buf_sync {
tests/Makefile.sources +1 -0
index 43f232f..d483c9e 100644
@@ -148,6 +148,7 @@ TESTS_progs = \
 	gem_lut_handle \
 	gem_mmap_offset_exhaustion \
 	gem_media_fill \
+	gem_mocs_settings \
 	gem_gpgpu_fill \
 	gem_pin \
 	gem_reg_read \
tests/gem_mocs_settings.c new file +573 -0

573 lines not on this page · raw message

Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 14 lines · Peter Antoine

The MOCS registers were added in Gen9 and define the caching policy. The registers are split into two sets. The first set controls the EDRAM policy and have a set for each engine, the second set controls the L3 policy. The two sets use the same index.

The RCS registers and the L3CC registers are stored in the RCS context.

The test checks that the registers are correct by checking the values by directly reading them via MMIO, then again it tests them by reading them from within a batch buffer. RCS engine is tested last as it programs the registers via a batch buffer and this will invalidate the test for workloads that don't use the render ring or don't run a render batch first.

Quoted 5 lines

v2: Reorganised the structure.
Added more tests. (Chris Wilson)
v3: Fixed a few bugs. (Chris Wilson)
v4: More Tidy-ups. (Chris Wilson)
SKL does does not have a snoop bit. (Peter Antoine)

Still got the domain control wrong, but I fixed that up and pushed. I also tweaked a few of the tests along the way... -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx