1. 06 3月, 2014 4 次提交
    • P
      drm/i915: call assert_device_not_suspended at gen6_force_wake_work · b2ec142c
      Paulo Zanoni 提交于
      Because we shouldn't be runtime suspended when forcewake is supposed
      to be enabled.
      Signed-off-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      [danvet: Update commit message - no WARN expected since the bugfix for
      issues hit with this assert is already in. And resolve conflicts with
      the change from worker to timer for the delayed fw release.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      b2ec142c
    • P
      drm/i915: put runtime PM only when we actually release force_wake · 6d88064e
      Paulo Zanoni 提交于
      When we call gen6_gt_force_wake_put we don't actually put force_wake,
      we just schedule gen6_force_wake_work through mod_delayed_work, and
      that will eventually release force_wake.
      
      The problem is that we call intel_runtime_pm_put directly at
      gen6_gt_force_wake_put, so most of the times we put our runtime PM
      reference before the delayed work happens, so we may runtime suspend
      while force_wake is still supposed to be enabled if the graphics
      autosuspend_delay_ms is too small.
      
      Now the nice thing about the current code is that after it triggers
      the delayed work function it gets a refcount, and it only triggers the
      delayed work function if refcount is zero. This guarantees that when
      we schedule the funciton, it will run before we try to schedule it
      again, which simplifies the problem and allows for the current
      solution to work properly (hopefully!).
      
      v2: - Keep the VLV refcounts balanced (Jesse)
      Signed-off-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6d88064e
    • C
      drm/i915: Convert the forcewake worker into a timer func · 8232644c
      Chris Wilson 提交于
      We don't want to suffer scheduling delay when turning off the GPU after
      waking it up to touch registers. Ideally, we only want to keep the GPU
      awake for the register access sequence, with a single forcewake dance on
      the first access and release immediately after the last. We set a timer
      on the first access so that we only dance once and on the next scheduler
      tick, we drop the forcewake again.
      
      This moves the cleanup routine from the common i915 workqueue to a timer
      func so that we don't anger powertop, and drop the forcewake again
      quicker.
      
      v2: Enable the deferred force_wake_put for regular register reads as
          well.
      v3: Beautification and make sure we disable forcewake when shutting
          down.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Ben Widawsky <ben@bwidawsk.net>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      8232644c
    • M
      drm/i915: Fix forcewake counts for gen8 · e9dbd2b2
      Mika Kuoppala 提交于
      Sometimes generic driver code gets forcewake explicitly by
      gen6_gt_force_wake_get(), which check forcewake_count before accessing
      hardware. However the register access with gen8_write function access
      low level hw accessors directly, ignoring the forcewake_count. This
      leads to nested forcewake get from hardware, in ring init and possibly
      elsewhere, causing forcewake ack clear errors and/or hangs.
      
      Fix this by checking the forcewake count also in gen8_write
      
      v2: Read side doesn't care about shadowed registers,
          Remove __needs_put funkiness from gen8_write. (Ville)
          Improved commit message.
      
      References: https://bugs.freedesktop.org/show_bug.cgi?id=74007Signed-off-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Cc: Ben Widawsky <benjamin.widawsky@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      e9dbd2b2
  2. 22 1月, 2014 1 次提交
  3. 18 12月, 2013 1 次提交
    • B
      drm/i915: Get context early in execbuf · 41bde553
      Ben Widawsky 提交于
      We need to have the address space when reserving space for the objects.
      Since the address space and context are tied together, and reserve
      occurs before context switch (for good reason), we must lookup our
      context earlier in the process.
      
      This leaves some room for optimizations where we no longer need to use
      ctx_id in certain places. This will be addressed in a subsequent patch.
      
      Important tricky bit:
      Because slow relocations during execbuffer drop struct_mutex
      
      Perhaps it would be best to acquire the reference when we get the
      context, but I'll save that for another day (note I have written the
      patch before, and I found the changes required to be uglier than this).
      
      Note that since we currently access everything via context id, and not
      the data structure this is fine, though not desirable. The next change
      attempts to get the context only once via the context ID idr lookup, and
      as such, the following can happen:
      
      CTX-A is created, refcount = 1
      CTX-A execbuf, mutex dropped
      close IOCTL called on CTX-A, refcount = 0
      CTX-A resumes in execbuf.
      
      v2: Rebased on top of
      commit b6359918
      Author: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Date:   Wed Oct 30 15:44:16 2013 +0200
      
          drm/i915: add i915_get_reset_stats_ioctl
      
      v3: Rebased on top of
      commit 25b3dfc8
      Author: Mika Westerberg <mika.westerberg@linux.intel.com>
      Date:   Tue Nov 12 11:57:30 2013 +0200
      
      Author: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Date:   Tue Nov 26 16:14:33 2013 +0200
      
          drm/i915: check context reset stats before relocations
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      41bde553
  4. 14 12月, 2013 1 次提交
  5. 13 12月, 2013 1 次提交
  6. 11 12月, 2013 2 次提交
    • P
      drm/i915: add some runtime PM get/put calls · c8c8fb33
      Paulo Zanoni 提交于
      These are needed when we cat the debugfs and sysfs files.
      
      V2: - Rebase
      V3: - Rebase
      V4: - Rebase
      Signed-off-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c8c8fb33
    • P
      drm/i915: add initial Runtime PM functions · 8a187455
      Paulo Zanoni 提交于
      This patch adds the initial infrastructure to allow a Runtime PM
      implementation that sets the device to its D3 state. The patch just
      adds the necessary callbacks and the initial infrastructure.
      
      We still don't have any platform that actually uses this
      infrastructure, we still don't call get/put in all the places we need
      to, and we don't have any function to save/restore the state of the
      registers. This is not a problem since no platform uses the code added
      by this patch. We have a few people simultaneously working on runtime
      PM, so this initial code could help everybody make their plans.
      
      V2: - Move some functions to intel_pm.c
          - Remove useless pm_runtime_allow() call at init
          - Remove useless pm_runtime_mark_last_busy() call at get
          - Use pm_runtime_get_sync() instead of 2 calls
          - Add a WARN to check if we're really awake
      
      V3: - Rebase.
      
      V4: - Don't need to call pci_{save,restore}_state and
            pci_set_power_sate, since they're already called by the PCI
            layer
          - Remove wrong pm_runtime_enable() call at init_runtime_pm
      Signed-off-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Reviewed-by: NRodrigo Vivi <rodrigo.vivi@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      8a187455
  7. 09 12月, 2013 1 次提交
    • D
      drm/i915: Remove duplicate intel_uncore_forcewake_reset. · c461562e
      Deepak S 提交于
      Since early sanitize and uncore sanitize are called one after the other,
      I think, we can remove second forcewake reset which was are calling
      twice in both the functions.
      
      Note that this is merge fallout between
      
      commit ef46e0d2
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Sat Nov 16 16:00:09 2013 +0100
      
          drm/i915: restore the early forcewake cleanup
      
      and
      
      commit 521198a2
      Author: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Date:   Fri Aug 23 16:52:30 2013 +0300
      
          drm/i915: sanitize forcewake registers on reset
      Signed-off-by: NDeepak S <deepak.s@intel.com>
      [danvet: Explain how this came to be.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c461562e
  8. 04 12月, 2013 2 次提交
    • D
      drm/i915/vlv: Update Wait for FIFO and wait for 20 free entries. v3 · 5135d64b
      Deepak S 提交于
      On VLV, FIFO will be shared by both SW and HW. So, we read the
      free entries through register and update dev_priv variable
      and wait for only 20 entries to be free
      
      From Deepak's follow-up mail explaining why vlv is special:
      
      "On SB, Out of 64 FIFO Entries, 20 Entries will be used by HW and
      remaining 44 will be used by the SW,. I think due to this reason, we
      have a threshold of 20 Entries."
      
      "On VLV, HW and SW can access all 64 fifo entries, I don't think
      having a threshold of 20 Entries is mandatory on VLV. Also, since both
      SW and HW can access all 64 Entries. I think on VLV, we need to update
      the fifo_count before waiting for the FIFO."
      
      v2: Apply mask when we read the number of free FIFO entries (Ville).
      
      v3: Mask applied after reading the register (Deepak).
      Signed-off-by: NDeepak S <deepak.s@intel.com>
      [danvet: Add further explanation from Deepak to commit message.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      5135d64b
    • V
      drm/i915: Add REG_WRITE_FOOTER · 0d965301
      Ville Syrjälä 提交于
      Add a REG_WRITE_FOOTER macro as a counterpart to the REG_WRITE_HEADER.
      The current code has the spin_lock() in the HEADER, but the
      spin_unlock() is open coded, which looks rather confusing on the first
      glance. A bit of additional symmetry might help.
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      0d965301
  9. 28 11月, 2013 6 次提交
  10. 19 11月, 2013 1 次提交
  11. 18 11月, 2013 1 次提交
    • D
      drm/i915: restore the early forcewake cleanup · ef46e0d2
      Daniel Vetter 提交于
      Some BIOS just leak the forcewak bits, which we clean up.
      Unfortunately this has been broken in
      
      commit 521198a2
      Author: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Date:   Fri Aug 23 16:52:30 2013 +0300
      
          drm/i915: sanitize forcewake registers on reset
      
      To make this work both for resets and for BIOS takeover just add the
      forcewake clearing call back to intel_uncore_early_sanitize.
      
      We need to clear the forcewake in early sanitize so that the forcewak
      dance in intel_uncore_init (to figure out whether we have mt or legacy
      forcewake on ivb) works. That cleanup fits in nicely with the general
      topic of early_sanitize to prepare for the very first mmio ops.
      
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Reported-by: NJörg Otte <jrg.otte@gmail.com>
      Cc: Jörg Otte <jrg.otte@gmail.com>
      References: https://lkml.org/lkml/2013/11/16/40
      Cc: stable@vger.kernel.org (for 3.12 only)
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ef46e0d2
  12. 14 11月, 2013 1 次提交
  13. 13 11月, 2013 1 次提交
  14. 12 11月, 2013 1 次提交
    • M
      drm/i915: add i915_get_reset_stats_ioctl · b6359918
      Mika Kuoppala 提交于
      This ioctl returns reset stats for specified context.
      
      The struct returned contains context loss counters.
      
      reset_count:    all resets across all contexts
      batch_active:   active batches lost on resets
      batch_pending:  pending batches lost on resets
      
      v2: get rid of state tracking completely and deliver only counts. Idea
          from Chris Wilson.
      
      v3: fix commit message
      
      v4: default context handled inside i915_gem_context_get_hang_stats
      
      v5: reset_count only for priviledged process
      
      v6: ctx=0 needs CAP_SYS_ADMIN for batch_* counters (Chris Wilson)
      
      v7: context hang stats never returns NULL
      
      v8: rebased on top of reworked context hang stats
          DRM_RENDER_ALLOW for ioctl
      
      v9: use DEFAULT_CONTEXT_ID. Improve comments for ioctl struct members
      Signed-off-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Cc: Ian Romanick <idr@freedesktop.org>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NDamien Lespiau <damien.lespiau@intel.com>
      Reviewed-by: NIan Romanick <ian.d.romanick@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      b6359918
  15. 09 11月, 2013 2 次提交
  16. 08 11月, 2013 1 次提交
    • B
      drm/i915/bdw: Handle forcewake for writes on gen8 · ab2aa47e
      Ben Widawsky 提交于
      GEN8 removes the GT FIFO which we've all come to know and love. Instead
      it offers a wider range of optimized registers which always keep a
      shadowed copy, and are fed to the GPU when it wakes.
      
      How this is implemented in hardware is still somewhat of a mystery. As
      far as I can tell, the basic design is as follows:
      
      If the register is not optimized, you must use the old forcewake
      mechanism to bring the GT out of sleep. [1]
      
      If register is in the optimized list the write will signal that the
      GT should begin to come out of whatever sleep state it is in.
      
      While the GT is coming out of sleep, the requested write will be stored
      in an intermediate shadow register.
      
      Do to the fact that the implementation details are not clear, I see
      several risks:
      1. Order is not preserved as it is with GT FIFO. If we issue multiple
      writes to optimized registers, where order matters, we may need to
      serialize it with forcewake.
      2. The optimized registers have only 1 shadowed slot, meaning if we
      issue multiple writes to the same register, and those values need to
      reach the GPU in order, forcewake will be required.
      
      [1] We could implement a SW queue the way the GT FIFO used to work if
      desired.
      
      NOTE: Compile tested only until we get real silicon.
      
      v2:
      - Use a default case to make future platforms also work.
      - Get rid of IS_BROADWELL since that's not yet defined, but we want to
        MMIO as soon as possible.
      
      v3: Apply suggestions from Mika's review:
      - s/optimized/shadowed/
      - invert the logic of the helper so that it does what it says (the
        code itself was correct, just confusing to read).
      
      v4:
      - Squash in lost break.
      
      Signed-off-by: Ben Widawsky <ben@bwidawsk.net> (v1)
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ab2aa47e
  17. 10 10月, 2013 7 次提交
  18. 04 10月, 2013 1 次提交
    • C
      drm/i915/vlv: Turn off power gate for BIOS-less system. · 02f4c9e0
      Chon Ming Lee 提交于
      During system boot up, by default, the power gate for render, media and
      display well still power gated.  Normally, BIOS will turn off the power
      gate.  In the BIOS-less system, the driver need to turn off the power
      gate very early during driver load.
      
      v2: Move this to intel_uncore_sanitize to allow it to get call during
      resume path. (Daniel)
      v3: Remove redundant write 0 to DPIO_CTL, and use DPIO_RESET instead of
      just 0x1 (Ville)
          Add turn of power gate for display 2d/render well/media well.
      v4: Remove toggle cmnreset in intel_uncore_sanitize.  Cmnreset should
      toggle after CRI clock source has been selected.  Jesse DPIO reset patch
      which toggle the cmnreset in intel_modeset_init_hw() should handle it.
      (Ville)
      Signed-off-by: NChon Ming Lee <chon.ming.lee@intel.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      02f4c9e0
  19. 01 10月, 2013 1 次提交
    • C
      drm/i915: Delay the release of the forcewake by a jiffie · aec347ab
      Chris Wilson 提交于
      Obtaining the forcwake requires expensive and time consuming
      serialisation. And we often try to obtain the forcewake multiple times
      in very quick succession. We can reduce the overhead of these sequences
      by delaying the forcewake release, and so not hammer the hw quite so
      hard.
      
      I was hoping this would help with the spurious
      [drm:__gen6_gt_force_wake_mt_get] *ERROR* Timed out waiting for forcewake old ack to clear.
      found on Haswell. Alas not.
      
      v2: Fix teardown ordering - unmap the regs after turning off forcewake,
      and make sure we do turn off forcewake - both found by Ville.
      
      v3: As we introduce intel_uncore_fini(), use it to make sure everything
      is disabled before we hand back to the BIOS.
      
      Note: I have no claims for improved performance, stablity or power
      comsumption for this patch. We should not be hitting the registers often
      enough for this to improve benchmarks, but given the nature of our hw it
      is likely to improve long term stability.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      aec347ab
  20. 03 9月, 2013 1 次提交
  21. 25 7月, 2013 3 次提交