From patchwork Mon Nov 10 16:13:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 40510 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B522E218DE for ; Mon, 10 Nov 2014 16:17:05 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id r20sf4313347wiv.2 for ; Mon, 10 Nov 2014 08:17:04 -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:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=M3vNN5to4zQvmbx6LYooYKevjss7dajK6U94+9fMXIM=; b=XkenxNEH3Jrm1AL1cZvUup6118NXAeVkkLQ87oNl+ghbD/+vwCbVWN+jMxSzKGMu2M E5a04qMDh1qbukup4PL4y8O8IX6GXr9wxov79KlLpQAWNGgBE4p2TKjBNypXwWVW478r mraW4RURfVOERoYZrdxpK2qdG19pkoSnZNInJ6qeEQTnrDYjZgpUh2YAGokHgcWx4kgW 66Mpf1DTM19TY6drSf49oBMtD/xLdkkgdGD1pF++bwPIjizsF/R4J6TKsJDphaG/DhjV Hb7or/LhxHMxZmh+GHtRuvm8nMAeYwY4M5pZhMRJo+zwefVUXM3h3s1xOVM02SVYULrr kgPw== X-Gm-Message-State: ALoCoQl5AxvIe/ran0W0IN9ptSqWxu3aQSfs7ZFV2b9ZunvjvCFlj901gD1BuRQEMkuvUaVqMUyv X-Received: by 10.112.137.202 with SMTP id qk10mr765177lbb.11.1415636224960; Mon, 10 Nov 2014 08:17:04 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.4 with SMTP id ky4ls484661lab.23.gmail; Mon, 10 Nov 2014 08:17:04 -0800 (PST) X-Received: by 10.152.234.227 with SMTP id uh3mr30565543lac.69.1415636224649; Mon, 10 Nov 2014 08:17:04 -0800 (PST) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id jr4si27732861lab.19.2014.11.10.08.17.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Nov 2014 08:17:04 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id gq15so7838615lab.7 for ; Mon, 10 Nov 2014 08:17:04 -0800 (PST) X-Received: by 10.152.116.102 with SMTP id jv6mr10376620lab.40.1415636224512; Mon, 10 Nov 2014 08:17:04 -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 ew9csp116360lbc; Mon, 10 Nov 2014 08:17:02 -0800 (PST) X-Received: by 10.140.107.37 with SMTP id g34mr42524959qgf.38.1415636220365; Mon, 10 Nov 2014 08:17:00 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id v20si31681205qaw.75.2014.11.10.08.16.59 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 10 Nov 2014 08:17:00 -0800 (PST) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XnrcZ-0003FJ-Cl; Mon, 10 Nov 2014 16:15:15 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XnrcX-0003EQ-5E for xen-devel@lists.xensource.com; Mon, 10 Nov 2014 16:15:13 +0000 Received: from [85.158.137.68] by server-17.bemta-3.messagelabs.com id 42/80-11608-094E0645; Mon, 10 Nov 2014 16:15:12 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-15.tower-31.messagelabs.com!1415636105!11487291!4 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n X-StarScan-Received: X-StarScan-Version: 6.12.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 24540 invoked from network); 10 Nov 2014 16:15:11 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-15.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 10 Nov 2014 16:15:11 -0000 X-IronPort-AV: E=Sophos;i="5.07,353,1413244800"; d="scan'208";a="189798977" 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-VZ; Mon, 10 Nov 2014 16:14:17 +0000 From: Stefano Stabellini To: Date: Mon, 10 Nov 2014 16:13:56 +0000 Message-ID: <1415636045-24669-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 Cc: Ian.Campbell@citrix.com, Stefano Stabellini , catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, david.vrabel@citrix.com, linux-arm-kernel@lists.infradead.org Subject: [Xen-devel] [PATCH v8 04/13] arm64: introduce is_device_dma_coherent X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.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.48 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-Archive: 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)