aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWeinan Li <weinan.z.li@intel.com>2019-06-13 21:35:19 -0400
committerZhenyu Wang <zhenyuw@linux.intel.com>2019-06-17 03:45:41 -0400
commit971afec3a5373f96684ad899579f6a4d51462410 (patch)
tree0fad1ad4ab99a80bfb0c1871864e161ebeab233c
parent15e7f52a4596b496ce3da2fa4c1f94c6fb0023f2 (diff)
drm/i915/gvt: ignore unexpected pvinfo write
There is pvinfo writing come from vgpu might be unexpected, like writing to one unknown address, GVT-g should do as reserved register to discard any invalid write. Now GVT-g lets it write to the vreg without prompt error message, should ignore the unexpected pvinfo write access and leave the vreg as the default value. For possible guest query GVT-g host feature, this returned proper value instead of wrong guest setting. v2: ignore unexpected pvinfo write instead of return predefined value Fixes: e39c5add3221 ("drm/i915/gvt: vGPU MMIO virtualization") Cc: Zhenyu Wang <zhenyuw@linux.intel.com> Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Weinan Li <weinan.z.li@intel.com> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
-rw-r--r--drivers/gpu/drm/i915/gvt/handlers.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c
index a6ade66349bd..25f78196b964 100644
--- a/drivers/gpu/drm/i915/gvt/handlers.c
+++ b/drivers/gpu/drm/i915/gvt/handlers.c
@@ -1254,18 +1254,15 @@ static int send_display_ready_uevent(struct intel_vgpu *vgpu, int ready)
1254static int pvinfo_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, 1254static int pvinfo_mmio_write(struct intel_vgpu *vgpu, unsigned int offset,
1255 void *p_data, unsigned int bytes) 1255 void *p_data, unsigned int bytes)
1256{ 1256{
1257 u32 data; 1257 u32 data = *(u32 *)p_data;
1258 int ret; 1258 bool invalid_write = false;
1259
1260 write_vreg(vgpu, offset, p_data, bytes);
1261 data = vgpu_vreg(vgpu, offset);
1262 1259
1263 switch (offset) { 1260 switch (offset) {
1264 case _vgtif_reg(display_ready): 1261 case _vgtif_reg(display_ready):
1265 send_display_ready_uevent(vgpu, data ? 1 : 0); 1262 send_display_ready_uevent(vgpu, data ? 1 : 0);
1266 break; 1263 break;
1267 case _vgtif_reg(g2v_notify): 1264 case _vgtif_reg(g2v_notify):
1268 ret = handle_g2v_notification(vgpu, data); 1265 handle_g2v_notification(vgpu, data);
1269 break; 1266 break;
1270 /* add xhot and yhot to handled list to avoid error log */ 1267 /* add xhot and yhot to handled list to avoid error log */
1271 case _vgtif_reg(cursor_x_hot): 1268 case _vgtif_reg(cursor_x_hot):
@@ -1282,13 +1279,19 @@ static int pvinfo_mmio_write(struct intel_vgpu *vgpu, unsigned int offset,
1282 case _vgtif_reg(execlist_context_descriptor_hi): 1279 case _vgtif_reg(execlist_context_descriptor_hi):
1283 break; 1280 break;
1284 case _vgtif_reg(rsv5[0])..._vgtif_reg(rsv5[3]): 1281 case _vgtif_reg(rsv5[0])..._vgtif_reg(rsv5[3]):
1282 invalid_write = true;
1285 enter_failsafe_mode(vgpu, GVT_FAILSAFE_INSUFFICIENT_RESOURCE); 1283 enter_failsafe_mode(vgpu, GVT_FAILSAFE_INSUFFICIENT_RESOURCE);
1286 break; 1284 break;
1287 default: 1285 default:
1286 invalid_write = true;
1288 gvt_vgpu_err("invalid pvinfo write offset %x bytes %x data %x\n", 1287 gvt_vgpu_err("invalid pvinfo write offset %x bytes %x data %x\n",
1289 offset, bytes, data); 1288 offset, bytes, data);
1290 break; 1289 break;
1291 } 1290 }
1291
1292 if (!invalid_write)
1293 write_vreg(vgpu, offset, p_data, bytes);
1294
1292 return 0; 1295 return 0;
1293} 1296}
1294 1297