1. 06 Dec, 2022 5 commits
  2. 05 Dec, 2022 3 commits
  3. 02 Dec, 2022 1 commit
    • Matt Roper's avatar
      drm/i915/mtl: Add hardware-level lock for steering · 3100240b
      Matt Roper authored
      Starting with MTL, the driver needs to not only protect the steering
      control register from simultaneous software accesses, but also protect
      against races with hardware/firmware agents.  The hardware provides a
      dedicated locking mechanism to support this via the MTL_STEER_SEMAPHORE
      register.  Reading the register acts as a 'trylock' operation; the read
      will return 0x1 if the lock is acquired or 0x0 if something else is
      already holding the lock; once acquired, writing 0x1 to the register
      will release the lock.
      
      We'll continue to grab the software lock as well, just so lockdep can
      track our locking; assuming the hardware lock is behaving properly,
      there should never be any contention on the software lock in this case.
      
      v2:
       - Extend hardware semaphore timeout and add a taint for CI if it ever
         happens (this would imply misbehaving hardware/firmware).  (Mika)
       - Add "MTL_" prefix to new steering semaphore register.  (Mika)
      
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: default avatarBalasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221128233014.4000136-5-matthew.d.roper@intel.com
      3100240b
  4. 01 Dec, 2022 2 commits
  5. 30 Nov, 2022 6 commits
  6. 29 Nov, 2022 2 commits
  7. 28 Nov, 2022 2 commits
  8. 24 Nov, 2022 2 commits
  9. 23 Nov, 2022 3 commits
  10. 22 Nov, 2022 1 commit
  11. 21 Nov, 2022 4 commits
  12. 18 Nov, 2022 1 commit
    • Matt Roper's avatar
      drm/i915/gt: Manage uncore->lock while waiting on MCR register · 192bb40f
      Matt Roper authored
      The GT MCR code currently relies on uncore->lock to avoid race
      conditions on the steering control register during MCR operations.  The
      *_fw() versions of MCR operations expect the caller to already hold
      uncore->lock, while the non-fw variants manage the lock internally.
      However the sole callsite of intel_gt_mcr_wait_for_reg_fw() does not
      currently obtain the forcewake lock, allowing a potential race condition
      (and triggering an assertion on lockdep builds).  Furthermore, since
      'wait for register value' requests may not return immediately, it is
      undesirable to hold a fundamental lock like uncore->lock for the entire
      wait and block all other MMIO for the duration; rather the lock is only
      needed around the MCR read operations and can be released during the
      delays.
      
      Convert intel_gt_mcr_wait_for_reg_fw() to a non-fw variant that will
      manage uncore->lock internally.  This does have the side effect of
      causing an unnecessary lookup in the forcewake table on each read
      operation, but since the caller is still holding the relevant forcewake
      domain, this will ultimately just incremenent the reference count and
      won't actually cause any additional MMIO traffic.
      
      In the future we plan to switch to a dedicated MCR lock to protect the
      steering critical section rather than using the overloaded and
      high-traffic uncore->lock; on MTL and beyond the new lock can be
      implemented on top of the hardware-provided synchonization mechanism for
      steering.
      
      Fixes: 3068bec8 ("drm/i915/gt: Add intel_gt_mcr_wait_for_reg_fw()")
      Cc: Lucas De Marchi <lucas.demarchi@intel.com>
      Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221117173358.1980230-1-matthew.d.roper@intel.com
      192bb40f
  13. 17 Nov, 2022 5 commits
  14. 16 Nov, 2022 3 commits
    • Daniele Ceraolo Spurio's avatar
      drm/i915/guc: add the GSC CS to the GuC capture list · b186b2d9
      Daniele Ceraolo Spurio authored
      For the GSC engine we only want to capture the instance regs.
      Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Cc: Alan Previn <alan.previn.teres.alexis@intel.com>
      Reviewed-by: default avatarAlan Previn <alan.previn.teres.alexis@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221111001832.4144910-1-daniele.ceraolospurio@intel.com
      b186b2d9
    • Alan Previn's avatar
      drm/i915/pxp: Separate PXP FW interface structures for both v42 and 43 · 07db5bd2
      Alan Previn authored
      Previously, we only used PXP FW interface version-42 structures for
      PXP arbitration session on ADL/TGL products and version-43 for HuC
      authentication on DG2. That worked fine despite not differentiating such
      versioning of the PXP firmware interaction structures. This was okay
      back then because the only commands used via version 42 was not
      used via version 43 and vice versa.
      
      With MTL, we'll need both these versions side by side for the same
      commands (PXP-session) with the older platform feature support. That
      said, let's create separate files to define the structures and definitions
      for both version-42 and 43 of PXP FW interfaces.
      Signed-off-by: default avatarAlan Previn <alan.previn.teres.alexis@intel.com>
      Reviewed-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221108045628.4187260-2-alan.previn.teres.alexis@intel.com
      07db5bd2
    • Matthew Auld's avatar
      drm/i915/ttm: never purge busy objects · 5524b5e5
      Matthew Auld authored
      In i915_gem_madvise_ioctl() we immediately purge the object is not
      currently used, like when the mm.pages are NULL.  With shmem the pages
      might still be hanging around or are perhaps swapped out. Similarly with
      ttm we might still have the pages hanging around on the ttm resource,
      like with lmem or shmem, but here we need to be extra careful since
      async unbinds are possible as well as in-progress kernel moves. In
      i915_ttm_purge() we expect the pipeline-gutting to nuke the ttm resource
      for us, however if it's busy the memory is only moved to a ghost object,
      which then leads to broken behaviour when for example clearing the
      i915_tt->filp, since the actual ttm_tt is still alive and populated,
      even though it's been moved to the ghost object.  When we later destroy
      the ghost object we hit the following, since the filp is now NULL:
      
      [  +0.006982] #PF: supervisor read access in kernel mode
      [  +0.005149] #PF: error_code(0x0000) - not-present page
      [  +0.005147] PGD 11631d067 P4D 11631d067 PUD 115972067 PMD 0
      [  +0.005676] Oops: 0000 [#1] PREEMPT SMP NOPTI
      [  +0.012962] Workqueue: events ttm_device_delayed_workqueue [ttm]
      [  +0.006022] RIP: 0010:i915_ttm_tt_unpopulate+0x3a/0x70 [i915]
      [  +0.005879] Code: 89 fb 48 85 f6 74 11 8b 55 4c 48 8b 7d 30 45 31 c0 31 c9 e8 18 6a e5 e0 80 7d 60 00 74 20 48 8b 45 68
      8b 55 08 4c 89 e7 5b 5d <48> 8b 40 20 83 e2 01 41 5c 89 d1 48 8b 70
       30 e9 42 b2 ff ff 4c 89
      [  +0.018782] RSP: 0000:ffffc9000bf6fd70 EFLAGS: 00010202
      [  +0.005244] RAX: 0000000000000000 RBX: ffff8883e12ae380 RCX: 0000000000000000
      [  +0.007150] RDX: 000000008000000e RSI: ffffffff823559b4 RDI: ffff8883e12ae3c0
      [  +0.007142] RBP: ffff888103b65d48 R08: 0000000000000001 R09: 0000000000000001
      [  +0.007144] R10: 0000000000000001 R11: ffff88829c2c8040 R12: ffff8883e12ae3c0
      [  +0.007148] R13: 0000000000000001 R14: ffff888115184140 R15: ffff888115184248
      [  +0.007154] FS:  0000000000000000(0000) GS:ffff88844db00000(0000) knlGS:0000000000000000
      [  +0.008108] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  +0.005763] CR2: 0000000000000020 CR3: 000000013fdb4004 CR4: 00000000003706e0
      [  +0.007152] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  +0.007145] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  +0.007154] Call Trace:
      [  +0.002459]  <TASK>
      [  +0.002126]  ttm_tt_unpopulate.part.0+0x17/0x70 [ttm]
      [  +0.005068]  ttm_bo_tt_destroy+0x1c/0x50 [ttm]
      [  +0.004464]  ttm_bo_cleanup_memtype_use+0x25/0x40 [ttm]
      [  +0.005244]  ttm_bo_cleanup_refs+0x90/0x2c0 [ttm]
      [  +0.004721]  ttm_bo_delayed_delete+0x235/0x250 [ttm]
      [  +0.004981]  ttm_device_delayed_workqueue+0x13/0x40 [ttm]
      [  +0.005422]  process_one_work+0x248/0x560
      [  +0.004028]  worker_thread+0x4b/0x390
      [  +0.003682]  ? process_one_work+0x560/0x560
      [  +0.004199]  kthread+0xeb/0x120
      [  +0.003163]  ? kthread_complete_and_exit+0x20/0x20
      [  +0.004815]  ret_from_fork+0x1f/0x30
      
      v2:
       - Just use ttm_bo_wait() directly (Niranjana)
       - Add testcase reference
      
      Testcase: igt@gem_madvise@dontneed-evict-race
      Fixes: 213d5092 ("drm/i915/ttm: Introduce a TTM i915 gem object backend")
      Reported-by: default avatarNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
      Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Cc: Andrzej Hajda <andrzej.hajda@intel.com>
      Cc: Nirmoy Das <nirmoy.das@intel.com>
      Cc: <stable@vger.kernel.org> # v5.15+
      Reviewed-by: default avatarNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
      Acked-by: default avatarNirmoy Das <Nirmoy.Das@intel.com>
      Reviewed-by: default avatarAndrzej Hajda <andrzej.hajda@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221115104620.120432-1-matthew.auld@intel.com
      5524b5e5