Message ID | 20230906113121.30472-4-nirmoy.das@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Update GGTT with MI_UPDATE_GTT on MTL | expand |
[...] > +/** > + * __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) \ normally iter is the last parameter, but this is similar to other for_each's... nor r-b'eing this yet as there is a comment coming in the next patch. Andi > + 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
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
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/i915_scatterlist.h | 10 ++++++++++ 1 file changed, 10 insertions(+)