From patchwork Tue May 28 01:37:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damian Hobson-Garcia X-Patchwork-Id: 2621681 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 133873FD4E for ; Tue, 28 May 2013 01:38:51 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uh8rb-00017W-2Z; Tue, 28 May 2013 01:38:11 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uh8rE-0001QC-Is; Tue, 28 May 2013 01:37:48 +0000 Received: from mail-pd0-f170.google.com ([209.85.192.170]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uh8rC-0001PI-3S for linux-arm-kernel@lists.infradead.org; Tue, 28 May 2013 01:37:46 +0000 Received: by mail-pd0-f170.google.com with SMTP id x10so6939697pdj.29 for ; Mon, 27 May 2013 18:37:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=8AdtU5GD4xGpDDQbdb7H2z65cn38WLbJ2b/19rJ6MyY=; b=FngSpVZs8XMVAM6XXpYFpqJdoLOYkmB/UELVyBiOO++ilORoParIFOrbryYBvqcDrh tIALzWdCuON0d7W2vTYhU9fSuL8KrLE331vf2TYjKPPiKNui+0XD48wy6EfoNuM932K9 YtPzxHZsLcB1eSFbHikW2Rm4WFali0bgGT86q3Pl6nJqdvXdQ2yQ6El6OcUSDtp2T+X8 pgF62ZyKyT6+HIU05MBqv5jcTI3cNAzzIFxZsn/knYlEOe+zqFmDkHdLX5WaBFG3mr2R 0p6wcyMGWEg3Ojvkfx61T49WJaZiBUnHtrYVo+HEsTn2j9GtsdNdugUNI8qzhJjdXqV9 KnGA== X-Received: by 10.68.234.100 with SMTP id ud4mr31917440pbc.9.1369705044683; Mon, 27 May 2013 18:37:24 -0700 (PDT) Received: from v400.hq.igel.co.jp ([219.106.231.132]) by mx.google.com with ESMTPSA id ig4sm2487854pbc.18.2013.05.27.18.37.22 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 May 2013 18:37:23 -0700 (PDT) From: Damian Hobson-Garcia To: linux-kernel@vger.kernel.org Subject: [PATCH v3 1/3] arm64: Provide default implementation for dma_{alloc, free}_attrs Date: Tue, 28 May 2013 10:37:14 +0900 Message-Id: <1369705034-16341-1-git-send-email-dhobsong@igel.co.jp> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQnSIdiE5WrpSeoytM11X2ppwf8qyVUYzEww5pWFEfFqouJEKjiXKqYwJ6vRaxnj+dnwx/Mc X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130527_213746_222555_5A68C823 X-CRM114-Status: UNSURE ( 9.57 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.192.170 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: catalin.marinas@arm.com, will.deacon@arm.com, Damian Hobson-Garcia , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Most architectures that define CONFIG_HAS_DMA, have implementations for both dma_alloc_attrs() and dma_free_attrs(). All achitectures that do not define CONFIG_HAS_DMA also have both of these definitions provided by dma-mapping-broken.h. Add default implementations for these functions on arm64. Signed-off-by: Damian Hobson-Garcia --- arch/arm64/include/asm/dma-mapping.h | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index 9947768..6ff7b8d 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h @@ -81,8 +81,12 @@ static inline void dma_mark_clean(void *addr, size_t size) { } -static inline void *dma_alloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t flags) +#define dma_alloc_coherent(d, s, h, f) dma_alloc_attrs(d, s, h, f, NULL) +#define dma_free_coherent(d, s, h, f) dma_free_attrs(d, s, h, f, NULL) + +static inline void *dma_alloc_attrs(struct device *dev, size_t size, + dma_addr_t *dma_handle, gfp_t flags, + struct dma_attrs *attrs) { struct dma_map_ops *ops = get_dma_ops(dev); void *vaddr; @@ -90,13 +94,14 @@ static inline void *dma_alloc_coherent(struct device *dev, size_t size, if (dma_alloc_from_coherent(dev, size, dma_handle, &vaddr)) return vaddr; - vaddr = ops->alloc(dev, size, dma_handle, flags, NULL); + vaddr = ops->alloc(dev, size, dma_handle, flags, attrs); debug_dma_alloc_coherent(dev, size, *dma_handle, vaddr); return vaddr; } -static inline void dma_free_coherent(struct device *dev, size_t size, - void *vaddr, dma_addr_t dev_addr) +static inline void dma_free_attrs(struct device *dev, size_t size, + void *vaddr, dma_addr_t dev_addr, + struct dma_attrs *attrs) { struct dma_map_ops *ops = get_dma_ops(dev); @@ -104,7 +109,7 @@ static inline void dma_free_coherent(struct device *dev, size_t size, return; debug_dma_free_coherent(dev, size, vaddr, dev_addr); - ops->free(dev, size, vaddr, dev_addr, NULL); + ops->free(dev, size, vaddr, dev_addr, attrs); } /*