[Intel-gfx] [PATCH] drm/i915/gvt: Mark i915.enable_gvt as false if loading fails

Wang, Zhi A zhi.a.wang at intel.com
Tue Jun 21 11:11:05 UTC 2016


I never thought that before. Brilliant. :P

> -----Original Message-----
> From: Chris Wilson [mailto:chris.ickle.wilson at gmail.com] On Behalf Of Chris
> Wilson
> Sent: Tuesday, June 21, 2016 2:07 PM
> To: intel-gfx at lists.freedesktop.org
> Cc: Chris Wilson <chris at chris-wilson.co.uk>; Wang, Zhi A
> <zhi.a.wang at intel.com>
> Subject: [PATCH] drm/i915/gvt: Mark i915.enable_gvt as false if loading fails
> 
> If we update the value of i195.enable_gvt if we fail to load GVT userspace can
> easily detect if when it fails to load as requested.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Zhi Wang <zhi.a.wang at intel.com>
> ---
>  drivers/gpu/drm/i915/intel_gvt.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_gvt.c b/drivers/gpu/drm/i915/intel_gvt.c
> index 9fa458c..434f4d5 100644
> --- a/drivers/gpu/drm/i915/intel_gvt.c
> +++ b/drivers/gpu/drm/i915/intel_gvt.c
> @@ -63,7 +63,7 @@ int intel_gvt_init(struct drm_i915_private *dev_priv)
> 
>  	if (!is_supported_device(dev_priv)) {
>  		DRM_DEBUG_DRIVER("Unsupported device. GVT-g is disabled\n");
> -		return 0;
> +		goto bail;
>  	}
> 
>  	/*
> @@ -72,16 +72,20 @@ int intel_gvt_init(struct drm_i915_private *dev_priv)
>  	ret = intel_gvt_init_host();
>  	if (ret) {
>  		DRM_DEBUG_DRIVER("Not in host or MPT modules not found\n");
> -		return 0;
> +		goto bail;
>  	}
> 
>  	ret = intel_gvt_init_device(dev_priv);
>  	if (ret) {
>  		DRM_DEBUG_DRIVER("Fail to init GVT device\n");
> -		return 0;
> +		goto bail;
>  	}
> 
>  	return 0;
> +
> +bail:
> +	i915.enable_gvt = 0;
> +	return 0;
>  }
> 
>  /**
> --
> 2.8.1



More information about the Intel-gfx mailing list