1. 11 6月, 2018 1 次提交
    • C
      drm/i915/ringbuffer: Fix context restore upon reset · b3ee09a4
      Chris Wilson 提交于
      The discovery with trying to enable full-ppgtt was that we were
      completely failing to the load both the mm and context following the
      reset. Although we were performing mmio to set the PP_DIR (per-process
      GTT) and CCID (context), these were taking no effect (the assumption was
      that this would trigger reload of the context and restore the page
      tables). It was not until we performed the LRI + MI_SET_CONTEXT in a
      following context switch would anything occur.
      
      Since we are then required to reset the context image and PP_DIR using
      CS commands, we place those commands into every batch. The hardware
      should recognise the no-ops and eliminate the expensive context loads,
      but we still have to pay the cost of using cross-powerwell register
      writes. In practice, this has no effect on actual context switch times,
      and only adds a few hundred nanoseconds to no-op switches. We can improve
      the latter by eliminating the w/a around known no-op switches, but there
      is an ulterior motive to keeping them.
      
      Always emitting the context switch at the beginning of the request (and
      relying on HW to skip unneeded switches) does have one key advantage.
      Should we implement request reordering on Haswell, we will not know in
      advance what the previous executing context was on the GPU and so we
      would not be able to elide the MI_SET_CONTEXT commands ourselves and
      always have to emit them. Having our hand forced now actually prepares
      us for later.
      
      Now since that context and mm follow the request, we no longer (and not
      for a long time since requests took over!) require a trace point to tell
      when we write the switch into the ring, since it is always. (This is
      even more important when you remember that simply writing into the ring
      bears no relation to the current mm.)
      
      v2: Sandybridge has to agree to use LRI as well.
      
      Testcase: igt/drv_selftests/live_hangcheck
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Cc: Matthew Auld <matthew.william.auld@gmail.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180611110845.31890-1-chris@chris-wilson.co.uk
      b3ee09a4
  2. 06 6月, 2018 1 次提交
  3. 24 5月, 2018 2 次提交
    • Y
      drm/i915/icl: Enable WaProgramMgsrForCorrectSliceSpecificMmioReads · d78fa508
      Yunwei Zhang 提交于
      WaProgramMgsrForCorrectSliceSpecificMmioReads applies for Icelake as
      well.
      
      References: HSD#1405586840, BSID#0575
      
      v2:
       - GEN11 mask is different from its predecessors. (Oscar)
       - Better separate GEN10 and GEN11. (Oscar)
      
      Cc: Oscar Mateo <oscar.mateo@intel.com>
      Cc: Michel Thierry <michel.thierry@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Signed-off-by: NYunwei Zhang <yunwei.zhang@intel.com>
      Reviewed-by: NOscar Mateo <oscar.mateo@intel.com>
      Signed-off-by: NMika Kuoppala <mika.kuoppala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/1526683232-24753-1-git-send-email-yunwei.zhang@intel.com
      d78fa508
    • Y
      drm/i915/cnl: Implement WaProgramMgsrForCorrectSliceSpecificMmioReads · 1e40d4ae
      Yunwei Zhang 提交于
      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.
      
      Also, 0xFDC will lose its information after TDR/engine reset/power state
      change.
      
      References: HSD#1405586840, BSID#0575
      
      v2:
       - use fls() instead of find_last_bit() (Chris)
       - added INTEL_SSEU to extract sseu from device info. (Chris)
      v3:
       - rebase on latest tip
      v5:
       - Added references (Mika)
       - Change the ordered of passing arguments and etc. (Ursulin)
      v7:
       - Moved WA explanation Comments(Oscar)
       - Rebased.
      v8:
       - Renamed sanitize_mcr to calculate_s_ss_select. (Oscar)
       - calculate s/ss selector instead of whole mcr. (Oscar)
      v9:
       - Updated function name (Oscar)
       - Remove redundant variables (Oscar)
      v10:
       - Separate pre-GEN10 and GEN11 mask. (Oscar)
      
      Cc: Oscar Mateo <oscar.mateo@intel.com>
      Cc: Michel Thierry <michel.thierry@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Signed-off-by: NYunwei Zhang <yunwei.zhang@intel.com>
      Reviewed-by: NOscar Mateo <oscar.mateo@intel.com>
      Signed-off-by: NMika Kuoppala <mika.kuoppala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/1526683197-24656-1-git-send-email-yunwei.zhang@intel.com
      1e40d4ae
  4. 19 5月, 2018 3 次提交
  5. 18 5月, 2018 4 次提交
  6. 17 5月, 2018 1 次提交
  7. 14 5月, 2018 1 次提交
  8. 11 5月, 2018 1 次提交
  9. 03 5月, 2018 3 次提交
  10. 02 5月, 2018 1 次提交
  11. 30 4月, 2018 2 次提交
  12. 26 4月, 2018 1 次提交
  13. 24 4月, 2018 3 次提交
  14. 19 4月, 2018 2 次提交
  15. 13 4月, 2018 1 次提交
  16. 12 4月, 2018 2 次提交
    • O
      drm/i915: Move a bunch of workaround-related code to its own file · 7d3c425f
      Oscar Mateo 提交于
      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)
      Signed-off-by: NOscar Mateo <oscar.mateo@intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      [ickle: appease checkpatch, mostly]
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/1523376767-18480-1-git-send-email-oscar.mateo@intel.com
      7d3c425f
    • C
      drm/i915/execlists: Set queue priority from secondary port · 15c83c43
      Chris Wilson 提交于
      We can refine our current execlists->queue_priority if we inspect
      ELSP[1] rather than the head of the unsubmitted queue. Currently, we use
      the unsubmitted queue and say that if a subsequent request is more
      important than the current queue, we will rerun the submission tasklet
      to evaluate the need for preemption. However, we only want to preempt if
      we need to jump ahead of a currently executing request in ELSP. The
      second reason for running the submission tasklet is amalgamate requests
      into the active context on ELSP[0] to avoid a stall when ELSP[0] drains.
      (Though repeatedly amalgamating requests into the active context and
      triggering many lite-restore is off question gain, the goal really is to
      put a context into ELSP[1] to cover the interrupt.) So if instead of
      looking at the head of the queue, we look at the context in ELSP[1] we
      can answer both of the questions more accurately -- we don't need to
      rerun the submission tasklet unless our new request is important enough
      to feed into, at least, ELSP[1].
      
      v2: Add some comments from the discussion with Tvrtko.
      v3: More commentary to cross-reference queue_request()
      
      References: f6322edd ("drm/i915/preemption: Allow preemption between submission ports")
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Michał Winiarski <michal.winiarski@intel.com>
      Cc: Michel Thierry <michel.thierry@intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180411103929.27374-1-chris@chris-wilson.co.uk
      15c83c43
  17. 27 3月, 2018 1 次提交
  18. 20 3月, 2018 1 次提交
  19. 15 3月, 2018 3 次提交
  20. 14 3月, 2018 1 次提交
    • C
      drm/i915: Check rq->timeline before deference · ab268151
      Chris Wilson 提交于
      Not only is the context suspect to disappearing, but so is it's
      timeline. Under a lockless inspection of the requests for
      debugging from intel_engine_dump(), the context may already have been
      freed and we have to check before chasing the dangling pointer.
      
      [28033.681755] Modules linked in: vgem snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_intel crct10dif_pclmul crc32_pclmul snd_hda_codec snd_hwdep snd_hda_core ghash_clmulni_intel snd_pcm mei_me mei i915 r8169 mii prime_numbers i2c_hid
      [28033.681796] CPU: 3 PID: 3058 Comm: gem_exec_schedu Tainted: G     U           4.16.0-rc5+ #9
      [28033.681804] Hardware name: Acer Aspire E5-575G/Ironman_SK  , BIOS V1.12 08/02/2016
      [28033.681834] RIP: 0010:print_request+0x2b/0xb0 [i915]
      [28033.681840] RSP: 0018:ffffc90004afbc18 EFLAGS: 00010202
      [28033.681847] RAX: 6b6b6b6b6b6b6b6b RBX: ffff8801921b5a40 RCX: 0000000000000006
      [28033.681854] RDX: ffffc90004afbc60 RSI: ffff8801921b5a40 RDI: 0000000000000004
      [28033.681861] RBP: ffffc90004afbd80 R08: 0000000000000000 R09: 0000000000000001
      [28033.681868] R10: ffffc90004afbbd0 R11: ffffc90004afbc73 R12: ffffc90004afbc60
      [28033.681875] R13: ffffc90004afbd80 R14: ffff8801d40ec670 R15: ffff8801921b5a40
      [28033.681883] FS:  00007fbba5f6c8c0(0000) GS:ffff8801e8400000(0000) knlGS:0000000000000000
      [28033.681891] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [28033.681897] CR2: 00007fbba5f8f000 CR3: 00000001b2efa002 CR4: 00000000003606e0
      [28033.681904] Call Trace:
      [28033.681932]  intel_engine_print_registers+0x6a7/0x930 [i915]
      [28033.681962]  intel_engine_dump+0x30d/0x740 [i915]
      [28033.681971]  ? seq_printf+0x3a/0x50
      [28033.681995]  i915_engine_info+0xb8/0xe0 [i915]
      [28033.682003]  ? drm_get_color_range_name+0x20/0x20
      [28033.682010]  seq_read+0xe1/0x440
      [28033.682018]  full_proxy_read+0x51/0x80
      [28033.682025]  __vfs_read+0x21/0x130
      [28033.682031]  ? do_sys_open+0x134/0x220
      [28033.682037]  ? kmem_cache_free+0x177/0x2b0
      [28033.682043]  vfs_read+0xa1/0x150
      [28033.682049]  SyS_read+0x40/0xa0
      [28033.682055]  do_syscall_64+0x6b/0x1b0
      [28033.682063]  entry_SYSCALL_64_after_hwframe+0x42/0xb7
      [28033.682069] RIP: 0033:0x7fbba4655d11
      [28033.682074] RSP: 002b:00007ffd8c49da58 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
      [28033.682082] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fbba4655d11
      [28033.682089] RDX: 000000000000003f RSI: 00005647bfbfc260 RDI: 0000000000000006
      [28033.682096] RBP: 000000000000003f R08: 00000000ffffffff R09: 0000000000000000
      [28033.682104] R10: 0000000000000000 R11: 0000000000000246 R12: 00005647bfbfc260
      [28033.682111] R13: 0000000000000006 R14: 0000000000000000 R15: 00005647bfbfc260
      [28033.682119] Code: 41 55 41 54 49 89 d4 55 53 48 89 fd 48 8b 86 c8 00 00 00 48 8b 3d d6 1e 14 e2 48 89 f3 48 2b be a8 02 00 00 48 8b 80 b0 00 00 00 <4c> 8b 68 18 e8 bc 80 02 e1 8b 8b 70 02 00 00 8b b3 28 02 00 00
      [28033.682206] RIP: print_request+0x2b/0xb0 [i915] RSP: ffffc90004afbc18
      Reported-by: NMika Kuoppala <mika.kuoppala@linux.intel.com>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Reviewed-by: NMika Kuoppala <mika.kuoppala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180314101630.8933-1-chris@chris-wilson.co.uk
      ab268151
  21. 10 3月, 2018 1 次提交
  22. 09 3月, 2018 1 次提交
  23. 07 3月, 2018 2 次提交
  24. 28 2月, 2018 1 次提交
    • C
      drm/i915: Don't deref request->ctx inside unlocked print_request() · 367a35a6
      Chris Wilson 提交于
      Although we protect the request itself, we don't lock inside
      intel_engine_dump() and so the request maybe retired as we peek into it.
      One consequence is that the request->ctx may be freed before we
      dereference it, leading to a use-after-free. Replace the hw_id we are
      peeking from inside request->ctx with the request->fence.context, with
      which we can still track from which context the request originated
      (although to tie to HW reports requires a little more legwork, but is
      good enough to follow the GEM traces).
      
      [52640.729670] general protection fault: 0000 [#2] SMP
      [52640.729694] Dumping ftrace buffer:
      [52640.729701]    (ftrace buffer empty)
      [52640.729705] Modules linked in: vgem snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic x86_pkg_\
      temp_thermal intel_powerclamp coretemp crct10dif_pclmul crc32_pclmul snd_hda_intel snd_hda_codec snd_hwdep gha\
      sh_clmulni_intel snd_hda_core snd_pcm mei_me mei i915 r8169 mii prime_numbers i2c_hid
      [52640.729748] CPU: 2 PID: 4335 Comm: gem_exec_schedu Tainted: G     UD W        4.16.0-rc3+ #7
      [52640.729759] Hardware name: Acer Aspire E5-575G/Ironman_SK  , BIOS V1.12 08/02/2016
      [52640.729803] RIP: 0010:print_request+0x2b/0xb0 [i915]
      [52640.729811] RSP: 0018:ffffc90001453c18 EFLAGS: 00010206
      [52640.729820] RAX: 6b6b6b6b6b6b6b6b RBX: ffff8801e0292d40 RCX: 0000000000000006
      [52640.729829] RDX: ffffc90001453c60 RSI: ffff8801e0292d40 RDI: 0000000000000003
      [52640.729838] RBP: ffffc90001453d80 R08: 0000000000000000 R09: 0000000000000001
      [52640.729847] R10: ffffc90001453bd0 R11: ffffc90001453c73 R12: ffffc90001453c60
      [52640.729856] R13: ffffc90001453d80 R14: ffff8801d5a683c8 R15: ffff8801e0292d40
      [52640.729866] FS:  00007f1ee50548c0(0000) GS:ffff8801e8200000(0000) knlGS:0000000000000000
      [52640.729876] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [52640.729884] CR2: 00007f1ee5077000 CR3: 00000001d9411004 CR4: 00000000003606e0
      [52640.729893] Call Trace:
      [52640.729922]  intel_engine_print_registers+0x623/0x890 [i915]
      [52640.729948]  intel_engine_dump+0x4a3/0x590 [i915]
      [52640.729957]  ? seq_printf+0x3a/0x50
      [52640.729977]  i915_engine_info+0xb8/0xe0 [i915]
      [52640.729984]  ? drm_mode_gamma_get_ioctl+0xf0/0xf0
      [52640.729990]  seq_read+0xd5/0x410
      [52640.729997]  full_proxy_read+0x4b/0x70
      [52640.730004]  __vfs_read+0x1e/0x120
      [52640.730009]  ? do_sys_open+0x134/0x220
      [52640.730015]  ? kmem_cache_free+0x174/0x2b0
      [52640.730021]  vfs_read+0xa1/0x150
      [52640.730026]  SyS_read+0x40/0xa0
      [52640.730032]  do_syscall_64+0x65/0x1a0
      [52640.730038]  entry_SYSCALL_64_after_hwframe+0x42/0xb7
      Reported-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Mika Kuoppala <mika.kuoppala@intel.com>
      Reviewed-by: NMika Kuoppala <mika.kuoppala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180228094732.28462-1-chris@chris-wilson.co.uk
      367a35a6