[Intel-gfx] [PATCH 2/2] drm/i915/vgt: Move VGT GGTT ballooning nodes to i915_ggtt
Michal Wajdeczko
michal.wajdeczko at intel.com
Sat Jan 11 17:36:18 UTC 2020
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 at intel.com>
Cc: Xiong Zhang <xiong.y.zhang at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula at 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 ac852d1a3302..bc5670617b39 100644
--- a/drivers/gpu/drm/i915/gt/intel_gtt.h
+++ b/drivers/gpu/drm/i915/gt/intel_gtt.h
@@ -348,6 +348,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 4e1889a7aa5c..428a4a7560ed 100644
--- a/drivers/gpu/drm/i915/i915_vgpu.c
+++ b/drivers/gpu/drm/i915/i915_vgpu.c
@@ -106,17 +106,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;
-
/**
* intel_vgt_deballoon - deballoon reserved graphics address trunks
* @ggtt: the global GGTT from which we reserved earlier
@@ -134,7 +123,7 @@ void intel_vgt_deballoon(struct i915_ggtt *ggtt)
DRM_DEBUG("VGT deballoon.\n");
for (i = 0; i < 4; i++)
- i915_ggtt_deballoon(ggtt, &bl_info.space[i]);
+ i915_ggtt_deballoon(ggtt, &ggtt->balloon[i]);
}
/**
@@ -221,7 +210,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;
@@ -229,7 +218,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;
}
@@ -237,7 +226,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;
@@ -245,7 +234,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;
@@ -255,11 +244,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_ERROR("VGT balloon fail\n");
return ret;
--
2.19.2
More information about the Intel-gfx
mailing list