From patchwork Tue May 22 12:04:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 918278 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=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="e/R6Qt6m"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::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 40qvwB4pZvz9s7C for ; Tue, 22 May 2018 22:24:26 +1000 (AEST) 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=1nozAs4ZCKsEC5Ieyt3yoSU2ZITp3lpMulSkDsqarKs=; b=e/R6Qt6mGD+s4H5mEYXA1JQUcK cXsVSXWJFy0eOpptIeIw8TCAKOOlUFe/Fo9IOcj7Ux0EV6+JNi5+i0nh0/4lxAqkMfqn4lnc5A840 rMPoWdch5asuNWDfd0/B43CqPOfe5EcBbeJlioDPGdpx4YEVmdmX2s2aqzSr2V1fXi2qPgWx51jNx H7cF0NrN6GGqd/YnTYeMhQkPRrko+3JboLqCNYZNfrf1ysQFWJkcwWeETbtCqvmiaQJJkd2KrF/P7 S8g0j14r13FV1IDodhWr2xhDCrlbOkOPWiWoT/FHNMUG7vbM7ZeoEmyc4ifMUS8X9zKhJ0x08L6Ag 4HZSEexQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fL6L0-0005lU-Sk; Tue, 22 May 2018 12:24:22 +0000 Received: from 80-109-164-210.cable.dynamic.surfer.at ([80.109.164.210] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fL62E-00088t-4j; Tue, 22 May 2018 12:04:58 +0000 From: Christoph Hellwig To: iommu@lists.linux-foundation.org Subject: [PATCH 07/25] nds32: remove the broken kmap code in nds32_dma_map_sg Date: Tue, 22 May 2018 14:04:12 +0200 Message-Id: <20180522120430.28709-8-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180522120430.28709-1-hch@lst.de> References: <20180522120430.28709-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-arch@vger.kernel.org, linux-xtensa@linux-xtensa.org, Michal Simek , Vincent Chen , linux-c6x-dev@linux-c6x.org, linux-parisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, openrisc@lists.librecores.org, Greentime Hu , linux-alpha@vger.kernel.org, sparclinux@vger.kernel.org, nios2-dev@lists.rocketboards.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org nds32_dma_map_sg is the only of the various DMA operations that tries to deal with highmem (the single page variants and SG sync routines are missing, SG unmap is entirely unimplemented), and it does so without taking into account S/G list items that are bigger than a page, which are legal and can happen frequently. Remove this code for now - if highmem support on nds32 becomes a real thing it needs to be added back as a loop over pages in the newly consolidated code that deals with all operations. Signed-off-by: Christoph Hellwig --- arch/nds32/kernel/dma.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c index d291800fc621..e1bf7206e015 100644 --- a/arch/nds32/kernel/dma.c +++ b/arch/nds32/kernel/dma.c @@ -393,24 +393,9 @@ static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg, int i; for (i = 0; i < nents; i++, sg++) { - void *virt; - unsigned long pfn; - struct page *page = sg_page(sg); - - sg->dma_address = sg_phys(sg); - pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE; - page = pfn_to_page(pfn); - if (PageHighMem(page)) { - virt = kmap_atomic(page); - consistent_sync(virt, sg->length, dir, FOR_CPU); - kunmap_atomic(virt); - } else { - if (sg->offset > PAGE_SIZE) - panic("sg->offset:%08x > PAGE_SIZE\n", - sg->offset); - virt = page_address(page) + sg->offset; - consistent_sync(virt, sg->length, dir, FOR_CPU); - } + char *virt = + page_address((struct page *)sg->page_link) + sg->offset; + consistent_sync(virt, sg->length, dir, FOR_CPU); } return nents; }