Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: <intel-xe@lists.freedesktop.org>
Cc: <lucas.demarchi@intel.com>, <jose.souza@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Michal Wajdeczko <michal.wajdeczko@intel.com>,
	Matthew Brost <matthew.brost@intel.com>
Subject: [PATCH 07/12] drm/xe: Limit drm_mm_node_allocated access to xe_ggtt_node
Date: Sat, 17 Aug 2024 06:35:50 -0400	[thread overview]
Message-ID: <20240817103556.163783-7-rodrigo.vivi@intel.com> (raw)
In-Reply-To: <20240817103556.163783-1-rodrigo.vivi@intel.com>

Continue with the encapsulation of drm_mm_node inside xe_ggtt.

Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/xe/display/xe_fb_pin.c     |  2 +-
 drivers/gpu/drm/xe/xe_ggtt.c               | 11 +++++++++++
 drivers/gpu/drm/xe/xe_ggtt.h               |  1 +
 drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 12 ++++++------
 4 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c
index db74c3395ef8..de4930b67a29 100644
--- a/drivers/gpu/drm/xe/display/xe_fb_pin.c
+++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c
@@ -323,7 +323,7 @@ static void __xe_unpin_fb_vma(struct i915_vma *vma)
 
 	if (vma->dpt)
 		xe_bo_unpin_map_no_vm(vma->dpt);
