[PATCH] drm/i915/gvt: enter failsafe mode when guest requires more resources

Min He min.he at intel.com
Wed Feb 15 07:33:38 UTC 2017


Windows guest will notitfy GVTg to request more resources through g2v
interface, when its resources are not enough.
This patch is to handle this case and let vgpu enter failsafe mode to
avoid to many error messages.

Signed-off-by: Min He <min.he at intel.com>
Signed-off-by: Pei Zhang <pei.zhang at intel.com>
---
 drivers/gpu/drm/i915/gvt/handlers.c | 15 +++++++++++++++
 drivers/gpu/drm/i915/i915_pvinfo.h  | 17 +++++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c
index 6089a1e..50a1850 100644
--- a/drivers/gpu/drm/i915/gvt/handlers.c
+++ b/drivers/gpu/drm/i915/gvt/handlers.c
@@ -1090,6 +1090,21 @@ static int pvinfo_mmio_write(struct intel_vgpu *vgpu, unsigned int offset,
 	case _vgtif_reg(execlist_context_descriptor_lo):
 	case _vgtif_reg(execlist_context_descriptor_hi):
 		break;
+	case _vgtif_reg(min_low_gmadr):
+		gvt_err("Guest requires %d aperture size!\n", data);
+		break;
+	case _vgtif_reg(min_high_gmadr):
+		gvt_err("Guest requires %d hidden gm size!\n", data);
+		break;
+	case _vgtif_reg(min_fence_num):
+		gvt_err("Guest requires %d fence size!\n", data);
+		break;
+	case _vgtif_reg(rs_insufficient):
+		pr_err("***Guest resource is not enough**********\n");
+		pr_err("***Please try another vgpu type**********\n");
+		pr_err("***Entering failsafe mode****************\n");
+		vgpu->failsafe = true;
+		break;
 	default:
 		gvt_err("invalid pvinfo write offset %x bytes %x data %x\n",
 				offset, bytes, data);
diff --git a/drivers/gpu/drm/i915/i915_pvinfo.h b/drivers/gpu/drm/i915/i915_pvinfo.h
index c0cb297..98a0f18 100644
--- a/drivers/gpu/drm/i915/i915_pvinfo.h
+++ b/drivers/gpu/drm/i915/i915_pvinfo.h
@@ -86,8 +86,21 @@ struct vgt_if {
 	 */
 	u32 rsv4;
 	u32 display_ready;	/* ready for display owner switch */
-
-	u32 rsv5[4];
+	/*
+	 * driver reported status/error code
+	 *     0: if the avail_rs is sufficient to driver
+	 *  Bit 2,1,0 set indicating
+	 *       Insufficient low_gmadr, high_gmadr, fence resources.
+	 *  Other bits are reserved.
+	 */
+	uint32_t  rs_insufficient;
+	/*
+	 * The driver is required to update the following field with minimal
+	 * required resource size.
+	 */
+	uint32_t  min_low_gmadr;
+	uint32_t  min_high_gmadr;
+	uint32_t  min_fence_num;
 
 	u32 g2v_notify;
 	u32 rsv6[7];
-- 
1.9.1



More information about the intel-gvt-dev mailing list