Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3387268imu; Mon, 14 Jan 2019 02:01:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN6yKKHj7tdvS9rxu2ELfCDkGXg9nZGMvG+hxd9gZi+qEYOreBZLz8GnxPpjh7JxiFWoi3ML X-Received: by 2002:a62:c302:: with SMTP id v2mr24864845pfg.155.1547460069511; Mon, 14 Jan 2019 02:01:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547460069; cv=none; d=google.com; s=arc-20160816; b=REFUSw5mMGMxasCeokGYCEZNqPhQmaH644vEKDEiOwettzMcZzu99nVrOgMcQ1sSVD RVVK1oFeYLeIJ84Nw//31NsBrCD6iKsQkGlJSNXmL/1GaEO+F8/C1EKC/DLpLWYf8t/u hQ/T2bHA9zCUWnqwG4FD4KImZR+wuu0loA0xda3wNt0gyb75QziM0k06spouieeS2TR1 xvbXeG0aDpwJ50z/Y0cYOC9eFnxQ/Pb6ZfwDhhXovyfahJVUcHO2e6LeALmoFMtlRVlf KUGEdPXYXkP+xHpHdnw1W6n94uOQouYWp7PW1OXI0CKsyXtl0gaWj81DmyNttoXNJ4xJ QDIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PC7MWnyri7Tw5JfDSYFG9mz/W8WDf8AUZ+PFyenukAs=; b=B7ZKf4bL23Wu9CNQ+Z1gyAoBIMoPETMz43DWrwCEGU+31yVJtchhT+8lzuxVCbmPpF zX5viA4C1LADqiuYwuIy9m8UAuNtn/JFtpRHLdwRJuS4fCscsBMKJOESd7kJvmiinx/C DQmRAa9M3nkVzYH5PsfbH0d0nsiZqpG62Ygg97gPXZj9WqYitVh0qyapel3H5dbVMcFO bQZpnAulMWAUO9nhbFIgsYR6K54JMIBjULtSR8FnY/IJ4ccC1WGj+C6OY8lrzgkQ9mgp pwQOA/gljMa5A78wdA7mEBFb5Z4TBnnrzJKaLAhcWR4crqHqbnrYvDoZtw+BstRMEqjp KC9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="fEqALaB/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s71si85096143pfk.105.2019.01.14.02.00.53; Mon, 14 Jan 2019 02:01:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="fEqALaB/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726715AbfANJ6V (ORCPT + 99 others); Mon, 14 Jan 2019 04:58:21 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:57828 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726513AbfANJ6U (ORCPT ); Mon, 14 Jan 2019 04:58:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=PC7MWnyri7Tw5JfDSYFG9mz/W8WDf8AUZ+PFyenukAs=; b=fEqALaB/1lhpdMtqfvSHCfhuqZ WOYrESC5tkiLF3DkA01tU904RKHV4Sw/rd2P+rsuK7Hzw07zCKqdd1+iFLUbjX6cadLnawPcQY40g 2dEOaAca0/9YbTH6vnnqQUgYDKbp7WphIhE7fbM0id2OJQopns3IC6pgPlCzUsKTrYBuPoEPyP5S9 5VCQW0DwasKYlB02xcu5Z5ld6y8li7ofxIvOuvMe42SAg+o7UO36KU31CAHnKyhzC3vciOZsh+vjV WHSTGKW3O/RYitrtb03pgm78f2IId8g4D5VjKUyBYd36GQzFVC4g4iS5zmG/KB1Wajq9hbnMnLp0m gMPiiQJQ==; Received: from 089144213167.atnat0022.highway.a1.net ([89.144.213.167] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1giz0W-0001rf-L4; Mon, 14 Jan 2019 09:58:13 +0000 From: Christoph Hellwig To: Ulf Hansson Cc: Russell King , Nicolas Pitre , Aaro Koskinen , Ben Dooks , linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/11] mmc: moxart: handle highmem pages Date: Mon, 14 Jan 2019 10:57:55 +0100 Message-Id: <20190114095804.27978-3-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190114095804.27978-1-hch@lst.de> References: <20190114095804.27978-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of setting up a kernel pointer to track the current PIO address, track the offset in the current page, and do a kmap for the page while doing the actual PIO operations. Signed-off-by: Christoph Hellwig --- drivers/mmc/host/moxart-mmc.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c index a0670e9cd012..7142bca425c8 100644 --- a/drivers/mmc/host/moxart-mmc.c +++ b/drivers/mmc/host/moxart-mmc.c @@ -311,7 +311,7 @@ static void moxart_transfer_pio(struct moxart_host *host) if (host->data_len == data->bytes_xfered) return; - sgp = sg_virt(host->cur_sg); + sgp = kmap(sg_page(host->cur_sg)) + host->cur_sg->offset; remain = host->data_remain; if (data->flags & MMC_DATA_WRITE) { @@ -319,8 +319,7 @@ static void moxart_transfer_pio(struct moxart_host *host) if (moxart_wait_for_status(host, FIFO_URUN, &status) == -ETIMEDOUT) { data->error = -ETIMEDOUT; - complete(&host->pio_complete); - return; + goto done; } for (len = 0; len < remain && len < host->fifo_width;) { iowrite32(*sgp, host->base + REG_DATA_WINDOW); @@ -335,8 +334,7 @@ static void moxart_transfer_pio(struct moxart_host *host) if (moxart_wait_for_status(host, FIFO_ORUN, &status) == -ETIMEDOUT) { data->error = -ETIMEDOUT; - complete(&host->pio_complete); - return; + goto done; } for (len = 0; len < remain && len < host->fifo_width;) { /* SCR data must be read in big endian. */ @@ -356,10 +354,15 @@ static void moxart_transfer_pio(struct moxart_host *host) data->bytes_xfered += host->data_remain - remain; host->data_remain = remain; - if (host->data_len != data->bytes_xfered) + if (host->data_len != data->bytes_xfered) { + kunmap(sg_page(host->cur_sg)); moxart_next_sg(host); - else - complete(&host->pio_complete); + return; + } + +done: + kunmap(sg_page(host->cur_sg)); + complete(&host->pio_complete); } static void moxart_prepare_data(struct moxart_host *host) -- 2.20.1