-	else if (!drm_mm_node_allocated(&vma->bo->ggtt_node.base) ||
+	else if (!xe_ggtt_node_allocated(&vma->bo->ggtt_node) ||
 		 vma->bo->ggtt_node.base.start != vma->node.base.start)
 		xe_ggtt_node_remove(ggtt, &vma->node, false);
 
diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
index e0da24bb5774..7c8bbaa30fca 100644
--- a/drivers/gpu/drm/xe/xe_ggtt.c
+++ b/drivers/gpu/drm/xe/xe_ggtt.c
@@ -477,6 +477,17 @@ void xe_ggtt_node_remove(struct xe_ggtt *ggtt, struct xe_ggtt_node *node,
 	drm_dev_exit(idx);
 }
 
+/**
+ * xe_ggtt_node_allocated - Check if node is allocated
+ * @node: the &xe_ggtt_node to be inspected
+ *
+ * Return: True if allocated, False otherwise.
+ */
+bool xe_ggtt_node_allocated(const struct xe_ggtt_node *node)
+{
+	return drm_mm_node_allocated(&node->base);
+}
+
 /**
  * xe_ggtt_map_bo - Map the BO into GGTT
  * @ggtt: the &xe_ggtt where node will be mapped
diff --git a/drivers/gpu/drm/xe/xe_ggtt.h b/drivers/gpu/drm/xe/xe_ggtt.h
index 5147930357de..f816b3c0732b 100644
--- a/drivers/gpu/drm/xe/xe_ggtt.h
+++ b/drivers/gpu/drm/xe/xe_ggtt.h
@@ -23,6 +23,7 @@ int xe_ggtt_node_insert_locked(struct xe_ggtt *ggtt,
 			       u32 size, u32 align, u32 mm_flags);
 void xe_ggtt_node_remove(struct xe_ggtt *ggtt, struct xe_ggtt_node *node,
 			 bool invalidate);
+bool xe_ggtt_node_allocated(const struct xe_ggtt_node *node);
 void xe_ggtt_map_bo(struct xe_ggtt *ggtt, struct xe_bo *bo);
 int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo);
 int xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo,
diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
index 3ca98f8a0eae..947750d97d7d 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
@@ -235,7 +235,7 @@ static u32 encode_config_ggtt(u32 *cfg, const struct xe_gt_sriov_config *config)
 {
 	u32 n = 0;
 
-	if (drm_mm_node_allocated(&config->ggtt_region.base)) {
+	if (xe_ggtt_node_allocated(&config->ggtt_region)) {
 		cfg[n++] = PREP_GUC_KLV_TAG(VF_CFG_GGTT_START);
 		cfg[n++] = lower_32_bits(config->ggtt_region.base.start);
 		cfg[n++] = upper_32_bits(config->ggtt_region.base.start);
@@ -376,7 +376,7 @@ static void pf_release_ggtt(struct xe_tile *tile, struct xe_ggtt_node *node)
 {
 	struct xe_ggtt *ggtt = tile->mem.ggtt;
 
-	if (drm_mm_node_allocated(&node->base)) {
+	if (xe_ggtt_node_allocated(node)) {
 		/*
 		 * explicit GGTT PTE assignment to the PF using xe_ggtt_assign()
 		 * is redundant, as PTE will be implicitly re-assigned to PF by
@@ -406,14 +406,14 @@ static int pf_provision_vf_ggtt(struct xe_gt *gt, unsigned int vfid, u64 size)
 
 	size = round_up(size, alignment);
 
-	if (drm_mm_node_allocated(&node->base)) {
+	if (xe_ggtt_node_allocated(node)) {
 		err = pf_distribute_config_ggtt(tile, vfid, 0, 0);
 		if (unlikely(err))
 			return err;
 
 		pf_release_ggtt(tile, node);
 	}
-	xe_gt_assert(gt, !drm_mm_node_allocated(&node->base));
+	xe_gt_assert(gt, !xe_ggtt_node_allocated(node));
 
 	if (!size)
 		return 0;
@@ -439,7 +439,7 @@ static u64 pf_get_vf_config_ggtt(struct xe_gt *gt, unsigned int vfid)
 	struct xe_ggtt_node *node = &config->ggtt_region;
 
 	xe_gt_assert(gt, !xe_gt_is_media_type(gt));
-	return drm_mm_node_allocated(&node->base) ? node->base.size : 0;
+	return xe_ggtt_node_allocated(node) ? node->base.size : 0;
 }
 
 /**
@@ -2028,7 +2028,7 @@ int xe_gt_sriov_pf_config_print_ggtt(struct xe_gt *gt, struct drm_printer *p)
 
 	for (n = 1; n <= total_vfs; n++) {
 		config = &gt->sriov.pf.vfs[n].config;
-		if (!drm_mm_node_allocated(&config->ggtt_region.base))
+		if (!xe_ggtt_node_allocated(&config->ggtt_region))
 			continue;
 
 		string_get_size(config->ggtt_region.base.size, 1, STRING_UNITS_2, buf, sizeof(buf));
-- 
2.46.0


  parent reply	other threads:[~2024-08-17 10:36 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-17 10:35 [PATCH 01/12] drm/xe: Removed unused xe_ggtt_printk Rodrigo Vivi
2024-08-17 10:35 ` [PATCH 02/12] drm/xe: Introduce GGTT documentation Rodrigo Vivi
2024-08-19 19:04   ` Michal Wajdeczko
2024-08-19 20:51     ` Rodrigo Vivi
2024-08-17 10:35 ` [PATCH 03/12] drm/xe: Remove unnecessary drm_mm.h includes Rodrigo Vivi
2024-08-17 10:35 ` [PATCH 04/12] drm/{i915, xe}: Avoid direct inspection of dpt_vma from outside dpt Rodrigo Vivi
2024-08-17 10:35 ` [PATCH 05/12] drm/xe: Encapsulate drm_mm_node inside xe_ggtt_node Rodrigo Vivi
2024-08-17 10:35 ` [PATCH 06/12] drm/xe: Rename xe_ggtt_node related functions Rodrigo Vivi
2024-08-17 10:35 ` Rodrigo Vivi [this message]
2024-08-17 10:35 ` [PATCH 08/12] drm/xe: Introduce xe_ggtt_largest_hole Rodrigo Vivi
2024-08-17 10:35 ` [PATCH 09/12] drm/xe: Introduce xe_ggtt_print_holes Rodrigo Vivi
2024-08-17 10:35 ` [PATCH 10/12] drm/xe: Refactor xe_ggtt balloon functions to make the node clear Rodrigo Vivi
2024-08-19 19:25   ` Michal Wajdeczko
2024-08-17 10:35 ` [PATCH 11/12] drm/xe: Make xe_ggtt_node struct independent Rodrigo Vivi
2024-08-19 19:56   ` Michal Wajdeczko
2024-08-17 10:35 ` [PATCH 12/12] drm/xe: Fix missing runtime outer protection for ggtt_remove_node Rodrigo Vivi
2024-08-17 10:41 ` ✓ CI.Patch_applied: success for series starting with [01/12] drm/xe: Removed unused xe_ggtt_printk Patchwork
2024-08-17 10:42 ` ✓ CI.checkpatch: " Patchwork
2024-08-17 10:43 ` ✓ CI.KUnit: " Patchwork
2024-08-17 10:55 ` ✓ CI.Build: " Patchwork
2024-08-17 10:58 ` ✓ CI.Hooks: " Patchwork
2024-08-17 10:59 ` ✗ CI.checksparse: warning " Patchwork
2024-08-17 11:50 ` ✗ CI.BAT: failure " Patchwork
2024-08-17 12:55 ` ✗ CI.FULL: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2024-08-21 19:38 [PATCH 01/12] " Rodrigo Vivi
2024-08-21 19:38 ` [PATCH 07/12] drm/xe: Limit drm_mm_node_allocated access to xe_ggtt_node Rodrigo Vivi
2024-08-20 20:25 [PATCH 01/12] drm/xe: Removed unused xe_ggtt_printk Rodrigo Vivi
2024-08-20 20:25 ` [PATCH 07/12] drm/xe: Limit drm_mm_node_allocated access to xe_ggtt_node Rodrigo Vivi
2024-08-16 15:02 [PATCH 01/12] drm/xe: Removed unused xe_ggtt_printk Rodrigo Vivi
2024-08-16 15:02 ` [PATCH 07/12] drm/xe: Limit drm_mm_node_allocated access to xe_ggtt_node Rodrigo Vivi
2024-08-16 15:26   ` Lucas De Marchi
2024-08-15 22:07 [PATCH 01/12] drm/xe: Removed unused xe_ggtt_printk Rodrigo Vivi
2024-08-15 22:07 ` [PATCH 07/12] drm/xe: Limit drm_mm_node_allocated access to xe_ggtt_node Rodrigo Vivi
2024-07-11 17:11 [PATCH 01/12] drm/xe: Removed unused xe_ggtt_printk Rodrigo Vivi
2024-07-11 17:11 ` [PATCH 07/12] drm/xe: Limit drm_mm_node_allocated access to xe_ggtt_node Rodrigo Vivi
2024-07-17 23:27   ` Matthew Brost

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=20240817103556.163783-7-rodrigo.vivi@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jose.souza@intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=michal.wajdeczko@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