From patchwork Wed May 9 13:55: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: 10389611 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 1D0C460318 for ; Wed, 9 May 2018 13:55:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D82228FAA for ; Wed, 9 May 2018 13:55:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0212F28FB6; Wed, 9 May 2018 13:55:51 +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 813AB28FAA for ; Wed, 9 May 2018 13:55:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934952AbeEINzu (ORCPT ); Wed, 9 May 2018 09:55:50 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:58866 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934948AbeEINzs (ORCPT ); Wed, 9 May 2018 09:55:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:To:From:Sender:Reply-To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=i4Ji0dQEVeD6GuirfFgxSvkQCRUHdjOL4EsUUtDiG0Y=; b=XqoLv2OE2+c56pIFu59w8ROCE eDyJF296V8w0+xWJzkRSsj1w+FHlj+hy1h00ZRCH3rNsL+6b72p+AzeS8deRKIMSN0sjIlYCWV7df zG6NdXmLjOvXRdD/pJPrGjfRPAFgBQqoZP9aTtHyBdcVxz9NKVCXQGzSCBkIphDZLLdERVX1FnHNF 1xW0jp+ImZF+CWRVSkfH2R8vwZ4i1as3UpCbFhIym2vqDkyEdu2Zo5Z2F2jnHGLqvaXk54KT6M1so WAKJVyQXn+qEIarnlXnAFid6jbhIMQ/ftRaM3q9Gu0HjvBt8M0HiqdfQlWQFz3fgABLo+FsYQLCxb Ez22qqimg==; Received: from 213-225-15-246.nat.highway.a1.net ([213.225.15.246] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fGPZL-0001qc-GV for linux-mmc@vger.kernel.org; Wed, 09 May 2018 13:55:48 +0000 From: Christoph Hellwig To: linux-mmc@vger.kernel.org Subject: [PATCH 3/7] mmc: au1xmmc: handle highmem pages Date: Wed, 9 May 2018 15:55:21 +0200 Message-Id: <20180509135525.19885-4-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180509135525.19885-1-hch@lst.de> References: <20180509135525.19885-1-hch@lst.de> 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 --- drivers/mmc/host/au1xmmc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c index ed77fbfa4774..9d74c6ec15a8 100644 --- a/drivers/mmc/host/au1xmmc.c +++ b/drivers/mmc/host/au1xmmc.c @@ -405,7 +405,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 +421,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(sg_ptr); host->pio.len -= count; host->pio.offset += count; @@ -462,7 +463,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 +502,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;