From patchwork Mon May 28 06:14:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10429803 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E10A260327 for ; Mon, 28 May 2018 06:14:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D253428A6E for ; Mon, 28 May 2018 06:14:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C60BE28A72; Mon, 28 May 2018 06:14:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20FE328A6E for ; Mon, 28 May 2018 06:14:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753197AbeE1GO1 (ORCPT ); Mon, 28 May 2018 02:14:27 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:52962 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751785AbeE1GO1 (ORCPT ); Mon, 28 May 2018 02:14:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5wDa2qe4oBHmFgF1vRaVip8+sGAtdsvKpJS/8I4hT2A=; b=ILSR9JCm3a3WmTdjjOWGtoZYk v/ZOMOzmaU/BV3ldN5clF+q9CF1rGO9La1b2UkUs5zoFHp+FiLXDdCPCnioJPrX4cyE1Lyc0d6cT+ Ak8MmNSaGo+DcdpP4nErbunkxx8gzlBAM8q8W4JrDyUfzaQDuh5I9wpE2y4JQ6+XQ16GJcQZpj5uB SwjCm17e1K5IibzaeX2eQQb5VmtADnRGPVRvxWoVtZsUB/OpjT128mZPvUeGQqnQR5rRAlttMNBFT ByBwRmfzY87ekW3QbTGEv152aUY/SxDmeTdxd6OvzIvVT3QDuLv0e3CXbH6DimXbU3Mzr6SpmWB09 rqk2JqgMg==; Received: from 213-225-0-51.nat.highway.a1.net ([213.225.0.51] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fNBQG-0002vy-LN; Mon, 28 May 2018 06:14:25 +0000 From: Christoph Hellwig To: ulf.hansson@linaro.org Cc: linux-mmc@vger.kernel.org Subject: [PATCH v2] mmc: au1xmmc: handle highmem pages Date: Mon, 28 May 2018 08:14:21 +0200 Message-Id: <20180528061421.25708-1-hch@lst.de> X-Mailer: git-send-email 2.17.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use kmap_atomic to map the scatterlist entry before using it. Signed-off-by: Christoph Hellwig --- Changes since v1: - pass the correct pointer to kunmap_atomic drivers/mmc/host/au1xmmc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c index ed77fbfa4774..9b4be67330dd 100644 --- a/drivers/mmc/host/au1xmmc.c +++ b/drivers/mmc/host/au1xmmc.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -405,7 +406,7 @@ static void au1xmmc_send_pio(struct au1xmmc_host *host) /* This is the pointer to the data buffer */ sg = &data->sg[host->pio.index]; - sg_ptr = sg_virt(sg) + host->pio.offset; + sg_ptr = kmap_atomic(sg_page(sg)) + sg->offset + host->pio.offset; /* This is the space left inside the buffer */ sg_len = data->sg[host->pio.index].length - host->pio.offset; @@ -421,11 +422,12 @@ static void au1xmmc_send_pio(struct au1xmmc_host *host) if (!(status & SD_STATUS_TH)) break; - val = *sg_ptr++; + val = sg_ptr[count]; __raw_writel((unsigned long)val, HOST_TXPORT(host)); wmb(); /* drain writebuffer */ } + kunmap_atomic(sg_ptr); host->pio.len -= count; host->pio.offset += count; @@ -462,7 +464,7 @@ static void au1xmmc_receive_pio(struct au1xmmc_host *host) if (host->pio.index < host->dma.len) { sg = &data->sg[host->pio.index]; - sg_ptr = sg_virt(sg) + host->pio.offset; + sg_ptr = kmap_atomic(sg_page(sg)) + sg->offset + host->pio.offset; /* This is the space left inside the buffer */ sg_len = sg_dma_len(&data->sg[host->pio.index]) - host->pio.offset; @@ -501,8 +503,10 @@ static void au1xmmc_receive_pio(struct au1xmmc_host *host) val = __raw_readl(HOST_RXPORT(host)); if (sg_ptr) - *sg_ptr++ = (unsigned char)(val & 0xFF); + sg_ptr[count] = (unsigned char)(val & 0xFF); } + if (sg_ptr) + kunmap_atomic(sg_ptr); host->pio.len -= count; host->pio.offset += count;