[Intel-gfx] [PATCH 2/2] drm/i915/vgt: Move VGT GGTT ballooning nodes to i915_ggtt
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 Cc: Xiong Zhang Cc: Chris Wilson Cc: Jani Nikula --- 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
[Intel-gfx] [PATCH 2/2] drm/i915/vgt: Move VGT GGTT ballooning nodes to i915_ggtt
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 Cc: Xiong Zhang Cc: Chris Wilson Cc: Jani Nikula --- 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 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx