Skip to content

Commit ac533c5

Browse files
committed
drm/i915/gt: Track if an engine requires forcewake w/a
Sometimes an engine might need to keep forcewake active while it is busy submitting requests for a particular workaround. Track such nuisance with engine->fw_domain. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com> Cc: Venkata Sandeep Dhanalakota <venkata.s.dhanalakota@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200604153145.21068-1-chris@chris-wilson.co.uk
1 parent f4bb45f commit ac533c5

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

drivers/gpu/drm/i915/gt/intel_engine_types.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "i915_selftest.h"
2525
#include "intel_sseu.h"
2626
#include "intel_timeline_types.h"
27+
#include "intel_uncore.h"
2728
#include "intel_wakeref.h"
2829
#include "intel_workarounds_types.h"
2930

@@ -313,6 +314,16 @@ struct intel_engine_cs {
313314
u32 context_size;
314315
u32 mmio_base;
315316

317+
/*
318+
* Some w/a require forcewake to be held (which prevents RC6) while
319+
* a particular engine is active. If so, we set fw_domain to which
320+
* domains need to be held for the duration of request activity,
321+
* and 0 if none. We try to limit the duration of the hold as much
322+
* as possible.
323+
*/
324+
enum forcewake_domains fw_domain;
325+
atomic_t fw_active;
326+
316327
unsigned long context_tag;
317328

318329
struct rb_node uabi_node;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,6 +1373,8 @@ __execlists_schedule_in(struct i915_request *rq)
13731373
ce->lrc.ccid |= engine->execlists.ccid;
13741374

13751375
__intel_gt_pm_get(engine->gt);
1376+
if (engine->fw_domain && !atomic_fetch_inc(&engine->fw_active))
1377+
intel_uncore_forcewake_get(engine->uncore, engine->fw_domain);
13761378
execlists_context_status_change(rq, INTEL_CONTEXT_SCHEDULE_IN);
13771379
intel_engine_context_in(engine);
13781380

@@ -1441,6 +1443,8 @@ __execlists_schedule_out(struct i915_request *rq,
14411443
intel_context_update_runtime(ce);
14421444
intel_engine_context_out(engine);
14431445
execlists_context_status_change(rq, INTEL_CONTEXT_SCHEDULE_OUT);
1446+
if (engine->fw_domain && !atomic_dec_return(&engine->fw_active))
1447+
intel_uncore_forcewake_put(engine->uncore, engine->fw_domain);
14441448
intel_gt_pm_put_async(engine->gt);
14451449

14461450
/*

0 commit comments

Comments
 (0)