It is currently possible for a RTP rule, and subsequently a workaround,
to expect contexts that may not be present when the workaround is
applied. For example, the workarounds in the engine_was[] in drm/xe/xe_wa.c
expect an engine entity to be active. Conversely, the gt_was[] is not
depending on an engine entity to implement its workarounds. This kunit
test addition checks the gt_was[] workaround list for any workarounds
with XEP_RTP_ENGINE_CLASS() rules. If a workaround does have one of
these rules, the workaround is then checked for the "FOREACH_ENGINE" flag,
which ensures the workaround is implemented properly.
The result of this test is an expectation failure if a workaround has an
improper XE_RTP_ENGINE_CLASS() rule setup, and aims to prevent future
issues of gt_was workarounds being applied without proper contexts.
The gt_tunings[] RTP table has the same functional layout and
requirements as gt_was[], so it shares the same kunit test function,
minimizing excessive code.
v6:
- No change
v5:
- Remove unnecessary headers from xe_rtp_table_test.c
v4:
- No change
v3:
- Removed "VISIBLE_IF_KUNIT" keyword from xe_wa.h
- Added gt_tunings[] for testing
- Reworked KUNIT_EXPECT_TRUE() for easier parsing of errors
v2:
- Moved contents of xe_rtp_tables_test.h to .c and removed file
- Renamed macro RTP_KUNIT_ARRAY_PARAM to RTP_TABLE_PARAM
- Removed unnecessary functions and iterative components from
generated _gen_params functions and implemented usage of table
name and WA number as entry name
- Condensed xe_rtp_table_gt_test() to use KUNIT_EXPECT_TRUE with no
message statement
- Removed xe_rtp_table_test_init() and xe_rtp_table_test_exit() as
fake device initialization is not necessary
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Signed-off-by: Violet Monti <violet.monti@intel.com>
Link: https://patch.msgid.link/20260601200947.2032784-8-violet.monti@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>