]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm/i915/gvt: Implement WaForceWakeRenderDuringMmioTLBInvalidate
authorArkadiusz Hiler <arkadiusz.hiler@intel.com>
Fri, 21 Oct 2016 11:11:50 +0000 (13:11 +0200)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Mon, 24 Oct 2016 02:45:26 +0000 (10:45 +0800)
When invalidating RCS TLB the device can enter RC6 state interrupting
the process, therefore the need for render forcewake for the whole
procedure.

This WA is needed for all production SKL SKUs.

v2: reworked putting and getting forcewake with help of Mika Kuoppala
v3: use I915_READ_FW and I915_WRITE_FW as we are handling forcewake on
    in the code path

References: HSD#2136899, HSD#1404391274
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
drivers/gpu/drm/i915/gvt/render.c

index feebb65ba6417c8df4268aa9f9904f2cb54cb89a..be1a7dfd210ba9d48eca80058a0690c00604b108 100644 (file)
@@ -118,6 +118,7 @@ static u32 gen9_render_mocs_L3[32];
 static void handle_tlb_pending_event(struct intel_vgpu *vgpu, int ring_id)
 {
        struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv;
+       enum forcewake_domains fw;
        i915_reg_t reg;
        u32 regs[] = {
                [RCS] = 0x4260,
@@ -135,11 +136,25 @@ static void handle_tlb_pending_event(struct intel_vgpu *vgpu, int ring_id)
 
        reg = _MMIO(regs[ring_id]);
 
-       I915_WRITE(reg, 0x1);
+       /* WaForceWakeRenderDuringMmioTLBInvalidate:skl
+        * we need to put a forcewake when invalidating RCS TLB caches,
+        * otherwise device can go to RC6 state and interrupt invalidation
+        * process
+        */
+       fw = intel_uncore_forcewake_for_reg(dev_priv, reg,
+                                           FW_REG_READ | FW_REG_WRITE);
+       if (ring_id == RCS && IS_SKYLAKE(dev_priv))
+               fw |= FORCEWAKE_RENDER;
 
-       if (wait_for_atomic((I915_READ(reg) == 0), 50))
+       intel_uncore_forcewake_get(dev_priv, fw);
+
+       I915_WRITE_FW(reg, 0x1);
+
+       if (wait_for_atomic((I915_READ_FW(reg) == 0), 50))
                gvt_err("timeout in invalidate ring (%d) tlb\n", ring_id);
 
+       intel_uncore_forcewake_put(dev_priv, fw);
+
        gvt_dbg_core("invalidate TLB for ring %d\n", ring_id);
 }