From patchwork Tue Apr 30 03:02:13 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: 2503101 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 019723FD1A for ; Tue, 30 Apr 2013 03:03:35 +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 1UX0qX-0005mg-Kj; Tue, 30 Apr 2013 03:03:13 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UX0q7-0001AN-8D; Tue, 30 Apr 2013 03:02:47 +0000 Received: from mail-da0-x234.google.com ([2607:f8b0:400e:c00::234]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UX0q4-00019V-Ow for linux-arm-kernel@lists.infradead.org; Tue, 30 Apr 2013 03:02:45 +0000 Received: by mail-da0-f52.google.com with SMTP id j17so36186dan.25 for ; Mon, 29 Apr 2013 20:02:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=wv3K9KUU1YC7JPYt3EoQ88YNwd9IXt6uBzEDTuxvwXE=; b=VBnm7koiXM8MmH446SSDQ9KTiscoJyDLyr1viBICnALeuOabkLyHJPTjRVzishWdjg lrH8f6P3PJ5EorbV3IM+pOwC3sVmIhntZCuYw8AmVORm+ay9G3Ltj1aS2wogxk61Cu9f HJXvdkdw9/2hnv8E0UTFfpz+kdCV2KlVbNcEOdsJgi+RUcGv24yKtPmmUsNGw609xTv1 MGzvDL/UKekboh2HjCd2mBeVc3np07VrDyC7/UQUVYY748eouc70VysBselE2ZxTTPDF 7ZX6KWJZ+N7Z24et0SRm425AlDHZDlpUiKQAH/a0gSuVUJY1lt7HQXhHF+rs4xU704OC wMxA== X-Received: by 10.66.216.198 with SMTP id os6mr18156936pac.145.1367290942169; Mon, 29 Apr 2013 20:02:22 -0700 (PDT) Received: from localhost.localdomain ([219.106.231.132]) by mx.google.com with ESMTPSA id cp1sm26433755pbc.42.2013.04.29.20.02.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 29 Apr 2013 20:02:21 -0700 (PDT) From: Damian Hobson-Garcia To: linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] arm64: Provide default implementation for dma_{alloc, free}_attrs Date: Tue, 30 Apr 2013 12:02:13 +0900 Message-Id: <1367290933-10453-1-git-send-email-dhobsong@igel.co.jp> X-Mailer: git-send-email 1.7.5.4 X-Gm-Message-State: ALoCoQlt6wn7to9YwCK4Oor3hjy2lshzMqv+Tjj7pcH27f38hWt00OXKzXm2JwmiM11TYU9WryRX X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130429_230244_913367_8829E30E X-CRM114-Status: UNSURE ( 9.54 ) 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 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_HAVE_DMA, have implementations for both dma_alloc_attrs() and dma_free_attrs(). All achitectures that do not define CONFIG_HAVE_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); } /*