• Lucas De Marchi's avatar
    drm/xe: Fix LRC workarounds · 278c3582
    Lucas De Marchi authored
    Fix 2 issues when writing LRC workarounds by copying the same handling
    done when processing other RTP entries:
    
    For masked registers, it was not correctly setting the upper 16bits.
    Differently than i915, the entry itself doesn't set the upper bits
    for masked registers: this is done when applying them. Testing on ADL-P:
    
    Before:
    	[drm:xe_gt_record_default_lrcs [xe]] LRC WA rcs0 save-restore MMIOs
    	[drm:xe_gt_record_default_lrcs [xe]] REG[0x2580] = 0x00000002
    	...
    	[drm:xe_gt_record_default_lrcs [xe]] REG[0x7018] = 0x00002000
    	[drm:xe_gt_record_default_lrcs [xe]] REG[0x7300] = 0x00000040
    	[drm:xe_gt_record_default_lrcs [xe]] REG[0x7304] = 0x00000200
    
    After:
    	[drm:xe_gt_record_default_lrcs [xe]] LRC WA rcs0 save-restore MMIOs
    	[drm:xe_gt_record_default_lrcs [xe]] REG[0x2580] = 0x00060002
    	...
    	[drm:xe_gt_record_default_lrcs [xe]] REG[0x7018] = 0x20002000
    	[drm:xe_gt_record_default_lrcs [xe]] REG[0x7300] = 0x00400040
    	[drm:xe_gt_record_default_lrcs [xe]] REG[0x7304] = 0x02000200
    
    All of these registers are masked registers, so writing to them without
    the relevant bits in the upper 16b doesn't have any effect.
    
    Also, this adds support to regular registers; previously it was assumed
    that LRC entries would only contain masked registers. However this is
    not true. 0x6604 is not a masked register, but used in workarounds for
    e.g.  ADL-P. See commit 28cf243a ("drm/i915/gt: Fix context
    workarounds with non-masked regs"). In the same test with ADL-P as
    above:
    
    Before:
    	[drm:xe_gt_record_default_lrcs [xe]] REG[0x6604] = 0xe0000000
    After:
    	[drm:xe_gt_record_default_lrcs [xe]] REG[0x6604] = 0xe0efef6f
    
    As can be seen, now it will read what was in the register rather than
    completely overwrite the other bits.
    Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
    Link: https://lore.kernel.org/r/20230906012053.1733755-5-lucas.demarchi@intel.comSigned-off-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
    Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
    278c3582
xe_gt.c 15.4 KB