• Tvrtko Ursulin's avatar
    drm/i915: Fix and improve MCR selection logic · 6c2b0103
    Tvrtko Ursulin authored
    A couple issues were present in this code:
    
    1.
    fls() usage was incorrect causing off by one in subslice mask lookup,
    which in other words means subslice mask of all zeroes is always used
    (subslice mask of a slice which is not present, or even out of bounds
    array access), rendering the checks in wa_init_mcr either futile or
    random.
    
    2.
    Condition in WARN_ON was not correct. It is doing a bitwise and operation
    between a positive (present subslices) and negative mask (disabled L3
    banks).
    
    This means that with corrected fls() usage the assert would always
    incorrectly fail.
    
    We could fix this by inverting the fuse bits in the check, but instead do
    one better and improve the code so it not only asserts, but finds the
    first common index between the two masks and only warns if no such index
    can be found.
    
    v2:
     * Simplify check for logic and redability.
     * Improve commentary explaining what is really happening ie. what the
       assert is really trying to check and why.
    
    v3:
     * Find first common index instead of just asserting.
    Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    Fixes: fe864b76 ("drm/i915: Implement WaProgramMgsrForL3BankSpecificMmioReads")
    Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> # v1
    Cc: Michał Winiarski <michal.winiarski@intel.com>
    Cc: Stuart Summers <stuart.summers@intel.com>
    Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Link: https://patchwork.freedesktop.org/patch/msgid/20190717180624.20354-4-tvrtko.ursulin@linux.intel.com
    6c2b0103
intel_engine_cs.c 43.5 KB