public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Zhenyu Wang <zhenyuw@linux.intel.com>
To: Xiong Zhang <xiong.y.zhang@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/i915: Move vgpu balloon info into i915_virtual_gpu struct
Date: Wed, 28 Aug 2019 14:06:59 +0800	[thread overview]
Message-ID: <20190828060659.GA4868@zhen-hp.sh.intel.com> (raw)
In-Reply-To: <1566357790-5003-1-git-send-email-xiong.y.zhang@intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 5771 bytes --]

On 2019.08.21 11:23:10 +0800, Xiong Zhang wrote:
> vgpu ballon info consists of four drm_mm_node which is used to reserve
> ggtt space, then linux guest won't use these reserved ggtt space.
> 
> Each vgpu has its own ballon info, so move ballon info into
> i915_virtual_gpu structure.
> 
> v2: Fix dim PARENTHESIS_ALIGNMENT check warning
> 
> Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> ---

Looks fine to me. You need to refresh after deballoon fix merged.

Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>

>  drivers/gpu/drm/i915/i915_drv.h  | 14 ++++++++++++++
>  drivers/gpu/drm/i915/i915_vgpu.c | 40 +++++++++++++++++-----------------------
>  2 files changed, 31 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 18be8b2..9c14095 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1024,6 +1024,20 @@ struct i915_frontbuffer_tracking {
>  struct i915_virtual_gpu {
>  	bool active;
>  	u32 caps;
> +
> +	struct balloon_info {
> +		/*
> +		 * There are up to 2 regions per mappable/unmappable graphic
> +		 * memory that might be ballooned. Here, index 0/1 is for
> +		 * mappable graphic memory, 2/3 for unmappable graphic memory.
> +		 */
> +#define VGPU_MAPPABLE_BALLOON_LOW     0
> +#define VGPU_MAPPABLE_BALLOON_HIGH    1
> +#define VGPU_UNMAPPABLE_BALLOON_LOW   2
> +#define VGPU_UNMAPPABLE_BALLOON_HIGH  3
> +#define VGPU_MAX_BALLOON_NUM          4
> +		struct drm_mm_node space[VGPU_MAX_BALLOON_NUM];
> +	} bl_info;
>  };
>  
>  /* used in computing the new watermarks state */
> diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c
> index d2fd66f..0ed35f4 100644
> --- a/drivers/gpu/drm/i915/i915_vgpu.c
> +++ b/drivers/gpu/drm/i915/i915_vgpu.c
> @@ -105,17 +105,6 @@ bool intel_vgpu_has_full_ppgtt(struct drm_i915_private *dev_priv)
>  	return dev_priv->vgpu.caps & VGT_CAPS_FULL_PPGTT;
>  }
>  
> -struct _balloon_info_ {
> -	/*
> -	 * There are up to 2 regions per mappable/unmappable graphic
> -	 * memory that might be ballooned. Here, index 0/1 is for mappable
> -	 * graphic memory, 2/3 for unmappable graphic memory.
> -	 */
> -	struct drm_mm_node space[4];
> -};
> -
> -static struct _balloon_info_ bl_info;
> -
>  static void vgt_deballoon_space(struct i915_ggtt *ggtt,
>  				struct drm_mm_node *node)
>  {
> @@ -140,15 +129,16 @@ static void vgt_deballoon_space(struct i915_ggtt *ggtt,
>   */
>  void intel_vgt_deballoon(struct i915_ggtt *ggtt)
>  {
> +	struct drm_i915_private *dev_priv = ggtt->vm.i915;
>  	int i;
>  
> -	if (!intel_vgpu_active(ggtt->vm.i915))
> +	if (!intel_vgpu_active(dev_priv))
>  		return;
>  
>  	DRM_DEBUG("VGT deballoon.\n");
>  
> -	for (i = 0; i < 4; i++)
> -		vgt_deballoon_space(ggtt, &bl_info.space[i]);
> +	for (i = 0; i < VGPU_MAX_BALLOON_NUM; i++)
> +		vgt_deballoon_space(ggtt, &dev_priv->vgpu.bl_info.space[i]);
>  }
>  
>  static int vgt_balloon_space(struct i915_ggtt *ggtt,
> @@ -219,6 +209,7 @@ static int vgt_balloon_space(struct i915_ggtt *ggtt,
>  int intel_vgt_balloon(struct i915_ggtt *ggtt)
>  {
>  	struct intel_uncore *uncore = &ggtt->vm.i915->uncore;
> +	struct drm_mm_node *space;
>  	unsigned long ggtt_end = ggtt->vm.total;
>  
>  	unsigned long mappable_base, mappable_size, mappable_end;
> @@ -253,9 +244,11 @@ int intel_vgt_balloon(struct i915_ggtt *ggtt)
>  		return -EINVAL;
>  	}
>  
> +	space = ggtt->vm.i915->vgpu.bl_info.space;
>  	/* Unmappable graphic memory ballooning */
>  	if (unmappable_base > ggtt->mappable_end) {
> -		ret = vgt_balloon_space(ggtt, &bl_info.space[2],
> +		ret = vgt_balloon_space(ggtt,
> +					&space[VGPU_UNMAPPABLE_BALLOON_LOW],
>  					ggtt->mappable_end, unmappable_base);
>  
>  		if (ret)
> @@ -263,7 +256,8 @@ int intel_vgt_balloon(struct i915_ggtt *ggtt)
>  	}
>  
>  	if (unmappable_end < ggtt_end) {
> -		ret = vgt_balloon_space(ggtt, &bl_info.space[3],
> +		ret = vgt_balloon_space(ggtt,
> +					&space[VGPU_UNMAPPABLE_BALLOON_HIGH],
>  					unmappable_end, ggtt_end);
>  		if (ret)
>  			goto err_upon_mappable;
> @@ -271,17 +265,17 @@ int intel_vgt_balloon(struct i915_ggtt *ggtt)
>  
>  	/* Mappable graphic memory ballooning */
>  	if (mappable_base) {
> -		ret = vgt_balloon_space(ggtt, &bl_info.space[0],
> +		ret = vgt_balloon_space(ggtt,
> +					&space[VGPU_MAPPABLE_BALLOON_LOW],
>  					0, mappable_base);
> -
>  		if (ret)
>  			goto err_upon_unmappable;
>  	}
>  
>  	if (mappable_end < ggtt->mappable_end) {
> -		ret = vgt_balloon_space(ggtt, &bl_info.space[1],
> +		ret = vgt_balloon_space(ggtt,
> +					&space[VGPU_MAPPABLE_BALLOON_HIGH],
>  					mappable_end, ggtt->mappable_end);
> -
>  		if (ret)
>  			goto err_below_mappable;
>  	}
> @@ -290,11 +284,11 @@ int intel_vgt_balloon(struct i915_ggtt *ggtt)
>  	return 0;
>  
>  err_below_mappable:
> -	vgt_deballoon_space(ggtt, &bl_info.space[0]);
> +	vgt_deballoon_space(ggtt, &space[VGPU_MAPPABLE_BALLOON_LOW]);
>  err_upon_unmappable:
> -	vgt_deballoon_space(ggtt, &bl_info.space[3]);
> +	vgt_deballoon_space(ggtt, &space[VGPU_UNMAPPABLE_BALLOON_HIGH]);
>  err_upon_mappable:
> -	vgt_deballoon_space(ggtt, &bl_info.space[2]);
> +	vgt_deballoon_space(ggtt, &space[VGPU_UNMAPPABLE_BALLOON_LOW]);
>  err:
>  	DRM_ERROR("VGT balloon fail\n");
>  	return ret;
> -- 
> 2.7.4
> 
> _______________________________________________
> intel-gvt-dev mailing list
> intel-gvt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-08-28  6:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-20  5:46 [PATCH 1/2] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest Xiong Zhang
2019-08-20  5:46 ` [PATCH 2/2] drm/i915: Move vgpu balloon info into i915_virtual_gpu struct Xiong Zhang
2019-08-21  3:23   ` [PATCH v2] " Xiong Zhang
2019-08-28  6:06     ` Zhenyu Wang [this message]
2019-08-20  5:53 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/2] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest Patchwork
2019-08-20  6:16 ` ✓ Fi.CI.BAT: success " Patchwork
2019-08-21  3:35 ` [PATCH 1/2] " Zhenyu Wang
2019-08-21 17:04   ` [Intel-gfx] " Chris Wilson
2019-08-21  4:03 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Don't deballoon unused ggtt drm_mm_node in linux guest (rev2) Patchwork
2019-08-21 16:58 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190828060659.GA4868@zhen-hp.sh.intel.com \
    --to=zhenyuw@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=xiong.y.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox