[PATCH V2] drm/i915/gvt: save RING_HEAD into vreg when vgpu switched out

Xiaolin Zhang xiaolin.zhang at intel.com
Wed May 22 05:08:00 UTC 2019


to save RING_HEAD into vgpu reg when vgpu switched out and report
it's value back to guest.

v2: save RING_TAIL as well during vgpu mmio switch to meet ring_is_idle
condition. (Fred Gao)
v1: based on input from Weinan. (Weinan Li)

Fixes: 519a019491b8 ("drm/i915/hangcheck: Replace hangcheck.seqno with RING_HEAD")

Signed-off-by: Xiaolin Zhang <xiaolin.zhang at intel.com>
---
 drivers/gpu/drm/i915/gvt/mmio_context.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/i915/gvt/mmio_context.c b/drivers/gpu/drm/i915/gvt/mmio_context.c
index 96e1edf..758a8b3 100644
--- a/drivers/gpu/drm/i915/gvt/mmio_context.c
+++ b/drivers/gpu/drm/i915/gvt/mmio_context.c
@@ -457,6 +457,7 @@ static void switch_mmio(struct intel_vgpu *pre,
 	struct intel_vgpu_submission *s;
 	struct engine_mmio *mmio;
 	u32 old_v, new_v;
+	u32 ring_base;
 
 	dev_priv = pre ? pre->gvt->dev_priv : next->gvt->dev_priv;
 	if (INTEL_GEN(dev_priv) >= 9)
@@ -519,6 +520,14 @@ static void switch_mmio(struct intel_vgpu *pre,
 				  old_v, new_v);
 	}
 
+	if (pre) {
+		ring_base = dev_priv->engine[ring_id]->mmio_base;
+		vgpu_vreg_t(pre, RING_HEAD(ring_base)) =
+				I915_READ_FW(RING_HEAD(ring_base));
+		vgpu_vreg_t(pre, RING_TAIL(ring_base)) =
+				I915_READ_FW(RING_TAIL(ring_base));
+	}
+
 	if (next)
 		handle_tlb_pending_event(next, ring_id);
 }
-- 
2.7.4



More information about the intel-gvt-dev mailing list