Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp681872imu; Fri, 11 Jan 2019 07:17:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN4PEBjugIVXPusuHl3X8td+V2MXqQqaQSF3E9V8JqfnsLky6Skt0gELwqFRMWGBH1MUWC9e X-Received: by 2002:a17:902:bc44:: with SMTP id t4mr14925471plz.260.1547219849892; Fri, 11 Jan 2019 07:17:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547219849; cv=none; d=google.com; s=arc-20160816; b=w1tobdq4NJZJ2kWdFYBTUr0+wkFNHTlO8grJUreUUKdGa3/FMsOLTzvs/JV50Q1QDE EcIpbrVI2OKBvJUntmPdiThZv21c9dnqyTG2Pky070mW1SHYPEVTwJfqJP5HWYFVIIk/ GVjo/fZy5PcV3EoQkMPx+rVQ9WzVzPXKyGkDkMazHsgfyOQpi5hjbLmzkKtGqRoi9CgF I1IG+R5zW0pFfix1B4/ei6n43fJifiBK5N1ATcnYinRaaNM0iIvEXfgwTkCMTAwTJk2b Nbwey//xWJOdORlrgrXKz47uxWTZOaXSZQXOJ9G8CAUqC44TsanYCF3ae+cSRtCA5D7r JH6g== 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=LS2nKj35L4dnmKTmMwDyeqjS19LEHMjUrCIiw+T4TP0=; b=dqIY05Wm6L2JI5cllfKZ/asXA2E8SHHmm7kHeqsHhnxK/E8+QCfefc1oPdohBoIpd9 Hdy0uEyfpgyJlV9N8neOKLsbBFeoczfG47S0PcHkxTKL42825aHOqI2HMHD6ssL+XHf/ 8HyXCI+bZ3hoDm1nCpGzZO1fBFRWAiC2T7M+kBjHhHurGdciZ6WcLbWv4DAwVXtzBvFr kR4ljnREQ6pfhXUteeKZuG+mFXSMkeH1uu29aSjAhW07agX6pOeT4u0aKQkAASy5caly LtNcR9Tr5ApEJeDnvaAcEjFnknqQwAVOteSg3FRyT8Uj+NT1af2ycRo7bAeO1PE3xeA3 RLgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qHjpicHx; 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 c9si6855056pll.439.2019.01.11.07.17.13; Fri, 11 Jan 2019 07:17:29 -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=qHjpicHx; 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 S2387701AbfAKPN6 (ORCPT + 99 others); Fri, 11 Jan 2019 10:13:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:58328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733069AbfAKOOh (ORCPT ); Fri, 11 Jan 2019 09:14:37 -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 6D47120874; Fri, 11 Jan 2019 14:14:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547216075; bh=0bo/QvKv0hAL6e1gqYT124c3dEZ+uWPSbX95hocvWdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHjpicHxd/ug32AtPQ16nZESEyhWudUAA9BaaTxvsJJdnrUX0wey3B6pBeXznZ4Ly wQj87w1MtoUQojt0TNh56sGTeETmLstZNKv6PQBni27mAw9GwSYlwMC/t2jKzvgBZr xSg2yzgRxBb/rjJR3ZbOOjp6fZkiqs3qYdjrZSiw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , Ulf Hansson Subject: [PATCH 3.18 04/47] mmc: omap_hsmmc: fix DMA API warning Date: Fri, 11 Jan 2019 15:07:49 +0100 Message-Id: <20190111130956.733599374@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111130956.170952125@linuxfoundation.org> References: <20190111130956.170952125@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 3.18-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 @@ -2141,7 +2141,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; @@ -2198,6 +2197,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);