drm/i915: Move a bunch of workaround-related code to its own file
Subsystems (4)
PATCH 1/2 drm/i915: Move a bunch of workaround-related code to its own file
This has grown to be a sizable amount of code, so move it to its own file before we try to refactor anything. For the moment, we are leaving behind the WA BB code and the WAs that get applied (incorrectly) in init_clock_gating, but we will deal with it later.
v2: Use intel_ prefix for code that deals with the hardware (Chris)
v3: Rebased
v4:
- Rebased
- New license header
v5:
- Rebased
- Added some organisational notes to the file (Chris)
v6: Include DOC section in the documentation build (Jani)
v7: A few stylistic changes to please checkpatch and sparse
--- Documentation/gpu/i915.rst | 6 + drivers/gpu/drm/i915/Makefile | 3 +- drivers/gpu/drm/i915/intel_engine_cs.c | 634 ---------------------------- drivers/gpu/drm/i915/intel_lrc.c | 1 + drivers/gpu/drm/i915/intel_ringbuffer.c | 1 + drivers/gpu/drm/i915/intel_ringbuffer.h | 3 - drivers/gpu/drm/i915/intel_workarounds.c | 683 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_workarounds.h | 13 + 8 files changed, 706 insertions(+), 638 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_workarounds.c create mode 100644 drivers/gpu/drm/i915/intel_workarounds.h
Documentation/gpu/i915.rst +6 -0
@@ -58,6 +58,12 @@ Intel GVT-g Host Support(vGPU device model) .. kernel-doc:: drivers/gpu/drm/i915/intel_gvt.c :internal: +Workarounds +----------- + +.. kernel-doc:: drivers/gpu/drm/i915/intel_workarounds.c + :doc: Hardware workarounds + Display Hardware Handling =========================
drivers/gpu/drm/i915/Makefile +2 -1
@@ -43,7 +43,8 @@ i915-y := i915_drv.o \ intel_csr.o \ intel_device_info.o \ intel_pm.o \ - intel_runtime_pm.o + intel_runtime_pm.o \ + intel_workarounds.o i915-$(CONFIG_COMPAT) += i915_ioc32.o i915-$(CONFIG_DEBUG_FS) += i915_debugfs.o intel_pipe_crc.o
drivers/gpu/drm/i915/intel_engine_cs.c +0 -634
640 lines not on this page · raw message
drivers/gpu/drm/i915/intel_lrc.c +1 -0
@@ -139,6 +139,7 @@#include "i915_gem_render_state.h" #include "intel_lrc_reg.h" #include "intel_mocs.h" +#include "intel_workarounds.h" #define RING_EXECLIST_QFULL (1 << 0x2)#define RING_EXECLIST1_VALID (1 << 0x3)
drivers/gpu/drm/i915/intel_ringbuffer.c +1 -0
@@ -36,6 +36,7 @@#include "i915_gem_render_state.h" #include "i915_trace.h" #include "intel_drv.h" +#include "intel_workarounds.h" /* Rough estimate of the typical request size, performing a flush, * set-context and then emitting the batch.
drivers/gpu/drm/i915/intel_ringbuffer.h +0 -3
@@ -885,9 +885,6 @@ static inline u32 intel_engine_last_submit(struct intel_engine_cs *engine)return READ_ONCE (engine->timeline->seqno); } -int init_workarounds_ring (struct intel_engine_cs *engine); -int intel_ring_workarounds_emit (struct i915_request *rq); -void intel_engine_get_instdone (struct intel_engine_cs *engine,struct intel_instdone *instdone);
drivers/gpu/drm/i915/intel_workarounds.c new file +683 -0
683 lines not on this page · raw message
drivers/gpu/drm/i915/intel_workarounds.h new file +13 -0
@@ -0,0 +1,13 @@ +/* +* SPDX-License-Identifier: MIT +* +* Copyright © 2014-2018 Intel Corporation +*/ + +#ifndef _I915_WORKAROUNDS_H_ +#define _I915_WORKAROUNDS_H_ + +int init_workarounds_ring (struct intel_engine_cs *engine); +int intel_ring_workarounds_emit (struct i915_request *rq); + +#endif
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/2 drm/i915: Split out functions for different kinds of workarounds
There are different kind of workarounds (those that modify registers that live in the context image, those that modify global registers, those that whitelist registers, etc...) and they have different requirements in terms of where they are applied and how. Also, by splitting them apart, it should be easier to decide where a new workaround should go.
v2:
- Add multiple MISSING_CASE
- Rebased
v3:
- Rename mmio_workarounds to gt_workarounds (Chris, Mika)
- Create empty placeholders for BDW and CHV GT WAs
- Rebased
v4: Rebased
v5:
- Rebased
- FORCE_TO_NONPRIV register exists since BDW, so make a path for it to achieve universality, even if empty (Chris)
v6:
- Rebased
- A few stylistic changes to please checkpatch and sparse
--- drivers/gpu/drm/i915/i915_gem.c | 3 + drivers/gpu/drm/i915/i915_gem_context.c | 6 + drivers/gpu/drm/i915/intel_lrc.c | 14 +- drivers/gpu/drm/i915/intel_ringbuffer.c | 8 +- drivers/gpu/drm/i915/intel_workarounds.c | 637 ++++++++++++++++++++----------- drivers/gpu/drm/i915/intel_workarounds.h | 8 +- 6 files changed, 438 insertions(+), 238 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +3 -0
@@ -35,6 +35,7 @@#include "intel_drv.h" #include "intel_frontbuffer.h" #include "intel_mocs.h" +#include "intel_workarounds.h" #include "i915_gemfs.h" #include <linux/dma-fence-array.h> #include <linux/kthread.h>
@@ -5198,6 +5199,8 @@ int i915_gem_init_hw(struct drm_i915_private *dev_priv) } } +intel_gt_workarounds_apply (dev_priv); +i915_gem_init_swizzling (dev_priv);/*
drivers/gpu/drm/i915/i915_gem_context.c +6 -0
@@ -90,6 +90,7 @@#include <drm/i915_drm.h> #include "i915_drv.h" #include "i915_trace.h" +#include "intel_workarounds.h" #define ALL_L3_SLICES (dev) (1 << NUM_L3_SLICES(dev)) - 1
@@ -459,11 +460,16 @@ static bool needs_preempt_context(struct drm_i915_private *i915)int i915_gem_contexts_init (struct drm_i915_private *dev_priv) {struct i915_gem_context *ctx; +int ret;/* Reassure ourselves we are only called once */ GEM_BUG_ON (dev_priv->kernel_context);GEM_BUG_ON (dev_priv->preempt_context); + ret =intel_ctx_workarounds_init (dev_priv); +if (ret) +return ret; +INIT_LIST_HEAD (&dev_priv->contexts.list);INIT_WORK (&dev_priv->contexts.free_work, contexts_free_worker);init_llist_head (&dev_priv->contexts.free_list);
drivers/gpu/drm/i915/intel_lrc.c +11 -3
@@ -1725,6 +1725,10 @@ static int gen8_init_render_ring(struct intel_engine_cs *engine)if (ret)return ret; + ret =intel_whitelist_workarounds_apply (engine); +if (ret) +return ret; +/* We need to disable the AsyncFlip performance optimisations in order * to use MI_WAIT_FOR_EVENT within the CS. It should already be * programmed to '1' on all products.
@@ -1735,7 +1739,7 @@ static int gen8_init_render_ring(struct intel_engine_cs *engine)I915_WRITE (INSTPM ,_MASKED_BIT_ENABLE (INSTPM_FORCE_ORDERING )); -return init_workarounds_ring (engine); +return 0 ; }static int gen9_init_render_ring (struct intel_engine_cs *engine)
@@ -1746,7 +1750,11 @@ static int gen9_init_render_ring(struct intel_engine_cs *engine)if (ret)return ret; -return init_workarounds_ring (engine); + ret =intel_whitelist_workarounds_apply (engine); +if (ret) +return ret; + +return 0 ; } static void reset_common_ring(struct intel_engine_cs *engine,
@@ -2071,7 +2079,7 @@ static int gen8_init_rcs_context(struct i915_request *rq) {int ret; - ret =intel_ring_workarounds_emit (rq); + ret =intel_ctx_workarounds_emit (rq);if (ret)return ret;
drivers/gpu/drm/i915/intel_ringbuffer.c +6 -2
@@ -600,7 +600,7 @@ static int intel_rcs_ctx_init(struct i915_request *rq) {int ret; - ret =intel_ring_workarounds_emit (rq); + ret =intel_ctx_workarounds_emit (rq);if (ret !=0 )return ret;
@@ -618,6 +618,10 @@ static int init_render_ring(struct intel_engine_cs *engine)if (ret)return ret; + ret =intel_whitelist_workarounds_apply (engine); +if (ret) +return ret; +/* WaTimedSingleVertexDispatch:cl,bw,ctg,elk,ilk,snb */ if (IS_GEN (dev_priv,4 ,6 ))I915_WRITE (MI_MODE ,_MASKED_BIT_ENABLE (VS_TIMER_DISPATCH ));
@@ -659,7 +663,7 @@ static int init_render_ring(struct intel_engine_cs *engine)if (INTEL_GEN (dev_priv) >=6 )I915_WRITE_IMR (engine, ~engine->irq_keep_mask); -return init_workarounds_ring (engine); +return 0 ; }static u32 *gen6_signal (struct i915_request *rq,u32 *cs)
drivers/gpu/drm/i915/intel_workarounds.c +406 -231
823 lines not on this page · raw message
drivers/gpu/drm/i915/intel_workarounds.h +6 -2
@@ -7,7 +7,11 @@#ifndef _I915_WORKAROUNDS_H_#define _I915_WORKAROUNDS_H_ -int init_workarounds_ring (struct intel_engine_cs *engine); -int intel_ring_workarounds_emit (struct i915_request *rq); +int intel_ctx_workarounds_init (struct drm_i915_private *dev_priv); +int intel_ctx_workarounds_emit (struct i915_request *rq); + +void intel_gt_workarounds_apply (struct drm_i915_private *dev_priv); + +int intel_whitelist_workarounds_apply (struct intel_engine_cs *engine);#endif
Signature · 6 lines
1.9.1 _______________________________________________ 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: Move a bunch of workaround-related code to its own file
In reply to Oscar Mateo== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915: Move a bunch of workaround-related code to its own file
URL : https://patchwork.freedesktop.org/series/41491/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip 18b0bd9fdeb1 drm/i915: Move a bunch of workaround-related code to its own file -:743: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #743: new file mode 100644
-:817: WARNING:MACRO_WITH_FLOW_CONTROL: Macros with flow control statements should be avoided #817: FILE: drivers/gpu/drm/i915/intel_workarounds.c:70:
+#define WA_REG(addr, mask, val) do { \
+ const int r = wa_add(dev_priv, (addr), (mask), (val)); \
+ if (r) \
+ return r; \
+ } while (0)
-:823: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'mask' - possible side-effects? #823: FILE: drivers/gpu/drm/i915/intel_workarounds.c:76:
+#define WA_SET_BIT_MASKED(addr, mask) \
+ WA_REG(addr, (mask), _MASKED_BIT_ENABLE(mask))
-:826: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'mask' - possible side-effects? #826: FILE: drivers/gpu/drm/i915/intel_workarounds.c:79:
+#define WA_CLR_BIT_MASKED(addr, mask) \
+ WA_REG(addr, (mask), _MASKED_BIT_DISABLE(mask))
-:829: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'mask' - possible side-effects? #829: FILE: drivers/gpu/drm/i915/intel_workarounds.c:82:
+#define WA_SET_FIELD_MASKED(addr, mask, value) \
+ WA_REG(addr, mask, _MASKED_FIELD(mask, value))
total: 0 errors, 2 warnings, 3 checks, 1380 lines checked 5e751eea41c4 drm/i915: Split out functions for different kinds of workarounds -:514: CHECK:BRACES: braces {} should be used on all arms of this statement #514: FILE: drivers/gpu/drm/i915/intel_workarounds.c:448:
+ if (INTEL_GEN(dev_priv) < 8)
[...]
+ else if (IS_BROADWELL(dev_priv))
[...]
+ else if (IS_CHERRYVIEW(dev_priv))
[...]
+ else if (IS_SKYLAKE(dev_priv))
[...]
+ else if (IS_BROXTON(dev_priv))
[...]
+ else if (IS_KABYLAKE(dev_priv))
[...]
+ else if (IS_GEMINILAKE(dev_priv))
[...]
+ else if (IS_COFFEELAKE(dev_priv))
[...]
+ else if (IS_CANNONLAKE(dev_priv))
[...]
+ else {
[...]
-:532: CHECK:BRACES: Unbalanced braces around else statement #532: FILE: drivers/gpu/drm/i915/intel_workarounds.c:466:
+ else {
-:939: CHECK:BRACES: braces {} should be used on all arms of this statement #939: FILE: drivers/gpu/drm/i915/intel_workarounds.c:830:
+ if (INTEL_GEN(dev_priv) < 8)
[...]
+ else if (IS_BROADWELL(dev_priv))
[...]
else if (IS_CHERRYVIEW(dev_priv))
[...]
+ err = chv_whitelist_workarounds_apply(engine);
[...]
- err = skl_init_workarounds(engine);
[...]
else if (IS_BROXTON(dev_priv))
[...]
+ err = bxt_whitelist_workarounds_apply(engine);
[...]
- err = kbl_init_workarounds(engine);
[...]
else if (IS_GEMINILAKE(dev_priv))
[...]
+ err = glk_whitelist_workarounds_apply(engine);
[...]
-:965: CHECK:BRACES: Unbalanced braces around else statement #965: FILE: drivers/gpu/drm/i915/intel_workarounds.c:848:
+ else {
total: 0 errors, 0 warnings, 4 checks, 938 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Move a bunch of workaround-related code to its own file
In reply to Oscar Mateo== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915: Move a bunch of workaround-related code to its own file
URL : https://patchwork.freedesktop.org/series/41491/
State : success
== Summary ==
Series 41491v1 series starting with [1/2] drm/i915: Move a bunch of workaround-related code to its own file
https://patchwork.freedesktop.org/api/1.0/series/41491/revisions/1/mbox/
---- Known issues:
Test gem_mmap_gtt:
Subgroup basic-small-bo-tiledx:
pass -> FAIL (fi-gdg-551) fdo#102575fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fi-bdw-5557u total:285 pass:264 dwarn:0 dfail:0 fail:0 skip:21 time:431s fi-bdw-gvtdvm total:285 pass:261 dwarn:0 dfail:0 fail:0 skip:24 time:443s fi-blb-e6850 total:285 pass:220 dwarn:1 dfail:0 fail:0 skip:64 time:385s fi-bsw-n3050 total:285 pass:239 dwarn:0 dfail:0 fail:0 skip:46 time:543s fi-bwr-2160 total:285 pass:180 dwarn:0 dfail:0 fail:0 skip:105 time:296s fi-bxt-dsi total:285 pass:255 dwarn:0 dfail:0 fail:0 skip:30 time:514s 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:517s fi-byt-n2820 total:285 pass:246 dwarn:0 dfail:0 fail:0 skip:39 time:507s fi-cfl-8700k total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:411s fi-cfl-s3 total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:562s fi-cfl-u total:285 pass:259 dwarn:0 dfail:0 fail:0 skip:26 time:513s fi-elk-e7500 total:285 pass:226 dwarn:0 dfail:0 fail:0 skip:59 time:428s fi-gdg-551 total:285 pass:176 dwarn:0 dfail:0 fail:1 skip:108 time:317s fi-glk-1 total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:540s fi-glk-j4005 total:285 pass:256 dwarn:0 dfail:0 fail:0 skip:29 time:488s fi-hsw-4770 total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:412s fi-ilk-650 total:285 pass:225 dwarn:0 dfail:0 fail:0 skip:60 time:429s fi-ivb-3520m total:285 pass:256 dwarn:0 dfail:0 fail:0 skip:29 time:469s fi-ivb-3770 total:285 pass:252 dwarn:0 dfail:0 fail:0 skip:33 time:431s fi-kbl-7500u total:285 pass:260 dwarn:1 dfail:0 fail:0 skip:24 time:471s 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:507s fi-pnv-d510 total:285 pass:220 dwarn:1 dfail:0 fail:0 skip:64 time:669s fi-skl-6260u total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:442s fi-skl-6600u total:285 pass:258 dwarn:0 dfail:0 fail:0 skip:27 time:536s fi-skl-6700k2 total:285 pass:261 dwarn:0 dfail:0 fail:0 skip:24 time:503s fi-skl-6770hq total:285 pass:265 dwarn:0 dfail:0 fail:0 skip:20 time:505s fi-skl-guc total:285 pass:257 dwarn:0 dfail:0 fail:0 skip:28 time:430s fi-skl-gvtdvm total:285 pass:262 dwarn:0 dfail:0 fail:0 skip:23 time:446s fi-snb-2520m total:285 pass:245 dwarn:0 dfail:0 fail:0 skip:40 time:565s fi-snb-2600 total:285 pass:245 dwarn:0 dfail:0 fail:0 skip:40 time:405s
df88a0c8d65abb40b39bd5f19b5290dac6746cb9 drm-tip: 2018y-04m-10d-14h-31m-39s UTC integration manifest 5e751eea41c4 drm/i915: Split out functions for different kinds of workarounds 18b0bd9fdeb1 drm/i915: Move a bunch of workaround-related code to its own file
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8660/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.IGT: warning for series starting with [1/2] drm/i915: Move a bunch of workaround-related code to its own file
In reply to Oscar Mateo== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915: Move a bunch of workaround-related code to its own file
URL : https://patchwork.freedesktop.org/series/41491/
State : warning
== Summary ==
= CI Bug Log - changes from CI_DRM_4041_full -> Patchwork_8660_full =
== Summary - WARNING ==
Minor unknown changes coming with Patchwork_8660_full need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_8660_full, please notify your bug team to allow them to document this new failure mode, which will reduce the CI noise.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8660/
== Possible new issues ==
Here are the unknown changes that may have been introduced in Patchwork_8660_full:
=== IGT changes ===
==== Warnings ====
igt@gem_mocs_settings@mocs-rc6-blt:
shard-kbl: PASS -> SKIP
igt@gem_mocs_settings@mocs-rc6-bsd2:
shard-kbl: SKIP -> PASS== Known issues ==
Here are the changes found in Patchwork_8660_full that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@kms_cursor_crc@cursor-128x128-suspend:
shard-kbl: PASS -> DMESG-WARN (fdo#103313)
igt@kms_flip@2x-wf_vblank-ts-check:
shard-hsw: PASS -> FAIL (fdo#100368)
==== Possible fixes ====
igt@kms_cursor_legacy@flip-vs-cursor-legacy:
shard-hsw: FAIL (fdo#102670) -> PASS
igt@kms_flip@2x-flip-vs-absolute-wf_vblank-interruptible:
shard-hsw: FAIL (fdo#103928) -> PASS
igt@kms_frontbuffer_tracking@fbc-rgb101010-draw-mmap-wc:
shard-apl: FAIL (fdo#103167) -> PASS
igt@kms_setmode@basic:
shard-kbl: FAIL (fdo#99912) -> PASS fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102670 https://bugs.freedesktop.org/show_bug.cgi?id=102670
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103313 https://bugs.freedesktop.org/show_bug.cgi?id=103313
fdo#103928 https://bugs.freedesktop.org/show_bug.cgi?id=103928
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
== Participating hosts (6 -> 4) ==
Missing (2): shard-glk shard-glkb
== Build changes ==
* Linux: CI_DRM_4041 -> Patchwork_8660
CI_DRM_4041: df88a0c8d65abb40b39bd5f19b5290dac6746cb9 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4418: 7c474e011548d35df6b80ceed81d3e6ca560c71d @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_8660: 5e751eea41c49f00527ff93005be294d2def7846 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4418: 45e115f293fd6acc0c9647cf2d3b76be78819ba5 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8660/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx