1. 10 10月, 2016 2 次提交
    • P
      drm/i915: SAGV is not SKL-only, so rename a few things · 674f823b
      Paulo Zanoni 提交于
      The plan is to introduce intel_has_sagv() and then use it to discover
      which platforms actually support it.
      
      I thought about keeping the functions with their current skl names,
      but found two problems: (i) skl_has_sagv() would become a very
      confusing name, and (ii) intel_atomic_commit_tail() doesn't seem to be
      calling any functions whose name start with a platform name, so the
      "intel_" naming scheme seems make more sense than the "firstplatorm_"
      naming scheme here.
      
      Cc: stable@vger.kernel.org
      Reviewed-by: NLyude <cpaul@redhat.com>
      Reviewed-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1474578035-424-2-git-send-email-paulo.r.zanoni@intel.com
      (cherry picked from commit 16dcdc4e)
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      674f823b
    • C
      drm/i915: Only shrink the unbound objects during freeze · ec7ce653
      Chris Wilson 提交于
      At the point of creating the hibernation image, the runtime power manage
      core is disabled - and using the rpm functions triggers a warn.
      i915_gem_shrink_all() tries to unbind objects, which requires device
      access and so tries to how an rpm reference triggering a warning:
      
      [   44.235420] ------------[ cut here ]------------
      [   44.235424] WARNING: CPU: 2 PID: 2199 at drivers/gpu/drm/i915/intel_runtime_pm.c:2688 intel_runtime_pm_get_if_in_use+0xe6/0xf0
      [   44.235426] WARN_ON_ONCE(ret < 0)
      [   44.235445] Modules linked in: ctr ccm arc4 rt2800usb rt2x00usb rt2800lib rt2x00lib crc_ccitt mac80211 cmac cfg80211 btusb rfcomm bnep btrtl btbcm btintel bluetooth dcdbas x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_codec_realtek crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_codec_generic aesni_intel snd_hda_codec_hdmi aes_x86_64 lrw gf128mul snd_hda_intel glue_helper ablk_helper cryptd snd_hda_codec hid_multitouch joydev snd_hda_core binfmt_misc i2c_hid serio_raw snd_pcm acpi_pad snd_timer snd i2c_designware_platform 8250_dw nls_iso8859_1 i2c_designware_core lpc_ich mfd_core soundcore usbhid hid psmouse ahci libahci
      [   44.235447] CPU: 2 PID: 2199 Comm: kworker/u8:8 Not tainted 4.8.0-rc5+ #130
      [   44.235447] Hardware name: Dell Inc. XPS 13 9343/0310JH, BIOS A07 11/11/2015
      [   44.235450] Workqueue: events_unbound async_run_entry_fn
      [   44.235453]  0000000000000000 ffff8801b2f7fb98 ffffffff81306c2f ffff8801b2f7fbe8
      [   44.235454]  0000000000000000 ffff8801b2f7fbd8 ffffffff81056c01 00000a801f50ecc0
      [   44.235456]  ffff88020ce50000 ffff88020ce59b60 ffffffff81a60b5c ffffffff81414840
      [   44.235456] Call Trace:
      [   44.235459]  [<ffffffff81306c2f>] dump_stack+0x4d/0x6e
      [   44.235461]  [<ffffffff81056c01>] __warn+0xd1/0xf0
      [   44.235464]  [<ffffffff81414840>] ? i915_pm_suspend_late+0x30/0x30
      [   44.235465]  [<ffffffff81056c6f>] warn_slowpath_fmt+0x4f/0x60
      [   44.235468]  [<ffffffff814e73ce>] ? pm_runtime_get_if_in_use+0x6e/0xa0
      [   44.235469]  [<ffffffff81433526>] intel_runtime_pm_get_if_in_use+0xe6/0xf0
      [   44.235471]  [<ffffffff81458a26>] i915_gem_shrink+0x306/0x360
      [   44.235473]  [<ffffffff81343fd4>] ? pci_platform_power_transition+0x24/0x90
      [   44.235475]  [<ffffffff81414840>] ? i915_pm_suspend_late+0x30/0x30
      [   44.235476]  [<ffffffff81458dfb>] i915_gem_shrink_all+0x1b/0x30
      [   44.235478]  [<ffffffff814560b3>] i915_gem_freeze_late+0x33/0x90
      [   44.235479]  [<ffffffff81414877>] i915_pm_freeze_late+0x37/0x40
      [   44.235481]  [<ffffffff814e9b8e>] dpm_run_callback+0x4e/0x130
      [   44.235483]  [<ffffffff814ea5db>] __device_suspend_late+0xdb/0x1f0
      [   44.235484]  [<ffffffff814ea70f>] async_suspend_late+0x1f/0xa0
      [   44.235486]  [<ffffffff81077557>] async_run_entry_fn+0x37/0x150
      [   44.235488]  [<ffffffff8106f518>] process_one_work+0x148/0x3f0
      [   44.235490]  [<ffffffff8106f8eb>] worker_thread+0x12b/0x490
      [   44.235491]  [<ffffffff8106f7c0>] ? process_one_work+0x3f0/0x3f0
      [   44.235492]  [<ffffffff81074d09>] kthread+0xc9/0xe0
      [   44.235495]  [<ffffffff816e257f>] ret_from_fork+0x1f/0x40
      [   44.235496]  [<ffffffff81074c40>] ? kthread_park+0x60/0x60
      [   44.235497] ---[ end trace e438706b97c7f132 ]---
      
      Alternatively, to actually shrink everything we have to do so slightly
      earlier in the hibernation process.
      
      To keep lockdep silent, we need to take struct_mutex for the shrinker
      even though we know that we are the only user during the freeze.
      
      Fixes: 7aab2d53 ("drm/i915: Shrink objects prior to hibernation")
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20160921135108.29574-2-chris@chris-wilson.co.uk
      (cherry picked from commit 6a800eab)
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      ec7ce653
  2. 19 9月, 2016 1 次提交
  3. 15 9月, 2016 2 次提交
  4. 09 9月, 2016 6 次提交
    • C
      drm/i915: Prepare object synchronisation for asynchronicity · a2bc4695
      Chris Wilson 提交于
      We are about to specialize object synchronisation to enable nonblocking
      execbuf submission. First we make a copy of the current object
      synchronisation for execbuffer. The general i915_gem_object_sync() will
      be removed following the removal of CS flips in the near future.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NJohn Harrison <john.c.harrison@intel.com>
      Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20160909131201.16673-16-chris@chris-wilson.co.uk
      a2bc4695
    • C
      drm/i915: Update reset path to fix incomplete requests · 821ed7df
      Chris Wilson 提交于
      Update reset path in preparation for engine reset which requires
      identification of incomplete requests and associated context and fixing
      their state so that engine can resume correctly after reset.
      
      The request that caused the hang will be skipped and head is reset to the
      start of breadcrumb. This allows us to resume from where we left-off.
      Since this request didn't complete normally we also need to cleanup elsp
      queue manually. This is vital if we employ nonblocking request
      submission where we may have a web of dependencies upon the hung request
      and so advancing the seqno manually is no longer trivial.
      
      ABI: gem_reset_stats / DRM_IOCTL_I915_GET_RESET_STATS
      
      We change the way we count pending batches. Only the active context
      involved in the reset is marked as either innocent or guilty, and not
      mark the entire world as pending. By inspection this only affects
      igt/gem_reset_stats (which assumes implementation details) and not
      piglit.
      
      ARB_robustness gives this guide on how we expect the user of this
      interface to behave:
      
       * Provide a mechanism for an OpenGL application to learn about
         graphics resets that affect the context.  When a graphics reset
         occurs, the OpenGL context becomes unusable and the application
         must create a new context to continue operation. Detecting a
         graphics reset happens through an inexpensive query.
      
      And with regards to the actual meaning of the reset values:
      
         Certain events can result in a reset of the GL context. Such a reset
         causes all context state to be lost. Recovery from such events
         requires recreation of all objects in the affected context. The
         current status of the graphics reset state is returned by
      
      	enum GetGraphicsResetStatusARB();
      
         The symbolic constant returned indicates if the GL context has been
         in a reset state at any point since the last call to
         GetGraphicsResetStatusARB. NO_ERROR indicates that the GL context
         has not been in a reset state since the last call.
         GUILTY_CONTEXT_RESET_ARB indicates that a reset has been detected
         that is attributable to the current GL context.
         INNOCENT_CONTEXT_RESET_ARB indicates a reset has been detected that
         is not attributable to the current GL context.
         UNKNOWN_CONTEXT_RESET_ARB indicates a detected graphics reset whose
         cause is unknown.
      
      The language here is explicit in that we must mark up the guilty batch,
      but is loose enough for us to relax the innocent (i.e. pending)
      accounting as only the active batches are involved with the reset.
      
      In the future, we are looking towards single engine resetting (with
      minimal locking), where it seems inappropriate to mark the entire world
      as innocent since the reset occurred on a different engine. Reducing the
      information available means we only have to encounter the pain once, and
      also reduces the information leaking from one context to another.
      
      v2: Legacy ringbuffer submission required a reset following hibernation,
      or else we restore stale values to the RING_HEAD and walked over
      stolen garbage.
      
      v3: GuC requires replaying the requests after a reset.
      
      v4: Restore engine IRQ after reset (so waiters will be woken!)
          Rearm hangcheck if resetting with a waiter.
      
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@intel.com>
      Cc: Arun Siluvery <arun.siluvery@linux.intel.com>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20160909131201.16673-13-chris@chris-wilson.co.uk
      821ed7df
    • C
      drm/i915: Replace wait-on-mutex with wait-on-bit in reset worker · 780f262a
      Chris Wilson 提交于
      Since we have a cooperative mode now with a direct reset, we can avoid
      the contention on struct_mutex and instead try then sleep on the
      I915_RESET_IN_PROGRESS bit. If the mutex is held and that bit is
      cleared, all is fine. Otherwise, we sleep for a bit and try again. In
      the worst case we sleep for an extra second waiting for the mutex to be
      released (no one touching the GPU is allowed the struct_mutex whilst the
      I915_RESET_IN_PROGRESS bit is set). But when we have a direct reset,
      this allows us to clean up the reset worker faster.
      
      v2: Remember to call wake_up_bit() after changing (for the faster wakeup
      as promised)
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20160909131201.16673-12-chris@chris-wilson.co.uk
      780f262a
    • C
      drm/i915: Perform a direct reset of the GPU from the waiter · 221fe799
      Chris Wilson 提交于
      If a waiter is holding the struct_mutex, then the reset worker cannot
      reset the GPU until the waiter returns. We do not want to return -EAGAIN
      form i915_wait_request as that breaks delicate operations like
      i915_vma_unbind() which often cannot be restarted easily, and returning
      -EIO is just as useless (and has in the past proven dangerous). The
      remaining WARN_ON(i915_wait_request) serve as a valuable reminder that
      handling errors from an indefinite wait are tricky.
      
      We can keep the current semantic that knowing after a reset is complete,
      so is the request, by performing the reset ourselves if we hold the
      mutex.
      
      uevent emission is still handled by the reset worker, so it may appear
      slightly out of order with respect to the actual reset (and concurrent
      use of the device).
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20160909131201.16673-11-chris@chris-wilson.co.uk
      221fe799
    • C
      drm/i915: Expand bool interruptible to pass flags to i915_wait_request() · ea746f36
      Chris Wilson 提交于
      We need finer control over wakeup behaviour during i915_wait_request(),
      so expand the current bool interruptible to a bitmask.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20160909131201.16673-9-chris@chris-wilson.co.uk
      ea746f36
    • C
      drm/i915: Separate out reset flags from the reset counter · 8af29b0c
      Chris Wilson 提交于
      In preparation for introducing a per-engine reset, we can first separate
      the mixing of the reset state from the global reset counter.
      
      The loss of atomicity in updating the reset state poses a small problem
      for handling the waiters. For requests, this is solved by advancing the
      seqno so that a waiter waking up after the reset knows the request is
      complete. For pending flips, we still rely on the increment of the
      global reset epoch (as well as the reset-in-progress flag) to signify
      when the hardware was reset.
      
      The advantage, now that we do not inspect the reset state during reset
      itself i.e. we no longer emit requests during reset, is that we can use
      the atomic updates of the state flags to ensure that only one reset
      worker is active.
      
      v2: Mika spotted that I transformed the i915_gem_wait_for_error() wakeup
      into a waiter wakeup.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Arun Siluvery <arun.siluvery@linux.intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1470414607-32453-6-git-send-email-arun.siluvery@linux.intel.comReviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20160909131201.16673-7-chris@chris-wilson.co.uk
      8af29b0c
  5. 08 9月, 2016 15 次提交
  6. 07 9月, 2016 1 次提交
  7. 02 9月, 2016 5 次提交
  8. 01 9月, 2016 1 次提交
  9. 29 8月, 2016 1 次提交
  10. 27 8月, 2016 1 次提交
  11. 26 8月, 2016 1 次提交
  12. 25 8月, 2016 1 次提交
  13. 23 8月, 2016 1 次提交
  14. 22 8月, 2016 2 次提交
    • L
      drm/i915/skl: Add support for the SAGV, fix underrun hangs · f4033726
      Lyude 提交于
      Since the watermark calculations for Skylake are still broken, we're apt
      to hitting underruns very easily under multi-monitor configurations.
      While it would be lovely if this was fixed, it's not. Another problem
      that's been coming from this however, is the mysterious issue of
      underruns causing full system hangs. An easy way to reproduce this with
      a skylake system:
      
      - Get a laptop with a skylake GPU, and hook up two external monitors to
        it
      - Move the cursor from the built-in LCD to one of the external displays
        as quickly as you can
      - You'll get a few pipe underruns, and eventually the entire system will
        just freeze.
      
      After doing a lot of investigation and reading through the bspec, I
      found the existence of the SAGV, which is responsible for adjusting the
      system agent voltage and clock frequencies depending on how much power
      we need. According to the bspec:
      
      "The display engine access to system memory is blocked during the
       adjustment time. SAGV defaults to enabled. Software must use the
       GT-driver pcode mailbox to disable SAGV when the display engine is not
       able to tolerate the blocking time."
      
      The rest of the bspec goes on to explain that software can simply leave
      the SAGV enabled, and disable it when we use interlaced pipes/have more
      then one pipe active.
      
      Sure enough, with this patchset the system hangs resulting from pipe
      underruns on Skylake have completely vanished on my T460s. Additionally,
      the bspec mentions turning off the SAGV	with more then one pipe enabled
      as a workaround for display underruns. While this patch doesn't entirely
      fix that, it looks like it does improve the situation a little bit so
      it's likely this is going to be required to make watermarks on Skylake
      fully functional.
      
      This will still need additional work in the future: we shouldn't be
      enabling the SAGV if any of the currently enabled planes can't enable WM
      levels that introduce latencies >= 30 µs.
      
      Changes since v11:
       - Add skl_can_enable_sagv()
       - Make sure we don't enable SAGV when not all planes can enable
         watermarks >= the SAGV engine block time. I was originally going to
         save this for later, but I recently managed to run into a machine
         that was having problems with a single pipe configuration + SAGV.
       - Make comparisons to I915_SKL_SAGV_NOT_CONTROLLED explicit
       - Change I915_SAGV_DYNAMIC_FREQ to I915_SAGV_ENABLE
       - Move printks outside of mutexes
       - Don't print error messages twice
      Changes since v10:
       - Apparently sandybridge_pcode_read actually writes values and reads
         them back, despite it's misleading function name. This means we've
         been doing this mostly wrong and have been writing garbage to the
         SAGV control. Because of this, we no longer attempt to read the SAGV
         status during initialization (since there are no helpers for this).
       - mlankhorst noticed that this patch was breaking on some very early
         pre-release Skylake machines, which apparently don't allow you to
         disable the SAGV. To prevent machines from failing tests due to SAGV
         errors, if the first time we try to control the SAGV results in the
         mailbox indicating an invalid command, we just disable future attempts
         to control the SAGV state by setting dev_priv->skl_sagv_status to
         I915_SKL_SAGV_NOT_CONTROLLED and make a note of it in dmesg.
       - Move mutex_unlock() a little higher in skl_enable_sagv(). This
         doesn't actually fix anything, but lets us release the lock a little
         sooner since we're finished with it.
      Changes since v9:
       - Only enable/disable sagv on Skylake
      Changes since v8:
       - Add intel_state->modeset guard to the conditional for
         skl_enable_sagv()
      Changes since v7:
       - Remove GEN9_SAGV_LOW_FREQ, replace with GEN9_SAGV_IS_ENABLED (that's
         all we use it for anyway)
       - Use GEN9_SAGV_IS_ENABLED instead of 0x1 for clarification
       - Fix a styling error that snuck past me
      Changes since v6:
       - Protect skl_enable_sagv() with intel_state->modeset conditional in
         intel_atomic_commit_tail()
      Changes since v5:
       - Don't use is_power_of_2. Makes things confusing
       - Don't use the old state to figure out whether or not to
         enable/disable the sagv, use the new one
       - Split the loop in skl_disable_sagv into it's own function
       - Move skl_sagv_enable/disable() calls into intel_atomic_commit_tail()
      Changes since v4:
       - Use is_power_of_2 against active_crtcs to check whether we have > 1
         pipe enabled
       - Fix skl_sagv_get_hw_state(): (temp & 0x1) indicates disabled, 0x0
         enabled
       - Call skl_sagv_enable/disable() from pre/post-plane updates
      Changes since v3:
       - Use time_before() to compare timeout to jiffies
      Changes since v2:
       - Really apply minor style nitpicks to patch this time
      Changes since v1:
       - Added comments about this probably being one of the requirements to
         fixing Skylake's watermark issues
       - Minor style nitpicks from Matt Roper
       - Disable these functions on Broxton, since it doesn't have an SAGV
      Signed-off-by: NLyude <cpaul@redhat.com>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1471463761-26796-3-git-send-email-cpaul@redhat.com
      [mlankhorst: ENOSYS -> ENXIO, whitespace fixes]
      
      (cherry picked from commit 656d1b89)
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      f4033726
    • D
      drm/i915: Reattach comment, complete type specification · 0184c2ff
      Dave Gordon 提交于
      In the recent patch
      bc3d6744 drm/i915: Allow userspace to request no-error-capture upon ...
      the final version moved the flags and the associated #defines around
      so they were adjacent; unfortunately, they ended up between a comment
      and the thing (hw_id) to which the comment applies :(
      
      So this patch reshuffles the comment and subject back together.
      
      Also, as we're touching 'hw_id', let's change it from just 'unsigned'
      to a fully-specified 'unsigned int', because some code checking tools
      (including checkpatch) object to plain 'unsigned'.
      
      Fixes: bc3d6744 ("drm/i915: Allow userspace to request no-error-capture...")
      Signed-off-by: NDave Gordon <david.s.gordon@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Link: http://patchwork.freedesktop.org/patch/msgid/1471616622-6919-1-git-send-email-david.s.gordon@intel.comReviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      (cherry picked from commit 0be81156)
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      0184c2ff