From patchwork Thu Apr 24 15:30:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Shilimkar X-Patchwork-Id: 28982 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 147DF2036A for ; Thu, 24 Apr 2014 15:33:07 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id jy13sf9981696veb.2 for ; Thu, 24 Apr 2014 08:33: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:delivered-to:from:to:subject:date:message-id :in-reply-to:references:mime-version:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=YBsLws+95+Oxar1OrzD9kwQfjRZKLh1rBXzByC32WQk=; b=eejYQxN/0R3+eKQwHB25LrHNkcizdnXtDKkiT1TkH2WSW16kd6QPvDSFAYlnS6rV+H 44T3Ar1g9DPyOecCVxDkMwfQXDDV4eBlY568ZJkKBCG8XmSPe8jCWJivTbEDNyUztT3R FqoW2dfqkzTTAF1meCYZRI/VClg1Cg0y4sbDWqzTthW7B+LgoJ6/6df6GZfapvd/M8U7 OArno/AqwHGCgQVYitvTVH7wepkjecQ3Xg+ZVF/yOB/dg33JqNLKx1ww1A/XaZFfxsEE 3CNPPiwwjEG1V2kYwb19Nv5TNiktNf2lSZux6WCbrHFtrnkfEnLRFwA60wEDAoIfV4cE ZtQA== X-Gm-Message-State: ALoCoQmdsL3gCfKLYlgJcdQG11YvQezEJjtRLGnaPMo4QpcEL/00Zp9AOK7oOC1Sx3tgOvwat0la X-Received: by 10.58.22.166 with SMTP id e6mr1619791vef.6.1398353586840; Thu, 24 Apr 2014 08:33:06 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.41.40 with SMTP id y37ls1328498qgy.10.gmail; Thu, 24 Apr 2014 08:33:06 -0700 (PDT) X-Received: by 10.52.34.4 with SMTP id v4mr857299vdi.42.1398353586724; Thu, 24 Apr 2014 08:33:06 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id ys15si1007411vcb.70.2014.04.24.08.33.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Apr 2014 08:33:06 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id im17so3135534vcb.14 for ; Thu, 24 Apr 2014 08:33:06 -0700 (PDT) X-Received: by 10.221.34.7 with SMTP id sq7mr1646415vcb.5.1398353586647; Thu, 24 Apr 2014 08:33:06 -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.220.221.72 with SMTP id ib8csp25467vcb; Thu, 24 Apr 2014 08:32:57 -0700 (PDT) X-Received: by 10.224.79.72 with SMTP id o8mr3831868qak.20.1398353577539; Thu, 24 Apr 2014 08:32:57 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id 100si2373015qgf.87.2014.04.24.08.32.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Apr 2014 08:32:57 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WdLca-0003eQ-Ti; Thu, 24 Apr 2014 15:31:32 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WdLcX-0003Yp-V5 for linux-arm-kernel@lists.infradead.org; Thu, 24 Apr 2014 15:31:30 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s3OFUvX0030393; Thu, 24 Apr 2014 10:30:57 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3OFUvnd012650; Thu, 24 Apr 2014 10:30:57 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Thu, 24 Apr 2014 10:30:57 -0500 Received: from ula0393909.am.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3OFU9M7019851; Thu, 24 Apr 2014 10:30:56 -0500 From: Santosh Shilimkar To: Subject: [PATCH v3 1/7] device: introduce per device dma_pfn_offset Date: Thu, 24 Apr 2014 11:30:01 -0400 Message-ID: <1398353407-2345-2-git-send-email-santosh.shilimkar@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1398353407-2345-1-git-send-email-santosh.shilimkar@ti.com> References: <1398353407-2345-1-git-send-email-santosh.shilimkar@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140424_083130_090533_C7A71256 X-CRM114-Status: UNSURE ( 9.75 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.7 (-----) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-5.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.94.94.41 listed in list.dnswl.org] -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: devicetree@vger.kernel.org, Grygorii Strashko , Russell King , Arnd Bergmann , Greg Kroah-Hartman , Linus Walleij , Grant Likely , Rob Herring , Santosh Shilimkar , Catalin Marinas , Olof Johansson , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: santosh.shilimkar@ti.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) 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 On few architectures, there are few restrictions on DMAble area of system RAM. That also means that devices needs to know about this restrictions so that the dma_masks can be updated accordingly and dma address translation helpers can add/subtract the dma offset. In most of cases DMA addresses can be performed using offset value of Bus address space relatively to physical address space as following: PFN->DMA: __pfn_to_phys(pfn + [-]dma_pfn_offset) DMA->PFN: __phys_to_pfn(dma_addr) + [-]dma_pfn_offset So we introduce per device dma_pfn_offset which can be popullated by architecture init code while creating the devices. Cc: Greg Kroah-Hartman Cc: Russell King Cc: Arnd Bergmann Cc: Olof Johansson Cc: Grant Likely Cc: Rob Herring Cc: Catalin Marinas Cc: Linus Walleij Signed-off-by: Grygorii Strashko Signed-off-by: Santosh Shilimkar Reviewed-by: Rob Herring --- include/linux/device.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/device.h b/include/linux/device.h index 233bbbe..85a52d6 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -691,6 +691,7 @@ struct acpi_dev_node { * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all * hardware supports 64-bit addresses for consistent allocations * such descriptors. + * @dma_pfn_offset: offset of DMA memory range relatively of RAM * @dma_parms: A low level driver may set these to teach IOMMU code about * segment limitations. * @dma_pools: Dma pools (if dma'ble device). @@ -756,6 +757,7 @@ struct device { not all hardware supports 64 bit addresses for consistent allocations such descriptors. */ + unsigned long dma_pfn_offset; struct device_dma_parameters *dma_parms;