drm/i915/gvt: not to touch undefined MOCS registers
authorXinyun Liu <xinyun.liu@intel.com>
Mon, 29 Oct 2018 06:18:25 +0000 (14:18 +0800)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Mon, 12 Nov 2018 09:05:39 +0000 (17:05 +0800)
Some engines are not available for all Gens. eg, Gen11 introduced
VCS3/VCS4/VECS2, and VCS2 is not supported on some Gen9 machines. So need to
add check before access them.

Signed-off-by: Xinyun Liu <xinyun.liu@intel.com>
Signed-off-by: Yakui Zhao <Yakui.Zhao@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
drivers/gpu/drm/i915/gvt/mmio_context.c

index 088a62ab2bc8913431b803fb32dd830782ad39ca..cdd366d44938b135debd6f461fbe88748246342f 100644 (file)
@@ -171,6 +171,8 @@ static void load_render_mocs(struct drm_i915_private *dev_priv)
        int ring_id, i;
 
        for (ring_id = 0; ring_id < ARRAY_SIZE(regs); ring_id++) {
+               if (!HAS_ENGINE(dev_priv, ring_id))
+                       continue;
                offset.reg = regs[ring_id];
                for (i = 0; i < GEN9_MOCS_SIZE; i++) {
                        gen9_render_mocs.control_table[ring_id][i] =