From patchwork Mon Nov 10 16:13:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 40503 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 1C5DE218DE for ; Mon, 10 Nov 2014 16:15:21 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id w7sf4255652lbi.8 for ; Mon, 10 Nov 2014 08:15:20 -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=xPkdBITrguhjD45hGUj6CspQpN3D1hJbIXXTPI+Vn6g=; b=LQ86BTiF3WSO1auHDLwEWjGdTEHDM5pdR8F/xXZyaF9ap4xWNXUUSXLg6ff8oasUcL 5ekM+2OEHPBpJcs2+vLSLfg8ezhD+FIAv6QWftcfaCs5sVUeTMNnJh7Q0e2rIofDXn1x 8ajqTsayATIquITo9HB3Fepqjf8SzvphviYI1rzYPiV2o+bS9hn7wlQzo8DoytmGtcxR QqlufHJJW/W+1RKDOEHZpbdRa4xF/GB3UglvBNYmM1SZTP1glG6CznTUDJbB0I1rptE5 w/VteMpdiUiwRqhJ42+eQ9+0cZOzwpCqYYhSC1Lu9mP9DbeLQB0CnVu5IOYG7+IYwF9e Go6w== X-Gm-Message-State: ALoCoQlpvfeo8xDy1UHcOj4RyHqM3w7f3D5jQPNQ36MOl9iQhGyFuHS2MrQ+BkUIJm2woClhh69e X-Received: by 10.152.246.40 with SMTP id xt8mr3789846lac.0.1415636120049; Mon, 10 Nov 2014 08:15:20 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.45.7 with SMTP id i7ls475640lam.107.gmail; Mon, 10 Nov 2014 08:15:19 -0800 (PST) X-Received: by 10.112.137.39 with SMTP id qf7mr29940371lbb.47.1415636119607; Mon, 10 Nov 2014 08:15:19 -0800 (PST) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id v3si27459140lal.134.2014.11.10.08.15.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Nov 2014 08:15:19 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id b6so6013489lbj.2 for ; Mon, 10 Nov 2014 08:15:19 -0800 (PST) X-Received: by 10.152.87.100 with SMTP id w4mr29797264laz.27.1415636119477; Mon, 10 Nov 2014 08:15:19 -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.112.184.201 with SMTP id ew9csp116025lbc; Mon, 10 Nov 2014 08:15:18 -0800 (PST) X-Received: by 10.70.126.38 with SMTP id mv6mr25261336pdb.28.1415636116472; Mon, 10 Nov 2014 08:15:16 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id km8si16862310pab.176.2014.11.10.08.15.15 for ; Mon, 10 Nov 2014 08:15:16 -0800 (PST) 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 S1753408AbaKJQPL (ORCPT + 25 others); Mon, 10 Nov 2014 11:15:11 -0500 Received: from smtp.citrix.com ([66.165.176.89]:36052 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752594AbaKJQPI (ORCPT ); Mon, 10 Nov 2014 11:15:08 -0500 X-IronPort-AV: E=Sophos;i="5.07,353,1413244800"; d="scan'208";a="189798975" Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Mon, 10 Nov 2014 11:14:23 -0500 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1Xnrbd-0000Mx-W9; Mon, 10 Nov 2014 16:14:17 +0000 From: Stefano Stabellini To: CC: , , , , , , , Stefano Stabellini , , Subject: [PATCH v8 05/13] arm: introduce is_device_dma_coherent Date: Mon, 10 Nov 2014 16:13:57 +0000 Message-ID: <1415636045-24669-5-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.217.171 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;