Skip to content

Commit fe864b7

Browse files
Yunwei Zhangmikuint
authored andcommitted
drm/i915: Implement WaProgramMgsrForL3BankSpecificMmioReads
L3Bank could be fused off in hardware for debug purpose, and it is possible that subslice is enabled while its corresponding L3Bank pairs are disabled. In such case, if MCR packet control register(0xFDC) is programed to point to a disabled bank pair, a MMIO read into L3Bank range will return 0 instead of correct values. However, this is not going to be the case in any production silicon. Therefore, we only check at initialization and issue a warning should this really happen. References: HSDES#1405586840 v2: - use fls instead of find_last_bit (Chris) - use is_power_of_2() instead of counting bit set (Chris) v3: - rebase on latest tip v5: - Added references (Mika) - Move local variable into scope where they are used (Ursulin) - use a new local variable to reduce long line of code (Ursulin) v6: - Some coding style and use more local variables for clearer logic (Ursulin) Cc: Oscar Mateo <[email protected]> Cc: Michel Thierry <[email protected]> Cc: Joonas Lahtinen <[email protected]> Cc: Chris Wilson <[email protected]> Cc: Mika Kuoppala <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Signed-off-by: Yunwei Zhang <[email protected]> Reviewed-by: Oscar Mateo <[email protected]> Signed-off-by: Mika Kuoppala <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent d78fa50 commit fe864b7

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2709,6 +2709,10 @@ enum i915_power_well_id {
27092709
#define GEN10_F2_SS_DIS_SHIFT 18
27102710
#define GEN10_F2_SS_DIS_MASK (0xf << GEN10_F2_SS_DIS_SHIFT)
27112711

2712+
#define GEN10_MIRROR_FUSE3 _MMIO(0x9118)
2713+
#define GEN10_L3BANK_PAIR_COUNT 4
2714+
#define GEN10_L3BANK_MASK 0x0F
2715+
27122716
#define GEN8_EU_DISABLE0 _MMIO(0x9134)
27132717
#define GEN8_EU_DIS0_S0_MASK 0xffffff
27142718
#define GEN8_EU_DIS0_S1_SHIFT 24

drivers/gpu/drm/i915/intel_workarounds.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,9 +674,44 @@ static void cfl_gt_workarounds_apply(struct drm_i915_private *dev_priv)
674674

675675
static void wa_init_mcr(struct drm_i915_private *dev_priv)
676676
{
677+
const struct sseu_dev_info *sseu = &(INTEL_INFO(dev_priv)->sseu);
677678
u32 mcr;
678679
u32 mcr_slice_subslice_mask;
679680

681+
/*
682+
* WaProgramMgsrForL3BankSpecificMmioReads: cnl,icl
683+
* L3Banks could be fused off in single slice scenario. If that is
684+
* the case, we might need to program MCR select to a valid L3Bank
685+
* by default, to make sure we correctly read certain registers
686+
* later on (in the range 0xB100 - 0xB3FF).
687+
* This might be incompatible with
688+
* WaProgramMgsrForCorrectSliceSpecificMmioReads.
689+
* Fortunately, this should not happen in production hardware, so
690+
* we only assert that this is the case (instead of implementing
691+
* something more complex that requires checking the range of every
692+
* MMIO read).
693+
*/
694+
if (INTEL_GEN(dev_priv) >= 10 &&
695+
is_power_of_2(sseu->slice_mask)) {
696+
/*
697+
* read FUSE3 for enabled L3 Bank IDs, if L3 Bank matches
698+
* enabled subslice, no need to redirect MCR packet
699+
*/
700+
u32 slice = fls(sseu->slice_mask);
701+
u32 fuse3 = I915_READ(GEN10_MIRROR_FUSE3);
702+
u8 ss_mask = sseu->subslice_mask[slice];
703+
704+
u8 enabled_mask = (ss_mask | ss_mask >>
705+
GEN10_L3BANK_PAIR_COUNT) & GEN10_L3BANK_MASK;
706+
u8 disabled_mask = fuse3 & GEN10_L3BANK_MASK;
707+
708+
/*
709+
* Production silicon should have matched L3Bank and
710+
* subslice enabled
711+
*/
712+
WARN_ON((enabled_mask & disabled_mask) != enabled_mask);
713+
}
714+
680715
mcr = I915_READ(GEN8_MCR_SELECTOR);
681716

682717
if (INTEL_GEN(dev_priv) >= 11)

0 commit comments

Comments
 (0)