Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8332950imu; Fri, 28 Dec 2018 15:45:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN5FztR64tZRXh/ca650A3IAmgOndZviGSwiQir7cB+QXIzaHWqvD/QOIGmq96kB6o3Pa7Tb X-Received: by 2002:a17:902:48:: with SMTP id 66mr28563630pla.68.1546040738939; Fri, 28 Dec 2018 15:45:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546040738; cv=none; d=google.com; s=arc-20160816; b=j1Xt/8oCnB+8k3M0hdwagAXgoamxJ3pa7HVFGXEi50pAsLdRcZxPN4qKIEbnC8vrwI XTWugz5XqqsboptqlXuui8FXmg9RLnNF3OKWTr+YOza9SpYN/NqV8SEeBAwlaL3zIkQd yj1mxFQgklfwl/ZklQkz2GJSMdQ55wqelLZFm3c7ir5mnvFinGWT70jlVzOK6skeqLK+ /iz9Kgm2fHAUij312GcLaPoyW9f6rt8o2ILwwURMyvFAnP4k55cpMQQI5IF9lPyW9jS7 S3S9yR0etGAH1wg6HXvcd0YZZzluAtX64PsdKQhU681X6i34CKzYZldHWUy96W+5P/Ut ve6A== 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=bu9zYfhESvVT+tKjyvuZnHUBSmWhYZoJfid8V01svVY=; b=qYDSvC+OmmJGZ62o2yKYyA3MRa/Nz+UbtpZp9T8KdLRO6e2e5nCHnqIj6Ti4Mp7gVX llfQQ6Qrwa/6LqKAFhKmPltl7zIsXd2mDoEbA1YtJ6f3OzeSVaBcMPZh1iCPq3exJpKm 41hMp+vPxwdXvNWDYK3xzyC6uMXMGexiyrKuaXPLaW/U9QFVF+TVXi0NWJeMNB/b1HyB SQrZqViRidu9EkOFMquzbCZc0/qqduiReoJxCyeq7wiS6BQpcta1dYgavSOfCfQ2NTFb V4NmPqOSvd0evlnuKGr8pssR1kl7/s+VZzMtaOoVmMd1rwkmiiCQlQzgRVMO1QoWu/yd F1Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Z+Vo9GEX; 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 r207si13191261pfc.179.2018.12.28.15.45.22; Fri, 28 Dec 2018 15:45:38 -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=Z+Vo9GEX; 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 S1732940AbeL1MR3 (ORCPT + 99 others); Fri, 28 Dec 2018 07:17:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:36486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732926AbeL1MR0 (ORCPT ); Fri, 28 Dec 2018 07:17:26 -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 29FBE20675; Fri, 28 Dec 2018 12:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1545999445; bh=iH34csVshxT0clUSATYd0b4CJ6kbq0MfULm0z/o7imc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z+Vo9GEXBs2hfZGpBgo8d8LlZ7UneJhDNV6B82KC4PQkbUlESbKAcmLjKJBlZhQWW tj1hKbTn/nEt0mq0K29WkJsbEeo/kYSfbttaoO0u1ofe5f5oAfhkxxqclLKaDprOOO KtIAN6/AsrCtqvG6IN6+9VupfXjpim8jhc8iSfWU= 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.9 14/22] mmc: omap_hsmmc: fix DMA API warning Date: Fri, 28 Dec 2018 12:52:51 +0100 Message-Id: <20181228113127.130782910@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181228113126.144310132@linuxfoundation.org> References: <20181228113126.144310132@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.9-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 @@ -2105,7 +2105,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; @@ -2135,6 +2134,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);