All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: andi.shyti@intel.com, chris.p.wilson@linux.intel.com,
	matthew.d.roper@intel.com, Nirmoy Das <nirmoy.das@intel.com>
Subject: [Intel-gfx] [PATCH 3/7] drm/i915: Implement for_each_sgt_daddr_next
Date: Wed, 13 Sep 2023 15:09:31 +0200	[thread overview]
Message-ID: <20230913130935.27707-5-nirmoy.das@intel.com> (raw)
In-Reply-To: <20230913130935.27707-1-nirmoy.das@intel.com>

Implement a way to iterate over sgt with pre-initialized
sgt_iter state.

Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_gtt.h     |  3 +++
 drivers/gpu/drm/i915/i915_scatterlist.h | 10 ++++++++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.h b/drivers/gpu/drm/i915/gt/intel_gtt.h
index 346ec8ec2edd..41e530d0a4e9 100644
--- a/drivers/gpu/drm/i915/gt/intel_gtt.h
+++ b/drivers/gpu/drm/i915/gt/intel_gtt.h
@@ -171,6 +171,9 @@ struct intel_gt;
 #define for_each_sgt_daddr(__dp, __iter, __sgt) \
 	__for_each_sgt_daddr(__dp, __iter, __sgt, I915_GTT_PAGE_SIZE)
 
+#define for_each_sgt_daddr_next(__dp, __iter) \
+	__for_each_daddr_next(__dp, __iter, I915_GTT_PAGE_SIZE)
+
 struct i915_page_table {
 	struct drm_i915_gem_object *base;
 	union {
diff --git a/drivers/gpu/drm/i915/i915_scatterlist.h b/drivers/gpu/drm/i915/i915_scatterlist.h
index 5a10c1a31183..6cf8a298849f 100644
--- a/drivers/gpu/drm/i915/i915_scatterlist.h
+++ b/drivers/gpu/drm/i915/i915_scatterlist.h
@@ -91,6 +91,16 @@ static inline struct scatterlist *__sg_next(struct scatterlist *sg)
 	     ((__dp) = (__iter).dma + (__iter).curr), (__iter).sgp;	\
 	     (((__iter).curr += (__step)) >= (__iter).max) ?		\
 	     (__iter) = __sgt_iter(__sg_next((__iter).sgp), true), 0 : 0)
+/**
+ * __for_each_daddr_next - iterates over the device addresses with pre-initialized iterator.
+ * @__dp:	Device address (output)
+ * @__iter:	'struct sgt_iter' (iterator state, external)
+ * @__step:	step size
+ */
+#define __for_each_daddr_next(__dp, __iter, __step)                  \
+	for (; ((__dp) = (__iter).dma + (__iter).curr), (__iter).sgp;   \
+	     (((__iter).curr += (__step)) >= (__iter).max) ?            \
+	     (__iter) = __sgt_iter(__sg_next((__iter).sgp), true), 0 : 0)
 
 /**
  * for_each_sgt_page - iterate over the pages of the given sg_table
-- 
2.41.0


  parent reply	other threads:[~2023-09-13 13:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-13 13:09 [Intel-gfx] [PATCH 0/7] Update GGTT with MI_UPDATE_GTT on MTL Nirmoy Das
2023-09-13 13:09 ` Nirmoy Das
2023-09-13 13:09 ` [Intel-gfx] [PATCH 1/7] drm/i915: Lift runtime-pm acquire callbacks out of intel_wakeref.mutex Nirmoy Das
2023-09-13 13:09 ` [Intel-gfx] [PATCH 2/7] drm/i915: Create a kernel context for GGTT updates Nirmoy Das
2023-09-13 16:30   ` Zeng, Oak
2023-09-14 19:22     ` Nirmoy Das
2023-09-13 13:09 ` Nirmoy Das [this message]
2023-09-13 16:45   ` [Intel-gfx] [PATCH 3/7] drm/i915: Implement for_each_sgt_daddr_next Zeng, Oak
2023-09-13 13:09 ` [Intel-gfx] [PATCH 4/7] drm/i915: Parameterize binder context creation Nirmoy Das
2023-09-13 16:47   ` Zeng, Oak
2023-09-13 13:09 ` [Intel-gfx] [PATCH 5/7] drm/i915: Implement GGTT update method with MI_UPDATE_GTT Nirmoy Das
2023-09-13 13:09 ` [Intel-gfx] [PATCH 6/7] drm/i915: Toggle binder context ready status Nirmoy Das
2023-09-13 13:09 ` [Intel-gfx] [PATCH 7/7] drm/i915: Enable GGTT updates with binder in MTL Nirmoy Das
2023-09-13 16:48   ` Zeng, Oak
2023-09-13 20:44 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Update GGTT with MI_UPDATE_GTT on MTL (rev4) Patchwork
2023-09-13 20:45 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-09-13 20:58 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-09-14  1:45 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2023-09-15  8:34 [Intel-gfx] [PATCH 0/7] Update GGTT with MI_UPDATE_GTT on MTL Nirmoy Das
2023-09-15  8:34 ` [Intel-gfx] [PATCH 3/7] drm/i915: Implement for_each_sgt_daddr_next Nirmoy Das
2023-09-18 17:02 [Intel-gfx] [PATCH 0/7] Update GGTT with MI_UPDATE_GTT on MTL Nirmoy Das
2023-09-18 17:02 ` [Intel-gfx] [PATCH 3/7] drm/i915: Implement for_each_sgt_daddr_next Nirmoy Das
2023-09-21 13:06   ` Andi Shyti
2023-09-26  8:37 [Intel-gfx] [PATCH 0/7] Update GGTT with MI_UPDATE_GTT on MTL Nirmoy Das
2023-09-26  8:37 ` [Intel-gfx] [PATCH 3/7] drm/i915: Implement for_each_sgt_daddr_next Nirmoy Das

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=20230913130935.27707-5-nirmoy.das@intel.com \
    --to=nirmoy.das@intel.com \
    --cc=andi.shyti@intel.com \
    --cc=chris.p.wilson@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.d.roper@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.