From patchwork Tue Aug 5 10:47:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 34915 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f72.google.com (mail-qg0-f72.google.com [209.85.192.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AFB5420523 for ; Tue, 5 Aug 2014 10:49:28 +0000 (UTC) Received: by mail-qg0-f72.google.com with SMTP id q107sf2163735qgd.3 for ; Tue, 05 Aug 2014 03:49:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=o0f7n9cpDyRuXfblTAW2WUddXg9irh4vtFEs6fKH9XA=; b=V+f51szkAVBQLitddMYD4d/mobSa7c53agUS+B8GWCe/ALZT9/5IIaLLkc6YBKWG1/ 92J3uhIwgwQKsyZMzLvISr7c7Kz+v7GkR8gfNjMTuvW/K4q0G/Z5JFeRNoKTTgwcmi1w n0sXHDIBqcYA/BJwNsPdguwgemo3K80hRcWqPjUsC3ExzcSaJwN7/eBHRJs9/VDnZbkx 10E61wmzjyIOvCofOsRg+7dJvn//gyKHgvMNANYIVpI0jBLyJ3m23rngpqXdHGkLFS3d 3LFzjKonep8eN0CdLTyXGRf76DooNHuohG0jVXs78R1+HY+1YldMAmWSwztrvuXoxJhS dQIw== X-Gm-Message-State: ALoCoQnmruSrArQGlO/KuzH+OGSXNIGPEZ//IqFMkilUS9m3NeDfVymis9LcouKPLKbMGECVHyNa X-Received: by 10.236.15.167 with SMTP id f27mr1467852yhf.37.1407235767921; Tue, 05 Aug 2014 03:49:27 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.18 with SMTP id v18ls211639qge.51.gmail; Tue, 05 Aug 2014 03:49:27 -0700 (PDT) X-Received: by 10.52.9.35 with SMTP id w3mr2045728vda.12.1407235767773; Tue, 05 Aug 2014 03:49:27 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id u4si780681vcs.52.2014.08.05.03.49.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Aug 2014 03:49:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id hy4so1092500vcb.41 for ; Tue, 05 Aug 2014 03:49:27 -0700 (PDT) X-Received: by 10.52.232.200 with SMTP id tq8mr2028630vdc.32.1407235767689; Tue, 05 Aug 2014 03:49:27 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp374563vcb; Tue, 5 Aug 2014 03:49:27 -0700 (PDT) X-Received: by 10.224.46.8 with SMTP id h8mr4449984qaf.6.1407235767173; Tue, 05 Aug 2014 03:49:27 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id g9si2119917qcg.19.2014.08.05.03.49.26 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 05 Aug 2014 03:49:27 -0700 (PDT) Received-SPF: none (google.com: linaro-mm-sig-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XEcJ3-0005IG-U7; Tue, 05 Aug 2014 10:49:25 +0000 Received: from mailout3.w1.samsung.com ([210.118.77.13]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XEcIb-0005Ec-GO for linaro-mm-sig@lists.linaro.org; Tue, 05 Aug 2014 10:48:57 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N9T006IVY1I5L00@mailout3.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Tue, 05 Aug 2014 11:48:54 +0100 (BST) X-AuditID: cbfec7f4-b7f156d0000063c7-af-53e0b6963628 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 2E.0C.25543.696B0E35; Tue, 05 Aug 2014 11:48:54 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync3.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0N9T0057MY17SE80@eusync3.samsung.com>; Tue, 05 Aug 2014 11:48:54 +0100 (BST) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Tue, 05 Aug 2014 12:47:35 +0200 Message-id: <1407235677-26324-8-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1407235677-26324-1-git-send-email-m.szyprowski@samsung.com> References: <1407235677-26324-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBLMWRmVeSWpSXmKPExsVy+t/xq7rTtj0INnj50dLi76Rj7BbNi9ez WUy6P4HFYsF+a4vO2RvYLXoXXGWzONv0ht2ic+ISdosvVx4yWWx6fI3V4vKuOWwWM87vY7JY e+Quu8Wp65/ZLP71HmS0OHP6EqvF/z072C0Ov2lntTjycDe7xapdfxgtbv/mcxD1eHJwHpPH 71+TGD12zrrL7jG7Yyarx6ZVnWwe++euYffYvKTe4/a/x8wek28sZ/S4cqKJ1aO3+R2bx5ar 7SwefVtWMXp83iQXwBfFZZOSmpNZllqkb5fAlXHz5Ay2gjccFYcevmBtYJzG3sXIySEhYCJx +vRDNghbTOLCvfVANheHkMBSRom9B5cwQzh9TBI/mm4yg1SxCRhKdL3tAqsSEehllOhv+sEE 4jALrGOV2N97nQWkSlggSeLI7idgNouAqsTetf/BunkFPCQevvjCBLFPTuL/yxVgNqeAp8Th mwdYQWwhoJqfG9awT2DkXcDIsIpRNLU0uaA4KT3XUK84Mbe4NC9dLzk/dxMjJHa+7GBcfMzq EKMAB6MSD6/B6bvBQqyJZcWVuYcYJTiYlUR4JdY8CBbiTUmsrEotyo8vKs1JLT7EyMTBKdXA aDypM31C2hwh10U/Aq+o9Ah0Njqs61zkyB0grS4qflOg2aJkyftNUp93S3/8OfMC78ITGpIL Lvxx+3q3iP1eUgSj3r6GnP2xuUVRi6pqAp7s73CQfqo0L7dfI7b0cSSz1Y6SjJ44qzTRxys8 /V0uV/mwLNWe6L740Od3D1+1T2w9O/vDlb1LlViKMxINtZiLihMBmZQDYHsCAAA= Cc: Rob Herring , Thierry Reding , Shaik Ameer Basha , Arnd Bergmann , Inki Dae , Greg Kroah-Hartman , Joerg Roedel , "Rafael J. Wysocki" , Tomasz Figa , linaro-mm-sig@lists.linaro.org, Kyungmin Park , Kukjin Kim , Laurent Pinchart , Sylwester Nawrocki , Olof Johansson , Cho KyongHo Subject: [Linaro-mm-sig] [PATCH 07/29] ARM: dma-mapping: arm_iommu_attach_device: automatically set max_seg_size X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-mm-sig-bounces@lists.linaro.org Sender: linaro-mm-sig-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 --- 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 7a996aa..8161102 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -2051,6 +2051,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)); + if (err) + return err; + } + err = iommu_attach_device(mapping->domain, dev); if (err) return err;