[PATCH 10/12] drm/xe: Rename xe_ggtt balloon functions to make the node clear

Lucas De Marchi lucas.demarchi at intel.com
Fri Aug 16 15:45:05 UTC 2024


On Fri, Aug 16, 2024 at 11:02:41AM GMT, Rodrigo Vivi wrote:
>These operations are related to node. Convert them to the
>new appropriate name space xe_ggtt_node.
>
>Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
>Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
>---
> drivers/gpu/drm/xe/xe_ggtt.c        | 12 ++++++------
> drivers/gpu/drm/xe/xe_ggtt.h        |  4 ++--
> drivers/gpu/drm/xe/xe_gt_sriov_vf.c | 10 +++++-----
> 3 files changed, 13 insertions(+), 13 deletions(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
>index 960f5a28b7ed..05c3e6e929ae 100644
>--- a/drivers/gpu/drm/xe/xe_ggtt.c
>+++ b/drivers/gpu/drm/xe/xe_ggtt.c
>@@ -347,17 +347,17 @@ static void xe_ggtt_dump_node(struct xe_ggtt *ggtt,
> }
>
> /**
>- * xe_ggtt_balloon - prevent allocation of specified GGTT addresses
>+ * xe_ggtt_node_balloon - prevent allocation of specified GGTT addresses
>  * @ggtt: the &xe_ggtt where we want to make reservation
>  * @start: the starting GGTT address of the reserved region
>  * @end: then end GGTT address of the reserved region
>  * @node: the &xe_ggtt_node to hold reserved GGTT node
>  *
>- * Use xe_ggtt_deballoon() to release a reserved GGTT node.
>+ * Use xe_ggtt_node_deballoon() to release a reserved GGTT node.
>  *
>  * Return: 0 on success or a negative error code on failure.
>  */
>-int xe_ggtt_balloon(struct xe_ggtt *ggtt, u64 start, u64 end, struct xe_ggtt_node *node)
>+int xe_ggtt_node_balloon(struct xe_ggtt *ggtt, u64 start, u64 end, struct xe_ggtt_node *node)

don't like the lack of consistency. All other functions use
foo(ggtt, node, ...), while this puts the node at the end.

Not even clear why we keep passing both as the node already has a
back pointer to ggtt. Using the back pointer coul be done on top, but
the lack of consistency bugs me :-/

with that,

// Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com>

Lucas De Marchi

> {
> 	int err;
>
>@@ -384,13 +384,13 @@ int xe_ggtt_balloon(struct xe_ggtt *ggtt, u64 start, u64 end, struct xe_ggtt_nod
> }
>
> /**
>- * xe_ggtt_deballoon - release a reserved GGTT region
>+ * xe_ggtt_node_deballoon - release a reserved GGTT region
>  * @ggtt: the &xe_ggtt where reserved node belongs
>  * @node: the &xe_ggtt_node with reserved GGTT region
>  *
>- * See xe_ggtt_balloon() for details.
>+ * See xe_ggtt_node_balloon() for details.
>  */
>-void xe_ggtt_deballoon(struct xe_ggtt *ggtt, struct xe_ggtt_node *node)
>+void xe_ggtt_node_deballoon(struct xe_ggtt *ggtt, struct xe_ggtt_node *node)
> {
> 	if (!drm_mm_node_allocated(&node->base))
> 		return;
>diff --git a/drivers/gpu/drm/xe/xe_ggtt.h b/drivers/gpu/drm/xe/xe_ggtt.h
>index 67ae5f1602a3..e68cede2e6b5 100644
>--- a/drivers/gpu/drm/xe/xe_ggtt.h
>+++ b/drivers/gpu/drm/xe/xe_ggtt.h
>@@ -13,8 +13,8 @@ struct drm_printer;
> int xe_ggtt_init_early(struct xe_ggtt *ggtt);
> int xe_ggtt_init(struct xe_ggtt *ggtt);
>
>-int xe_ggtt_balloon(struct xe_ggtt *ggtt, u64 start, u64 size, struct xe_ggtt_node *node);
>-void xe_ggtt_deballoon(struct xe_ggtt *ggtt, struct xe_ggtt_node *node);
>+int xe_ggtt_node_balloon(struct xe_ggtt *ggtt, u64 start, u64 size, struct xe_ggtt_node *node);
>+void xe_ggtt_node_deballoon(struct xe_ggtt *ggtt, struct xe_ggtt_node *node);
>
> int xe_ggtt_node_insert(struct xe_ggtt *ggtt, struct xe_ggtt_node *node,
> 			u32 size, u32 align);
>diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
>index 47222bd9988d..9a1be23ae71d 100644
>--- a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
>+++ b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
>@@ -528,7 +528,7 @@ static int vf_balloon_ggtt(struct xe_gt *gt)
> 	start = xe_wopcm_size(xe);
> 	end = config->ggtt_base;
> 	if (end != start) {
>-		err = xe_ggtt_balloon(ggtt, start, end, &tile->sriov.vf.ggtt_balloon[0]);
>+		err = xe_ggtt_node_balloon(ggtt, start, end, &tile->sriov.vf.ggtt_balloon[0]);
> 		if (err)
> 			goto failed;
> 	}
>@@ -536,7 +536,7 @@ static int vf_balloon_ggtt(struct xe_gt *gt)
> 	start = config->ggtt_base + config->ggtt_size;
> 	end = GUC_GGTT_TOP;
> 	if (end != start) {
>-		err = xe_ggtt_balloon(ggtt, start, end, &tile->sriov.vf.ggtt_balloon[1]);
>+		err = xe_ggtt_node_balloon(ggtt, start, end, &tile->sriov.vf.ggtt_balloon[1]);
> 		if (err)
> 			goto deballoon;
> 	}
>@@ -544,7 +544,7 @@ static int vf_balloon_ggtt(struct xe_gt *gt)
> 	return 0;
>
> deballoon:
>-	xe_ggtt_deballoon(ggtt, &tile->sriov.vf.ggtt_balloon[0]);
>+	xe_ggtt_node_deballoon(ggtt, &tile->sriov.vf.ggtt_balloon[0]);
> failed:
> 	return err;
> }
>@@ -555,8 +555,8 @@ static void deballoon_ggtt(struct drm_device *drm, void *arg)
> 	struct xe_ggtt *ggtt = tile->mem.ggtt;
>
> 	xe_tile_assert(tile, IS_SRIOV_VF(tile_to_xe(tile)));
>-	xe_ggtt_deballoon(ggtt, &tile->sriov.vf.ggtt_balloon[1]);
>-	xe_ggtt_deballoon(ggtt, &tile->sriov.vf.ggtt_balloon[0]);
>+	xe_ggtt_node_deballoon(ggtt, &tile->sriov.vf.ggtt_balloon[1]);
>+	xe_ggtt_node_deballoon(ggtt, &tile->sriov.vf.ggtt_balloon[0]);
> }
>
> /**
>-- 
>2.46.0
>


More information about the Intel-xe mailing list