1. 09 Nov, 2017 8 commits
    • Ville Syrjälä's avatar
      drm/i915: Move init_clock_gating() back to where it was · 6ac43272
      Ville Syrjälä authored
      Apparently setting up a bunch of GT registers before we've properly
      initialized the rest of the GT hardware leads to these setting being
      lost. So looks like I broke HSW with commit b7048ea1 ("drm/i915:
      Do .init_clock_gating() earlier to avoid it clobbering watermarks")
      by doing init_clock_gating() too early. This should actually affect
      other platforms as well, but apparently not to such a great degree.
      
      What I was ultimately after in that commit was to move the
      ilk_init_lp_watermarks() call earlier. So let's undo the damage and
      move init_clock_gating() back to where it was, and call
      ilk_init_lp_watermarks() just before the watermark state readout.
      
      This highlights how fragile and messed up our init order really is.
      I wonder why we even initialize the display before gem. The opposite
      order would make much more sense to me...
      
      v2: Keep WaRsPkgCStateDisplayPMReq:hsw early as it really must
          be done before all planes might get disabled.
      
      Cc: stable@vger.kernel.org
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Mark Janes <mark.a.janes@intel.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Oscar Mateo <oscar.mateo@intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Reported-by: default avatarMark Janes <mark.a.janes@intel.com>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103549
      Fixes: b7048ea1 ("drm/i915: Do .init_clock_gating() earlier to avoid it clobbering watermarks")
      References: https://lists.freedesktop.org/archives/intel-gfx/2017-November/145432.htmlSigned-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171108133555.14091-1-ville.syrjala@linux.intel.comTested-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      (cherry picked from commit f72b84c6)
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      6ac43272
    • Chris Wilson's avatar
      drm/i915: Prune the reservation shared fence array · 398c13b9
      Chris Wilson authored
      The shared fence array is not autopruning and may continue to grow as an
      object is shared between new timelines. Take the opportunity when we
      think the object is idle (we have to confirm that any external fence is
      also signaled) to decouple all the fences.
      
      We apply a similar trick after waiting on an object, see commit
      e54ca977 ("drm/i915: Remove completed fences after a wait")
      
      v2: No longer need to handle the batch pool as a special case.
      v3: Need to trylock from within i915_vma_retire as this may be called
      form the shrinker - and we may later try to allocate underneath the
      reservation lock, so a deadlock is possible.
      
      References: https://bugs.freedesktop.org/show_bug.cgi?id=102936
      Fixes: d07f0e59 ("drm/i915: Move GEM activity tracking into a common struct reservation_object")
      Fixes: 80b204bc ("drm/i915: Enable multiple timelines")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171107220656.5020-1-chris@chris-wilson.co.ukReviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      (cherry picked from commit 1ab22356)
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      398c13b9
    • Chris Wilson's avatar
      drm/i915: Idle the GPU before shinking everything · 0676e794
      Chris Wilson authored
      The handling of contexts are peculiar. Instead of tieing their vma to
      activity, we pin the context. This means that we cannot simply unbind
      the context object itself at will (which would normally cause us to wait
      for the vma to be idle), but must manually idle the GPU and retire
      requests first.
      
      A consequence of this peculiarity is when doing a last desperate attempt
      to recover memory. If the memory is tied up inside active context
      objects, we will fail to recover any memory simply by trying to unbind
      the objects without first doing a wait-for-idle.
      
      A side-effect of removing the call to shrinker_lock_uninterruptible()
      from i915_gem_shrinker_oom() was that we removed an unlocked
      wait-for-idle, and so lost the "natural" shrinkage of context objects.
      By replacing that with a locked wait from inside i915_gem_shrink(), we
      not only replace it with the ability to recover all context objects, but
      do so for all i915_gem_shrink_all() callers.
      
      v2: Switching requires request allocation, which is not permitted from
      inside the shrinker as it only uses ordinary allocations.
      
      References: https://bugs.freedesktop.org/show_bug.cgi?id=102936
      Fixes: f2123818 ("drm/i915: Move dev_priv->mm.[un]bound_list to its own lock")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171108094400.1386-1-chris@chris-wilson.co.ukReviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      (cherry picked from commit 2f6a3783)
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      0676e794
    • Chris Wilson's avatar
      drm/i915: Lock llist_del_first() vs llist_del_all() · 0f763ff3
      Chris Wilson authored
      An oversight in commit 87701b4b ("drm/i915: Only free the oldest
      stale object before a fresh allocation") was that not only do we have to
      serialise concurrent users of llist_del_first(), but we also have to
      lock llist_del_first() vs llist_del_all().
      
      From llist.h,
      
       * This can be summarized as follows:
       *
       *           |   add    | del_first |  del_all
       * add       |    -     |     -     |     -
       * del_first |          |     L     |     L
       * del_all   |          |           |     -
       *
       * Where, a particular row's operation can happen concurrently with a column's
       * operation, with "-" being no lock needed, while "L" being lock is needed.
      
      This should hopefully explain:
      
      <4>[   89.287106] general protection fault: 0000 [#1] PREEMPT SMP
      <4>[   89.287126] Modules linked in: snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic x86_pkg_temp_thermal intel_powerclamp coretemp i915 crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core r8169 mii mei_me mei snd_pcm prime_numbers i2c_hid pinctrl_geminilake pinctrl_intel
      <4>[   89.287226] CPU: 2 PID: 23 Comm: ksoftirqd/2 Tainted: G     U          4.14.0-rc8-CI-CI_DRM_3315+ #1
      <4>[   89.287247] Hardware name: Intel Corp. Geminilake/GLK RVP2 LP4SD (07), BIOS GELKRVPA.X64.0062.B30.1708222146 08/22/2017
      <4>[   89.287270] task: ffff88017ab34ec0 task.stack: ffffc90000128000
      <4>[   89.287290] RIP: 0010:llist_add_batch+0x4/0x20
      <4>[   89.287301] RSP: 0018:ffffc9000012bdb8 EFLAGS: 00010296
      <4>[   89.287314] RAX: ffffffff811017ad RBX: 6e468801a1560000 RCX: ef3e53fceecdeb81
      <4>[   89.287330] RDX: 6e468801a1566130 RSI: ffff880103d73d98 RDI: ffff880103d73d98
      <4>[   89.287346] RBP: ffffc9000012bdb8 R08: ffff88017ab35780 R09: 0000000000000000
      <4>[   89.287361] R10: ffffc9000012bd68 R11: 00000000abb18c3d R12: ffffffffa01369e0
      <4>[   89.287377] R13: ffff88017fd1b8f8 R14: ffff88017ab34ec0 R15: 000000000000000a
      <4>[   89.287393] FS:  0000000000000000(0000) GS:ffff88017fd00000(0000) knlGS:0000000000000000
      <4>[   89.287411] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      <4>[   89.287424] CR2: 00007ff0c0755018 CR3: 000000016df9b000 CR4: 00000000003406e0
      <4>[   89.287440] Call Trace:
      <4>[   89.287511]  __i915_gem_free_object_rcu+0x20/0x40 [i915]
      <4>[   89.287527]  rcu_process_callbacks+0x27a/0x730
      <4>[   89.287544]  __do_softirq+0xc0/0x4ae
      <4>[   89.287559]  ? smpboot_thread_fn+0x2d/0x280
      <4>[   89.287571]  run_ksoftirqd+0x1f/0x70
      <4>[   89.287582]  smpboot_thread_fn+0x18a/0x280
      <4>[   89.287595]  kthread+0x114/0x150
      <4>[   89.287605]  ? sort_range+0x30/0x30
      <4>[   89.287615]  ? kthread_create_on_node+0x40/0x40
      <4>[   89.287628]  ret_from_fork+0x27/0x40
      <4>[   89.287641] Code: 0d 48 83 ea 01 4c 89 c1 48 83 fa ff 74 12 48 23 0c d7 74 ed 48 c1 e2 06 48 0f bd c9 48 8d 04 0a 5d c3 90 90 90 90 90 55 48 89 e5 <48> 8b 0a 48 89 0e 48 89 c8 f0 48 0f b1 3a 48 39 c1 75 ed 48 85
      <1>[   89.287774] RIP: llist_add_batch+0x4/0x20 RSP: ffffc9000012bdb8
      <4>[   89.287826] ---[ end trace e775d15174d8ae02 ]---
      
      (Lockless lists are only easy (and lockless) when only using
      llist_add/llist_del_all!)
      
      Fixes: 87701b4b ("drm/i915: Only free the oldest stale object before
      a fresh allocation")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171106111508.11941-1-chris@chris-wilson.co.ukReviewed-by: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
      (cherry picked from commit f991c492)
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      0f763ff3
    • Maarten Lankhorst's avatar
      drm/i915: Calculate ironlake intermediate watermarks correctly, v2. · 90c702b8
      Maarten Lankhorst authored
      The watermarks it should calculate against are the old optimal watermarks.
      The currently active crtc watermarks are pure fiction, and are invalid in
      case of a nonblocking modeset, page flip enabling/disabling planes or any
      other reason.
      
      When the crtc is disabled or during a modeset the intermediate watermarks
      don't need to be programmed separately, and could be directly assigned
      to the optimal watermarks.
      
      Changes since v1:
      - Use intel_atomic_get_old_crtc_state. (ville)
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171019151341.4579-2-maarten.lankhorst@linux.intel.com
      [mlankhorst: Add cc stable and bugzilla link, since previous patch doesn't fix issue by itself]
      Cc: stable@vger.kernel.org #v4.8+
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102373
      (cherry picked from commit b6b178a7)
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      90c702b8
    • Joonas Lahtinen's avatar
      drm/i915: Disable lazy PPGTT page table optimization for vGPU · b58d4bef
      Joonas Lahtinen authored
      When running under virtualization (vGPU active), we must disable
      the lazy PPGTT page table initialization optimization introduced by
      commit 14826673 ("drm/i915: Only initialize partially filled
      pagetables").
      
      We must do this because GVT-g makes unduly assumptions about guest
      behaviour, which this optimization breaks. This results in following
      looking errors in the host:
      
      ERROR gvt: guest page write error -22, gfn 0x7ada8, pa 0x7ada89a8, var 0x6, len 1
      
      The real fix is to not to depend on i915 driver behaviour, but instead
      either rely on only the contracts that i915 has with the hardware, or
      add some paravirtualization. While the real fix is en route, it won't
      be finished in time for 4.15, so the best option is to disable the
      optimization for now when vGPU is active to avoid breaking 4.15 guests
      in existing VM environments.
      
      Fixes: 14826673 ("drm/i915: Only initialize partially filled pagetables")
      Suggested-by: default avatarXiaolin Zhang <xiaolin.zhang@intel.com>
      Signed-off-by: default avatarXiaolin Zhang <xiaolin.zhang@intel.com>
      [Joonas: Rewrote the commit message and added tags.]
      Signed-off-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Cc: Zhi Wang <zhi.a.wang@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Matthew Auld <matthew.auld@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Acked-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Acked-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171023153209.10527-1-joonas.lahtinen@linux.intel.com
      (cherry picked from commit 22a8a4fc)
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      b58d4bef
    • Chris Wilson's avatar
      drm/i915/execlists: Remove the priority "optimisation" · a2487174
      Chris Wilson authored
      Originally we set the priority to max upon inserting the request into
      the execlists queue (and removing it from the scheduler lists). We could
      then use the prio==INT_MAX as a shortcut within execlists_schedule() to
      detect the end of the dependency chain. Since commit 1f181225
      ("drm/i915/execlists: Keep request->priority for its lifetime") this is
      no longer true as we use the request completion as an indicator the
      schedule dependency chain is complete instead. (This allows us to then
      reschedule requests even when its context is in flight.) However, this
      makes the GEM_BUG_ON() inside execlists_schedule() racy as we may change
      the rq->prio at the same time. As the assertion is useful, let's keep
      the assertion and remove the micro-optimisation.
      
      Fixes: 1f181225 ("drm/i915/execlists: Keep request->priority for its lifetime")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Michał Winiarski <michal.winiarski@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171024115501.21033-1-chris@chris-wilson.co.ukReviewed-by: default avatarMichał Winiarski <michal.winiarski@intel.com>
      (cherry picked from commit 64b80085)
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      a2487174
    • Chris Wilson's avatar
      drm/i915: Filter out spurious execlists context-switch interrupts · 5d266692
      Chris Wilson authored
      Back in commit a4b2b015 ("drm/i915: Don't mark an execlists
      context-switch when idle") we noticed the presence of late
      context-switch interrupts. We were able to filter those out by looking
      at whether the ELSP remained active, but in commit beecec90
      ("drm/i915/execlists: Preemption!") that became problematic as we now
      anticipate receiving a context-switch event for preemption while ELSP
      may be empty. To restore the spurious interrupt suppression, add a
      counter for the expected number of pending context-switches and skip if
      we do not need to handle this interrupt to make forward progress.
      
      v2: Don't forget to switch on for preempt.
      v3: Reduce the counter to a on/off boolean tracker. Declare the HW as
      active when we first submit, and idle after the final completion event
      (with which we confirm the HW says it is idle), and track each source
      of activity separately. With a finite number of sources, it should aide
      us in debugging which gets stuck.
      
      Fixes: beecec90 ("drm/i915/execlists: Preemption!")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Michal Winiarski <michal.winiarski@intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171023213237.26536-3-chris@chris-wilson.co.ukReviewed-by: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
      (cherry picked from commit 4a118ecb)
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      5d266692
  2. 06 Nov, 2017 1 commit
  3. 04 Nov, 2017 2 commits
  4. 03 Nov, 2017 3 commits
    • Akshu Agrawal's avatar
      drm/amd/amdgpu: Enabling ACP clock in hw_init (v2) · 37c5f2c9
      Akshu Agrawal authored
      Enabling of ACP in hw_init does away with requirement of order
      of probe on designware_i2s and acp dma driver. designware_i2s
      reads i2s registers and this use to fail if acp dma driver was not probed
      prior to it.
      
      BUG=:b:62103837
      TEST=modprobe snd-soc-acp-pcm
      modprobe snd-soc-acp-rt5645-mach
      aplay -l
      **** List of PLAYBACK Hardware Devices ****
      card 0: acprt5650 [acprt5650], device 0: RT5645_AIF1 rt5645-aif1-0 []
        Subdevices: 1/1
          Subdevice #0: subdevice #0
      
      v2: use proper device in dev_err to fix warnings (Alex)
      Signed-off-by: default avatarAkshu Agrawal <akshu.agrawal@amd.com>
      Reviewed-on: https://chromium-review.googlesource.com/670207Reviewed-by: default avatarJason Clinton <jclinton@chromium.org>
      Reviewed-on: https://chromium-review.googlesource.com/676628Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      37c5f2c9
    • Dave Airlie's avatar
      Merge tag 'drm-intel-next-2017-10-23' of git://anongit.freedesktop.org/drm/drm-intel into drm-next · 36a5fdf7
      Dave Airlie authored
      This time really the last i915 batch for v4.15:
      
      - PSR state tracking in crtc state (Ville)
      - Fix eviction when the GGTT is idle but full (Chris)
      - BDW DP aux channel timeout fix (James)
      - LSPCON detection fixes (Shashank)
      - Use for_each_pipe to iterate over pipes (Mika Kahola)
      - Replace *_reference/unreference() or *_ref/unref with _get/put() (Harsha)
      - Refactoring and preparation for DDI encoder type cleanup (Ville)
      - Broadwell DDI FDI buf translation fix (Chris)
      - Read CSB and CSB write pointer from HWSP in GVT-g VM if available (Weinan)
      - GuC/HuC firmware loader refactoring (Michal)
      - Make shrinking more effective and not stall so much (Chris)
      - Cannonlake PLL fixes (Rodrigo)
      - DP MST connector error propagation fixes (James)
      - Convert timers to use timer_setup (Kees Cook)
      - Skylake plane enable/disable unification (Juha-Pekka)
      - Fix to actually free driver internal objects when requested (Chris)
      - DDI buf trans refactoring (Ville)
      - Skip waking the device to service pwrite (Chris)
      - Improve DSI VBT backlight parsing abstraction (Madhav)
      - Cannonlake VBT DDC pin mapping fix (Rodrigo)
      
      * tag 'drm-intel-next-2017-10-23' of git://anongit.freedesktop.org/drm/drm-intel: (87 commits)
        drm/i915: Update DRIVER_DATE to 20171023
        drm/i915/cnl: Map VBT DDC Pin to BSpec DDC Pin.
        drm/i915: Let's use more enum intel_dpll_id pll_id.
        drm/i915: Use existing DSI backlight ports info
        drm/i915: Parse DSI backlight/cabc ports.
        drm/i915: Skip waking the device to service pwrite
        drm/i915/crt: split compute_config hook by platforms
        drm/i915: remove g4x lowfreq_avail and has_pipe_cxsr
        drm/i915: Drop the redundant hdmi prefix/suffix from a lot of variables
        drm/i915: Unify error handling for missing DDI buf trans tables
        drm/i915: Centralize the SKL DDI A/E vs. B/C/D buf trans handling
        drm/i915: Kill off the BXT buf_trans default_index
        drm/i915: Pass encoder type to cnl_ddi_vswing_sequence() explicitly
        drm/i915: Integrate BXT into intel_ddi_dp_voltage_max()
        drm/i915: Pass the level to intel_prepare_hdmi_ddi_buffers()
        drm/i915: Pass the encoder type explicitly to skl_set_iboost()
        drm/i915: Extract intel_ddi_get_buf_trans_hdmi()
        drm/i915: Relocate intel_ddi_get_buf_trans_*() functions
        drm/i915: Flush the idle-worker for debugfs/i915_drop_caches
        drm/i915: adjust get_crtc_fence_y_offset() to use base.y instead of crtc.y
        ...
      36a5fdf7
    • Arnd Bergmann's avatar
      drm/amdgpu/virt: don't dereference undefined 'module' struct · e477e940
      Arnd Bergmann authored
      Accessing the THIS_MODULE directly is only possible when modules
      are enabled, otherwise we get a build failure:
      
      drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c: In function 'amdgpu_virt_init_data_exchange':
      drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c:331:20: error: dereferencing pointer to incomplete type 'struct module'
      
      Further, THIS_MODULE is NULL when the driver is built-in, so the
      code would likely cause a NULL pointer dereference.
      
      This adds an #ifdef check to avoid the compile-time error, plus
      a NULL pointer check before dereferencing THIS_MODULE. It might
      be better to find a way to avoid using the module version
      altogether.
      
      Fixes: 2dc8f81e ("drm/amdgpu: SR-IOV data exchange between PF&VF")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
      Reviewed-By: default avatarXiangliang Yu <Xiangliang.Yu@amd.com>
      e477e940
  5. 02 Nov, 2017 26 commits