drm/i915/mtl: Add hardware-level lock for steering
authorMatt Roper <matthew.d.roper@intel.com>
Mon, 28 Nov 2022 23:30:13 +0000 (15:30 -0800)
committerMatt Roper <matthew.d.roper@intel.com>
Fri, 2 Dec 2022 16:00:40 +0000 (08:00 -0800)
commit3100240bf846ead1a2dbd6ae62bf48c687b9f5be
tree69a2779fdeed8e358497445d76e34aba35bfcf14
parent70b612084586402d39aabf7d76c605914cc3c2b6
drm/i915/mtl: Add hardware-level lock for steering

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: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221128233014.4000136-5-matthew.d.roper@intel.com
drivers/gpu/drm/i915/gt/intel_gt_mcr.c
drivers/gpu/drm/i915/gt/intel_gt_regs.h