Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp875260imu; Fri, 11 Jan 2019 10:34:07 -0800 (PST) X-Google-Smtp-Source: ALg8bN7T3oa02N5G67gxIy1bhhEhZFYqnSulCAyt2m4oKY7fT5HWddINvOL8j9UNNaDN89ZA3MRO X-Received: by 2002:a17:902:24e7:: with SMTP id l36mr15775694plg.61.1547231647335; Fri, 11 Jan 2019 10:34:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547231647; cv=none; d=google.com; s=arc-20160816; b=LqBGSRq2PgEx7arDUWh3kIEPt1tMJyOXZtYK/Odu0ooLoOwK0y6DC8VYpE0bVY0FMJ FvyJSwFR4JcAAkBlrAUnJDSMQuJ+Y/9GRQq4iNMmUn9gB2b6hUSHVq3e5ZpF+b/uI5rh QbU3Rv8LNWN+KggrFDyCkwamdAKiQKhpQonAAXda0fVsJDmNvEwzmCVsHqTjiFKfT7al tV4Em2a4QXQHRtOIVWZlTa1K7SRis51YnW7Ysu66T4BaWtR1EoGxMcDDveoZogceG0mT boIBGQWQwF/xL+xSObvD1aodTW0IJdf2nR4CK6Q0Wp6xQaX9j3cB/LIewPGUZGlaFbau 9SPA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JqpsNlcncSVq3N0MvrraJKNn6wgWknI+b5dbrDCBSBA=; b=a9UU4C36egthMUAhNOClVOh5Jw6bQ143nEABFRDjYQR0j/YnSQfUgLoU95GkHR57Pb g7pdOD8nOIzcPzbmVqNnzv/R+jlEZhisoSQ/VRSpLW+2pun6MjUXwAG8WK/psRqCtu2N ZRb6XCszhcMGQPhaocrKCI0o7Xa6g31ZsE7qDDWcxoUephyDkRFbozNrzaCgc6unsmnH ubVeKDPlnzgvJGqcmxnEPFAZ1qUulMHzPZcKrFXr7ZeakLFMe6JEQQUa9GWZWJg04PEk gSmV//mdEt4OXw/uCzqm//EDKN789yULaYiNAj684u/a09EPFrQbF7w6b+CFNLjOLi1U +oLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vXv0l2W3; 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 j34si69344826pgj.557.2019.01.11.10.33.51; Fri, 11 Jan 2019 10:34:07 -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=pass header.i=@kernel.org header.s=default header.b=vXv0l2W3; 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 S2387915AbfAKORt (ORCPT + 99 others); Fri, 11 Jan 2019 09:17:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:34200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727745AbfAKORs (ORCPT ); Fri, 11 Jan 2019 09:17:48 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C7BD92177B; Fri, 11 Jan 2019 14:17:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547216267; bh=oYStL8Y6IyLE4TFHrfAg59N1iY7PQI/e4gYdMfNgup0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vXv0l2W3BTdKh9u0fGEwsky/RFpcRpatVxgjpxPSTx8fCYnVqBWcu0d/Y/fUmbo2Z bxyM225YcPsRL7WBOSbgXuTBpBNosM5VH97v1+ynw1cg2Bn4t30RKTaWrchajWtq1b 4UufFuyfkYMAZdJ5XmM8OHomF6AXhqsUfxJKKabM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , Ulf Hansson Subject: [PATCH 4.4 09/88] mmc: omap_hsmmc: fix DMA API warning Date: Fri, 11 Jan 2019 15:07:38 +0100 Message-Id: <20190111131047.673305450@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111131045.137499039@linuxfoundation.org> References: <20190111131045.137499039@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Russell King commit 0b479790684192ab7024ce6a621f93f6d0a64d92 upstream. While booting with rootfs on MMC, the following warning is encountered on OMAP4430: omap-dma-engine 4a056000.dma-controller: DMA-API: mapping sg segment longer than device claims to support [len=69632] [max=65536] This is because the DMA engine has a default maximum segment size of 64K but HSMMC sets: mmc->max_blk_size = 512; /* Block Length at max can be 1024 */ mmc->max_blk_count = 0xFFFF; /* No. of Blocks is 16 bits */ mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; mmc->max_seg_size = mmc->max_req_size; which ends up telling the block layer that we support a maximum segment size of 65535*512, which exceeds the advertised DMA engine capabilities. Fix this by clamping the maximum segment size to the lower of the maximum request size and of the DMA engine device used for either DMA channel. Signed-off-by: Russell King Cc: Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/omap_hsmmc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -2117,7 +2117,6 @@ static int omap_hsmmc_probe(struct platf mmc->max_blk_size = 512; /* Block Length at max can be 1024 */ mmc->max_blk_count = 0xFFFF; /* No. of Blocks is 16 bits */ mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; - mmc->max_seg_size = mmc->max_req_size; mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_ERASE; @@ -2174,6 +2173,17 @@ static int omap_hsmmc_probe(struct platf goto err_irq; } + /* + * Limit the maximum segment size to the lower of the request size + * and the DMA engine device segment size limits. In reality, with + * 32-bit transfers, the DMA engine can do longer segments than this + * but there is no way to represent that in the DMA model - if we + * increase this figure here, we get warnings from the DMA API debug. + */ + mmc->max_seg_size = min3(mmc->max_req_size, + dma_get_max_seg_size(host->rx_chan->device->dev), + dma_get_max_seg_size(host->tx_chan->device->dev)); + /* Request IRQ for MMC operations */ ret = devm_request_irq(&pdev->dev, host->irq, omap_hsmmc_irq, 0, mmc_hostname(mmc), host);