From patchwork Fri Jan 12 08:42:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 859652 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="e8n+V/T5"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zHxQT1KC8z9s7M for ; Fri, 12 Jan 2018 19:54:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ku5O/lT9x6becCdZuCLHtqgDYSMz3H6G4wxBTlargY4=; b=e8n+V/T5NF8xzPe8KeZNrcuzk5 NK4aum88l8Yn63wX63nvovLYlZmnStry84pWv60OUjxnFHLjsS7Et/N6FeO84C9Jn8JNVhFvaZ/mO MRiBxrqid8vKUKKqaKUdQfKSKvw3rEMY6s8I9/T2wocjemaWz3o9xTgj2nwS/cypaam6c86oBGxzO zyiQnePFIYExW93Igo3swxJNIDifWmoxLy66AgW4gO8ZJZX4q3sOOVx7QEVGVJCVzmac+ZAZcGUpb zbX9WofM8CTbGL4CqCdObit+mJ3p+qX5pJ25xGP71L+nmljZI0Eh+N3rqptiNX8OQkU4Kp2n1B9kp fAhTBPVQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eZv6z-00061c-Pp; Fri, 12 Jan 2018 08:54:53 +0000 Received: from [188.21.167.3] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1eZuwn-0000TB-Dh; Fri, 12 Jan 2018 08:44:21 +0000 From: Christoph Hellwig To: iommu@lists.linux-foundation.org Subject: [PATCH 34/34] h8300: use dma-direct Date: Fri, 12 Jan 2018 09:42:32 +0100 Message-Id: <20180112084232.2857-35-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180112084232.2857-1-hch@lst.de> References: <20180112084232.2857-1-hch@lst.de> X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mips@linux-mips.org, linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, Guan Xuetao , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, linux-c6x-dev@linux-c6x.org, linux-hexagon@vger.kernel.org, x86@kernel.org, Konrad Rzeszutek Wilk , linux-snps-arc@lists.infradead.org, linux-m68k@lists.linux-m68k.org, patches@groups.riscv.org, linux-metag@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michal Simek , linux-parisc@vger.kernel.org, linux-cris-kernel@axis.com, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linuxppc-dev@lists.ozlabs.org MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Replace the bare-bones h8300 direct dma mapping implementation with the fully featured generic dma-direct one. Signed-off-by: Christoph Hellwig --- arch/h8300/Kconfig | 1 + arch/h8300/include/asm/Kbuild | 1 + arch/h8300/include/asm/dma-mapping.h | 12 ------- arch/h8300/kernel/Makefile | 2 +- arch/h8300/kernel/dma.c | 66 ------------------------------------ 5 files changed, 3 insertions(+), 79 deletions(-) delete mode 100644 arch/h8300/include/asm/dma-mapping.h delete mode 100644 arch/h8300/kernel/dma.c diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index f8d3fde08190..091d6d04b5e5 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig @@ -23,6 +23,7 @@ config H8300 select HAVE_ARCH_KGDB select HAVE_ARCH_HASH select CPU_NO_EFFICIENT_FFS + select DMA_DIRECT_OPS config CPU_BIG_ENDIAN def_bool y diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild index bc077491d299..642752c94306 100644 --- a/arch/h8300/include/asm/Kbuild +++ b/arch/h8300/include/asm/Kbuild @@ -9,6 +9,7 @@ generic-y += delay.h generic-y += device.h generic-y += div64.h generic-y += dma.h +generic-y += dma-mapping.h generic-y += emergency-restart.h generic-y += exec.h generic-y += extable.h diff --git a/arch/h8300/include/asm/dma-mapping.h b/arch/h8300/include/asm/dma-mapping.h deleted file mode 100644 index 21bb1fc3a6f1..000000000000 --- a/arch/h8300/include/asm/dma-mapping.h +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _H8300_DMA_MAPPING_H -#define _H8300_DMA_MAPPING_H - -extern const struct dma_map_ops h8300_dma_map_ops; - -static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) -{ - return &h8300_dma_map_ops; -} - -#endif diff --git a/arch/h8300/kernel/Makefile b/arch/h8300/kernel/Makefile index b62e830525c6..307aa51576dd 100644 --- a/arch/h8300/kernel/Makefile +++ b/arch/h8300/kernel/Makefile @@ -7,7 +7,7 @@ extra-y := vmlinux.lds obj-y := process.o traps.o ptrace.o \ signal.o setup.o syscalls.o \ - irq.o entry.o dma.o + irq.o entry.o obj-$(CONFIG_ROMKERNEL) += head_rom.o obj-$(CONFIG_RAMKERNEL) += head_ram.o diff --git a/arch/h8300/kernel/dma.c b/arch/h8300/kernel/dma.c deleted file mode 100644 index d44ba5db4ac3..000000000000 --- a/arch/h8300/kernel/dma.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive - * for more details. - */ - -#include -#include -#include -#include -#include - -static void *dma_alloc(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t gfp, - unsigned long attrs) -{ - void *ret; - - if (dev == NULL || (*dev->dma_mask < 0xffffffff)) - gfp |= GFP_DMA; - ret = (void *)__get_free_pages(gfp, get_order(size)); - - if (ret != NULL) { - memset(ret, 0, size); - *dma_handle = virt_to_phys(ret); - } - return ret; -} - -static void dma_free(struct device *dev, size_t size, - void *vaddr, dma_addr_t dma_handle, - unsigned long attrs) - -{ - free_pages((unsigned long)vaddr, get_order(size)); -} - -static dma_addr_t map_page(struct device *dev, struct page *page, - unsigned long offset, size_t size, - enum dma_data_direction direction, - unsigned long attrs) -{ - return page_to_phys(page) + offset; -} - -static int map_sg(struct device *dev, struct scatterlist *sgl, - int nents, enum dma_data_direction direction, - unsigned long attrs) -{ - struct scatterlist *sg; - int i; - - for_each_sg(sgl, sg, nents, i) { - sg->dma_address = sg_phys(sg); - } - - return nents; -} - -const struct dma_map_ops h8300_dma_map_ops = { - .alloc = dma_alloc, - .free = dma_free, - .map_page = map_page, - .map_sg = map_sg, -}; -EXPORT_SYMBOL(h8300_dma_map_ops);