#include "i915_selftest.h"
 #include "intel_sseu.h"
 #include "intel_timeline_types.h"
+#include "intel_uncore.h"
 #include "intel_wakeref.h"
 #include "intel_workarounds_types.h"
 
        u32 context_size;
        u32 mmio_base;
 
+       /*
+        * Some w/a require forcewake to be held (which prevents RC6) while
+        * a particular engine is active. If so, we set fw_domain to which
+        * domains need to be held for the duration of request activity,
+        * and 0 if none. We try to limit the duration of the hold as much
+        * as possible.
+        */
+       enum forcewake_domains fw_domain;
+       atomic_t fw_active;
+
        unsigned long context_tag;
 
        struct rb_node uabi_node;
 
        ce->lrc.ccid |= engine->execlists.ccid;
 
        __intel_gt_pm_get(engine->gt);
+       if (engine->fw_domain && !atomic_fetch_inc(&engine->fw_active))
+               intel_uncore_forcewake_get(engine->uncore, engine->fw_domain);
        execlists_context_status_change(rq, INTEL_CONTEXT_SCHEDULE_IN);
        intel_engine_context_in(engine);
 
        intel_context_update_runtime(ce);
        intel_engine_context_out(engine);
        execlists_context_status_change(rq, INTEL_CONTEXT_SCHEDULE_OUT);
+       if (engine->fw_domain && !atomic_dec_return(&engine->fw_active))
+               intel_uncore_forcewake_put(engine->uncore, engine->fw_domain);
        intel_gt_pm_put_async(engine->gt);
 
        /*