From patchwork Fri Oct 10 11:51:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 38560 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AB389202DB for ; Fri, 10 Oct 2014 11:54:45 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id n3sf721644wiv.8 for ; Fri, 10 Oct 2014 04:54:44 -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: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=4TVECoC0LyzmV0jJ23Ojc4N4liF28cCMzIQnwssR6v8=; b=DdpyQ1lO8gCN44jDMIE2By71EATMVZH6OPuC0crFM40Trl9j546aR7yoE6eQ1tXcpz /IH+RVTgAJTneOXfUoQnUGQdzXuUVEfXbYogVlLyls3fAOgAZprXlyejHoabi1IvdviW izqT1EJQOmlg9fem+W1vSR5A46nfADT0iUsFeOXyUu9PP5NxrHqFBtUh/9Ak6px0SVuy VuD8xZp9ip5hs/EGiIX31+DGR7+waxnlieTok/yx5kG2BkAX1ZrmLYTIiCvq1gmI8ErL /xYUpPjaIXxwxs2me6APpXytICHebwGMep2UNvLJPWgdsgvdrjRE8ApHkgNYo6h/4KaL kWkw== X-Gm-Message-State: ALoCoQmXoDCEmsdGytvres54863qOoCXOcPxENL34L43+/isFtX8c7wKdAydN7HdyrK/NNZ90QlH X-Received: by 10.112.198.226 with SMTP id jf2mr855029lbc.1.1412942084860; Fri, 10 Oct 2014 04:54:44 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.169 with SMTP id k9ls283189laa.91.gmail; Fri, 10 Oct 2014 04:54:44 -0700 (PDT) X-Received: by 10.112.7.101 with SMTP id i5mr4074810lba.57.1412942084691; Fri, 10 Oct 2014 04:54:44 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com [209.85.215.53]) by mx.google.com with ESMTPS id dd4si8799696lad.100.2014.10.10.04.54.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Oct 2014 04:54:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id gq15so3008930lab.40 for ; Fri, 10 Oct 2014 04:54:44 -0700 (PDT) X-Received: by 10.152.19.195 with SMTP id h3mr4228550lae.71.1412942084604; Fri, 10 Oct 2014 04:54:44 -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 c5csp412781lbz; Fri, 10 Oct 2014 04:54:43 -0700 (PDT) X-Received: by 10.220.92.198 with SMTP id s6mr736607vcm.38.1412942082279; Fri, 10 Oct 2014 04:54:42 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id b9si6575768vdw.73.2014.10.10.04.54.41 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 10 Oct 2014 04:54:42 -0700 (PDT) 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 1XcYm2-0000ft-3w; Fri, 10 Oct 2014 11:54:18 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XcYm0-0000eS-B1 for xen-devel@lists.xensource.com; Fri, 10 Oct 2014 11:54:16 +0000 Received: from [193.109.254.147:59253] by server-6.bemta-14.messagelabs.com id E6/70-01867-7E8C7345; Fri, 10 Oct 2014 11:54:15 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-2.tower-27.messagelabs.com!1412942049!11971313!2 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.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 19491 invoked from network); 10 Oct 2014 11:54:14 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-2.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 10 Oct 2014 11:54:14 -0000 X-IronPort-AV: E=Sophos;i="5.04,691,1406592000"; d="scan'208";a="180114186" 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; Fri, 10 Oct 2014 07:54:09 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1XcYln-0008ML-SY; Fri, 10 Oct 2014 12:54:03 +0100 From: Stefano Stabellini To: Date: Fri, 10 Oct 2014 12:51:44 +0100 Message-ID: <1412941908-5850-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 Cc: linux@arm.linux.org.uk, 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 v4 3/7] [RFC] arm/arm64: introduce is_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.53 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 function to check whether a device is dma coherent. Signed-off-by: Stefano Stabellini CC: linux@arm.linux.org.uk CC: catalin.marinas@arm.com CC: will.deacon@arm.com CC: linux-arm-kernel@lists.infradead.org --- arch/arm/include/asm/dma-mapping.h | 6 ++++++ arch/arm64/include/asm/dma-mapping.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index c45b61a..bededbb 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -126,6 +126,12 @@ static inline int set_arch_dma_coherent_ops(struct device *dev) set_dma_ops(dev, &arm_coherent_dma_ops); return 0; } + +static inline bool is_dma_coherent(struct device *dev) +{ + return (__generic_dma_ops(dev) == &arm_coherent_dma_ops); +} + #define set_arch_dma_coherent_ops(dev) set_arch_dma_coherent_ops(dev) static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index dc82e52..d51d67e 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h @@ -52,6 +52,11 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops) dev->archdata.dma_ops = ops; } +static inline bool is_dma_coherent(struct device *dev) +{ + return (__generic_dma_ops(dev) == &coherent_swiotlb_dma_ops); +} + #include static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)