drm/i915: Introduce intel_gt_mcr_lock_sanitize()

Implement intel_gt_mcr_lock_sanitize() to provide a mechanism
for cleaning the steer semaphore when absolutely necessary.

v2: remove unnecessary lock(Andi, Matt)
    improve the kernel doc(Matt)
    s/intel_gt_mcr_lock_clear/intel_gt_mcr_lock_sanitize

Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230928130015.6758-1-nirmoy.das@intel.com
This commit is contained in:
Nirmoy Das 2023-09-28 15:00:12 +02:00
parent 03d681412b
commit 42a71bbaee
2 changed files with 23 additions and 0 deletions

View File

@ -419,6 +419,28 @@ void intel_gt_mcr_unlock(struct intel_gt *gt, unsigned long flags)
intel_uncore_write_fw(gt->uncore, MTL_STEER_SEMAPHORE, 0x1);
}
/**
* intel_gt_mcr_lock_sanitize - Sanitize MCR steering lock
* @gt: GT structure
*
* This will be used to sanitize the initial status of the hardware lock
* during driver load and resume since there won't be any concurrent access
* from other agents at those times, but it's possible that boot firmware
* may have left the lock in a bad state.
*
*/
void intel_gt_mcr_lock_sanitize(struct intel_gt *gt)
{
/*
* This gets called at load/resume time, so we shouldn't be
* racing with other driver threads grabbing the mcr lock.
*/
lockdep_assert_not_held(&gt->mcr_lock);
if (GRAPHICS_VER_FULL(gt->i915) >= IP_VER(12, 70))
intel_uncore_write_fw(gt->uncore, MTL_STEER_SEMAPHORE, 0x1);
}
/**
* intel_gt_mcr_read - read a specific instance of an MCR register
* @gt: GT structure

View File

@ -11,6 +11,7 @@
void intel_gt_mcr_init(struct intel_gt *gt);
void intel_gt_mcr_lock(struct intel_gt *gt, unsigned long *flags);
void intel_gt_mcr_unlock(struct intel_gt *gt, unsigned long flags);
void intel_gt_mcr_lock_sanitize(struct intel_gt *gt);
u32 intel_gt_mcr_read(struct intel_gt *gt,
i915_mcr_reg_t reg,