• Lucas De Marchi's avatar
    drm/xe: Add test for GT workarounds and tunings · b9d773fc
    Lucas De Marchi authored
    In order to avoid mistakes when populating the workarounds, it's good to
    be able to test if the entries added are all compatible for a certain
    platform. The platform itself is not needed as long as we create fake
    devices with enough configuration for the RTP helpers to process the
    tables.  Common mistakes that can be avoided:
    
    	- Entries clashing the bitfields being updated
    	- Register type being mixed (MCR vs regular / masked vs regular)
    	- Unexpected errors while adding the reg_sr entry
    
    To test, inject a duplicate entry in gt_was, but with platform == tigerlake
    rather than the currenct graphics version check:
    
           { XE_RTP_NAME("14011059788"),
    	 XE_RTP_RULES(PLATFORM(TIGERLAKE)),
    	 XE_RTP_ACTIONS(SET(GEN10_DFR_RATIO_EN_AND_CHICKEN, DFR_DISABLE))
           },
    
    This produces the following result:
    
    	$  ./tools/testing/kunit/kunit.py run \
    		--kunitconfig drivers/gpu/drm/xe/.kunitconfig  xe_wa
    
    	[14:18:02] Starting KUnit Kernel (1/1)...
    	[14:18:02] ============================================================
    	[14:18:02] ==================== xe_wa (1 subtest) =====================
    	[14:18:02] ======================== xe_wa_gt  =========================
    	[14:18:02] [drm:xe_reg_sr_add] *ERROR* Discarding save-restore reg 9550 (clear: 00000200, set: 00000200, masked: no): ret=-22
    	[14:18:02]     # xe_wa_gt: ASSERTION FAILED at drivers/gpu/drm/xe/tests/xe_wa_test.c:116
    	[14:18:02]     Expected gt->reg_sr.errors == 0, but
    	[14:18:02]         gt->reg_sr.errors == 1 (0x1)
    	[14:18:02] [FAILED] TIGERLAKE (B0)
    	[14:18:02] [PASSED] DG1 (A0)
    	[14:18:02] [PASSED] DG1 (B0)
    	...
    Signed-off-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
    Reviewed-by: default avatarMichał Winiarski <michal.winiarski@intel.com>
    Link: https://lore.kernel.org/r/20230401085151.1786204-8-lucas.demarchi@intel.comSigned-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
    b9d773fc
xe_wa.c 23.8 KB