2019-03-29 14:12:17 +08:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-10-20 01:05:20 +08:00
|
|
|
From: Ping Gao <ping.a.gao@intel.com>
|
|
|
|
Date: Wed, 6 Sep 2017 16:13:40 +0800
|
2019-03-29 14:12:17 +08:00
|
|
|
Subject: [PATCH] drm/i915/gvt: Simply the conformance check
|
2018-10-20 01:05:20 +08:00
|
|
|
|
|
|
|
The overall comparison for non-context MMIOs only need once, then
|
|
|
|
it's enough for conformance check that audit these MMIOs during
|
|
|
|
runtime to make sure the value written to them are the same with
|
|
|
|
the host cache. The way could void frequently overall comparion.
|
|
|
|
|
|
|
|
Signed-off-by: Ping Gao <ping.a.gao@intel.com>
|
2018-10-30 05:21:52 +08:00
|
|
|
Reviewed-by: Kevin Tian
|
2018-10-20 01:05:20 +08:00
|
|
|
Reviewed-by: Singh, Satyeshwar <satyeshwar.singh@intel.com>
|
|
|
|
Reviewed-on:
|
|
|
|
Reviewed-by: He, Min <min.he@intel.com>
|
|
|
|
Reviewed-by: Jiang, Fei <fei.jiang@intel.com>
|
|
|
|
Reviewed-by: Dong, Eddie <eddie.dong@intel.com>
|
|
|
|
Tested-by: Dong, Eddie <eddie.dong@intel.com>
|
|
|
|
|
|
|
|
v2: rebase to 4.19, reuse gvt_host_reg() to fix wrong offset
|
|
|
|
|
|
|
|
Signed-off-by: Xinyun Liu <xinyun.liu@intel.com>
|
|
|
|
---
|
|
|
|
drivers/gpu/drm/i915/gvt/cmd_parser.c | 26 ++++++++++++++++++++++++++
|
|
|
|
drivers/gpu/drm/i915/gvt/gvt.h | 1 +
|
|
|
|
drivers/gpu/drm/i915/gvt/mmio.c | 10 ++++++++++
|
|
|
|
3 files changed, 37 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c
|
2020-05-05 09:02:46 +08:00
|
|
|
index d69cc8e63..150ba0f07 100644
|
2018-10-20 01:05:20 +08:00
|
|
|
--- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
|
|
|
|
+++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
|
|
|
|
@@ -966,6 +966,32 @@ static int cmd_handler_lri(struct parser_exec_state *s)
|
|
|
|
ret |= cmd_reg_handler(s, cmd_reg(s, i), i, "lri");
|
|
|
|
if (ret)
|
|
|
|
break;
|
|
|
|
+
|
|
|
|
+ if (s->vgpu->entire_nonctxmmio_checked
|
|
|
|
+ && intel_gvt_mmio_is_non_context(gvt,
|
|
|
|
+ cmd_reg(s, i))) {
|
|
|
|
+ int offset = cmd_reg(s, i);
|
|
|
|
+ int value = cmd_val(s, i + 1);
|
|
|
|
+
|
|
|
|
+ if (intel_gvt_mmio_has_mode_mask(gvt, offset)) {
|
|
|
|
+ u32 mask = value >> 16;
|
|
|
|
+
|
|
|
|
+ vgpu_vreg(s->vgpu, offset) =
|
|
|
|
+ (vgpu_vreg(s->vgpu, offset) & ~mask)
|
|
|
|
+ | (value & mask);
|
|
|
|
+ } else {
|
|
|
|
+ vgpu_vreg(s->vgpu, offset) = value;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (gvt_host_reg(gvt, offset) !=
|
|
|
|
+ vgpu_vreg(s->vgpu, offset)) {
|
|
|
|
+
|
|
|
|
+ gvt_err("vgpu%d unexpected non-context MMIO "
|
|
|
|
+ "access by cmd 0x%x:0x%x,0x%x\n",
|
|
|
|
+ s->vgpu->id, offset, value,
|
|
|
|
+ gvt_host_reg(gvt, offset));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
diff --git a/drivers/gpu/drm/i915/gvt/gvt.h b/drivers/gpu/drm/i915/gvt/gvt.h
|
2020-05-05 09:02:46 +08:00
|
|
|
index 882859c20..7da1e9bad 100644
|
2018-10-20 01:05:20 +08:00
|
|
|
--- a/drivers/gpu/drm/i915/gvt/gvt.h
|
|
|
|
+++ b/drivers/gpu/drm/i915/gvt/gvt.h
|
|
|
|
@@ -239,6 +239,7 @@ struct intel_vgpu {
|
|
|
|
|
|
|
|
unsigned long long *cached_guest_entry;
|
|
|
|
bool ge_cache_enable;
|
|
|
|
+ bool entire_nonctxmmio_checked;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* validating GM healthy status*/
|
|
|
|
diff --git a/drivers/gpu/drm/i915/gvt/mmio.c b/drivers/gpu/drm/i915/gvt/mmio.c
|
2020-05-05 09:02:46 +08:00
|
|
|
index 4cb3f72ab..b6a974f55 100644
|
2018-10-20 01:05:20 +08:00
|
|
|
--- a/drivers/gpu/drm/i915/gvt/mmio.c
|
|
|
|
+++ b/drivers/gpu/drm/i915/gvt/mmio.c
|
|
|
|
@@ -213,6 +213,14 @@ int intel_vgpu_emulate_mmio_write(struct intel_vgpu *vgpu, uint64_t pa,
|
|
|
|
if (ret < 0)
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
+ if (vgpu->entire_nonctxmmio_checked
|
|
|
|
+ && intel_gvt_mmio_is_non_context(vgpu->gvt, offset)
|
|
|
|
+ && vgpu_vreg(vgpu, offset) != gvt_host_reg(gvt, offset)) {
|
|
|
|
+ gvt_err("vgpu%d unexpected non-context MMIO change at 0x%x:0x%x,0x%x\n",
|
|
|
|
+ vgpu->id, offset, vgpu_vreg(vgpu, offset),
|
|
|
|
+ gvt_host_reg(gvt, offset));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
intel_gvt_mmio_set_accessed(gvt, offset);
|
|
|
|
ret = 0;
|
|
|
|
goto out;
|
|
|
|
@@ -298,6 +306,8 @@ void intel_vgpu_reset_mmio(struct intel_vgpu *vgpu, bool dmlr)
|
|
|
|
vgpu_vreg_t(vgpu, HUC_STATUS2) = I915_READ(HUC_STATUS2);
|
|
|
|
mmio_hw_access_post(dev_priv);
|
|
|
|
}
|
|
|
|
+ /* Non-context MMIOs need entire check again if mmio/vgpu reset */
|
|
|
|
+ vgpu->entire_nonctxmmio_checked = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
--
|
2019-04-08 18:08:36 +08:00
|
|
|
https://clearlinux.org
|
2018-10-20 01:05:20 +08:00
|
|
|
|