intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>,
	Chris Wilson <chris@chris-wilson.co.uk>
Subject: [Intel-gfx] [PATCH 2/2] drm/i915/vgt: Move VGT GGTT ballooning nodes to i915_ggtt
Date: Sun,  2 Aug 2020 17:34:10 +0200	[thread overview]
Message-ID: <20200802153410.2298-3-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20200802153410.2298-1-michal.wajdeczko@intel.com>

Since VGT ballooning nodes are GGTT specific, we can move them
to i915_ggtt struct close to some other similar nodes. This way
we drop another place in driver that uses static data.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Xiong Zhang <xiong.y.zhang@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_gtt.h |  1 +
 drivers/gpu/drm/i915/i915_vgpu.c    | 27 ++++++++-------------------
 2 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.h b/drivers/gpu/drm/i915/gt/intel_gtt.h
index 111306f2f8d6..72780543c9c6 100644
--- a/drivers/gpu/drm/i915/gt/intel_gtt.h
+++ b/drivers/gpu/drm/i915/gt/intel_gtt.h
@@ -336,6 +336,7 @@ struct i915_ggtt {
 	struct mutex error_mutex;
 	struct drm_mm_node error_capture;
 	struct drm_mm_node uc_fw;
+	struct drm_mm_node balloon[4];
 };
 
 struct i915_ppgtt {
diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c
index f505142d6dfc..6eb7657fb2ca 100644
--- a/drivers/gpu/drm/i915/i915_vgpu.c
+++ b/drivers/gpu/drm/i915/i915_vgpu.c
@@ -134,17 +134,6 @@ bool intel_vgpu_has_huge_gtt(struct drm_i915_private *dev_priv)
 	return dev_priv->vgpu.caps & VGT_CAPS_HUGE_GTT;
 }
 
-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;
-
 /**
  * intel_vgt_deballoon - deballoon reserved graphics address trunks
  * @ggtt: the global GGTT from which we reserved earlier
@@ -163,7 +152,7 @@ void intel_vgt_deballoon(struct i915_ggtt *ggtt)
 	drm_dbg(&dev_priv->drm, "VGT deballoon.\n");
 
 	for (i = 0; i < 4; i++)
-		i915_ggtt_deballoon(ggtt, &bl_info.space[i]);
+		i915_ggtt_deballoon(ggtt, &ggtt->balloon[i]);
 }
 
 /**
@@ -253,7 +242,7 @@ int intel_vgt_balloon(struct i915_ggtt *ggtt)
 	/* Unmappable graphic memory ballooning */
 	if (unmappable_base > ggtt->mappable_end) {
 		ret = i915_ggtt_balloon(ggtt, ggtt->mappable_end,
-					unmappable_base, &bl_info.space[2]);
+					unmappable_base, &ggtt->balloon[2]);
 
 		if (ret)
 			goto err;
@@ -261,7 +250,7 @@ int intel_vgt_balloon(struct i915_ggtt *ggtt)
 
 	if (unmappable_end < ggtt_end) {
 		ret = i915_ggtt_balloon(ggtt, unmappable_end, ggtt_end,
-					&bl_info.space[3]);
+					&ggtt->balloon[3]);
 		if (ret)
 			goto err_upon_mappable;
 	}
@@ -269,7 +258,7 @@ int intel_vgt_balloon(struct i915_ggtt *ggtt)
 	/* Mappable graphic memory ballooning */
 	if (mappable_base) {
 		ret = i915_ggtt_balloon(ggtt, 0, mappable_base,
-					&bl_info.space[0]);
+					&ggtt->balloon[0]);
 
 		if (ret)
 			goto err_upon_unmappable;
@@ -277,7 +266,7 @@ int intel_vgt_balloon(struct i915_ggtt *ggtt)
 
 	if (mappable_end < ggtt->mappable_end) {
 		ret = i915_ggtt_balloon(ggtt, mappable_end, ggtt->mappable_end,
-					&bl_info.space[1]);
+					&ggtt->balloon[1]);
 
 		if (ret)
 			goto err_below_mappable;
@@ -287,11 +276,11 @@ int intel_vgt_balloon(struct i915_ggtt *ggtt)
 	return 0;
 
 err_below_mappable:
-	i915_ggtt_deballoon(ggtt, &bl_info.space[0]);
+	i915_ggtt_deballoon(ggtt, &ggtt->balloon[0]);
 err_upon_unmappable:
-	i915_ggtt_deballoon(ggtt, &bl_info.space[3]);
+	i915_ggtt_deballoon(ggtt, &ggtt->balloon[3]);
 err_upon_mappable:
-	i915_ggtt_deballoon(ggtt, &bl_info.space[2]);
+	i915_ggtt_deballoon(ggtt, &ggtt->balloon[2]);
 err:
 	drm_err(&dev_priv->drm, "VGT balloon fail\n");
 	return ret;
-- 
2.27.0

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

  parent reply	other threads:[~2020-08-02 15:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-02 15:34 [Intel-gfx] [PATCH 0/2] Add generic i915_ggtt ballooning support Michal Wajdeczko
2020-08-02 15:34 ` [Intel-gfx] [PATCH 1/2] drm/i915/ggtt: " Michal Wajdeczko
2020-08-02 15:56   ` Chris Wilson
2020-08-02 15:34 ` Michal Wajdeczko [this message]
2020-08-02 15:58 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for " Patchwork
2020-08-02 16:17 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-08-02 19:37 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2020-01-11 17:36 [Intel-gfx] [PATCH 1/2] drm/i915/ggtt: " Michal Wajdeczko
2020-01-11 17:36 ` [Intel-gfx] [PATCH 2/2] drm/i915/vgt: Move VGT GGTT ballooning nodes to i915_ggtt Michal Wajdeczko

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=20200802153410.2298-3-michal.wajdeczko@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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;
as well as URLs for NNTP newsgroup(s).