Message ID | 1495767859-10064-2-git-send-email-chuanxiao.dong@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, May 26, 2017 at 11:04:17AM +0800, Chuanxiao Dong wrote: > The intel_gvt_sanitize_options will sanitize the GVT-g related > options before doing GVT-g init. > > Suggested-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com> > --- > drivers/gpu/drm/i915/i915_drv.c | 2 ++ > drivers/gpu/drm/i915/intel_gvt.c | 36 ++++++++++++++++++++++++++---------- > drivers/gpu/drm/i915/intel_gvt.h | 5 +++++ > 3 files changed, 33 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c > index 72fb47a..9c59b22 100644 > --- a/drivers/gpu/drm/i915/i915_drv.c > +++ b/drivers/gpu/drm/i915/i915_drv.c > @@ -997,6 +997,8 @@ static void intel_sanitize_options(struct drm_i915_private *dev_priv) > DRM_DEBUG_DRIVER("use GPU semaphores? %s\n", yesno(i915.semaphores)); > > intel_uc_sanitize_options(dev_priv); > + > + intel_gvt_sanitize_options(dev_priv); > } > > /** > diff --git a/drivers/gpu/drm/i915/intel_gvt.c b/drivers/gpu/drm/i915/intel_gvt.c > index e1ab643..dde9c78 100644 > --- a/drivers/gpu/drm/i915/intel_gvt.c > +++ b/drivers/gpu/drm/i915/intel_gvt.c > @@ -51,6 +51,32 @@ static bool is_supported_device(struct drm_i915_private *dev_priv) > } > > /** > + * intel_gvt_sanitize_options - sanitize GVT related options > + * @dev_priv: drm i915 private data > + * > + * This function is called at the i915 options sanitize stage. > + */ > +void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv) > +{ > + if (!i915.enable_gvt) > + return; > + > + if (intel_vgpu_active(dev_priv)) { > + DRM_INFO("GVT-g is disabled for guest\n"); > + goto bail; > + } > + > + if (!is_supported_device(dev_priv)) { > + DRM_INFO("Unsupported device. GVT-g is disabled\n"); > + goto bail; > + } Good. I came back to check that we didn't trigger an EIO if the device wasn't supported (and only an EIO if the user gave conflicting params). Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> -Chris
> -----Original Message----- > From: intel-gvt-dev [mailto:intel-gvt-dev-bounces@lists.freedesktop.org] On > Behalf Of Chris Wilson > Sent: Friday, May 26, 2017 7:09 PM > To: Dong, Chuanxiao <chuanxiao.dong@intel.com> > Cc: intel-gfx@lists.freedesktop.org; intel-gvt-dev@lists.freedesktop.org > Subject: Re: [Intel-gfx] [PATCH 1/3] drm/i915/gvt: Add gvt options sanitize > function > > On Fri, May 26, 2017 at 11:04:17AM +0800, Chuanxiao Dong wrote: > > The intel_gvt_sanitize_options will sanitize the GVT-g related options > > before doing GVT-g init. > > > > Suggested-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > > Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com> > > --- > > drivers/gpu/drm/i915/i915_drv.c | 2 ++ > > drivers/gpu/drm/i915/intel_gvt.c | 36 > > ++++++++++++++++++++++++++---------- > > drivers/gpu/drm/i915/intel_gvt.h | 5 +++++ > > 3 files changed, 33 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/i915_drv.c > > b/drivers/gpu/drm/i915/i915_drv.c index 72fb47a..9c59b22 100644 > > --- a/drivers/gpu/drm/i915/i915_drv.c > > +++ b/drivers/gpu/drm/i915/i915_drv.c > > @@ -997,6 +997,8 @@ static void intel_sanitize_options(struct > drm_i915_private *dev_priv) > > DRM_DEBUG_DRIVER("use GPU semaphores? %s\n", > > yesno(i915.semaphores)); > > > > intel_uc_sanitize_options(dev_priv); > > + > > + intel_gvt_sanitize_options(dev_priv); > > } > > > > /** > > diff --git a/drivers/gpu/drm/i915/intel_gvt.c > > b/drivers/gpu/drm/i915/intel_gvt.c > > index e1ab643..dde9c78 100644 > > --- a/drivers/gpu/drm/i915/intel_gvt.c > > +++ b/drivers/gpu/drm/i915/intel_gvt.c > > @@ -51,6 +51,32 @@ static bool is_supported_device(struct > > drm_i915_private *dev_priv) } > > > > /** > > + * intel_gvt_sanitize_options - sanitize GVT related options > > + * @dev_priv: drm i915 private data > > + * > > + * This function is called at the i915 options sanitize stage. > > + */ > > +void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv) { > > + if (!i915.enable_gvt) > > + return; > > + > > + if (intel_vgpu_active(dev_priv)) { > > + DRM_INFO("GVT-g is disabled for guest\n"); > > + goto bail; > > + } > > + > > + if (!is_supported_device(dev_priv)) { > > + DRM_INFO("Unsupported device. GVT-g is disabled\n"); > > + goto bail; > > + } > > Good. I came back to check that we didn't trigger an EIO if the device wasn't > supported (and only an EIO if the user gave conflicting params). > > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> -Chris > Thanks Chris. Patch 2/3 and 3/3 will be updated in v2 to use DRM_ERROR. Thanks Chuanxiao
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 72fb47a..9c59b22 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -997,6 +997,8 @@ static void intel_sanitize_options(struct drm_i915_private *dev_priv) DRM_DEBUG_DRIVER("use GPU semaphores? %s\n", yesno(i915.semaphores)); intel_uc_sanitize_options(dev_priv); + + intel_gvt_sanitize_options(dev_priv); } /** diff --git a/drivers/gpu/drm/i915/intel_gvt.c b/drivers/gpu/drm/i915/intel_gvt.c index e1ab643..dde9c78 100644 --- a/drivers/gpu/drm/i915/intel_gvt.c +++ b/drivers/gpu/drm/i915/intel_gvt.c @@ -51,6 +51,32 @@ static bool is_supported_device(struct drm_i915_private *dev_priv) } /** + * intel_gvt_sanitize_options - sanitize GVT related options + * @dev_priv: drm i915 private data + * + * This function is called at the i915 options sanitize stage. + */ +void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv) +{ + if (!i915.enable_gvt) + return; + + if (intel_vgpu_active(dev_priv)) { + DRM_INFO("GVT-g is disabled for guest\n"); + goto bail; + } + + if (!is_supported_device(dev_priv)) { + DRM_INFO("Unsupported device. GVT-g is disabled\n"); + goto bail; + } + + return; +bail: + i915.enable_gvt = 0; +} + +/** * intel_gvt_init - initialize GVT components * @dev_priv: drm i915 private data * @@ -69,16 +95,6 @@ int intel_gvt_init(struct drm_i915_private *dev_priv) return 0; } - if (intel_vgpu_active(dev_priv)) { - DRM_DEBUG_DRIVER("GVT-g is disabled for guest\n"); - goto bail; - } - - if (!is_supported_device(dev_priv)) { - DRM_DEBUG_DRIVER("Unsupported device. GVT-g is disabled\n"); - goto bail; - } - if (!i915.enable_execlists) { DRM_INFO("GPU guest virtualisation [GVT-g] disabled due to disabled execlist submission [i915.enable_execlists module parameter]\n"); goto bail; diff --git a/drivers/gpu/drm/i915/intel_gvt.h b/drivers/gpu/drm/i915/intel_gvt.h index 25df2d6..61b2464 100644 --- a/drivers/gpu/drm/i915/intel_gvt.h +++ b/drivers/gpu/drm/i915/intel_gvt.h @@ -32,6 +32,7 @@ void intel_gvt_cleanup(struct drm_i915_private *dev_priv); int intel_gvt_init_device(struct drm_i915_private *dev_priv); void intel_gvt_clean_device(struct drm_i915_private *dev_priv); int intel_gvt_init_host(void); +void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv); #else static inline int intel_gvt_init(struct drm_i915_private *dev_priv) { @@ -40,6 +41,10 @@ static inline int intel_gvt_init(struct drm_i915_private *dev_priv) static inline void intel_gvt_cleanup(struct drm_i915_private *dev_priv) { } + +static inline void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv) +{ +} #endif #endif /* _INTEL_GVT_H_ */
The intel_gvt_sanitize_options will sanitize the GVT-g related options before doing GVT-g init. Suggested-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com> --- drivers/gpu/drm/i915/i915_drv.c | 2 ++ drivers/gpu/drm/i915/intel_gvt.c | 36 ++++++++++++++++++++++++++---------- drivers/gpu/drm/i915/intel_gvt.h | 5 +++++ 3 files changed, 33 insertions(+), 10 deletions(-)