test/gem_mocs_settings: Testing MOCS register settings
PATCH v3 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)
--- lib/ioctl_wrappers.c | 13 ++ lib/ioctl_wrappers.h | 1 + tests/Makefile.sources | 1 + tests/gem_mocs_settings.c | 559 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 574 insertions(+) create mode 100644 tests/gem_mocs_settings.c
lib/ioctl_wrappers.c +13 -0
@@ -1382,6 +1382,19 @@ void gem_require_ring(int fd, unsigned ring)igt_require (gem_has_ring (fd, ring)); } +/** +* gem_has_mocs: +* @fd: open i915 drm file descriptor +* +* Feature test macro to query whether the device has MOCS registers. +* These exist gen 9+. +*/ +void gem_has_mocs (int fd) +{ +const int gen =intel_gen (intel_get_drm_devid (fd)); +igt_require (gen >=9 ); +} +/* prime */ /**
lib/ioctl_wrappers.h +1 -0
@@ -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_has_mocs (int fd);/* prime */ struct local_dma_buf_sync {
tests/Makefile.sources +1 -0
@@ -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 +559 -0
559 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
Quoted 33 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.
v2: Reorganised the structure.
Added more tests. (Chris Wilson)
v3: Fixed a few bugs. (Chris Wilson)Signed-off-by Peter Antoine <[email protected]>--- lib/ioctl_wrappers.c | 13 ++ lib/ioctl_wrappers.h | 1 + tests/Makefile.sources | 1 + tests/gem_mocs_settings.c | 559 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 574 insertions(+) create mode 100644 tests/gem_mocs_settings.clib/ioctl_wrappers.c +0
-0@@ -1382,6 +1382,19 @@ void gem_require_ring(int fd, unsigned ring)igt_require (gem_has_ring (fd, ring));
lib/ioctl_wrappers.c void gem_require_ring(int fd, unsigned ring) · line 1392
Quoted 10 lines
lib/ioctl_wrappers.c +8
-0} +/** +* gem_has_mocs: +* @fd: open i915 drm file descriptor +* +* Feature test macro to query whether the device has MOCS registers. +* These exist gen 9+. +*/ +void gem_has_mocs (int fd)
gem_has_mocs() returns boolgem_require_mocs() calls igt_require() and doesn't return if not available.
Quoted 93 lines
lib/ioctl_wrappers.c +5
-0+{ +const int gen =intel_gen (intel_get_drm_devid (fd)); +igt_require (gen >=9 ); +} +/* prime */ /** lib/ioctl_wrappers.h +1
-0@@ -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_has_mocs (int fd);/* prime */ struct local_dma_buf_sync {tests/Makefile.sources +1
-0@@ -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 +55
-0@@ -0,0 +1,559 @@ +/* +* Copyright © 2016 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. +* +*/ + +/** @file gem_mocs_settings.c +* +* Check that the MOCs cache settings are valid. +*/ + +#include "igt.h" +#include "igt_gt.h" + +#define MAX_NUMBER_MOCS_REGISTERS (64) + +enum { +NONE , +RESET , +SUSPEND , +HIBERNATE +}; + +#define GEN9_LNCFCMOCS0 (0xB020)/* L3 Cache Control base */ +#define GEN9_GFX_MOCS_0 (0xc800)/* Graphics MOCS base register*/ +#define GEN9_MFX0_MOCS_0 (0xc900)/* Media 0 MOCS base register*/ +#define GEN9_MFX1_MOCS_0 (0xcA00)/* Media 1 MOCS base register*/ +#define GEN9_VEBOX_MOCS_0 (0xcB00)/* Video MOCS base register*/ +#define GEN9_BLT_MOCS_0 (0xcc00)/* Blitter MOCS base register*/ + +#define ENGINE_GFX (I915_EXEC_RENDER) +#define ENGINE_MFX0 (I915_EXEC_BSD) +#define ENGINE_MFX0_ALT (I915_EXEC_BSD | 1 << 13) +#define ENGINE_MFX1 (I915_EXEC_BSD | 2 << 13) +#define ENGINE_BLT (I915_EXEC_BLT) +#define ENGINE_VEBOX (I915_EXEC_VEBOX) +
tests/gem_mocs_settings.c line 65
Quoted 10 lines
tests/gem_mocs_settings.c new file +10
-0+struct mocs_entry { +uint32_t control_value; +uint16_t l3cc_value; +}; + +struct mocs_table { +uint32_t size; +const struct mocs_entry *table; +}; +
/* The first entries in the MOCS tables are defined by uABI */
Quoted 22 lines
tests/gem_mocs_settings.c new file +22
-0+static const struct mocs_entry skylake_mocs_table[] = { + {0x00000009 ,0x0010 }, + {0x00000038 ,0x0030 }, + {0x0000003b ,0x0030 }, +}; + +static const struct mocs_entry broxton_mocs_table[] = { + {0x00000009 ,0x0010 }, + {0x00000038 ,0x0030 }, + {0x0000003b ,0x0030 }, +}; + +static const struct mocs_entry dirty_table_mocs_table[] = { + {0x00007FFF ,0x003F }, + {0x00007FFF ,0x003F }, + {0x00007FFF ,0x003F }, +}; + +static const uint32_t write_values[] = { +0xFFFFFFFF , +0xFFFFFFFF , +0xFFFFFFFF ,
tests/gem_mocs_settings.c
Quoted 10 lines
tests/gem_mocs_settings.c new file +9
-0+ 0xFFFFFFFF +}; +static void test_mocs_values (int fd) +{ +const struct intel_execution_engine *e; + +for (e = intel_execution_engines; e->name; e++) +if (e->exec_id !=I915_EXEC_DEFAULT && +gem_has_ring (fd, e->exec_id | e->flags))
You could use
unsigned engine;
for_each_engine(fd, engine)
if (engine != 0) test_mocs_control_values(fd, engine);
Just to hide the gem_has_ring().
Quoted 17 lines
tests/gem_mocs_settings.c new file +17
-0+ + +test_mocs_l3cc_values (fd); +} + +#define MI_STORE_REGISTER_MEM_64_BIT_ADDR ((0x24 << 23) | 2) + +static int create_read_batch (struct drm_i915_gem_relocation_entry *reloc, +uint32_t *batch, +uint32_t dst_handle, +uint32_t size, +uint32_t reg_base) +{ +unsigned int index; +unsigned int offset =0 ; + +for (index =0 , offset =0 ; index < size; index++, offset +=4 )
tests/gem_mocs_settings.c line 211
Quoted 10 lines
tests/gem_mocs_settings.c new file +10
-0+ { + batch[offset] =MI_STORE_REGISTER_MEM_64_BIT_ADDR ; + batch[offset+1 ] = reg_base + (index *sizeof (uint32_t )); + batch[offset+2 ] = index *sizeof (uint32_t );/* reloc */ + batch[offset+3 ] =0 ; + + reloc[index].offset = (offset +2 ) *sizeof (uint32_t ); + reloc[index].delta = index *sizeof (uint32_t ); + reloc[index].target_handle = dst_handle; + reloc[index].write_domain =I915_GEM_DOMAIN_RENDER ;
Will cause an -EINVAL as you are specifing a write_domain but not the corresponding read_domain.
tests/gem_mocs_settings.c line 261
Quoted 9 lines
tests/gem_mocs_settings.c new file +9
-0+static void do_read_registers (int fd, +uint32_t ctx_id, +uint32_t dst_handle, +uint32_t reg_base, +uint32_t size, +uint32_t engine_id) +{ +gem_execbuf (fd, &execbuf); +gem_wait (fd, dst_handle, &timeout_ns);
As mentioned earlier, tried to avoid manual wait/sync so that we stress the kernel harder to do the right thing. Sometimes the sync is required as part of the test, but only rarely and should be well documented.
Quoted 13 lines
tests/gem_mocs_settings.c new file +12
-0+gem_close (fd, handle); +} +static void check_control_registers (int fd, +const struct intel_execution_engine *engine, +uint32_t ctx_id, +bool dirty) +{ +uint32_t dst_handle =gem_create (fd,4096 ); +uint32_t reg_base =get_engine_base (engine->exec_id | engine->flags); +uint32_t *read_regs; +struct mocs_table table; +
tests/gem_mocs_settings.c line 340
Quoted 10 lines
tests/gem_mocs_settings.c new file +10
-0+igt_assert (get_mocs_settings (intel_get_drm_devid (fd), &table, dirty)); + +do_read_registers (fd, + ctx_id, + dst_handle, + reg_base, + table.size, + engine->exec_id | engine->flags); + + read_regs =gem_mmap__cpu (fd, dst_handle,0 ,4096 ,PROT_READ );
Here you need the correspondinggem_set_comdin(fd, dst_handle, DOMAIN_CPU, 0);
and in check_l3cc_registers.
tests/gem_mocs_settings.c line 348
Quoted 8 lines
tests/gem_mocs_settings.c new file +8
-0+ +for (int index =0 ; index < table.size; index++) +igt_assert_eq (read_regs[index], + table.table[index].control_value); + +munmap (read_regs,4096 ); +gem_close (fd, dst_handle); +}
Otherwise, looking good. (Could use snooping or gem_read to minimise the clflush on bxt, but I don't think anyone will notice over 4k). -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
Quoted 36 lines · Chris Wilson
Quoted 35 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.
v2: Reorganised the structure.
Added more tests. (Chris Wilson)
v3: Fixed a few bugs. (Chris Wilson)Signed-off-by Peter Antoine <[email protected]>--- lib/ioctl_wrappers.c | 13 ++ lib/ioctl_wrappers.h | 1 + tests/Makefile.sources | 1 + tests/gem_mocs_settings.c | 559 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 574 insertions(+) create mode 100644 tests/gem_mocs_settings.clib/ioctl_wrappers.c +0
-0@@ -1382,6 +1382,19 @@ void gem_require_ring(int fd, unsigned ring)igt_require (gem_has_ring (fd, ring)); }
Quoted 13 lines
lib/ioctl_wrappers.c void gem_require_ring(int fd, unsigned ring) · line 1392
Quoted 8 lines
lib/ioctl_wrappers.c +8
-0+/** +* gem_has_mocs: +* @fd: open i915 drm file descriptor +* +* Feature test macro to query whether the device has MOCS registers. +* These exist gen 9+. +*/ +void gem_has_mocs (int fd)
gem_has_mocs()returns boolgem_require_mocs()callsigt_require()and doesn't return if not available.
Done.
Quoted 97 lines
Quoted 97 lines
lib/ioctl_wrappers.c +5
-0+{ +const int gen =intel_gen (intel_get_drm_devid (fd)); +igt_require (gen >=9 ); +} +/* prime */ /** lib/ioctl_wrappers.h +1
-0@@ -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_has_mocs (int fd);/* prime */ struct local_dma_buf_sync {tests/Makefile.sources +1
-0@@ -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 +59
-0@@ -0,0 +1,559 @@ +/* +* Copyright © 2016 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. +* +*/ + +/** @file gem_mocs_settings.c +* +* Check that the MOCs cache settings are valid. +*/ + +#include "igt.h" +#include "igt_gt.h" + +#define MAX_NUMBER_MOCS_REGISTERS (64) + +enum { +NONE , +RESET , +SUSPEND , +HIBERNATE +}; + +#define GEN9_LNCFCMOCS0 (0xB020)/* L3 Cache Control base */ +#define GEN9_GFX_MOCS_0 (0xc800)/* Graphics MOCS base register*/ +#define GEN9_MFX0_MOCS_0 (0xc900)/* Media 0 MOCS base register*/ +#define GEN9_MFX1_MOCS_0 (0xcA00)/* Media 1 MOCS base register*/ +#define GEN9_VEBOX_MOCS_0 (0xcB00)/* Video MOCS base register*/ +#define GEN9_BLT_MOCS_0 (0xcc00)/* Blitter MOCS base register*/ + +#define ENGINE_GFX (I915_EXEC_RENDER) +#define ENGINE_MFX0 (I915_EXEC_BSD) +#define ENGINE_MFX0_ALT (I915_EXEC_BSD | 1 << 13) +#define ENGINE_MFX1 (I915_EXEC_BSD | 2 << 13) +#define ENGINE_BLT (I915_EXEC_BLT) +#define ENGINE_VEBOX (I915_EXEC_VEBOX) + +struct mocs_entry { +uint32_t control_value; +uint16_t l3cc_value; +};
Quoted 9 lines
tests/gem_mocs_settings.c line 65
Quoted 6 lines
tests/gem_mocs_settings.c new file +6
-0+ +struct mocs_table { +uint32_t size; +const struct mocs_entry *table; +}; +/* The first entries in the MOCS tables are defined by uABI */
Added.
Quoted 35 lines
Quoted 22 lines
tests/gem_mocs_settings.c new file +22
-0+static const struct mocs_entry skylake_mocs_table[] = { + {0x00000009 ,0x0010 }, + {0x00000038 ,0x0030 }, + {0x0000003b ,0x0030 }, +}; + +static const struct mocs_entry broxton_mocs_table[] = { + {0x00000009 ,0x0010 }, + {0x00000038 ,0x0030 }, + {0x0000003b ,0x0030 }, +}; + +static const struct mocs_entry dirty_table_mocs_table[] = { + {0x00007FFF ,0x003F }, + {0x00007FFF ,0x003F }, + {0x00007FFF ,0x003F }, +}; + +static const uint32_t write_values[] = { +0xFFFFFFFF , +0xFFFFFFFF , +0xFFFFFFFF ,tests/gem_mocs_settings.c
Quoted 10 lines
tests/gem_mocs_settings.c new file +9
-0+ 0xFFFFFFFF +}; +static void test_mocs_values (int fd) +{ +const struct intel_execution_engine *e; + +for (e = intel_execution_engines; e->name; e++) +if (e->exec_id !=I915_EXEC_DEFAULT && +gem_has_ring (fd, e->exec_id | e->flags))You could use
Quoted 6 lines
unsigned engine;
for_each_engine(fd, engine)if (engine != 0) test_mocs_control_values(fd, engine);Just to hide the
gem_has_ring().
Done.
Quoted 23 lines
Quoted 23 lines
tests/gem_mocs_settings.c new file +22
-0+ + +test_mocs_l3cc_values (fd); +} + +#define MI_STORE_REGISTER_MEM_64_BIT_ADDR ((0x24 << 23) | 2) + +static int create_read_batch (struct drm_i915_gem_relocation_entry *reloc, +uint32_t *batch, +uint32_t dst_handle, +uint32_t size, +uint32_t reg_base) +{ +unsigned int index; +unsigned int offset =0 ; + +for (index =0 , offset =0 ; index < size; index++, offset +=4 ) + { + batch[offset] =MI_STORE_REGISTER_MEM_64_BIT_ADDR ; + batch[offset+1 ] = reg_base + (index *sizeof (uint32_t )); + batch[offset+2 ] = index *sizeof (uint32_t );/* reloc */ + batch[offset+3 ] =0 ;
Quoted 8 lines
tests/gem_mocs_settings.c line 211
Quoted 5 lines
tests/gem_mocs_settings.c new file +5
-0+ + reloc[index].offset = (offset +2 ) *sizeof (uint32_t ); + reloc[index].delta = index *sizeof (uint32_t ); + reloc[index].target_handle = dst_handle; + reloc[index].write_domain =I915_GEM_DOMAIN_RENDER ;Will cause an
-EINVALas you are specifing awrite_domainbut not the correspondingread_domain.
Removed.
(Did not cause an error when tested)
Quoted 14 lines
tests/gem_mocs_settings.c line 261
Quoted 10 lines
tests/gem_mocs_settings.c new file +9
-0+static void do_read_registers (int fd, +uint32_t ctx_id, +uint32_t dst_handle, +uint32_t reg_base, +uint32_t size, +uint32_t engine_id) +{ +gem_execbuf (fd, &execbuf); +gem_wait (fd, dst_handle, &timeout_ns);As mentioned earlier, tried to avoid manual wait/sync so that we stress the kernel harder to do the right thing. Sometimes the sync is required as part of the test, but only rarely and should be well documented.
replaced with set_domain.
Quoted 20 lines
Quoted 20 lines
tests/gem_mocs_settings.c new file +18
-0+gem_close (fd, handle); +} +static void check_control_registers (int fd, +const struct intel_execution_engine *engine, +uint32_t ctx_id, +bool dirty) +{ +uint32_t dst_handle =gem_create (fd,4096 ); +uint32_t reg_base =get_engine_base (engine->exec_id | engine->flags); +uint32_t *read_regs; +struct mocs_table table; + +igt_assert (get_mocs_settings (intel_get_drm_devid (fd), &table, dirty)); + + do_read_registers(fd, + ctx_id, + dst_handle, + reg_base,
Quoted 8 lines
tests/gem_mocs_settings.c line 340
Quoted 4 lines
tests/gem_mocs_settings.c new file +4
-0+ table.size, + engine->exec_id | engine->flags); + + read_regs =gem_mmap__cpu (fd, dst_handle,0 ,4096 ,PROT_READ );Here you need the corresponding
gem_set_comdin(fd, dst_handle, DOMAIN_CPU, 0);
and incheck_l3cc_registers.
Added into do_read_registers() so should handle both.
Quoted 15 lines
tests/gem_mocs_settings.c line 348
Quoted 9 lines
tests/gem_mocs_settings.c new file +8
-0+ +for (int index =0 ; index < table.size; index++) +igt_assert_eq (read_regs[index], + table.table[index].control_value); + +munmap (read_regs,4096 ); +gem_close (fd, dst_handle); +}Otherwise, looking good. (Could use snooping or
gem_readto minimise the clflush on bxt, but I don't think anyone will notice over 4k). -Chris
Ok.
Will run it on something not a BXT and then push again. So the other patched are good as well?
Thanks for the review.
Peter.
--
Peter Antoine (Android Graphics Driver Software Engineer)
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 14 lines · Peter Antoine
Quoted 6 lines
Quoted 6 lines
tests/gem_mocs_settings.c new file +6
-0+for (index =0 , offset =0 ; index < size; index++, offset +=4 ) + { + batch[offset] =MI_STORE_REGISTER_MEM_64_BIT_ADDR ; + batch[offset+1 ] = reg_base + (index *sizeof (uint32_t )); + batch[offset+2 ] = index *sizeof (uint32_t );/* reloc */ + batch[offset+3 ] =0 ;Quoted 8 lines
tests/gem_mocs_settings.c line 211
Quoted 5 lines
tests/gem_mocs_settings.c new file +5
-0+ + reloc[index].offset = (offset +2 ) *sizeof (uint32_t ); + reloc[index].delta = index *sizeof (uint32_t ); + reloc[index].target_handle = dst_handle; + reloc[index].write_domain =I915_GEM_DOMAIN_RENDER ;Will cause an
-EINVALas you are specifing awrite_domainbut not the correspondingread_domain.
Quoted 1 line
Removed.
I hope you meant added the missing read_domains!
Quoted 1 line
(Did not cause an error when tested)
Hmm, ok we don't actually warn about that!
Quoted 43 lines
Quoted 5 lines
Quoted 5 lines
tests/gem_mocs_settings.c new file +5
-0+static void do_read_registers(int fd, + uint32_t ctx_id, + uint32_t dst_handle, + uint32_t reg_base, + uint32_t size,Quoted 8 lines
tests/gem_mocs_settings.c line 261
Quoted 4 lines
tests/gem_mocs_settings.c new file +4
-0+ uint32_t engine_id) +{ +gem_execbuf (fd, &execbuf); +gem_wait (fd, dst_handle, &timeout_ns);As mentioned earlier, tried to avoid manual wait/sync so that we stress the kernel harder to do the right thing. Sometimes the sync is required as part of the test, but only rarely and should be well documented.
replaced with
set_domain.Quoted 20 lines
Quoted 20 lines
tests/gem_mocs_settings.c new file +18
-0+gem_close (fd, handle); +} +static void check_control_registers (int fd, +const struct intel_execution_engine *engine, +uint32_t ctx_id, +bool dirty) +{ +uint32_t dst_handle =gem_create (fd,4096 ); +uint32_t reg_base =get_engine_base (engine->exec_id | engine->flags); +uint32_t *read_regs; +struct mocs_table table; + +igt_assert (get_mocs_settings (intel_get_drm_devid (fd), &table, dirty)); + + do_read_registers(fd, + ctx_id, + dst_handle, + reg_base,Quoted 8 lines
tests/gem_mocs_settings.c line 340
Quoted 4 lines
tests/gem_mocs_settings.c new file +4
-0+ table.size, + engine->exec_id | engine->flags); + + read_regs =gem_mmap__cpu (fd, dst_handle,0 ,4096 ,PROT_READ );Here you need the corresponding
gem_set_comdin(fd, dst_handle, DOMAIN_CPU, 0);
and incheck_l3cc_registers.
Quoted 1 line
Added into
do_read_registers()so should handle both.
But less explicit and doesn't document the code as well. Move the set-domain next to the usage of dst_handle in the CPU domain. -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
Quoted 15 lines · Chris Wilson
Quoted 14 lines · Peter Antoine
Quoted 14 lines
tests/gem_mocs_settings.c line 211
Quoted 11 lines
tests/gem_mocs_settings.c new file +11
-0+for (index =0 , offset =0 ; index < size; index++, offset +=4 ) + { + batch[offset] =MI_STORE_REGISTER_MEM_64_BIT_ADDR ; + batch[offset+1 ] = reg_base + (index *sizeof (uint32_t )); + batch[offset+2 ] = index *sizeof (uint32_t );/* reloc */ + batch[offset+3 ] =0 ; + + reloc[index].offset = (offset +2 ) *sizeof (uint32_t ); + reloc[index].delta = index *sizeof (uint32_t ); + reloc[index].target_handle = dst_handle; + reloc[index].write_domain =I915_GEM_DOMAIN_RENDER ;Will cause an
-EINVALas you are specifing awrite_domainbut not the correspondingread_domain.
Quoted 8 lines
Quoted 1 line
Removed.
I hope you meant added the missing
read_domains!Quoted 1 line
(Did not cause an error when tested)
Hmm, ok we don't actually warn about that!
BXT no error, SKL error (different versions of the kernel). Added missing read_domains.
Quoted 43 lines
Quoted 43 lines
Quoted 5 lines
Quoted 5 lines
tests/gem_mocs_settings.c new file +5
-0+static void do_read_registers(int fd, + uint32_t ctx_id, + uint32_t dst_handle, + uint32_t reg_base, + uint32_t size,Quoted 8 lines
tests/gem_mocs_settings.c line 261
Quoted 4 lines
tests/gem_mocs_settings.c new file +4
-0+ uint32_t engine_id) +{ +gem_execbuf (fd, &execbuf); +gem_wait (fd, dst_handle, &timeout_ns);As mentioned earlier, tried to avoid manual wait/sync so that we stress the kernel harder to do the right thing. Sometimes the sync is required as part of the test, but only rarely and should be well documented.
replaced with
set_domain.Quoted 28 lines
Quoted 14 lines
tests/gem_mocs_settings.c new file +12
-0+gem_close (fd, handle); +} +static void check_control_registers (int fd, +const struct intel_execution_engine *engine, +uint32_t ctx_id, +bool dirty) +{ +uint32_t dst_handle =gem_create (fd,4096 ); +uint32_t reg_base =get_engine_base (engine->exec_id | engine->flags); +uint32_t *read_regs; +struct mocs_table table; +tests/gem_mocs_settings.c line 340
Quoted 10 lines
tests/gem_mocs_settings.c new file +10
-0+igt_assert (get_mocs_settings (intel_get_drm_devid (fd), &table, dirty)); + +do_read_registers (fd, + ctx_id, + dst_handle, + reg_base, + table.size, + engine->exec_id | engine->flags); + + read_regs =gem_mmap__cpu (fd, dst_handle,0 ,4096 ,PROT_READ );Here you need the corresponding
gem_set_comdin(fd, dst_handle, DOMAIN_CPU, 0);
and incheck_l3cc_registers.
Quoted 7 lines
Quoted 1 line
Added into
do_read_registers()so should handle both.But less explicit and doesn't document the code as well. Move the set-domain next to the usage of
dst_handlein the CPU domain. -Chris
Moved out of do_ream_domain()
Found an issue on SKL, it does not have the snoop bit that the BXT has, changed test so that the dirty check takes account of the different settable bits.
Version 4, coming now.
Peter.
--
Peter Antoine (Android Graphics Driver Software Engineer)
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx