[PATCH 1/2] drm/i915/gvt: add override and restore callback for render mmio
Chuanxiao Dong
chuanxiao.dong at intel.com
Mon Feb 27 09:37:22 UTC 2017
When doing the render mmio load/restore, host might not be able to
directly use the guest render mmio value, e.g. guest and host are
using different ring submission, and in this case, GFX_MODE register
needs to be taken care separately.
This patch adds the override and restore call back for render mmio to
solve this gap. The override call back is used to override some of
the bits for a render mmio and restore call back is used to restore
the overridden bits back.
Signed-off-by: Chuanxiao Dong <chuanxiao.dong at intel.com>
---
drivers/gpu/drm/i915/gvt/render.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/i915/gvt/render.c b/drivers/gpu/drm/i915/gvt/render.c
index 73f052a..7997d70 100644
--- a/drivers/gpu/drm/i915/gvt/render.c
+++ b/drivers/gpu/drm/i915/gvt/render.c
@@ -41,7 +41,11 @@ struct render_mmio {
i915_reg_t reg;
u32 mask;
bool in_context;
+ void (*override)(struct render_mmio *mmio, u32 *v);
+ void (*restore)(struct render_mmio *mmio, u32 *v);
u32 value;
+ u32 override_mask;
+ u32 original_bits;
};
static struct render_mmio gen8_render_mmio_list[] = {
@@ -290,10 +294,13 @@ void intel_gvt_load_render_mmio(struct intel_vgpu *vgpu, int ring_id)
i915.enable_execlists)
continue;
+ v = vgpu_vreg(vgpu, mmio->reg);
+
+ if (mmio->override && mmio->restore)
+ mmio->override(mmio, &v);
+
if (mmio->mask)
- v = vgpu_vreg(vgpu, mmio->reg) | (mmio->mask << 16);
- else
- v = vgpu_vreg(vgpu, mmio->reg);
+ v |= (mmio->mask << 16);
I915_WRITE(mmio->reg, v);
POSTING_READ(mmio->reg);
@@ -325,8 +332,10 @@ void intel_gvt_restore_render_mmio(struct intel_vgpu *vgpu, int ring_id)
if (mmio->ring_id != ring_id)
continue;
- vgpu_vreg(vgpu, mmio->reg) = I915_READ(mmio->reg);
-
+ v = I915_READ(mmio->reg);
+ if (mmio->override && mmio->restore)
+ mmio->restore(mmio, &v);
+ vgpu_vreg(vgpu, mmio->reg) = v;
if (mmio->mask) {
vgpu_vreg(vgpu, mmio->reg) &= ~(mmio->mask << 16);
v = mmio->value | (mmio->mask << 16);
--
2.7.4
More information about the intel-gvt-dev
mailing list