[PATCH] drm/i915/gvt: Refine fence mmio read handler

Zhiyuan Lv zhiyuan.lv at intel.com
Thu Jun 15 09:49:13 UTC 2017


On Wed, Jun 14, 2017 at 04:03:09PM +0800, fred gao wrote:
> during the emulation of fence mmio read, once the fence number is
> greater than vgpu fence size, it will return error and eventually
> trigger xengt_emulation_thread to shutdown the guest.

The guest shotdown is a designed behavior, caused by a misbehaved MMIO
access of partitioned resource not belonging to it. We have to reach the
agreement of the policy change first before the patch is merged.
Thanks!

Regards,
-Zhiyuan

> 
> 1. dump the error info once the fence number is out of scope.
> 2. set read value to zero and no need to return error.
> 
> this will fix the issue of Windows guest will be removed automatically
> after running forceTDR in Windows guest.
> 
> Cc: Zhang Yulei <yulei.zhang at intel.com>
> Signed-off-by: fred gao <fred.gao at intel.com>
> ---
>  drivers/gpu/drm/i915/gvt/handlers.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c
> index 1414d7e..2741f04 100644
> --- a/drivers/gpu/drm/i915/gvt/handlers.c
> +++ b/drivers/gpu/drm/i915/gvt/handlers.c
> @@ -177,11 +177,10 @@ static int sanitize_fence_mmio_access(struct intel_vgpu *vgpu,
>  			enter_failsafe_mode(vgpu,
>  					GVT_FAILSAFE_UNSUPPORTED_GUEST);
>  
> -		if (!vgpu->mmio.disable_warn_untrack) {
> -			gvt_vgpu_err("found oob fence register access\n");
> -			gvt_vgpu_err("total fence %d, access fence %d\n",
> -					vgpu_fence_sz(vgpu), fence_num);
> -		}
> +		gvt_err("found oob fence register access\n");
> +		gvt_err("total fence %d, access fence %d\n",
> +				vgpu_fence_sz(vgpu), fence_num);
> +
>  		memset(p_data, 0, bytes);
>  		return -EINVAL;
>  	}
> @@ -195,9 +194,8 @@ static int fence_mmio_read(struct intel_vgpu *vgpu, unsigned int off,
>  
>  	ret = sanitize_fence_mmio_access(vgpu, offset_to_fence_num(off),
>  			p_data, bytes);
> -	if (ret)
> -		return ret;
> -	read_vreg(vgpu, off, p_data, bytes);
> +	if (!ret)
> +		read_vreg(vgpu, off, p_data, bytes);
>  	return 0;
>  }
>  
> -- 
> 2.7.4
> 
> _______________________________________________
> intel-gvt-dev mailing list
> intel-gvt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev


More information about the intel-gvt-dev mailing list