Message ID | 1422347154-15258-1-git-send-email-sumit.semwal@linaro.org (mailing list archive) |
---|---|
State | RFC, archived |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from <linux-media-owner@vger.kernel.org>) id 1YG1Ti-0003rE-ES; Tue, 27 Jan 2015 09:26:30 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-7) with esmtp id 1YG1Tg-0008Qj-09; Tue, 27 Jan 2015 09:26:30 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753180AbbA0I0R (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Tue, 27 Jan 2015 03:26:17 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:38342 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753717AbbA0I0P (ORCPT <rfc822;linux-media@vger.kernel.org>); Tue, 27 Jan 2015 03:26:15 -0500 Received: by mail-pa0-f46.google.com with SMTP id lj1so17098488pab.5 for <linux-media@vger.kernel.org>; Tue, 27 Jan 2015 00:26:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=KRdJre4EhtglPTbZ45BwI8KWoIMXrYARo+pRGNxtGqk=; b=O2pQG/crUhK+FJqgkfR5r4/nCSX/l9WhT1GxxyteKC58NwQ6H8/YAZvk20jqtTjzsj 0p4MWc9RMMZvbpLma6KItSN/qSNH3UX8lOOWaPOBYl6qOcEt8J5zcseikCz1jUlVZC82 ZNGO8tuS+o0qdNyWpYlwjR/65khYLG/zYlM3854gghWrJpVKzNMEhtNS1hszyLan6Epu kS7glUuAHe/fT0rotRAc7g72sqmeRlPrws9rnR50gNu+b9oG1Lm03bcTUjFzKbsraGX3 kxYMuM+7jATq1ekDOzIwQLX/H0p3V6ggXHPsu40XbJNbVo886X5nPAJMKC/3XGIRXQ+O zMhA== X-Gm-Message-State: ALoCoQkAcwpqOYtKmjr0mxYEfZBwXv7m4P1FrNis59vohzVL9RCnpp0SoDxULSxaoUQ9MkHUVR8C X-Received: by 10.66.120.109 with SMTP id lb13mr160642pab.66.1422347175232; Tue, 27 Jan 2015 00:26:15 -0800 (PST) Received: from ss-ubuntu.lan ([106.51.225.38]) by mx.google.com with ESMTPSA id l4sm783884pdj.47.2015.01.27.00.26.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Jan 2015 00:26:14 -0800 (PST) From: Sumit Semwal <sumit.semwal@linaro.org> To: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org Cc: linaro-kernel@lists.linaro.org, robdclark@gmail.com, daniel@ffwll.ch, m.szyprowski@samsung.com, stanislawski.tomasz@googlemail.com, robin.murphy@arm.com, Sumit Semwal <sumit.semwal@linaro.org> Subject: [RFCv3 1/2] device: add dma_params->max_segment_count Date: Tue, 27 Jan 2015 13:55:53 +0530 Message-Id: <1422347154-15258-1-git-send-email-sumit.semwal@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2015.1.27.81518 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __MULTIPLE_RCPTS_TO_X5 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' |
Commit Message
Sumit Semwal
Jan. 27, 2015, 8:25 a.m. UTC
From: Rob Clark <robdclark@gmail.com> For devices which have constraints about maximum number of segments in an sglist. For example, a device which could only deal with contiguous buffers would set max_segment_count to 1. The initial motivation is for devices sharing buffers via dma-buf, to allow the buffer exporter to know the constraints of other devices which have attached to the buffer. The dma_mask and fields in 'struct device_dma_parameters' tell the exporter everything else that is needed, except whether the importer has constraints about maximum number of segments. Signed-off-by: Rob Clark <robdclark@gmail.com> [sumits: Minor updates wrt comments] Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org> --- v3: include Robin Murphy's fix[1] for handling '0' as a value for max_segment_count v2: minor updates wrt comments on the first version [1]: http://article.gmane.org/gmane.linux.kernel.iommu/8175/ include/linux/device.h | 1 + include/linux/dma-mapping.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+)
Comments
Hello, On 2015-01-27 09:25, Sumit Semwal wrote: > From: Rob Clark <robdclark@gmail.com> > > For devices which have constraints about maximum number of segments in > an sglist. For example, a device which could only deal with contiguous > buffers would set max_segment_count to 1. > > The initial motivation is for devices sharing buffers via dma-buf, > to allow the buffer exporter to know the constraints of other > devices which have attached to the buffer. The dma_mask and fields > in 'struct device_dma_parameters' tell the exporter everything else > that is needed, except whether the importer has constraints about > maximum number of segments. > > Signed-off-by: Rob Clark <robdclark@gmail.com> > [sumits: Minor updates wrt comments] > Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org> This feature is definitely needed to start thinking of real buffer sharing between devices. Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> > --- > > v3: include Robin Murphy's fix[1] for handling '0' as a value for > max_segment_count > v2: minor updates wrt comments on the first version > > [1]: http://article.gmane.org/gmane.linux.kernel.iommu/8175/ > > include/linux/device.h | 1 + > include/linux/dma-mapping.h | 19 +++++++++++++++++++ > 2 files changed, 20 insertions(+) > > diff --git a/include/linux/device.h b/include/linux/device.h > index fb506738f7b7..a32f9b67315c 100644 > --- a/include/linux/device.h > +++ b/include/linux/device.h > @@ -647,6 +647,7 @@ struct device_dma_parameters { > * sg limitations. > */ > unsigned int max_segment_size; > + unsigned int max_segment_count; /* INT_MAX for unlimited */ > unsigned long segment_boundary_mask; > }; > > diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h > index c3007cb4bfa6..d3351a36d5ec 100644 > --- a/include/linux/dma-mapping.h > +++ b/include/linux/dma-mapping.h > @@ -154,6 +154,25 @@ static inline unsigned int dma_set_max_seg_size(struct device *dev, > return -EIO; > } > > +#define DMA_SEGMENTS_MAX_SEG_COUNT ((unsigned int) INT_MAX) > + > +static inline unsigned int dma_get_max_seg_count(struct device *dev) > +{ > + if (dev->dma_parms && dev->dma_parms->max_segment_count) > + return dev->dma_parms->max_segment_count; > + return DMA_SEGMENTS_MAX_SEG_COUNT; > +} > + > +static inline int dma_set_max_seg_count(struct device *dev, > + unsigned int count) > +{ > + if (dev->dma_parms) { > + dev->dma_parms->max_segment_count = count; > + return 0; > + } > + return -EIO; > +} > + > static inline unsigned long dma_get_seg_boundary(struct device *dev) > { > return dev->dma_parms ? Best regards
Hi Sumit, Rob, Is there any reason why this patch hasn't been merged yet? It makes perfect sense to me and I would really like to use this in the media drivers. Many DMA engines do have a limit to the number of segments (obviously a max count of 1 being the most common limitation, but other limits are definitely possible), so this patch seems a no-brainer to me. So: Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Regards, Hans On 01/27/2015 09:25 AM, Sumit Semwal wrote: > From: Rob Clark <robdclark@gmail.com> > > For devices which have constraints about maximum number of segments in > an sglist. For example, a device which could only deal with contiguous > buffers would set max_segment_count to 1. > > The initial motivation is for devices sharing buffers via dma-buf, > to allow the buffer exporter to know the constraints of other > devices which have attached to the buffer. The dma_mask and fields > in 'struct device_dma_parameters' tell the exporter everything else > that is needed, except whether the importer has constraints about > maximum number of segments. > > Signed-off-by: Rob Clark <robdclark@gmail.com> > [sumits: Minor updates wrt comments] > Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org> > --- > > v3: include Robin Murphy's fix[1] for handling '0' as a value for > max_segment_count > v2: minor updates wrt comments on the first version > > [1]: http://article.gmane.org/gmane.linux.kernel.iommu/8175/ > > include/linux/device.h | 1 + > include/linux/dma-mapping.h | 19 +++++++++++++++++++ > 2 files changed, 20 insertions(+) > > diff --git a/include/linux/device.h b/include/linux/device.h > index fb506738f7b7..a32f9b67315c 100644 > --- a/include/linux/device.h > +++ b/include/linux/device.h > @@ -647,6 +647,7 @@ struct device_dma_parameters { > * sg limitations. > */ > unsigned int max_segment_size; > + unsigned int max_segment_count; /* INT_MAX for unlimited */ > unsigned long segment_boundary_mask; > }; > > diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h > index c3007cb4bfa6..d3351a36d5ec 100644 > --- a/include/linux/dma-mapping.h > +++ b/include/linux/dma-mapping.h > @@ -154,6 +154,25 @@ static inline unsigned int dma_set_max_seg_size(struct device *dev, > return -EIO; > } > > +#define DMA_SEGMENTS_MAX_SEG_COUNT ((unsigned int) INT_MAX) > + > +static inline unsigned int dma_get_max_seg_count(struct device *dev) > +{ > + if (dev->dma_parms && dev->dma_parms->max_segment_count) > + return dev->dma_parms->max_segment_count; > + return DMA_SEGMENTS_MAX_SEG_COUNT; > +} > + > +static inline int dma_set_max_seg_count(struct device *dev, > + unsigned int count) > +{ > + if (dev->dma_parms) { > + dev->dma_parms->max_segment_count = count; > + return 0; > + } > + return -EIO; > +} > + > static inline unsigned long dma_get_seg_boundary(struct device *dev) > { > return dev->dma_parms ? > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/include/linux/device.h b/include/linux/device.h index fb506738f7b7..a32f9b67315c 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -647,6 +647,7 @@ struct device_dma_parameters { * sg limitations. */ unsigned int max_segment_size; + unsigned int max_segment_count; /* INT_MAX for unlimited */ unsigned long segment_boundary_mask; }; diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index c3007cb4bfa6..d3351a36d5ec 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -154,6 +154,25 @@ static inline unsigned int dma_set_max_seg_size(struct device *dev, return -EIO; } +#define DMA_SEGMENTS_MAX_SEG_COUNT ((unsigned int) INT_MAX) + +static inline unsigned int dma_get_max_seg_count(struct device *dev) +{ + if (dev->dma_parms && dev->dma_parms->max_segment_count) + return dev->dma_parms->max_segment_count; + return DMA_SEGMENTS_MAX_SEG_COUNT; +} + +static inline int dma_set_max_seg_count(struct device *dev, + unsigned int count) +{ + if (dev->dma_parms) { + dev->dma_parms->max_segment_count = count; + return 0; + } + return -EIO; +} + static inline unsigned long dma_get_seg_boundary(struct device *dev) { return dev->dma_parms ?