1. 23 5月, 2016 3 次提交
    • D
      drm/i915/guc: don't spinwait if the GuC's workqueue is full · 551aaecd
      Dave Gordon 提交于
      Rather than wait to see whether more space becomes available in the GuC
      submission workqueue, we can just return -EAGAIN and let the caller try
      again in a little while. This gets rid of an uninterruptable sleep in
      the polling code :)
      
      We'll also add a counter to the GuC client statistics, to see how often
      we find the WQ full.
      
      v2:
          Flag the likely() code path (Tvtrko Ursulin).
      
      v4:
          Add/update comments about failure counters (Tvtrko Ursulin).
      Signed-off-by: NDave Gordon <david.s.gordon@intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      551aaecd
    • D
      drm/i915/guc: pass request (not client) to i915_guc_{wq_check_space, submit}() · 7c2c270d
      Dave Gordon 提交于
      The knowledge of how to derive the relevant client from the request
      should be localised within i915_guc_submission.c; the LRC code shouldn't
      have to know about the internal details of the GuC submission process.
      And all the information the GuC code needs should be encapsulated in (or
      reachable from) the request.
      
      v2:
          GEM_BUG_ON() for bad GuC client (Tvrtko Ursulin).
          Add/update kerneldoc explaining check_space/submit protocol
      Signed-off-by: NDave Gordon <david.s.gordon@intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      7c2c270d
    • D
      drm/i915/guc: add enable_guc_loading parameter · fce91f22
      Dave Gordon 提交于
      Split the function of "enable_guc_submission" into two separate
      options.  The new one ("enable_guc_loading") controls only the
      *fetching and loading* of the GuC firmware image. The existing
      one is redefined to control only the *use* of the GuC for batch
      submission once the firmware is loaded.
      
      In addition, the degree of control has been refined from a simple
      bool to an integer key, allowing several options:
      -1 (default)     whatever the platform default is
       0  DISABLE      don't load/use the GuC
       1  BEST EFFORT  try to load/use the GuC, fallback if not available
       2  REQUIRE      must load/use the GuC, else leave the GPU wedged
      
      The new platform default (as coded here) will be to attempt to
      load the GuC iff the device has a GuC that requires firmware,
      but not yet to use it for submission. A later patch will change
      to enable it if appropriate.
      
      v4:
          Changed some error-message levels, mostly ERROR->INFO, per
          review comments by Tvrtko Ursulin.
      
      v5:
          Dropped one more error message, disabled GuC submission on
          hypothetical firmware-free devices [Tvrtko Ursulin].
      
      v6:
          Logging tidy by Tvrtko Ursulin:
           * Do not log falling back to execlists when wedging the GPU.
           * Do not log fw load errors when load was disabled by user.
           * Pass down some error code from fw load for log message to
             make more sense.
      Signed-off-by: NDave Gordon <david.s.gordon@intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> (v5)
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Tested-by: NFiedorowicz, Lukasz <lukasz.fiedorowicz@intel.com>
      Signed-off-by: NDave Gordon <david.s.gordon@intel.com>
      Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> (v5)
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: Nick Hoath <nicholas.hoath@intel.com> (v6)
      fce91f22
  2. 11 5月, 2016 1 次提交
  3. 28 4月, 2016 1 次提交
  4. 25 4月, 2016 1 次提交
  5. 20 4月, 2016 3 次提交
    • D
      drm/i915/guc: local optimisations and updating comments · 86e06cc0
      Dave Gordon 提交于
      Tidying up guc_init_proc_desc() and adding commentary to the client
      structure after the recent change in GuC page mapping strategy.
      Signed-off-by: NDave Gordon <david.s.gordon@intel.com>
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1461078516-28678-1-git-send-email-david.s.gordon@intel.comReviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      86e06cc0
    • A
      drm/i915/guc: drop cached copy of 'wq_head' · a5916e8f
      Alex Dai 提交于
      Now that we keep the GuC client process descriptor permanently mapped,
      we don't really need to keep a local copy of the GuC's work-queue-head.
      So we can simplify the code a little by not doing this.
      Signed-off-by: NAlex Dai <yu.dai@intel.com>
      Signed-off-by: NDave Gordon <david.s.gordon@intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      a5916e8f
    • D
      drm/i915/guc: keep GuC doorbell & process descriptor mapped in kernel · 0d92a6a4
      Dave Gordon 提交于
      Don't use kmap_atomic() for doorbell & process descriptor access.
      This patch fixes the BUG shown below, where the thread could sleep
      while holding a kmap_atomic mapping. In order not to need to call
      kmap_atomic() in this code path, we now set up a permanent kernel
      mapping of the shared doorbell and process-descriptor page, and
      use that in all doorbell and process-descriptor related code.
      
        BUG: scheduling while atomic: gem_close_race/1941/0x00000002
        Modules linked in: hid_generic usbhid i915 asix usbnet libphy mii
          i2c_algo_bit drm_kms_helper cfbfillrect syscopyarea cfbimgblt
          sysfillrect sysimgblt fb_sys_fops cfbcopyarea drm coretemp i2c_hid
          hid video pinctrl_sunrisepoint pinctrl_intel acpi_pad nls_iso8859_1
          e1000e ptp psmouse pps_core ahci libahci
        CPU: 0 PID: 1941 Comm: gem_close_race Tainted: G     U 4.4.0-160121+ #123
        Hardware name: Intel Corporation Skylake Client platform/Skylake AIO
          DDR3L RVP10, BIOS SKLSE2R1.R00.X100.B01.1509220551 09/22/2015
          0000000000013e40 ffff880166c27a78 ffffffff81280d02 ffff880172c13e40
          ffff880166c27a88 ffffffff810c203a ffff880166c27ac8 ffffffff814ec808
          ffff88016b7c6000 ffff880166c28000 00000000000f4240 0000000000000001
        Call Trace:
          [<ffffffff81280d02>] dump_stack+0x4b/0x79
          [<ffffffff810c203a>] __schedule_bug+0x41/0x4f
          [<ffffffff814ec808>] __schedule+0x5a8/0x690
          [<ffffffff814ec927>] schedule+0x37/0x80
          [<ffffffff814ef3fd>] schedule_hrtimeout_range_clock+0xad/0x130
          [<ffffffff81090be0>] ? hrtimer_init+0x10/0x10
          [<ffffffff814ef3f1>] ?  schedule_hrtimeout_range_clock+0xa1/0x130
          [<ffffffff814ef48e>] schedule_hrtimeout_range+0xe/0x10
          [<ffffffff814eef9b>] usleep_range+0x3b/0x40
          [<ffffffffa01ec109>] i915_guc_wq_check_space+0x119/0x210 [i915]
          [<ffffffffa01da47c>] intel_logical_ring_alloc_request_extras+0x5c/0x70 [i915]
          [<ffffffffa01cdbf1>] i915_gem_request_alloc+0x91/0x170 [i915]
          [<ffffffffa01c1c07>] i915_gem_do_execbuffer.isra.25+0xbc7/0x12a0 [i915]
          [<ffffffffa01cb785>] ?  i915_gem_object_get_pages_gtt+0x225/0x3c0 [i915]
          [<ffffffffa01d1fb6>] ? i915_gem_pwrite_ioctl+0xd6/0x9f0 [i915]
          [<ffffffffa01c2e68>] i915_gem_execbuffer2+0xa8/0x250 [i915]
          [<ffffffffa00f65d8>] drm_ioctl+0x258/0x4f0 [drm]
          [<ffffffffa01c2dc0>] ? i915_gem_execbuffer+0x340/0x340 [i915]
          [<ffffffff8111590d>] do_vfs_ioctl+0x2cd/0x4a0
          [<ffffffff8111eac2>] ? __fget+0x72/0xb0
          [<ffffffff81115b1c>] SyS_ioctl+0x3c/0x70
          [<ffffffff814effd7>] entry_SYSCALL_64_fastpath+0x12/0x6a
        ------------[ cut here ]------------
      
      v4:
        Only tear down doorbell & kunmap() client object if we actually
        succeeded in allocating a client object (Tvrtko Ursulin)
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93847Original-version-by: NAlex Dai <yu.dai@intel.com>
      Signed-off-by: NDave Gordon <david.s.gordon@intel.com>
      Cc: Tvtrko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      0d92a6a4
  6. 24 3月, 2016 2 次提交
  7. 16 3月, 2016 3 次提交
    • T
      drm/i915: More intel_engine_cs renaming · 666796da
      Tvrtko Ursulin 提交于
      Some trivial ones, first pass done with Coccinelle:
      
      @@
      @@
      (
      - I915_NUM_RINGS
      + I915_NUM_ENGINES
      |
      - intel_ring_flag
      + intel_engine_flag
      |
      - for_each_ring
      + for_each_engine
      |
      - i915_gem_request_get_ring
      + i915_gem_request_get_engine
      |
      - intel_ring_idle
      + intel_engine_idle
      |
      - i915_gem_reset_ring_status
      + i915_gem_reset_engine_status
      |
      - i915_gem_reset_ring_cleanup
      + i915_gem_reset_engine_cleanup
      |
      - init_ring_lists
      + init_engine_lists
      )
      
      But that didn't fully work so I cleaned it up with:
      
      for f in *.[hc]; do sed -i -e s/I915_NUM_RINGS/I915_NUM_ENGINES/ $f; done
      for f in *.[hc]; do sed -i -e s/i915_gem_request_get_ring/i915_gem_request_get_engine/ $f; done
      for f in *.[hc]; do sed -i -e s/intel_ring_flag/intel_engine_flag/ $f; done
      for f in *.[hc]; do sed -i -e s/intel_ring_idle/intel_engine_idle/ $f; done
      for f in *.[hc]; do sed -i -e s/init_ring_lists/init_engine_lists/ $f; done
      for f in *.[hc]; do sed -i -e s/i915_gem_reset_ring_cleanup/i915_gem_reset_engine_cleanup/ $f; done
      for f in *.[hc]; do sed -i -e s/i915_gem_reset_ring_status/i915_gem_reset_engine_status/ $f; done
      
      v2: Rebase.
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      666796da
    • T
      drm/i915: Rename intel_engine_cs struct members · 4a570db5
      Tvrtko Ursulin 提交于
      below and a couple manual fixups.
      
      @@
      identifier I, J;
      @@
      struct I {
      ...
      - struct intel_engine_cs *J;
      + struct intel_engine_cs *engine;
      ...
      }
      @@
      identifier I, J;
      @@
      struct I {
      ...
      - struct intel_engine_cs J;
      + struct intel_engine_cs engine;
      ...
      }
      @@
      struct drm_i915_private *d;
      @@
      (
      - d->ring
      + d->engine
      )
      @@
      struct i915_execbuffer_params *p;
      @@
      (
      - p->ring
      + p->engine
      )
      @@
      struct intel_ringbuffer *r;
      @@
      (
      - r->ring
      + r->engine
      )
      @@
      struct drm_i915_gem_request *req;
      @@
      (
      - req->ring
      + req->engine
      )
      
      v2: Script missed the tracepoint code - fixed up by hand.
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      4a570db5
    • T
      drm/i915: Rename local struct intel_engine_cs variables · e2f80391
      Tvrtko Ursulin 提交于
      Done by the Coccinelle script below plus a manual
      intervention to GEN8_RING_SEMAPHORE_INIT.
      
      @@
      expression E;
      @@
      - struct intel_engine_cs *ring = E;
      + struct intel_engine_cs *engine = E;
      <+...
      - ring
      + engine
      ...+>
      @@
      @@
      - struct intel_engine_cs *ring;
      + struct intel_engine_cs *engine;
      <+...
      - ring
      + engine
      ...+>
      Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      e2f80391
  8. 25 1月, 2016 2 次提交
  9. 21 1月, 2016 1 次提交
  10. 05 1月, 2016 4 次提交
  11. 19 12月, 2015 1 次提交
  12. 12 12月, 2015 1 次提交
    • D
      drm/i915: mark GEM object pages dirty when mapped & written by the CPU · 033908ae
      Dave Gordon 提交于
      In various places, a single page of a (regular) GEM object is mapped into
      CPU address space and updated. In each such case, either the page or the
      the object should be marked dirty, to ensure that the modifications are
      not discarded if the object is evicted under memory pressure.
      
      The typical sequence is:
      	va = kmap_atomic(i915_gem_object_get_page(obj, pageno));
      	*(va+offset) = ...
      	kunmap_atomic(va);
      
      Here we introduce i915_gem_object_get_dirty_page(), which performs the
      same operation as i915_gem_object_get_page() but with the side-effect
      of marking the returned page dirty in the pagecache.  This will ensure
      that if the object is subsequently evicted (due to memory pressure),
      the changes are written to backing store rather than discarded.
      
      Note that it works only for regular (shmfs-backed) GEM objects, but (at
      least for now) those are the only ones that are updated in this way --
      the objects in question are contexts and batchbuffers, which are always
      shmfs-backed.
      
      Separate patches deal with the cases where whole objects are (or may
      be) dirtied.
      
      v3: Mark two more pages dirty in the page-boundary-crossing
          cases of the execbuffer relocation code [Chris Wilson]
      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/1449773486-30822-2-git-send-email-david.s.gordon@intel.comReviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      033908ae
  13. 03 12月, 2015 1 次提交
  14. 27 11月, 2015 1 次提交
  15. 18 11月, 2015 1 次提交
    • V
      drm/i915: Type safe register read/write · f0f59a00
      Ville Syrjälä 提交于
      Make I915_READ and I915_WRITE more type safe by wrapping the register
      offset in a struct. This should eliminate most of the fumbles we've had
      with misplaced parens.
      
      This only takes care of normal mmio registers. We could extend the idea
      to other register types and define each with its own struct. That way
      you wouldn't be able to accidentally pass the wrong thing to a specific
      register access function.
      
      The gpio_reg setup is probably the ugliest thing left. But I figure I'd
      just leave it for now, and wait for some divine inspiration to strike
      before making it nice.
      
      As for the generated code, it's actually a bit better sometimes. Eg.
      looking at i915_irq_handler(), we can see the following change:
        lea    0x70024(%rdx,%rax,1),%r9d
        mov    $0x1,%edx
      - movslq %r9d,%r9
      - mov    %r9,%rsi
      - mov    %r9,-0x58(%rbp)
      - callq  *0xd8(%rbx)
      + mov    %r9d,%esi
      + mov    %r9d,-0x48(%rbp)
       callq  *0xd8(%rbx)
      
      So previously gcc thought the register offset might be signed and
      decided to sign extend it, just in case. The rest appears to be
      mostly just minor shuffling of instructions.
      
      v2: i915_mmio_reg_{offset,equal,valid}() helpers added
          s/_REG/_MMIO/ in the register defines
          mo more switch statements left to worry about
          ring_emit stuff got sorted in a prep patch
          cmd parser, lrc context and w/a batch buildup also in prep patch
          vgpu stuff cleaned up and moved to a prep patch
          all other unrelated changes split out
      v3: Rebased due to BXT DSI/BLC, MOCS, etc.
      v4: Rebased due to churn, s/i915_mmio_reg_t/i915_reg_t/
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Link: http://patchwork.freedesktop.org/patch/msgid/1447853606-2751-1-git-send-email-ville.syrjala@linux.intel.com
      f0f59a00
  16. 21 10月, 2015 3 次提交
  17. 06 10月, 2015 1 次提交
  18. 30 9月, 2015 1 次提交
  19. 02 9月, 2015 1 次提交
  20. 15 8月, 2015 4 次提交
    • A
      drm/i915: Integrate GuC-based command submission · d1675198
      Alex Dai 提交于
      GuC-based submission is mostly the same as execlist mode, up to
      intel_logical_ring_advance_and_submit(), where the context being
      dispatched would be added to the execlist queue; at this point
      we submit the context to the GuC backend instead.
      
      There are, however, a few other changes also required, notably:
      1.  Contexts must be pinned at GGTT addresses accessible by the GuC
          i.e. NOT in the range [0..WOPCM_SIZE), so we have to add the
          PIN_OFFSET_BIAS flag to the relevant GGTT-pinning calls.
      
      2.  The GuC's TLB must be invalidated after a context is pinned at
          a new GGTT address.
      
      3.  GuC firmware uses the one page before Ring Context as shared data.
          Therefore, whenever driver wants to get base address of LRC, we
          will offset one page for it. LRC_PPHWSP_PN is defined as the page
          number of LRCA.
      
      4.  In the work queue used to pass requests to the GuC, the GuC
          firmware requires the ring-tail-offset to be represented as an
          11-bit value, expressed in QWords. Therefore, the ringbuffer
          size must be reduced to the representable range (4 pages).
      
      v2:
          Defer adding #defines until needed [Chris Wilson]
          Rationalise type declarations [Chris Wilson]
      
      v4:
          Squashed kerneldoc patch into here [Daniel Vetter]
      
      v5:
          Update request->tail in code common to both GuC and execlist modes.
          Add a private version of lr_context_update(), as sharing the
              execlist version leads to race conditions when the CPU and
              the GuC both update TAIL in the context image.
          Conversion of error-captured HWS page to string must account
              for offset from start of object to actual HWS (LRC_PPHWSP_PN).
      
      Issue: VIZ-4884
      Signed-off-by: NAlex Dai <yu.dai@intel.com>
      Signed-off-by: NDave Gordon <david.s.gordon@intel.com>
      Reviewed-by: NTom O'Rourke <Tom.O'Rourke@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d1675198
    • D
      drm/i915: Implementation of GuC submission client · 44a28b1d
      Dave Gordon 提交于
      A GuC client has its own doorbell and workqueue. It maintains the
      doorbell cache line, process description object and work queue item.
      
      A default guc_client is created for the i915 driver to use for
      normal-priority in-order submission.
      
      Note that the created client is not yet ready for use; doorbell
      allocation will fail as we haven't yet linked the GuC's context
      descriptor to the default contexts for each ring (see later patch).
      
      v2:
          Defer adding structure members until needed [Chris Wilson]
          Rationalise type declarations [Chris Wilson]
      
      v5:
          Add GuC per-engine submission & seqno statistics.
          Move wq locking to encompass both get_space() and add_item().
          Take forcewake lock in host2guc_action() [Tom O'Rourke]
      
      v6:
          Fix GuC doorbell cacheline selection code (the
              cacheline-within-page calculation was wrong).
          Rename GuC priorities to make them closer to the names used in
              the GuC firmware source, matching what the autogenerated
              versions will (probably) be.
          Add per-ring statistics to client.
      
      Issue: VIZ-4884
      Signed-off-by: NAlex Dai <yu.dai@intel.com>
      Signed-off-by: NDave Gordon <david.s.gordon@intel.com>
      Reviewed-by: NTom O'Rourke <Tom.O'Rourke@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      44a28b1d
    • A
      drm/i915: Enable GuC firmware log · 4c7e77fc
      Alex Dai 提交于
      Allocate a GEM object to hold GuC log data. A debugfs interface
      (i915_guc_log_dump) is provided to print out the log content.
      
      v2:
          Add struct members at point of use [Chris Wilson]
      
      v6:
          Rebased
      
      Issue: VIZ-4884
      Signed-off-by: NAlex Dai <yu.dai@intel.com>
      Signed-off-by: NDave Gordon <david.s.gordon@intel.com>
      Reviewed-by: NTom O'Rourke <Tom.O'Rourke@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      4c7e77fc
    • A
      drm/i915: Prepare for GuC-based command submission · bac427f8
      Alex Dai 提交于
      This adds the first of the data structures used to communicate with the
      GuC (the pool of guc_context structures).
      
      We create a GuC-specific wrapper round the GEM object allocator as all
      GEM objects shared with the GuC must be pinned into GGTT space at an
      address that is NOT in the range [0..WOPCM_TOP), as that range of GGTT
      addresses is not accessible to the GuC (from the GuC's point of view,
      it's permanently reserved for other objects such as the BootROM & SRAM).
      
      Later, we will need to allocate additional GuC-sharable objects for the
      submission client(s) and the GuC's debug log.
      
      v2:
          Remove redundant initialisation [Chris Wilson]
          Defer adding struct members until needed [Chris Wilson]
          Local functions should pass dev_priv rather than dev [Chris Wilson]
      
      v5:
          Invalidate GuC TLB after allocating and pinning a new object
      
      v6:
          Rebased
      
      Issue: VIZ-4884
      Signed-off-by: NAlex Dai <yu.dai@intel.com>
      Signed-off-by: NDave Gordon <david.s.gordon@intel.com>
      Reviewed-by: NTom O'Rourke <Tom.O'Rourke@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      bac427f8