From: Tomasz Lis <tomasz.lis@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "Michał Winiarski" <michal.winiarski@intel.com>,
"Michał Wajdeczko" <michal.wajdeczko@intel.com>,
"Piotr Piórkowski" <piotr.piorkowski@intel.com>,
dri-devel@lists.freedesktop.org,
"Christian König" <christian.koenig@amd.com>,
"Arun R Murthy" <arun.r.murthy@intel.com>,
"Matthew Brost" <matthew.brost@intel.com>
Subject: [PATCH v4 1/3] drm/drm_mm: Safe macro for iterating through nodes in range
Date: Thu, 6 Mar 2025 23:21:24 +0100 [thread overview]
Message-ID: <20250306222126.3382322-2-tomasz.lis@intel.com> (raw)
In-Reply-To: <20250306222126.3382322-1-tomasz.lis@intel.com>
Benefits of drm_mm_for_each_node_safe and drm_mm_for_each_node_in_range
squished together into one macro.
Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
---
Cc: dri-devel@lists.freedesktop.org
Cc: Christian König <christian.koenig@amd.com>
Cc: Arun R Murthy <arun.r.murthy@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
include/drm/drm_mm.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index f654874c4ce6..43e99441f6ba 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -504,6 +504,25 @@ __drm_mm_interval_first(const struct drm_mm *mm, u64 start, u64 last);
node__->start < (end__); \
node__ = list_next_entry(node__, node_list))
+/**
+ * drm_mm_for_each_node_in_range_safe - iterator to walk over a range of
+ * allocated nodes
+ * @node__: drm_mm_node structure to assign to in each iteration step
+ * @next__: &struct drm_mm_node to store the next step
+ * @mm__: drm_mm allocator to walk
+ * @start__: starting offset, the first node will overlap this
+ * @end__: ending offset, the last node will start before this (but may overlap)
+ *
+ * This iterator walks over all nodes in the range allocator that lie
+ * between @start and @end. It is implemented similarly to list_for_each_safe(),
+ * so safe against removal of elements.
+ */
+#define drm_mm_for_each_node_in_range_safe(node__, next__, mm__, start__, end__) \
+ for (node__ = __drm_mm_interval_first((mm__), (start__), (end__)-1), \
+ next__ = list_next_entry(node__, node_list); \
+ node__->start < (end__); \
+ node__ = next__, next__ = list_next_entry(next__, node_list))
+
void drm_mm_scan_init_with_range(struct drm_mm_scan *scan,
struct drm_mm *mm,
u64 size, u64 alignment, unsigned long color,
--
2.25.1
next prev parent reply other threads:[~2025-03-06 22:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-06 22:21 [PATCH v4 0/3] drm/xe/vf: Post-migration recovery of GGTT nodes and CTB Tomasz Lis
2025-03-06 22:21 ` Tomasz Lis [this message]
2025-03-07 9:59 ` [PATCH v4 1/3] drm/drm_mm: Safe macro for iterating through nodes in range Christian König
2025-03-06 22:21 ` [PATCH v4 2/3] drm/xe/sriov: Shifting GGTT area post migration Tomasz Lis
2025-03-14 18:22 ` Michal Wajdeczko
2025-03-14 23:45 ` Lis, Tomasz
2025-03-15 14:27 ` Michal Wajdeczko
2025-03-28 17:52 ` Lis, Tomasz
2025-03-24 5:58 ` Dan Carpenter
2025-03-06 22:21 ` [PATCH v4 3/3] drm/xe/vf: Fixup CTB send buffer messages after migration Tomasz Lis
2025-03-14 20:46 ` Michal Wajdeczko
2025-03-14 22:11 ` Lis, Tomasz
2025-03-15 12:59 ` Michal Wajdeczko
2025-03-28 17:52 ` Lis, Tomasz
2025-03-07 0:22 ` ✓ CI.Patch_applied: success for drm/xe/vf: Post-migration recovery of GGTT nodes and CTB (rev5) Patchwork
2025-03-07 0:22 ` ✗ CI.checkpatch: warning " Patchwork
2025-03-07 0:24 ` ✓ CI.KUnit: success " Patchwork
2025-03-07 0:46 ` ✓ CI.Build: " Patchwork
2025-03-07 0:48 ` ✓ CI.Hooks: " Patchwork
2025-03-07 0:50 ` ✗ CI.checksparse: warning " Patchwork
2025-03-07 1:09 ` ✓ Xe.CI.BAT: success " Patchwork
2025-03-07 9:20 ` ✗ Xe.CI.Full: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2024-12-20 23:34 [PATCH v4 0/3] drm/xe/vf: Post-migration recovery of GGTT nodes and CTB Tomasz Lis
2024-12-20 23:34 ` [PATCH v4 1/3] drm/drm_mm: Safe macro for iterating through nodes in range Tomasz Lis
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=20250306222126.3382322-2-tomasz.lis@intel.com \
--to=tomasz.lis@intel.com \
--cc=arun.r.murthy@intel.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=michal.winiarski@intel.com \
--cc=piotr.piorkowski@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