2019-03-29 14:12:17 +08:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-10-11 02:06:46 +08:00
|
|
|
From: Zhao Yakui <yakui.zhao@intel.com>
|
|
|
|
Date: Wed, 5 Sep 2018 15:52:06 +0800
|
2019-03-29 14:12:17 +08:00
|
|
|
Subject: [PATCH] drm/i915/gvt: Check the state of PVMMIO gtt table to avoid
|
|
|
|
incorrect calling for hypervisor
|
2018-10-11 02:06:46 +08:00
|
|
|
|
|
|
|
Now hypervisor adds strict checks when the sos tries to add/delete the mapping
|
|
|
|
between gfn and mfn. In such case it should check the state of PVMMIO gtt
|
|
|
|
table to avoid the incorrect hyper call. If the mapping between gfn and mfn
|
|
|
|
is not setup for PVMMIO GTT, it should not remove the mapping. Otherwise
|
|
|
|
the hypervisor will report that the mapping doesn't exist.
|
|
|
|
|
|
|
|
Tracked-On: https://github.com/projectacrn/acrn-hypervisor/issues/1158
|
|
|
|
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
|
|
|
|
Reviewed-by: He, Min <min.he@intel.com>
|
|
|
|
---
|
|
|
|
drivers/gpu/drm/i915/gvt/cfg_space.c | 7 +++++++
|
|
|
|
drivers/gpu/drm/i915/gvt/gtt.h | 3 +++
|
|
|
|
2 files changed, 10 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/drivers/gpu/drm/i915/gvt/cfg_space.c b/drivers/gpu/drm/i915/gvt/cfg_space.c
|
2020-10-27 02:14:06 +08:00
|
|
|
index fd461db48a8d..505e255c4d8a 100644
|
2018-10-11 02:06:46 +08:00
|
|
|
--- a/drivers/gpu/drm/i915/gvt/cfg_space.c
|
|
|
|
+++ b/drivers/gpu/drm/i915/gvt/cfg_space.c
|
|
|
|
@@ -152,6 +152,11 @@ int map_gttmmio(struct intel_vgpu *vgpu, bool map)
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (vgpu->gtt.ggtt_pv_mapped == map) {
|
|
|
|
+ /* If it is already set as the target state, skip it */
|
|
|
|
+ return ret;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
start = *(u64 *)(vgpu_cfg_space(vgpu) + PCI_BASE_ADDRESS_0);
|
|
|
|
start &= ~GENMASK(3, 0);
|
|
|
|
start += vgpu->cfg_space.bar[INTEL_GVT_PCI_BAR_GTTMMIO].size >> 1;
|
|
|
|
@@ -176,6 +181,8 @@ int map_gttmmio(struct intel_vgpu *vgpu, bool map)
|
|
|
|
start += sg->length >> PAGE_SHIFT;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ vgpu->gtt.ggtt_pv_mapped = map;
|
|
|
|
+
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/drivers/gpu/drm/i915/gvt/gtt.h b/drivers/gpu/drm/i915/gvt/gtt.h
|
2020-10-27 02:14:06 +08:00
|
|
|
index 5af949d8b316..b3cfcae4032a 100644
|
2018-10-11 02:06:46 +08:00
|
|
|
--- a/drivers/gpu/drm/i915/gvt/gtt.h
|
|
|
|
+++ b/drivers/gpu/drm/i915/gvt/gtt.h
|
2019-03-29 14:12:17 +08:00
|
|
|
@@ -198,6 +198,9 @@ struct intel_vgpu_gtt {
|
2018-10-11 02:06:46 +08:00
|
|
|
struct list_head oos_page_list_head;
|
|
|
|
struct list_head post_shadow_list_head;
|
|
|
|
struct intel_vgpu_scratch_pt scratch_pt[GTT_TYPE_MAX];
|
|
|
|
+
|
|
|
|
+ /* indicate whether the PV mapped is enabled for ggtt */
|
|
|
|
+ bool ggtt_pv_mapped;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern int intel_vgpu_init_gtt(struct intel_vgpu *vgpu);
|
|
|
|
--
|
2019-04-08 18:08:36 +08:00
|
|
|
https://clearlinux.org
|
2018-10-11 02:06:46 +08:00
|
|
|
|