1. Sep 23, 2019
  2. Sep 21, 2019
  3. Sep 20, 2019
    • Chris Wilson's avatar
      Revert "drm/i915/tgl: Implement Wa_1406941453" · e5de91e6
      Chris Wilson authored
      Our sanitychecks indicate that while this register is context
      saved/restore, the HW does not preserve this bit within the register --
      it likely doesn't exist, or one of those mythical bits that the
      architects insist does something despite all appearances to the
      contrary.
      
      For reference, SAMPLER_MODE is already in i915_reg.h as
      GEN10_SAMPLER_MODE and is being setup in icl_ctx_workarounds_init() as
      opposed to the chosen location here of rcs_engine_wa_init).
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111754
      Fixes: 7f0cc34b
      
       ("drm/i915/tgl: Implement Wa_1406941453")
      Testcase: igt/i915_selftest/live_workarounds
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Lucas De Marchi <lucas.demarchi@intel.com>
      Cc: Stuart Summers <stuart.summers@intel.com>
      Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Acked-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190920081254.18389-1-chris@chris-wilson.co.uk
      e5de91e6
    • Chris Wilson's avatar
      drm/i915: Protect timeline->hwsp dereferencing · 9eee0dd7
      Chris Wilson authored
      
      
      As not only is the signal->timeline volatile, so will be acquiring the
      timeline's HWSP. We must first carefully acquire the timeline from the
      signaling request and then lock the timeline. With the removal of the
      struct_mutex serialisation of request construction, we can have multiple
      timelines active at once, and so we must avoid using the nested mutex
      lock as it is quite possible for both timelines to be establishing
      semaphores on the other and so deadlock.
      
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190919111912.21631-3-chris@chris-wilson.co.uk
      9eee0dd7
    • Chris Wilson's avatar
      drm/i915: Lock signaler timeline while navigating · 6a79d848
      Chris Wilson authored
      
      
      As we need to take a walk back along the signaler timeline to find the
      fence before upon which we want to wait, we need to lock that timeline
      to prevent it being modified as we walk. Similarly, we also need to
      acquire a reference to the earlier fence while it still exists!
      
      Though we lack the correct locking today, we are saved by the
      overarching struct_mutex -- but that protection is being removed.
      
      v2: Tvrtko made me realise I was being lax and using annotations to
      ignore the AB-BA deadlock from the timeline overlap. As it would be
      possible to construct a second request that was using a semaphore from the
      same timeline as ourselves, we could quite easily end up in a situation
      where we deadlocked in our mutex waits. Avoid that by using a trylock
      and falling back to a normal dma-fence await if contended.
      
      v3: Eek, the signal->timeline is volatile and must be carefully
      dereferenced to ensure it is valid.
      
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190919111912.21631-2-chris@chris-wilson.co.uk
      6a79d848
    • Chris Wilson's avatar
      drm/i915: Mark i915_request.timeline as a volatile, rcu pointer · d19d71fc
      Chris Wilson authored
      
      
      The request->timeline is only valid until the request is retired (i.e.
      before it is completed). Upon retiring the request, the context may be
      unpinned and freed, and along with it the timeline may be freed. We
      therefore need to be very careful when chasing rq->timeline that the
      pointer does not disappear beneath us. The vast majority of users are in
      a protected context, either during request construction or retirement,
      where the timeline->mutex is held and the timeline cannot disappear. It
      is those few off the beaten path (where we access a second timeline) that
      need extra scrutiny -- to be added in the next patch after first adding
      the warnings about dangerous access.
      
      One complication, where we cannot use the timeline->mutex itself, is
      during request submission onto hardware (under spinlocks). Here, we want
      to check on the timeline to finalize the breadcrumb, and so we need to
      impose a second rule to ensure that the request->timeline is indeed
      valid. As we are submitting the request, it's context and timeline must
      be pinned, as it will be used by the hardware. Since it is pinned, we
      know the request->timeline must still be valid, and we cannot submit the
      idle barrier until after we release the engine->active.lock, ergo while
      submitting and holding that spinlock, a second thread cannot release the
      timeline.
      
      v2: Don't be lazy inside selftests; hold the timeline->mutex for as long
      as we need it, and tidy up acquiring the timeline with a bit of
      refactoring (i915_active_add_request)
      
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190919111912.21631-1-chris@chris-wilson.co.uk
      d19d71fc
    • Chris Wilson's avatar
      drm/i915/tgl: Suspend pre-parser across GTT invalidations · c45e788d
      Chris Wilson authored
      Before we execute a batch, we must first issue any and all TLB
      invalidations so that batch picks up the new page table entries.
      Tigerlake's preparser is weakening our post-sync CS_STALL inside the
      invalidate pipe-control and allowing the loading of the batch buffer
      before we have setup its page table (and so it loads the wrong page and
      executes indefinitely).
      
      The igt_cs_tlb indicates that this issue can only be observed on rcs,
      even though the preparser is common to all engines. Alternatively, we
      could do TLB shootdown via mmio on updating the GTT.
      
      By inserting the pre-parser disable inside EMIT_INVALIDATE, we will also
      accidentally fixup execution that writes into subsequent batches, such
      as gem_exec_whisper and even relocations performed on the GPU. We should
      be careful not to allow this disable to become baked into the uABI! The
      issue is that if userspace relies on our disabling of the HW
      optimisation, when we are ready to enable that optimisation, userspace
      will then be broken...
      
      Testcase: igt/i915_selftests/live_gtt/igt_cs_tlb
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111753
      
      
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Acked-by: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190919151811.9526-1-chris@chris-wilson.co.uk
      c45e788d
    • Ville Syrjälä's avatar
      drm/i915: Don't advertise modes that exceed the max plane size · 2d20411e
      Ville Syrjälä authored
      
      
      Modern platforms allow the transcoders hdisplay/vdisplay to exceed the
      planes' max resolution. This has the nasty implication that modes on the
      connectors' mode list may not be usable when the user asks for a
      fullscreen plane. Seeing as that is the most common use case it seems
      prudent to filter out modes that don't allow for fullscreen planes to
      be enabled.
      
      Let's do that in the connetor .mode_valid() hook so that normally
      such modes are kept hidden but the user is still able to forcibly
      specify such a mode if they know they don't need fullscreen planes.
      
      This is in line with ealier policies regarding certain clock limits.
      The idea is to prevent the casual user from encountering a mode that
      would fail under typical conditions, but allow the expert user to
      force things if they so wish.
      
      Maybe in the future we should consider automagically using two
      planes when one can't cover the entire screen? Wouldn't be a
      great match for the current uapi with explicit planes though,
      but I guess no worse than using two pipes (which we apparently
      have to in the future anyway). Either that or we'd have to
      teach userspace to do it for us.
      
      v2: Fix icl+ max plane heigth (Manasi)
      
      Cc: Manasi Navare <manasi.d.navare@intel.com>
      Cc: Leho Kraav <leho@kraav.com>
      Cc: Sean Paul <sean@poorly.run>
      Cc: José Roberto de Souza <jose.souza@intel.com>
      Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Reviewed-by: default avatarManasi Navare <manasi.d.navare@intel.com>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190918150707.32420-1-ville.syrjala@linux.intel.com
      2d20411e