From patchwork Mon Jan 13 13:53:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 3475401 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 279049F2E9 for ; Mon, 13 Jan 2014 13:53:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4A5DC20121 for ; Mon, 13 Jan 2014 13:53:48 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4E9F42011E for ; Mon, 13 Jan 2014 13:53:47 +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 1W2hxT-0005vj-UX; Mon, 13 Jan 2014 13:53:40 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W2hxR-0007i0-5h; Mon, 13 Jan 2014 13:53:37 +0000 Received: from mail-bk0-x22f.google.com ([2a00:1450:4008:c01::22f]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W2hxO-0007hF-Gk for linux-arm-kernel@lists.infradead.org; Mon, 13 Jan 2014 13:53:35 +0000 Received: by mail-bk0-f47.google.com with SMTP id mx12so2415847bkb.20 for ; Mon, 13 Jan 2014 05:53:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=L9QalzgY3ulZ6uZoa6bF63pg6Qp0f1V3zbXrAKkD4QA=; b=edq4uxzyJBfvKshLLPBoqxXVMr9tmq5mtbq/IebhPXFLUj3sNBK9kCJt1p02MRjN0v /+nOG1mzaMxIX/QvjD9VYO86KIkvaUZaQqVlEbJS9BZGfE0CphGO/YNgIVTuehdXc9Lx dI6auXqw0a+x/qx5APwTNsRA1sUvyL2d+8oOsq1D2mGi9TxbL+uU39OD5f9UtbsCn4xT ULFodPc4o0kBCkNOiZBJYX33saqwOFZ5/VCOcWOEi+QW9FmY8CpDF8BYGkLH4lL5uie5 joPNDS7DkNBdDNWgxh5y3ocmjTymdLRGvtI/bliccF8fEB/iCRmQFB67P8DnH5O0XijP 7V5Q== X-Received: by 10.205.17.9 with SMTP id qa9mr1104991bkb.63.1389621191322; Mon, 13 Jan 2014 05:53:11 -0800 (PST) Received: from localhost (port-52867.pppoe.wtnet.de. [46.59.207.43]) by mx.google.com with ESMTPSA id tf11sm15819609bkb.17.2014.01.13.05.53.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Jan 2014 05:53:10 -0800 (PST) From: Thierry Reding To: Russell King , Marek Szyprowski , Arnd Bergmann Subject: [RFC] dma-mapping: Provide write-combine allocations Date: Mon, 13 Jan 2014 14:53:08 +0100 Message-Id: <1389621188-3094-1-git-send-email-treding@nvidia.com> X-Mailer: git-send-email 1.8.4.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140113_085334_716137_259FB600 X-CRM114-Status: GOOD ( 10.86 ) X-Spam-Score: -2.0 (--) Cc: linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, 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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Provide an implementation for dma_{alloc,free}_writecombine() when the architecture supports DMA attributes. Signed-off-by: Thierry Reding --- arch/arm/include/asm/dma-mapping.h | 16 ---------------- include/linux/dma-mapping.h | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index e701a4d9aa59..96b7634a7edc 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -242,22 +242,6 @@ extern int arm_dma_mmap(struct device *dev, struct vm_area_struct *vma, void *cpu_addr, dma_addr_t dma_addr, size_t size, struct dma_attrs *attrs); -static inline void *dma_alloc_writecombine(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t flag) -{ - DEFINE_DMA_ATTRS(attrs); - dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); - return dma_alloc_attrs(dev, size, dma_handle, flag, &attrs); -} - -static inline void dma_free_writecombine(struct device *dev, size_t size, - void *cpu_addr, dma_addr_t dma_handle) -{ - DEFINE_DMA_ATTRS(attrs); - dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); - return dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs); -} - /* * This can be called during early boot to increase the size of the atomic * coherent DMA pool above the default value of 256KiB. It must be called diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index fd4aee29ad10..8475e02b4bd1 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -249,6 +249,22 @@ struct dma_attrs; #define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \ dma_unmap_sg(dev, sgl, nents, dir) +#else +static inline void *dma_alloc_writecombine(struct device *dev, size_t size, + dma_addr_t *dma_addr, gfp_t gfp) +{ + DEFINE_DMA_ATTRS(attrs); + dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); + return dma_alloc_attrs(dev, size, dma_addr, gfp, &attrs); +} + +static inline void dma_free_writecombine(struct device *dev, size_t size, + void *cpu_addr, dma_addr_t dma_addr) +{ + DEFINE_DMA_ATTRS(attrs); + dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); + return dma_free_attrs(dev, size, cpu_addr, dma_addr, &attrs); +} #endif /* CONFIG_HAVE_DMA_ATTRS */ #ifdef CONFIG_NEED_DMA_MAP_STATE