From patchwork Tue Sep 16 11:54:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 37447 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 85BCB206A5 for ; Tue, 16 Sep 2014 11:55:13 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id p9sf3020806lbv.4 for ; Tue, 16 Sep 2014 04:55:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=FNbuDFoOsMGr8McMRcjTY0hv5LJj/We6wHMjIrfyfg4=; b=UWFiKCPML+X6vx3udHFrbnrStOM7EaAhQpxZe3zNWdiJSAuDUpqIxegHU+L3sKsWr+ ncD+rqYZNEfWx7LZn9SObAsPC3KWliXyS0LwtQU4SKBOVtHhhEpTPZNEvxPlbst+ctdR HFknP+eoWwVXtFdSmH9O7eseIi+RyI9ro8oX/3T/xHJDB6kEw/r0dpOQfjml5znj2eM/ H7BWvjeqIrQ6Po2ECAlWJVwOwwcc803f4k3vQ6DDa0SpTlufIWfXn/+mQrARuY+zR8aA uF/0iNT4c8f09octYw0xHsbmAEwdrxDQ772fvvQQG2XRSk96NriF8QCfgDYmzazM+Nuf gUvQ== X-Gm-Message-State: ALoCoQmN48xbpcsdKoklxysDmRBN51WX0eUwiqNQXvHDUFj4KTZ4TkL3rbecIsmok2pKX1W/rjw3 X-Received: by 10.194.235.166 with SMTP id un6mr8178944wjc.2.1410868504733; Tue, 16 Sep 2014 04:55:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.41 with SMTP id o9ls101787laa.52.gmail; Tue, 16 Sep 2014 04:55:04 -0700 (PDT) X-Received: by 10.112.210.197 with SMTP id mw5mr2707868lbc.20.1410868504314; Tue, 16 Sep 2014 04:55:04 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by mx.google.com with ESMTPS id ba4si23847869lab.45.2014.09.16.04.55.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Sep 2014 04:55:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id w7so6401029lbi.18 for ; Tue, 16 Sep 2014 04:55:03 -0700 (PDT) X-Received: by 10.152.42.136 with SMTP id o8mr16325548lal.71.1410868502967; Tue, 16 Sep 2014 04:55:02 -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.112.130.169 with SMTP id of9csp374258lbb; Tue, 16 Sep 2014 04:55:02 -0700 (PDT) X-Received: by 10.50.82.98 with SMTP id h2mr29272608igy.26.1410868501696; Tue, 16 Sep 2014 04:55:01 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dw7si13274669pab.96.2014.09.16.04.55.00 for ; Tue, 16 Sep 2014 04:55:01 -0700 (PDT) Received-SPF: none (google.com: linux-samsung-soc-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753766AbaIPLy5 (ORCPT + 6 others); Tue, 16 Sep 2014 07:54:57 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:26200 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753206AbaIPLyz (ORCPT ); Tue, 16 Sep 2014 07:54:55 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NBZ001OKT8CWX80@mailout1.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Tue, 16 Sep 2014 12:57:48 +0100 (BST) X-AuditID: cbfec7f4-b7f156d0000063c7-9f-5418250d93ad Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 4E.28.25543.D0528145; Tue, 16 Sep 2014 12:54:53 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NBZ00CMIT3CL960@eusync2.samsung.com>; Tue, 16 Sep 2014 12:54:53 +0100 (BST) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Marek Szyprowski , linaro-mm-sig@lists.linaro.org, Arnd Bergmann , Shaik Ameer Basha , Cho KyongHo , Joerg Roedel , Thierry Reding , Olof Johansson , Laurent Pinchart , Rob Herring , Will Deacon , David Wodhouse , Inki Dae , Kukjin Kim , Tomasz Figa , Kyungmin Park Subject: [PATCH v2 01/18] arm: dma-mapping: arm_iommu_attach_device: automatically set max_seg_size Date: Tue, 16 Sep 2014 13:54:28 +0200 Message-id: <1410868485-4143-2-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1410868485-4143-1-git-send-email-m.szyprowski@samsung.com> References: <1410868485-4143-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNLMWRmVeSWpSXmKPExsVy+t/xK7q8qhIhBscXilj8nXSM3WLiysnM FpPuT2CxWLDf2qJz9gZ2i94FV9kszja9YbfonLiE3eLLlYdMFpseX2O1mHF+H5PF2iN32S1O Xf/MZvGv9yCjxf89O9gtjjzczW6xatcfRovbv/ksXn48weIg7PHk4DwmjzXz1jB6/P41idFj 56y77B6zO2ayemxeoeWxaVUnm8fmJfUet/89ZvaYfGM5o8eVE02sHr3N79g8+rasYvT4vEku gC+KyyYlNSezLLVI3y6BK6N9+gy2gm8cFetv7WdtYFzA3sXIySEhYCKxb9l6RghbTOLCvfVs XYxcHEICSxklJtw8zg7h9DFJvD10iQ2kik3AUKLrbReYLSKQL/Fi718WEJtZ4A2LxL1NhiC2 sECqxJFfm8E2sAioSvxY+Q+shlfAXaL75TtWiG1yEv9frmACsTkFPCQmtz1hBrGFgGo+fjvF NIGRdwEjwypG0dTS5ILipPRcQ73ixNzi0rx0veT83E2MkAj5soNx8TGrQ4wCHIxKPLwZ/8RD hFgTy4orcw8xSnAwK4nwaihKhAjxpiRWVqUW5ccXleakFh9iZOLglGpgjJ0xc+Gh3cz2/oF/ ix2zHe66/0pY77JOWstyzeOGBTlR8mX66gK7Tt7RqwjT+Nl5JnvOk10dDf+2alxRV7+1YNI8 WdHrjd4bVjQZr5d8/ucCa/TvhLBHqY8YyiZaf98WeGV/03+bpk19db1xl3fySLJfMlqv4Xz4 qZbzycefN5an7nEWrpNNU2Ipzkg01GIuKk4EAPaPV25uAgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.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.217.173 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 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)); + if (err) + return err; + } + err = iommu_attach_device(mapping->domain, dev); if (err) return err;