From patchwork Fri May 18 17:18:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10411671 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 56C8C6031B for ; Fri, 18 May 2018 17:19:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 457BB28932 for ; Fri, 18 May 2018 17:19:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39A0A28963; Fri, 18 May 2018 17:19:05 +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 9C71328932 for ; Fri, 18 May 2018 17:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751897AbeERRTD (ORCPT ); Fri, 18 May 2018 13:19:03 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:45500 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751914AbeERRTC (ORCPT ); Fri, 18 May 2018 13:19:02 -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=dvtJgBR4uMuCLX1EVPG3mMxeZ +dZmdc9BvUkJ+vlrnw0rxGRKZd2SCMAKGiLg7s4JjtM7mysSEgH1eKW+BXg16+fUNa00iiDNVpFZw Nwqj3C4mWEXUZe3/i25MvkIfws6Ra1hBAGkZ+HmZV23kSuSgibWkscE6MZpO4d2IbwrCL8zSwCb4X 4ITwlT7+/Dz0hUsJs1W83umZ8Mp8aTVMg0OEcC0qBrH6XWxThoPOillflSeU+hvuFL3V9ny8iwSf5 3mRrTJvR5o4ifn5LlOUgMN/DlHNcNDanqSVyWzDntJVeFRcyUyXxUxwe78baQSNPgyUoZgx2t5XVn zK8Ku4rBg==; 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 1fJj1x-0007CN-Cf for linux-mmc@vger.kernel.org; Fri, 18 May 2018 17:19:01 +0000 From: Christoph Hellwig To: linux-mmc@vger.kernel.org Subject: [PATCH 4/7] mmc: mxcmmc: handle highmem pages Date: Fri, 18 May 2018 19:18:44 +0200 Message-Id: <20180518171847.16419-5-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180518171847.16419-1-hch@lst.de> References: <20180518171847.16419-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;