From patchwork Thu Mar 6 09:19:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Shilimkar X-Patchwork-Id: 25786 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 557F5203C3 for ; Thu, 6 Mar 2014 09:21:12 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id lx4sf8779710iec.3 for ; Thu, 06 Mar 2014 01:21:11 -0800 (PST) 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:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=b+v5jm22Txe+yafPTe4bf53pb0ypdKgFvmIFjLsZztY=; b=OxBFIR5y2QlzyZQB3rmrH+smHqAvsl1OHz00fPR4QmUi39KN5+H18jGxC67N+trg8u 9II8HpwM5O6bsP+28Xg0+3ppvZy2epLHm/HzYesE3wqI5kiZqh02sTsFhp1M4QFWqYiF 29Mp8FwmamYiykQ9nq8O8giHM/6dI7MK1LGHQsz98vv2RxSxwit8csfig/bdXbvwWNd8 QcW4s6qFsl9521ziSU//Oo3wNyB0GS5ylJo/gp0wF38f05NJHWDEFkdcdrrJyNIw/Rps GVwIJi5TLQd54TYrvXBSftGUxlk0mx4LQ5d2lt0PHNa4CgQw83rlZLwA99Cdje9K44K1 FGPw== X-Gm-Message-State: ALoCoQlRftNGABI6/aU6E8POORNxdwYxtjzLViz2iatgLMqR+E9P5x96r/aMfhd6eAQD9wDobTmB X-Received: by 10.42.148.72 with SMTP id q8mr4314812icv.6.1394097671478; Thu, 06 Mar 2014 01:21:11 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.161 with SMTP id o30ls685206qga.94.gmail; Thu, 06 Mar 2014 01:21:11 -0800 (PST) X-Received: by 10.52.179.198 with SMTP id di6mr7245211vdc.7.1394097671249; Thu, 06 Mar 2014 01:21:11 -0800 (PST) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id qi7si972991veb.72.2014.03.06.01.21.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Mar 2014 01:21:11 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id pa12so2331659veb.15 for ; Thu, 06 Mar 2014 01:21:11 -0800 (PST) X-Received: by 10.220.164.80 with SMTP id d16mr4055996vcy.15.1394097671166; Thu, 06 Mar 2014 01:21:11 -0800 (PST) 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.78.9 with SMTP id i9csp25085vck; Thu, 6 Mar 2014 01:21:10 -0800 (PST) X-Received: by 10.66.142.107 with SMTP id rv11mr13081456pab.17.1394097668753; Thu, 06 Mar 2014 01:21:08 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si4513159pab.116.2014.03.06.01.21.08; Thu, 06 Mar 2014 01:21:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752730AbaCFJVA (ORCPT + 26 others); Thu, 6 Mar 2014 04:21:00 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:32975 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751647AbaCFJUz (ORCPT ); Thu, 6 Mar 2014 04:20:55 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s269KIfu025857; Thu, 6 Mar 2014 03:20:18 -0600 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s269KIkn029146; Thu, 6 Mar 2014 03:20:18 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Thu, 6 Mar 2014 03:20:18 -0600 Received: from ula0393909.itg.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s269K8Mx031770; Thu, 6 Mar 2014 03:20:14 -0600 From: Santosh Shilimkar To: CC: , , Santosh Shilimkar , Greg Kroah-Hartman , Russell King , Arnd Bergmann , Olof Johansson , Grant Likely , Rob Herring , Catalin Marinas , Linus Walleij , Grygorii Strashko Subject: [PATCH 1/7] device: introduce per device dma_pfn_offset Date: Thu, 6 Mar 2014 17:19:52 +0800 Message-ID: <1394097598-17622-2-git-send-email-santosh.shilimkar@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1394097598-17622-1-git-send-email-santosh.shilimkar@ti.com> References: <1394097598-17622-1-git-send-email-santosh.shilimkar@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.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: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , 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 architectures 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 --- include/linux/device.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/device.h b/include/linux/device.h index 952b010..6940b25 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -688,6 +688,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). @@ -753,6 +754,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;