Linux Samsung SOC development
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
To: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	"linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Shaik Ameer Basha
	<shaik.ameer-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
	Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Inki Dae <inki.dae-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Tomasz Figa <tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw@public.gmane.org"
	<linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw@public.gmane.org>,
	"iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	Kukjin Kim <kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Laurent Pinchart
	<laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>,
	Kyungmin Park
	<kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	David Wodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH v2 01/18] arm: dma-mapping: arm_iommu_attach_device: automatically set max_seg_size
Date: Wed, 24 Sep 2014 18:06:27 +0100	[thread overview]
Message-ID: <20140924170627.GK16244@arm.com> (raw)
In-Reply-To: <1410868485-4143-2-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

Hi Marek,

On Tue, Sep 16, 2014 at 12:54:28PM +0100, Marek Szyprowski wrote:
> If device has no max_seg_size set, we assume that there is no limit and
> force it to DMA_BIT_MASK(32) to always use contiguous mappings in DMA
> address space.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
>  arch/arm/mm/dma-mapping.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> index bcd5f836f27e..84705e24571b 100644
> --- a/arch/arm/mm/dma-mapping.c
> +++ b/arch/arm/mm/dma-mapping.c
> @@ -2050,6 +2050,22 @@ int arm_iommu_attach_device(struct device *dev,
>  {
>  	int err;
>  
> +	/*
> +	 * if device has no max_seg_size set, we assume that there is no limit
> +	 * and force it to DMA_BIT_MASK(32) to always use contiguous mappings
> +	 * in DMA address space
> +	 */
> +	if (!dev->dma_parms) {
> +		dev->dma_parms = kzalloc(sizeof(*dev->dma_parms), GFP_KERNEL);
> +		if (!dev->dma_parms)
> +			return -ENOMEM;
> +	}
> +	if (!dev->dma_parms->max_segment_size) {
> +		err = dma_set_max_seg_size(dev, DMA_BIT_MASK(32));

Would it make more sense to base this default value off the dma_mask?
In my IOMMU series, of_dma_configure passes back a size parameter to
arch_setup_dma_ops which is calculated from the dma-ranges property or the
coherent dma mask if the ranges property is absent, so maybe we should set
this there too?

Will

  parent reply	other threads:[~2014-09-24 17:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-16 11:54 [PATCH v2 00/18] Exynos SYSMMU (IOMMU) integration with DT and DMA-mapping subsystem Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 02/18] arm: exynos: bind power domains earlier, on device creation Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 05/18] ARM: DTS: Exynos4: add System MMU nodes Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 06/18] iommu: exynos: don't read version register on every tlb operation Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 07/18] iommu: exynos: remove unused functions Marek Szyprowski
     [not found] ` <1410868485-4143-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-09-16 11:54   ` [PATCH v2 01/18] arm: dma-mapping: arm_iommu_attach_device: automatically set max_seg_size Marek Szyprowski
     [not found]     ` <1410868485-4143-2-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-09-24 17:06       ` Will Deacon [this message]
2014-09-25 10:43         ` Marek Szyprowski
2014-09-25 18:34           ` Will Deacon
2014-09-16 11:54   ` [PATCH v2 03/18] drm: exynos: detach from default dma-mapping domain on init Marek Szyprowski
2014-09-16 11:54   ` [PATCH v2 04/18] clk: exynos: add missing smmu_g2d clock and update comments Marek Szyprowski
2014-09-22 12:09     ` Tomasz Figa
2014-09-16 11:54   ` [PATCH v2 08/18] iommu: exynos: remove useless spinlock Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 09/18] iommu: exynos: refactor function parameters to simplify code Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 10/18] iommu: exynos: remove unused functions, part 2 Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 11/18] iommu: exynos: remove useless device_add/remove callbacks Marek Szyprowski
2014-10-21 10:59   ` Alban Browaeys
2014-10-22  9:15   ` Alban Browaeys
2014-10-22  9:26     ` Arnd Bergmann
2014-10-22  9:54       ` Marek Szyprowski
2014-10-23 14:02         ` Arnd Bergmann
2014-10-24  7:41           ` [PATCH] iommu: exynos: make driver multiarch friendly Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 12/18] iommu: exynos: add support for binding more than one sysmmu to master device Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 13/18] iommu: exynos: add support for runtime_pm Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 14/18] iommu: exynos: rename variables to reflect their purpose Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 15/18] iommu: exynos: document internal structures Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 16/18] iommu: exynos: remove excessive includes and sort others alphabetically Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 17/18] iommu: exynos: init from dt-specific callback instead of initcall Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 18/18] iommu: exynos: add callback for initializing devices from device tree Marek Szyprowski

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=20140924170627.GK16244@arm.com \
    --to=will.deacon-5wv7dgnigg8@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=inki.dae-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \
    --cc=linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=shaik.ameer-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    /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