From patchwork Wed May 9 13:55:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10389613 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 8D20460318 for ; Wed, 9 May 2018 13:55:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CF4528FAA for ; Wed, 9 May 2018 13:55:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70F6C28FB6; Wed, 9 May 2018 13:55:55 +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 E750628FAA for ; Wed, 9 May 2018 13:55:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934953AbeEINzx (ORCPT ); Wed, 9 May 2018 09:55:53 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:58880 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934948AbeEINzx (ORCPT ); Wed, 9 May 2018 09:55:53 -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=O67iJyCeKcbT9kMQ9CsHYuuclbWgG4e4TWWduuvWIls=; b=CDN4y18juJm6zetqIkmqr+RH1 AXJ2M49DGiZEUrgBrSLhvXYxV233x48Ve+tG0NU8LfKvoe4TJq35Di96hEse5bXG09oPa6Zfzkio3 qp0/Lq34UjcfB+1RoxrGOps8I6RcJak+nnjzuKePO5ZuHKAEpJyMXcJrr13JRglMFDtuCjA2VGvVH yWBiMJIKUYNpAMRTyR2cws2m+L6Z3eov8WqXCdJJDU5aTER0wZ3OmUgbD9fqIDF38azDXt1sFf0k/ hYb5XUKXuFPyayEmLkfkQt6zMZm7vHJu8OMbU4JQehAvUiJwDK9byiG/fVQp4zzGDoqtw8SH5jsFg zbZe0vO1g==; 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 1fGPZQ-0001rq-0a for linux-mmc@vger.kernel.org; Wed, 09 May 2018 13:55:52 +0000 From: Christoph Hellwig To: linux-mmc@vger.kernel.org Subject: [PATCH 4/7] mmc: mxcmmc: handle highmem pages Date: Wed, 9 May 2018 15:55:22 +0200 Message-Id: <20180509135525.19885-5-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/mxcmmc.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c index 5ff8ef7223cc..150fbdba777d 100644 --- a/drivers/mmc/host/mxcmmc.c +++ b/drivers/mmc/host/mxcmmc.c @@ -291,8 +291,10 @@ static void mxcmci_swap_buffers(struct mmc_data *data) struct scatterlist *sg; int i; - for_each_sg(data->sg, sg, data->sg_len, i) - buffer_swap32(sg_virt(sg), sg->length); + for_each_sg(data->sg, sg, data->sg_len, i) { + void *buf = kmap_atomic(sg_page(sg) + sg->offset; + buffer_swap32(buf, sg->length); + kunmap_atomic(buf); } #else static inline void mxcmci_swap_buffers(struct mmc_data *data) {} @@ -609,6 +611,7 @@ static int mxcmci_transfer_data(struct mxcmci_host *host) { struct mmc_data *data = host->req->data; struct scatterlist *sg; + void *buf; int stat, i; host->data = data; @@ -616,14 +619,18 @@ static int mxcmci_transfer_data(struct mxcmci_host *host) if (data->flags & MMC_DATA_READ) { for_each_sg(data->sg, sg, data->sg_len, i) { - stat = mxcmci_pull(host, sg_virt(sg), sg->length); + buf = kmap_atomic(sg_page(sg) + sg->offset); + stat = mxcmci_pull(host, buf, sg->length); + kunmap(buf); if (stat) return stat; host->datasize += sg->length; } } else { for_each_sg(data->sg, sg, data->sg_len, i) { - stat = mxcmci_push(host, sg_virt(sg), sg->length); + buf = kmap_atomic(sg_page(sg) + sg->offset); + stat = mxcmci_push(host, buf, sg->length); + kunmap(buf); if (stat) return stat; host->datasize += sg->length;