drm/i915/cnl: Implement WaProgramMgsrForCorrectSliceSpecificMmioReads
Subsystems (2)
PATCH 1/2 drm/i915/cnl: Implement WaProgramMgsrForCorrectSliceSpecificMmioReads
WaProgramMgsrForCorrectSliceSpecificMmioReads dictate that before any MMIO read into Slice/Subslice specific registers, MCR packet control register(0xFDC) needs to be programmed to point to any enabled slice/subslice pair. Otherwise, incorrect value will be returned.
However, that means each subsequent MMIO read will be forwarded to a specific slice/subslice combination as read is unicast. This is OK since slice/subslice specific register values are consistent in almost all cases across slice/subslice. There are rare occasions such as INSTDONE that this value will be dependent on slice/subslice combo, in such cases, we need to program 0xFDC and recover this after. This is already covered by read_subslice_reg for INSTDONE.
Also, 0xFDC will lose its information after TDR/engine reset/power state change.
--- drivers/gpu/drm/i915/intel_engine_cs.c | 43 ++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_engine_cs.c +41 -2
@@ -781,6 +781,29 @@ const char *i915_cache_level_str(struct drm_i915_private *i915, int type) } } +static u32 calculate_mcr (u32 mcr,struct drm_i915_private *dev_priv) +{ +const struct sseu_dev_info *sseu = &(INTEL_INFO (dev_priv)->sseu); +u32 slice =find_last_bit ((unsigned long *)&(sseu->slice_mask), +sizeof (sseu->slice_mask)); +u32 subslice =find_last_bit ((unsigned long *)&(sseu->subslice_mask[slice]), +sizeof (sseu->subslice_mask[0 ])); + + mcr &= ~(GEN8_MCR_SLICE_MASK |GEN8_MCR_SUBSLICE_MASK ); + mcr |=GEN8_MCR_SLICE (slice) |GEN8_MCR_SUBSLICE (subslice); + +return mcr; +} + +static void wa_init_mcr (struct drm_i915_private *dev_priv) +{ +u32 mcr; + + mcr =I915_READ (GEN8_MCR_SELECTOR ); + mcr =calculate_mcr (mcr, dev_priv); +I915_WRITE (GEN8_MCR_SELECTOR , mcr); +} +static inline uint32_t read_subslice_reg (struct drm_i915_private *dev_priv,int slice,int subslice,i915_reg_t reg)
@@ -799,18 +822,31 @@ read_subslice_reg(struct drm_i915_private *dev_priv, int slice,intel_uncore_forcewake_get__locked (dev_priv, fw_domains); mcr =I915_READ_FW (GEN8_MCR_SELECTOR ); +/* * The HW expects the slice and sublice selectors to be reset to 0 * after reading out the registers. */ -WARN_ON_ONCE (mcr & (GEN8_MCR_SLICE_MASK |GEN8_MCR_SUBSLICE_MASK )); +if (INTEL_GEN (dev_priv) <10 ) +WARN_ON_ONCE (mcr & (GEN8_MCR_SLICE_MASK | +GEN8_MCR_SUBSLICE_MASK )); + mcr &= ~(GEN8_MCR_SLICE_MASK |GEN8_MCR_SUBSLICE_MASK ); mcr |=GEN8_MCR_SLICE (slice) |GEN8_MCR_SUBSLICE (subslice);I915_WRITE_FW (GEN8_MCR_SELECTOR , mcr); ret =I915_READ_FW (reg); - mcr &= ~(GEN8_MCR_SLICE_MASK |GEN8_MCR_SUBSLICE_MASK ); +/* +* WaProgramMgsrForCorrectSliceSpecificMmioReads:cnl +* expects mcr to be programed to a enabled slice/subslice pair +* before any MMIO read into slice/subslice register +*/ +if (INTEL_GEN (dev_priv) <10 ) + mcr &= ~(GEN8_MCR_SLICE_MASK |GEN8_MCR_SUBSLICE_MASK ); +else + mcr =calculate_mcr (mcr, dev_priv); +I915_WRITE_FW (GEN8_MCR_SELECTOR , mcr);intel_uncore_forcewake_put__locked (dev_priv, fw_domains);
@@ -1278,6 +1314,9 @@ static int cnl_init_workarounds(struct intel_engine_cs *engine)struct drm_i915_private *dev_priv = engine->i915;int ret; +/* WaProgramMgsrForCorrectSliceSpecificMmioReads: cnl */ +wa_init_mcr (dev_priv); +/* WaDisableI2mCycleOnWRPort:cnl (pre-prod) */ if (IS_CNL_REVID (dev_priv,CNL_REVID_B0 ,CNL_REVID_B0 )) I915_WRITE(GAMT_CHKN_BIT_REG,
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/2 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.
--- drivers/gpu/drm/i915/i915_reg.h | 4 ++++ drivers/gpu/drm/i915/intel_engine_cs.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +4 -0
@@ -2849,6 +2849,10 @@ enum i915_power_well_id {#define GEN10_F2_SS_DIS_SHIFT 18#define GEN10_F2_SS_DIS_MASK (0xf << GEN10_F2_SS_DIS_SHIFT) +#define GEN10_MIRROR_FUSE3 _MMIO(0x9118) +#define GEN10_L3BANK_PAIR_COUNT 4 +#define GEN10_L3BANK_MASK 0x0F +#define GEN8_EU_DISABLE0 _MMIO(0x9134)#define GEN8_EU_DIS0_S0_MASK 0xffffff#define GEN8_EU_DIS0_S1_SHIFT 24
drivers/gpu/drm/i915/intel_engine_cs.c +19 -0
@@ -798,7 +798,26 @@ static u32 calculate_mcr(u32 mcr, struct drm_i915_private *dev_priv)static void wa_init_mcr (struct drm_i915_private *dev_priv) {u32 mcr; +u32 fuse3; +const struct sseu_dev_info *sseu = &(INTEL_INFO (dev_priv)->sseu); +u32 slice; +/* If more than one slice are enabled, L3Banks should be all enabled */ +if (hweight8 (sseu->slice_mask) ==1 ) { +/* +* WaProgramMgsrForL3BankSpecificMmioReads: +* read FUSE3 for enabled L3 Bank IDs, if L3 Bank matches +* enabled subslice, no need to redirect MCR packet +*/ + slice =find_last_bit ((unsigned long *)&(sseu->slice_mask), +sizeof (sseu->slice_mask)); + fuse3 =I915_READ (GEN10_MIRROR_FUSE3 ); +if (WARN_ON (!((fuse3 &GEN10_L3BANK_MASK ) + & ((sseu->subslice_mask[slice] + | sseu->subslice_mask[slice]>>GEN10_L3BANK_PAIR_COUNT ) + &GEN10_L3BANK_MASK )))) +DRM_WARN ("Real silicon should have matched L3Bank and subslice enabled\n" ); + } mcr =I915_READ (GEN8_MCR_SELECTOR ); mcr =calculate_mcr (mcr, dev_priv);I915_WRITE (GEN8_MCR_SELECTOR , mcr);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: Implement WaProgramMgsrForL3BankSpecificMmioReads
Quoting Yunwei Zhang (2018-03-19 21:50:08)
drivers/gpu/drm/i915/intel_engine_cs.c static u32 calculate_mcr(u32 mcr, struct drm_i915_private *dev_priv) · line 806
Quoted 2 lines
drivers/gpu/drm/i915/intel_engine_cs.c +2
-0+/* If more than one slice are enabled, L3Banks should be all enabled */ +if (hweight8 (sseu->slice_mask) ==1 ) {
if (is_power_of_two(sseu->slice_mask))
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Yunwei Zhang (2018-03-19 21:50:07)
Quoted 29 lines
WaProgramMgsrForCorrectSliceSpecificMmioReads dictate that before any MMIO read into Slice/Subslice specific registers, MCR packet control register(0xFDC) needs to be programmed to point to any enabled slice/subslice pair. Otherwise, incorrect value will be returned.
However, that means each subsequent MMIO read will be forwarded to a specific slice/subslice combination as read is unicast. This is OK since slice/subslice specific register values are consistent in almost all cases across slice/subslice. There are rare occasions such as INSTDONE that this value will be dependent on slice/subslice combo, in such cases, we need to program
0xFDCand recover this after. This is already covered byread_subslice_regfor INSTDONE.Also,
0xFDCwill lose its information after TDR/engine reset/power state change.Signed-off-by Yunwei Zhang <[email protected]>Cc Oscar Mateo <[email protected]>Cc Michel Thierry <[email protected]>Cc Joonas Lahtinen <[email protected]>--- drivers/gpu/drm/i915/intel_engine_cs.c | 43 ++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_engine_cs.c +0
-0
drivers/gpu/drm/i915/intel_engine_cs.c const char *i915_cache_level_str(struct drm_i915_private *i915, int type) · line 786
Quoted 6 lines
drivers/gpu/drm/i915/intel_engine_cs.c +3
-0@@ -781,6 +781,29 @@ const char *i915_cache_level_str(struct drm_i915_private *i915, int type) } } +static u32 calculate_mcr (u32 mcr,struct drm_i915_private *dev_priv) +{ +const struct sseu_dev_info *sseu = &(INTEL_INFO (dev_priv)->sseu);
INTEL_SSEU(dev_priv);
drivers/gpu/drm/i915/intel_engine_cs.c const char *i915_cache_level_str(struct drm_i915_private *i915, int type) · line 790
Quoted 4 lines
drivers/gpu/drm/i915/intel_engine_cs.c +4
-0+u32 slice =find_last_bit ((unsigned long *)&(sseu->slice_mask), +sizeof (sseu->slice_mask)); +u32 subslice =find_last_bit ((unsigned long *)&(sseu->subslice_mask[slice]), +sizeof (sseu->subslice_mask[0 ]));
You seem to have mispelt fls().
Or send a patch to convert find_last_bit() into fls() for known small sizes.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.CHECKPATCH: warning for series starting with [1/2] drm/i915/cnl: Implement WaProgramMgsrForCorrectSliceSpecificMmioReads
In reply to Yunwei Zhang== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915/cnl: Implement WaProgramMgsrForCorrectSliceSpecificMmioReads
URL : https://patchwork.freedesktop.org/series/40233/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip e6a22b973125 drm/i915/cnl: Implement WaProgramMgsrForCorrectSliceSpecificMmioReads -:39: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around sseu->slice_mask #39: FILE: drivers/gpu/drm/i915/intel_engine_cs.c:802: + u32 slice = find_last_bit((unsigned long *)&(sseu->slice_mask),
-:41: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around sseu->subslice_mask[slice] #41: FILE: drivers/gpu/drm/i915/intel_engine_cs.c:804:
+ u32 subslice = find_last_bit((unsigned long *)&(sseu->subslice_mask[slice]),
total: 0 errors, 0 warnings, 2 checks, 71 lines checked254d3c903a5e drm/i915: Implement WaProgramMgsrForL3BankSpecificMmioReads -:55: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around sseu->slice_mask #55: FILE: drivers/gpu/drm/i915/intel_engine_cs.c:827:
+ slice = find_last_bit((unsigned long *)&(sseu->slice_mask),
-:56: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #56: FILE: drivers/gpu/drm/i915/intel_engine_cs.c:828:
+ slice = find_last_bit((unsigned long *)&(sseu->slice_mask),
+ sizeof(sseu->slice_mask));
-:60: CHECK:SPACING: spaces preferred around that '>>' (ctx:VxV) #60: FILE: drivers/gpu/drm/i915/intel_engine_cs.c:832:
+ | sseu->subslice_mask[slice]>>GEN10_L3BANK_PAIR_COUNT)
^
total: 0 errors, 0 warnings, 3 checks, 36 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: warning for series starting with [1/2] drm/i915/cnl: Implement WaProgramMgsrForCorrectSliceSpecificMmioReads
In reply to Yunwei Zhang== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915/cnl: Implement WaProgramMgsrForCorrectSliceSpecificMmioReads
URL : https://patchwork.freedesktop.org/series/40233/
State : warning
== Summary ==
Series 40233v1 series starting with [1/2] drm/i915/cnl: Implement WaProgramMgsrForCorrectSliceSpecificMmioReads
https://patchwork.freedesktop.org/api/1.0/series/40233/revisions/1/mbox/
---- Possible new issues:
Test gem_busy:
Subgroup basic-hang-default:
pass -> DMESG-WARN (fi-cnl-drrs)
Test gem_exec_fence:
Subgroup await-hang-default:
pass -> DMESG-WARN (fi-cnl-drrs)
Test gem_exec_suspend:
Subgroup basic-s4-devices:
pass -> DMESG-WARN (fi-cnl-drrs)
Test gem_ringfill:
Subgroup basic-default-hang:
pass -> DMESG-WARN (fi-cnl-drrs)---- Known issues:
Test debugfs_test:
Subgroup read_all_entries:
incomplete -> PASS (fi-snb-2520m) fdo#103713
Test gem_exec_suspend:
Subgroup basic-s3:
pass -> DMESG-WARN (fi-cnl-drrs) fdo#105086
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
pass -> DMESG-WARN (fi-cnl-drrs) k.org#198519 +2fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#105086 https://bugs.freedesktop.org/show_bug.cgi?id=105086
k.org#198519 https://bugzilla.kernel.org/show_bug.cgi?id=198519
fi-bdw-5557u total:285 pass:264 dwarn:0 dfail:0 fail:0 skip:21 time:433s fi-bdw-gvtdvm total:285 pass:261 dwarn:0 dfail:0 fail:0 skip:24 time:442s fi-blb-e6850 total:285 pass:220 dwarn:1 dfail:0 fail:0 skip:64 time:379s fi-bsw-n3050 total:285 pass:239 dwarn:0 dfail:0 fail:0 skip:46 time:535s fi-bwr-2160 total:285 pass:180 dwarn:0 dfail:0 fail:0 skip:105 time:298s fi-bxt-dsi total:285 pass:255 dwarn:0 dfail:0 fail:0 skip:30 time:510s fi-bxt-j4205 total:285 pass:256 dwarn:0 dfail:0 fail:0 skip:29 time:511s fi-byt-j1900 total:285 pass:250 dwarn:0 dfail:0 fail:0 skip:35 time:512s fi-byt-n2820 total:285 pass:246 dwarn:0 dfail:0 fail:0 skip:39 time:503s fi-cfl-8700k total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:410s fi-cfl-s2 total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:582s fi-cfl-u total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:511s fi-cnl-drrs total:285 pass:246 dwarn:11 dfail:0 fail:0 skip:28 time:523s fi-elk-e7500 total:285 pass:225 dwarn:1 dfail:0 fail:0 skip:59 time:429s fi-gdg-551 total:285 pass:176 dwarn:0 dfail:0 fail:1 skip:108 time:320s fi-glk-1 total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:533s fi-hsw-4770 total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:400s fi-ilk-650 total:285 pass:225 dwarn:0 dfail:0 fail:0 skip:60 time:419s fi-ivb-3520m total:285 pass:256 dwarn:0 dfail:0 fail:0 skip:29 time:464s fi-ivb-3770 total:285 pass:252 dwarn:0 dfail:0 fail:0 skip:33 time:429s fi-kbl-7500u total:285 pass:260 dwarn:1 dfail:0 fail:0 skip:24 time:475s fi-kbl-7567u total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:465s fi-kbl-r total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:516s fi-pnv-d510 total:285 pass:219 dwarn:1 dfail:0 fail:0 skip:65 time:657s fi-skl-6260u total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:444s fi-skl-6600u total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:528s fi-skl-6700hq total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:541s fi-skl-6700k2 total:285 pass:261 dwarn:0 dfail:0 fail:0 skip:24 time:505s fi-skl-6770hq total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:483s fi-skl-guc total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:427s fi-skl-gvtdvm total:285 pass:262 dwarn:0 dfail:0 fail:0 skip:23 time:445s fi-snb-2520m total:285 pass:245 dwarn:0 dfail:0 fail:0 skip:40 time:601s fi-snb-2600 total:285 pass:245 dwarn:0 dfail:0 fail:0 skip:40 time:399s
9280bf159e350e78fb19db3d76deca4be7f083c8 drm-tip: 2018y-03m-19d-21h-23m-32s UTC integration manifest 254d3c903a5e drm/i915: Implement WaProgramMgsrForL3BankSpecificMmioReads e6a22b973125 drm/i915/cnl: Implement WaProgramMgsrForCorrectSliceSpecificMmioReads
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8404/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx