From patchwork Wed Nov 12 11:40:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 40657 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 40AFD206A5 for ; Wed, 12 Nov 2014 11:43:06 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id l18sf6490531wgh.8 for ; Wed, 12 Nov 2014 03:43:05 -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=DCAv8Dzy4hOu0W/Lmgfy38/baWpGksMIGslSSUn+FAE=; b=PKTiHLTtSdi/FV/O5PJ46gHQdtECqQ/WKyFkgO0zxUjCULpVHzruXrfqC6ejDupZGf eRWKtQw8UnmF5Tdqom2XIqldv4wQx1NNbYTXr1A2OyZPsBacVoHEEbKdGgvsKH+X4tj+ DdcT/YKYtciLRHcQeDyulke9LwThxNGyy92BufKXmhF423j7pIpORrULPCEy8T4pAq4h tffJEHN7QORfEQsWA4HzJZfT1ECh9W4IvoJTmgp9EWLEUIwQCyNpvMVJTI/8b+qgRMIR pd5PQnazxxxNDRhto6zn3z+EFK8mnddMIXvfrk9iAOZd6xeGO1Gzv9B34BS6+i0jQHnn +ZSg== X-Gm-Message-State: ALoCoQkka7Ept2NN4vt9rhUCNuvDD7V16gdwMgxL2bpZgcnVvvrrObXaX+ekpDrJaHhf7wug8LL7 X-Received: by 10.181.11.193 with SMTP id ek1mr6670874wid.0.1415792585576; Wed, 12 Nov 2014 03:43:05 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.226 with SMTP id r2ls801625lal.49.gmail; Wed, 12 Nov 2014 03:43:05 -0800 (PST) X-Received: by 10.112.158.40 with SMTP id wr8mr1669475lbb.90.1415792585188; Wed, 12 Nov 2014 03:43:05 -0800 (PST) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id w6si34609882lad.65.2014.11.12.03.43.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Nov 2014 03:43:05 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id f15so9915663lbj.41 for ; Wed, 12 Nov 2014 03:43:04 -0800 (PST) X-Received: by 10.112.189.10 with SMTP id ge10mr41317222lbc.23.1415792584900; Wed, 12 Nov 2014 03:43: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 ew9csp408239lbc; Wed, 12 Nov 2014 03:43:03 -0800 (PST) X-Received: by 10.236.27.70 with SMTP id d46mr42701656yha.73.1415792583139; Wed, 12 Nov 2014 03:43:03 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id n4si41384933qay.5.2014.11.12.03.43.02 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 12 Nov 2014 03:43:03 -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 1XoWIb-0006mS-Lo; Wed, 12 Nov 2014 11:41:21 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XoWIZ-0006l9-JE for xen-devel@lists.xensource.com; Wed, 12 Nov 2014 11:41:19 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id 46/CA-17694-E5743645; Wed, 12 Nov 2014 11:41:18 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1415792477!10881519!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.12.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7495 invoked from network); 12 Nov 2014 11:41:18 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-3.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 12 Nov 2014 11:41:18 -0000 X-IronPort-AV: E=Sophos;i="5.07,368,1413244800"; d="scan'208";a="191920927" 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-Uc; Wed, 12 Nov 2014 11:41:08 +0000 From: Stefano Stabellini To: Date: Wed, 12 Nov 2014 11:40:46 +0000 Message-ID: <1415792454-23161-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 Cc: linux@arm.linux.org.uk, Ian.Campbell@citrix.com, Stefano Stabellini , catalin.marinas@arm.com, linux-kernel@vger.kernel.org, david.vrabel@citrix.com, linux-arm-kernel@lists.infradead.org Subject: [Xen-devel] [PATCH v9 05/13] arm: 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.217.182 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 Reviewed-by: Catalin Marinas CC: linux@arm.linux.org.uk --- 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;