[Intel-xe] [PATCH v2 6/7] drm/xe: Add basic unit tests for rtp

Michał Winiarski michal.winiarski at intel.com
Mon Apr 3 11:33:55 UTC 2023


On Sat, Apr 01, 2023 at 01:51:50AM -0700, Lucas De Marchi wrote:
> Add some basic unit tests for rtp. This is intended to prove the
> functionality of the rtp itself, like coalescing entries, rejecting
> non-disjoint values, etc.
> 
> Contrary to the other tests in xe, this is a unit test to test the
> sw-side only, so it can be executed on any machine - it doesn't interact
> with the real hardware. Running it produces the following output:
> 
> 	$ ./tools/testing/kunit/kunit.py run --raw_output-kunit  \
> 		--kunitconfig drivers/gpu/drm/xe/.kunitconfig xe_rtp
> 	...
> 	[01:26:27] Starting KUnit Kernel (1/1)...
> 	KTAP version 1
> 	1..1
> 	    KTAP version 1
> 	    # Subtest: xe_rtp
> 	    1..1
> 		KTAP version 1
> 		# Subtest: xe_rtp_process_tests
> 		ok 1 coalesce-same-reg
> 		ok 2 no-match-no-add
> 		ok 3 no-match-no-add-multiple-rules
> 		ok 4 two-regs-two-entries
> 		ok 5 clr-one-set-other
> 		ok 6 set-field
> 	[drm:xe_reg_sr_add] *ERROR* Discarding save-restore reg 0001 (clear: 00000001, set: 00000001, masked: no): ret=-22
> 		ok 7 conflict-duplicate
> 	[drm:xe_reg_sr_add] *ERROR* Discarding save-restore reg 0001 (clear: 00000003, set: 00000000, masked: no): ret=-22
> 		ok 8 conflict-not-disjoint
> 	[drm:xe_reg_sr_add] *ERROR* Discarding save-restore reg 0001 (clear: 00000002, set: 00000002, masked: no): ret=-22
> 	[drm:xe_reg_sr_add] *ERROR* Discarding save-restore reg 0001 (clear: 00000001, set: 00000001, masked: yes): ret=-22
> 		ok 9 conflict-reg-type
> 	    # xe_rtp_process_tests: pass:9 fail:0 skip:0 total:9
> 	    ok 1 xe_rtp_process_tests
> 	# Totals: pass:9 fail:0 skip:0 total:9
> 	ok 1 xe_rtp
> 	...
> 
> Note that the ERRORs in the kernel log are expected since it's testing
> incompatible entries.
> 
> v2:
>   - Use parameterized table for tests  (Michał Winiarski)
>   - Move everything to the xe_rtp_test.ko and only add a few exports to the
>     right namespace
>   - Add more tests to cover FIELD_SET, CLR, partially true rules, etc
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
> Reviewed-by: Maarten Lankhorst<maarten.lankhorst at linux.intel.com> # v1

Reviewed-by: Michał Winiarski <michal.winiarski at intel.com>

-Michał

> ---
>  drivers/gpu/drm/xe/Kconfig.debug       |   1 +
>  drivers/gpu/drm/xe/tests/Makefile      |   7 +-
>  drivers/gpu/drm/xe/tests/xe_rtp_test.c | 318 +++++++++++++++++++++++++
>  drivers/gpu/drm/xe/xe_reg_sr.c         |   2 +
>  drivers/gpu/drm/xe/xe_rtp.c            |   3 +
>  5 files changed, 329 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/gpu/drm/xe/tests/xe_rtp_test.c


More information about the Intel-xe mailing list