From patchwork Mon Oct 27 15:09:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 39635 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 878AE2118A for ; Mon, 27 Oct 2014 15:13:33 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id y10sf3074423wgg.2 for ; Mon, 27 Oct 2014 08:13:32 -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=USEsZpdYrEey5zndJWHpdoGUqlz4D+IYHE5mcT8TDPc=; b=BTnPLsLpPEfM6KAE9Uzn80zBtYNzWyhXBxaVJ2y+x1yWiD5lG8Z/7etvyPrRmruaq3 jG7OsHDzAJLBScdXGN/boEM8LeRshXJLzaDUyzqZMWT7jvvcF9dkXRhcjHo9Q5KXYawl XWeZCbwsNzc08wtp3aknrSUWtokbc1wXPuhEvAjtN7CtiVpWHjD7679BtBiuxnSXAy+Q othaZ4AYjyBP7t1HQD5XCjiRxn3hhYKh9zDsNnwTxsY/VLi6/9FWmMdOlMsdUcjIP1tt 7LYwWBJqyZvd+3GfKmxvLx+sWRZXm7D6+U2pXE7CqjJFw8tW59ipdvmx771AQ+jK0E7S oWWA== X-Gm-Message-State: ALoCoQkEcTwctbqzW319sW7pFmKPcP8+qWc6jX+Lj/JmtMlyHuKdQcwDAVXsI00Bj7P6RIbHjgdH X-Received: by 10.112.138.202 with SMTP id qs10mr5555085lbb.5.1414422812599; Mon, 27 Oct 2014 08:13:32 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.68 with SMTP id p4ls713754laa.52.gmail; Mon, 27 Oct 2014 08:13:32 -0700 (PDT) X-Received: by 10.112.63.70 with SMTP id e6mr4072114lbs.93.1414422812397; Mon, 27 Oct 2014 08:13:32 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id ed2si20440837lbc.37.2014.10.27.08.13.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Oct 2014 08:13:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id gi9so5945562lab.5 for ; Mon, 27 Oct 2014 08:13:32 -0700 (PDT) X-Received: by 10.152.29.8 with SMTP id f8mr24430266lah.56.1414422811956; Mon, 27 Oct 2014 08:13:31 -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 c5csp309910lbz; Mon, 27 Oct 2014 08:13:31 -0700 (PDT) X-Received: by 10.68.220.133 with SMTP id pw5mr4836395pbc.129.1414422810258; Mon, 27 Oct 2014 08:13:30 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p5si10838085pdb.8.2014.10.27.08.13.29 for ; Mon, 27 Oct 2014 08:13:30 -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 S1753232AbaJ0PNM (ORCPT + 26 others); Mon, 27 Oct 2014 11:13:12 -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 S1753098AbaJ0PNH (ORCPT ); Mon, 27 Oct 2014 11:13:07 -0400 X-IronPort-AV: E=Sophos;i="5.04,796,1406592000"; d="scan'208";a="185211234" 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-Ak; Mon, 27 Oct 2014 15:12:00 +0000 From: Stefano Stabellini To: CC: , , , , , , Stefano Stabellini , Catalin Marinas , Subject: [PATCH v7 3/8] arm64: introduce is_device_dma_coherent Date: Mon, 27 Oct 2014 15:09:23 +0000 Message-ID: <1414422568-19103-3-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.46 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: will.deacon@arm.com --- 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)