From patchwork Tue Feb 12 07:25:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10807479 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EFCA713A4 for ; Tue, 12 Feb 2019 07:27:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D78932915C for ; Tue, 12 Feb 2019 07:27:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBB292A3CA; Tue, 12 Feb 2019 07:27: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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 6D93C2915C for ; Tue, 12 Feb 2019 07:27:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727934AbfBLHZt (ORCPT ); Tue, 12 Feb 2019 02:25:49 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:57820 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725936AbfBLHZs (ORCPT ); Tue, 12 Feb 2019 02:25:48 -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=X7acI9+T4s0sysdc/0cb9IiZBmC/K8FNZBk+vRCRvWI=; b=aw+TPjn3RJidxYZ+NX+n8/W1ED X8hgIvBAEC5uqTz80Zud6QokdPJiVLib0q8PJhl1K1ACO/Ofhm4Qa8+JDmWpSsOM0XnxUkn8iDfXV BXBzoENsuKyhthQjLkxjG5zv4IDxeXBZxw6n3tznJqB+eHvS4tFrQwcTRhXxD4fTE7m3DT8a0DD+A YdXiK7WJx/rg4Lpw/dqc12gZtxinc5Hx9xUCUQr2tVDfyAHctiteBLbjsObG9zumujK/nCmk2IGS0 FOAAWhi2QppdQWhTfyvoGsWK3HNeESO0HiBdLcrmcLWBihsedSLRtOxv1KPfvQ4/VOX7ZPewBVI0p 9v2MsmJA==; Received: from 089144210182.atnat0019.highway.a1.net ([89.144.210.182] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtSRm-0002P6-HK; Tue, 12 Feb 2019 07:25:38 +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 03/14] mmc: add a need_kmap flag to struct mmc_host Date: Tue, 12 Feb 2019 08:25:17 +0100 Message-Id: <20190212072528.13167-4-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190212072528.13167-1-hch@lst.de> References: <20190212072528.13167-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If we want to get rid of the block layer bounce buffering for highmem we need to ensure no segment spans multiple pages so that we can kmap it. Add a flag to struct mmc_host so that we can handle the block and DMA layer interactions in common code. Signed-off-by: Christoph Hellwig --- drivers/mmc/core/queue.c | 13 +++++++++++++ include/linux/mmc/host.h | 1 + 2 files changed, 14 insertions(+) diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c index 35cc138b096d..71cd2411329e 100644 --- a/drivers/mmc/core/queue.c +++ b/drivers/mmc/core/queue.c @@ -370,6 +370,19 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card) blk_queue_max_segments(mq->queue, host->max_segs); blk_queue_max_segment_size(mq->queue, host->max_seg_size); + /* + * If the host requires kmapping for PIO we need to ensure + * that no segment spans a page boundary. + */ + if (host->need_kmap) { + unsigned int dma_boundary = host->max_seg_size - 1; + + if (dma_boundary >= PAGE_SIZE) + dma_boundary = PAGE_SIZE - 1; + blk_queue_segment_boundary(mq->queue, dma_boundary); + dma_set_seg_boundary(mmc_dev(host), dma_boundary); + } + INIT_WORK(&mq->recovery_work, mmc_mq_recovery_handler); INIT_WORK(&mq->complete_work, mmc_blk_mq_complete_work); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 4eadf01b4a93..87f8a89d2f70 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -397,6 +397,7 @@ struct mmc_host { unsigned int doing_retune:1; /* re-tuning in progress */ unsigned int retune_now:1; /* do re-tuning at next req */ unsigned int retune_paused:1; /* re-tuning is temporarily disabled */ + unsigned int need_kmap:1; /* only allow single page segments */ int rescan_disable; /* disable card detection */ int rescan_entered; /* used with nonremovable devices */