Message ID | 1494469984-3486-5-git-send-email-tina.zhang@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On to, 2017-05-11 at 10:33 +0800, Tina Zhang wrote: > Add full ppgtt capability check in guest i915 driver and enable the full > ppgtt in guest only when device mode supports. > > Signed-off-by: Tina Zhang <tina.zhang@intel.com> <SNIP> > @@ -1909,6 +1909,7 @@ struct i915_workarounds { > > struct i915_virtual_gpu { > bool active; > + uint32_t caps; u32, and no extra spaces. > @@ -141,8 +141,8 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv, > has_full_ppgtt = dev_priv->info.has_full_ppgtt; > has_full_48bit_ppgtt = dev_priv->info.has_full_48bit_ppgtt; > > - if (intel_vgpu_active(dev_priv)) { > - /* emulation is too hard */ > + if (intel_vgpu_active(dev_priv) && > + (!intel_vgpu_has_full_ppgtt(dev_priv))) { > has_full_ppgtt = false; > has_full_48bit_ppgtt = false; has_full_ppgtt = dev_priv->info.has_full_ppgtt; if (intel_vpgu_active(dev_priv)) has_full_ppgtt = intel_vgpu_has_full_ppgtt(dev_priv); has_full_48bit_ppgtt = has_full_ppgtt && dev_priv->info.has_full_48bit_ppgtt; Would make for cleanest code. > } > diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c > index 4ab8a97..9b92c73 100644 > --- a/drivers/gpu/drm/i915/i915_vgpu.c > +++ b/drivers/gpu/drm/i915/i915_vgpu.c > @@ -77,10 +77,16 @@ void i915_check_vgpu(struct drm_i915_private *dev_priv) > return; > } > > + dev_priv->vgpu.caps = __raw_i915_read32(dev_priv, vgtif_reg(vgt_caps)); Newline. > dev_priv->vgpu.active = true; > DRM_INFO("Virtual GPU for Intel GVT-g detected.\n"); > } > > +bool intel_vgpu_has_full_ppgtt(struct drm_i915_private *dev_priv) > +{ > + return (dev_priv->vgpu.caps & VGT_CAPS_FULL_PPGTT) ? true : false; > +} The ternary operator is not needed. > + > struct _balloon_info_ { > /* > * There are up to 2 regions per mappable/unmappable graphic > diff --git a/drivers/gpu/drm/i915/i915_vgpu.h b/drivers/gpu/drm/i915/i915_vgpu.h > index 3c3b2d2..4fc20aa 100644 > --- a/drivers/gpu/drm/i915/i915_vgpu.h > +++ b/drivers/gpu/drm/i915/i915_vgpu.h > @@ -29,5 +29,6 @@ > void i915_check_vgpu(struct drm_i915_private *dev_priv); Add the new function here and add a newline to separate. Regards, Joonas > int intel_vgt_balloon(struct drm_i915_private *dev_priv); > void intel_vgt_deballoon(struct drm_i915_private *dev_priv); > +bool intel_vgpu_has_full_ppgtt(struct drm_i915_private *dev_priv); > > #endif /* _I915_VGPU_H_ */
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 357b6c6..212147b 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1909,6 +1909,7 @@ struct i915_workarounds { struct i915_virtual_gpu { bool active; + uint32_t caps; }; /* used in computing the new watermarks state */ diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 8bab4ae..15aa081 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -141,8 +141,8 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv, has_full_ppgtt = dev_priv->info.has_full_ppgtt; has_full_48bit_ppgtt = dev_priv->info.has_full_48bit_ppgtt; - if (intel_vgpu_active(dev_priv)) { - /* emulation is too hard */ + if (intel_vgpu_active(dev_priv) && + (!intel_vgpu_has_full_ppgtt(dev_priv))) { has_full_ppgtt = false; has_full_48bit_ppgtt = false; } diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c index 4ab8a97..9b92c73 100644 --- a/drivers/gpu/drm/i915/i915_vgpu.c +++ b/drivers/gpu/drm/i915/i915_vgpu.c @@ -77,10 +77,16 @@ void i915_check_vgpu(struct drm_i915_private *dev_priv) return; } + dev_priv->vgpu.caps = __raw_i915_read32(dev_priv, vgtif_reg(vgt_caps)); dev_priv->vgpu.active = true; DRM_INFO("Virtual GPU for Intel GVT-g detected.\n"); } +bool intel_vgpu_has_full_ppgtt(struct drm_i915_private *dev_priv) +{ + return (dev_priv->vgpu.caps & VGT_CAPS_FULL_PPGTT) ? true : false; +} + struct _balloon_info_ { /* * There are up to 2 regions per mappable/unmappable graphic diff --git a/drivers/gpu/drm/i915/i915_vgpu.h b/drivers/gpu/drm/i915/i915_vgpu.h index 3c3b2d2..4fc20aa 100644 --- a/drivers/gpu/drm/i915/i915_vgpu.h +++ b/drivers/gpu/drm/i915/i915_vgpu.h @@ -29,5 +29,6 @@ void i915_check_vgpu(struct drm_i915_private *dev_priv); int intel_vgt_balloon(struct drm_i915_private *dev_priv); void intel_vgt_deballoon(struct drm_i915_private *dev_priv); +bool intel_vgpu_has_full_ppgtt(struct drm_i915_private *dev_priv); #endif /* _I915_VGPU_H_ */
Add full ppgtt capability check in guest i915 driver and enable the full ppgtt in guest only when device mode supports. Signed-off-by: Tina Zhang <tina.zhang@intel.com> --- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++-- drivers/gpu/drm/i915/i915_vgpu.c | 6 ++++++ drivers/gpu/drm/i915/i915_vgpu.h | 1 + 4 files changed, 10 insertions(+), 2 deletions(-)