Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe: Refactor xe_ggtt balloon functions to make the node clear

These operations are related to node. Convert them to the
new appropriate name space xe_ggtt_node.

v2: Also move arguments around for consistency (Lucas).
v3: s/node_balloon/node_insert_balloon and
s/node_deballoon/node_remove_balloon (Michal).

Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240821193842.352557-10-rodrigo.vivi@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

+18 -15
+8 -8
drivers/gpu/drm/xe/xe_ggtt.c
··· 347 347 } 348 348 349 349 /** 350 - * xe_ggtt_balloon - prevent allocation of specified GGTT addresses 350 + * xe_ggtt_node_insert_balloon - prevent allocation of specified GGTT addresses 351 351 * @ggtt: the &xe_ggtt where we want to make reservation 352 + * @node: the &xe_ggtt_node to hold reserved GGTT node 352 353 * @start: the starting GGTT address of the reserved region 353 354 * @end: then end GGTT address of the reserved region 354 - * @node: the &xe_ggtt_node to hold reserved GGTT node 355 355 * 356 - * Use xe_ggtt_deballoon() to release a reserved GGTT node. 356 + * Use xe_ggtt_node_remove_balloon() to release a reserved GGTT node. 357 357 * 358 358 * Return: 0 on success or a negative error code on failure. 359 359 */ 360 - int xe_ggtt_balloon(struct xe_ggtt *ggtt, u64 start, u64 end, struct xe_ggtt_node *node) 360 + int xe_ggtt_node_insert_balloon(struct xe_ggtt *ggtt, struct xe_ggtt_node *node, u64 start, u64 end) 361 361 { 362 362 int err; 363 363 ··· 384 384 } 385 385 386 386 /** 387 - * xe_ggtt_deballoon - release a reserved GGTT region 387 + * xe_ggtt_node_remove_balloon - release a reserved GGTT region 388 388 * @ggtt: the &xe_ggtt where reserved node belongs 389 389 * @node: the &xe_ggtt_node with reserved GGTT region 390 390 * 391 - * See xe_ggtt_balloon() for details. 391 + * See xe_ggtt_node_insert_balloon() for details. 392 392 */ 393 - void xe_ggtt_deballoon(struct xe_ggtt *ggtt, struct xe_ggtt_node *node) 393 + void xe_ggtt_node_remove_balloon(struct xe_ggtt *ggtt, struct xe_ggtt_node *node) 394 394 { 395 395 if (!drm_mm_node_allocated(&node->base)) 396 396 return; 397 397 398 - xe_ggtt_dump_node(ggtt, &node->base, "deballoon"); 398 + xe_ggtt_dump_node(ggtt, &node->base, "remove-balloon"); 399 399 400 400 mutex_lock(&ggtt->lock); 401 401 drm_mm_remove_node(&node->base);
+3 -2
drivers/gpu/drm/xe/xe_ggtt.h
··· 13 13 int xe_ggtt_init_early(struct xe_ggtt *ggtt); 14 14 int xe_ggtt_init(struct xe_ggtt *ggtt); 15 15 16 - int xe_ggtt_balloon(struct xe_ggtt *ggtt, u64 start, u64 size, struct xe_ggtt_node *node); 17 - void xe_ggtt_deballoon(struct xe_ggtt *ggtt, struct xe_ggtt_node *node); 16 + int xe_ggtt_node_insert_balloon(struct xe_ggtt *ggtt, struct xe_ggtt_node *node, 17 + u64 start, u64 size); 18 + void xe_ggtt_node_remove_balloon(struct xe_ggtt *ggtt, struct xe_ggtt_node *node); 18 19 19 20 int xe_ggtt_node_insert(struct xe_ggtt *ggtt, struct xe_ggtt_node *node, 20 21 u32 size, u32 align);
+7 -5
drivers/gpu/drm/xe/xe_gt_sriov_vf.c
··· 528 528 start = xe_wopcm_size(xe); 529 529 end = config->ggtt_base; 530 530 if (end != start) { 531 - err = xe_ggtt_balloon(ggtt, start, end, &tile->sriov.vf.ggtt_balloon[0]); 531 + err = xe_ggtt_node_insert_balloon(ggtt, &tile->sriov.vf.ggtt_balloon[0], 532 + start, end); 532 533 if (err) 533 534 goto failed; 534 535 } ··· 537 536 start = config->ggtt_base + config->ggtt_size; 538 537 end = GUC_GGTT_TOP; 539 538 if (end != start) { 540 - err = xe_ggtt_balloon(ggtt, start, end, &tile->sriov.vf.ggtt_balloon[1]); 539 + err = xe_ggtt_node_insert_balloon(ggtt, &tile->sriov.vf.ggtt_balloon[1], 540 + start, end); 541 541 if (err) 542 542 goto deballoon; 543 543 } ··· 546 544 return 0; 547 545 548 546 deballoon: 549 - xe_ggtt_deballoon(ggtt, &tile->sriov.vf.ggtt_balloon[0]); 547 + xe_ggtt_node_remove_balloon(ggtt, &tile->sriov.vf.ggtt_balloon[0]); 550 548 failed: 551 549 return err; 552 550 } ··· 557 555 struct xe_ggtt *ggtt = tile->mem.ggtt; 558 556 559 557 xe_tile_assert(tile, IS_SRIOV_VF(tile_to_xe(tile))); 560 - xe_ggtt_deballoon(ggtt, &tile->sriov.vf.ggtt_balloon[1]); 561 - xe_ggtt_deballoon(ggtt, &tile->sriov.vf.ggtt_balloon[0]); 558 + xe_ggtt_node_remove_balloon(ggtt, &tile->sriov.vf.ggtt_balloon[1]); 559 + xe_ggtt_node_remove_balloon(ggtt, &tile->sriov.vf.ggtt_balloon[0]); 562 560 } 563 561 564 562 /**