Skip to content

Commit 5679dd2

Browse files
committed
Merge tag 'drm-intel-fixes-2023-10-26' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
- Determine context valid in OA reports (Umesh) - Hold GT forcewake during steering operations (Matt Roper) - Check if PMU is closed before stopping event (Umesh) Signed-off-by: Dave Airlie <[email protected]> From: Rodrigo Vivi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 6366ffa + 4cbed77 commit 5679dd2

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

drivers/gpu/drm/i915/gt/intel_gt_mcr.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,26 @@ void intel_gt_mcr_lock(struct intel_gt *gt, unsigned long *flags)
376376
* driver threads, but also with hardware/firmware agents. A dedicated
377377
* locking register is used.
378378
*/
379-
if (GRAPHICS_VER_FULL(gt->i915) >= IP_VER(12, 70))
379+
if (GRAPHICS_VER_FULL(gt->i915) >= IP_VER(12, 70)) {
380+
/*
381+
* The steering control and semaphore registers are inside an
382+
* "always on" power domain with respect to RC6. However there
383+
* are some issues if higher-level platform sleep states are
384+
* entering/exiting at the same time these registers are
385+
* accessed. Grabbing GT forcewake and holding it over the
386+
* entire lock/steer/unlock cycle ensures that those sleep
387+
* states have been fully exited before we access these
388+
* registers. This wakeref will be released in the unlock
389+
* routine.
390+
*
391+
* This is expected to become a formally documented/numbered
392+
* workaround soon.
393+
*/
394+
intel_uncore_forcewake_get(gt->uncore, FORCEWAKE_GT);
395+
380396
err = wait_for(intel_uncore_read_fw(gt->uncore,
381397
MTL_STEER_SEMAPHORE) == 0x1, 100);
398+
}
382399

383400
/*
384401
* Even on platforms with a hardware lock, we'll continue to grab
@@ -415,8 +432,11 @@ void intel_gt_mcr_unlock(struct intel_gt *gt, unsigned long flags)
415432
{
416433
spin_unlock_irqrestore(&gt->mcr_lock, flags);
417434

418-
if (GRAPHICS_VER_FULL(gt->i915) >= IP_VER(12, 70))
435+
if (GRAPHICS_VER_FULL(gt->i915) >= IP_VER(12, 70)) {
419436
intel_uncore_write_fw(gt->uncore, MTL_STEER_SEMAPHORE, 0x1);
437+
438+
intel_uncore_forcewake_put(gt->uncore, FORCEWAKE_GT);
439+
}
420440
}
421441

422442
/**

drivers/gpu/drm/i915/i915_perf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,7 @@ static void oa_report_id_clear(struct i915_perf_stream *stream, u32 *report)
482482
static bool oa_report_ctx_invalid(struct i915_perf_stream *stream, void *report)
483483
{
484484
return !(oa_report_id(stream, report) &
485-
stream->perf->gen8_valid_ctx_bit) &&
486-
GRAPHICS_VER(stream->perf->i915) <= 11;
485+
stream->perf->gen8_valid_ctx_bit);
487486
}
488487

489488
static u64 oa_timestamp(struct i915_perf_stream *stream, void *report)
@@ -5106,6 +5105,7 @@ static void i915_perf_init_info(struct drm_i915_private *i915)
51065105
perf->gen8_valid_ctx_bit = BIT(16);
51075106
break;
51085107
case 12:
5108+
perf->gen8_valid_ctx_bit = BIT(16);
51095109
/*
51105110
* Calculate offset at runtime in oa_pin_context for gen12 and
51115111
* cache the value in perf->ctx_oactxctrl_offset.

drivers/gpu/drm/i915/i915_pmu.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,9 +832,18 @@ static void i915_pmu_event_start(struct perf_event *event, int flags)
832832

833833
static void i915_pmu_event_stop(struct perf_event *event, int flags)
834834
{
835+
struct drm_i915_private *i915 =
836+
container_of(event->pmu, typeof(*i915), pmu.base);
837+
struct i915_pmu *pmu = &i915->pmu;
838+
839+
if (pmu->closed)
840+
goto out;
841+
835842
if (flags & PERF_EF_UPDATE)
836843
i915_pmu_event_read(event);
837844
i915_pmu_disable(event);
845+
846+
out:
838847
event->hw.state = PERF_HES_STOPPED;
839848
}
840849

0 commit comments

Comments
 (0)