[Intel-gfx] [PATCH v1 4/4] drm/i915: enable guest full ppgtt when device model supports
Joonas Lahtinen
joonas.lahtinen at linux.intel.com
Thu May 11 09:14:39 UTC 2017
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 at 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_ */
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
More information about the Intel-gfx
mailing list