From patchwork Wed Nov 12 11:40:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 40649 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 42F6E206A5 for ; Wed, 12 Nov 2014 11:41:23 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id n15sf6460136lbi.10 for ; Wed, 12 Nov 2014 03:41:22 -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=N3yHwgTew4dR2ShV8cJLtjlRr3CUUszpfjFwrZuTfos=; b=Pvo5VMteubv2QubWLII6KGqDQ5aAeAlyYwFbzymkI6opug/QVEQGa2bDedArMLtg/b AhornkXFfdQpaS/KmcGHtCzLsHiWt7VoEPQrXiIHrIvBJ9bvmnBD6CvJpjxxpp8tUhEq /MxnQL/L8n1Kh+ekOHM3THgSzzdAt91Lt26E5WRW8B4Z3/p1QBEK8HEy5VYppW3IgIxu QFzFj046QiQjUDrnD4aIXWCER5Qm7kYusNdEpYpDbI0BCYe99/azZy09AQ+ZVjTC2pEO Dx+Z0FnyD8c8ugK3KncB+jA5YYk1nZb1je1cIFgwyahsVnYQUljDnv8fJ9bjHfoW118J RC7A== X-Gm-Message-State: ALoCoQmwPdeIaI+m6udiox7Bi1rsvaAQkeclimTx9c/AVErkx1JwFIFQrDA+VxQjhixmYcZ4fJxc X-Received: by 10.112.247.74 with SMTP id yc10mr7674397lbc.8.1415792482091; Wed, 12 Nov 2014 03:41:22 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.1 with SMTP id bc1ls116830lab.24.gmail; Wed, 12 Nov 2014 03:41:21 -0800 (PST) X-Received: by 10.112.147.225 with SMTP id tn1mr41745556lbb.37.1415792481744; Wed, 12 Nov 2014 03:41:21 -0800 (PST) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id jw6si34536202lbc.101.2014.11.12.03.41.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Nov 2014 03:41:21 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id 10so9039401lbg.21 for ; Wed, 12 Nov 2014 03:41:21 -0800 (PST) X-Received: by 10.152.5.38 with SMTP id p6mr41384651lap.44.1415792481575; Wed, 12 Nov 2014 03:41:21 -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 ew9csp408062lbc; Wed, 12 Nov 2014 03:41:20 -0800 (PST) X-Received: by 10.66.121.103 with SMTP id lj7mr47550268pab.84.1415792479816; Wed, 12 Nov 2014 03:41:19 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yl1si9361406pbb.243.2014.11.12.03.41.19 for ; Wed, 12 Nov 2014 03:41:19 -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 S1752687AbaKLLlR (ORCPT + 25 others); Wed, 12 Nov 2014 06:41:17 -0500 Received: from smtp02.citrix.com ([66.165.176.63]:20177 "EHLO SMTP02.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751782AbaKLLlP (ORCPT ); Wed, 12 Nov 2014 06:41:15 -0500 X-IronPort-AV: E=Sophos;i="5.07,368,1413244800"; d="scan'208";a="191920925" Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.3.181.6; Wed, 12 Nov 2014 06:41:14 -0500 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1XoWIO-0003Gl-U1; Wed, 12 Nov 2014 11:41:08 +0000 From: Stefano Stabellini To: CC: , , , , , , , Stefano Stabellini Subject: [PATCH v9 04/13] arm64: introduce is_device_dma_coherent Date: Wed, 12 Nov 2014 11:40:45 +0000 Message-ID: <1415792454-23161-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.217.176 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 Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/device.h | 1 + arch/arm64/include/asm/dma-mapping.h | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/arch/arm64/include/asm/device.h b/arch/arm64/include/asm/device.h index cf98b36..243ef25 100644 --- a/arch/arm64/include/asm/device.h +++ b/arch/arm64/include/asm/device.h @@ -21,6 +21,7 @@ struct dev_archdata { #ifdef CONFIG_IOMMU_API void *iommu; /* private IOMMU data */ #endif + bool dma_coherent; }; struct pdev_archdata { diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index adeae3f..e213dc4 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h @@ -54,11 +54,17 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops) static inline int set_arch_dma_coherent_ops(struct device *dev) { + dev->archdata.dma_coherent = true; set_dma_ops(dev, &coherent_swiotlb_dma_ops); return 0; } #define set_arch_dma_coherent_ops set_arch_dma_coherent_ops +static inline bool is_device_dma_coherent(struct device *dev) +{ + return dev->archdata.dma_coherent; +} + #include static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)