From patchwork Mon Oct 27 15:09:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 39639 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 926612118A for ; Mon, 27 Oct 2014 15:14:44 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id gi9sf4241708lab.10 for ; Mon, 27 Oct 2014 08:14:43 -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: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=xPkdBITrguhjD45hGUj6CspQpN3D1hJbIXXTPI+Vn6g=; b=iTXhxGfU/G+hT5NdCFQUL8JtJ8gntKLRSzWhSAo8ryScAVN6lDzdhXppMGzah0ojLB gATR0tT4Oj2XXDXb1RPnjsudRo5dArqFwdUQah83cLct1cEVF6HPW5mZrisWp3vJg0o1 4+40lVxkqIkEJLnmDn/vWEJLrKXeIXqfPfcQGRK5ceefxUDUXInyyHorcjHab3sH/jQH uOeOYJo6V+l6cHebDlTRDK/NF36sR95xTdwBn8BpXcSWGqVyUcd3Nrv2/KcuMQKpXG75 nr7MhLTv6EMLox/UCtMVN8peL/9kzRONwG09zec2A9V/0zhe9mVlvCVFmswikwn85S8U FP8Q== X-Gm-Message-State: ALoCoQkHgVoNIRPnlgsIGm/lHAZhqy8yVHb4sGaGal7LdabjUFoGvev1gc++ej5ZLgkdbCOYBxvg X-Received: by 10.112.97.35 with SMTP id dx3mr46754lbb.20.1414422883448; Mon, 27 Oct 2014 08:14:43 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.42 with SMTP id v10ls422407laj.56.gmail; Mon, 27 Oct 2014 08:14:43 -0700 (PDT) X-Received: by 10.112.147.199 with SMTP id tm7mr4161543lbb.92.1414422883244; Mon, 27 Oct 2014 08:14:43 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id k3si20414404lbs.64.2014.10.27.08.14.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Oct 2014 08:14:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id gq15so837547lab.15 for ; Mon, 27 Oct 2014 08:14:42 -0700 (PDT) X-Received: by 10.112.140.5 with SMTP id rc5mr5152662lbb.32.1414422882689; Mon, 27 Oct 2014 08:14:42 -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.84.229 with SMTP id c5csp310160lbz; Mon, 27 Oct 2014 08:14:41 -0700 (PDT) X-Received: by 10.66.179.140 with SMTP id dg12mr25282533pac.31.1414422880598; Mon, 27 Oct 2014 08:14:40 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kp4si10685651pdb.195.2014.10.27.08.14.39 for ; Mon, 27 Oct 2014 08:14:40 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-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 S1753453AbaJ0POh (ORCPT + 26 others); Mon, 27 Oct 2014 11:14:37 -0400 Received: from smtp.citrix.com ([66.165.176.89]:11947 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753122AbaJ0PNI (ORCPT ); Mon, 27 Oct 2014 11:13:08 -0400 X-IronPort-AV: E=Sophos;i="5.04,796,1406592000"; d="scan'208";a="185211233" Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.80) with Microsoft SMTP Server id 14.3.181.6; Mon, 27 Oct 2014 11:12:05 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1Xilxg-0006cI-BO; Mon, 27 Oct 2014 15:12:00 +0000 From: Stefano Stabellini To: CC: , , , , , , Stefano Stabellini , Catalin Marinas , , Subject: [PATCH v7 4/8] arm: introduce is_device_dma_coherent Date: Mon, 27 Oct 2014 15:09:24 +0000 Message-ID: <1414422568-19103-4-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-DLP: MIA1 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: stefano.stabellini@eu.citrix.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.215.42 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: , Introduce a boolean flag and an accessor function to check whether a device is dma_coherent. Set the flag from set_arch_dma_coherent_ops. Signed-off-by: Stefano Stabellini Signed-off-by: Catalin Marinas CC: linux@arm.linux.org.uk CC: will.deacon@arm.com --- arch/arm/include/asm/device.h | 1 + arch/arm/include/asm/dma-mapping.h | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/arch/arm/include/asm/device.h b/arch/arm/include/asm/device.h index dc662fc..4111592 100644 --- a/arch/arm/include/asm/device.h +++ b/arch/arm/include/asm/device.h @@ -17,6 +17,7 @@ struct dev_archdata { #ifdef CONFIG_ARM_DMA_USE_IOMMU struct dma_iommu_mapping *mapping; #endif + bool dma_coherent; }; struct omap_device; diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index 85738b2..8c3b616 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -123,11 +123,17 @@ static inline unsigned long dma_max_pfn(struct device *dev) static inline int set_arch_dma_coherent_ops(struct device *dev) { + dev->archdata.dma_coherent = true; set_dma_ops(dev, &arm_coherent_dma_ops); return 0; } #define set_arch_dma_coherent_ops(dev) set_arch_dma_coherent_ops(dev) +static inline bool is_device_dma_coherent(struct device *dev) +{ + return dev->archdata.dma_coherent; +} + static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) { unsigned int offset = paddr & ~PAGE_MASK;