Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8241274imu; Fri, 28 Dec 2018 13:30:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN6q0yywKoWCB6sP7gzNg0v4r1svJh286lUUD8rLb3exENe3zijpOFiNRwAsb2qZM1Amd1sU X-Received: by 2002:a63:561b:: with SMTP id k27mr27720998pgb.271.1546032606828; Fri, 28 Dec 2018 13:30:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546032606; cv=none; d=google.com; s=arc-20160816; b=LbWphItzvkjUK5bK5Zgj49ODI2ldkIpm+GKm9y8DFSNvcjD5bCIIXjXHDoGLJDOiPs KuFOTmPtLyr+G+xP/7cI9pzDTgmQH71tOLLVjq2IT0kfMutpBKS7OjMUUqx3gP1uKNHp yQqGu/lSiBWJdx5WSXQWdAPbrzsvAsjw4aIb6kfhAQIHIfrS8rHDErI/5o6K2nWKK7jx Eqs+4UWqf/RMVqzYmwsMBcDqHR4ivKJ1/gXjA1o2wxo++xnrLT1ko4EG5+IQPXLNQNdN kjQsJ+if31dGWaJCFbpSpBUrlCUI0uLDttjDWsxAvJtMbOD7gVmk4R7MPqewrQ8SGquW rMoA== 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=7nPWrtOpjWWgE5iYWHvQb8viKLRJecSMxiGDfx1OQUA=; b=bHswlkG+GjSmS5/51ZZoS1vEjo940Fi140DrRUD6T1C9zEa6HkJKQ/vlKRyamKQRo9 SLuxFXyIrX+Z6ZnQoACDNbQohQTyQiafPOpMwRD2HSRYRbbViOotbXpYDUM+igynkFbE nlnINgaOW+HfMgXipvo+/b5ndmW05iCb8mXTSMK21w/BESfkhBkxiKghFAGPn35/LF8w H8oxvM+f5dstVpb/G66pDLW6dGXZq+be1L49+JB39xKlkP9LmEdew1FD6RU4vEu3OWhe GWK1W0im6aQplKnbl3PXH7BXapHm0PsPQhYgOxkfAQuZWaCOFFVWfNhHA3VgJuXqw2JU ktNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OcXK4QTB; 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 f95si34087024plb.60.2018.12.28.13.29.51; Fri, 28 Dec 2018 13:30:06 -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=OcXK4QTB; 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 S1732408AbeL1Ly1 (ORCPT + 99 others); Fri, 28 Dec 2018 06:54:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:53314 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731280AbeL1Lx2 (ORCPT ); Fri, 28 Dec 2018 06:53:28 -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 6ADA12087F; Fri, 28 Dec 2018 11:53:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1545998007; bh=KG5Bf1HfyI9KxGNXiinf5gA0HwIPbCmD+bcmQZ1ZaVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OcXK4QTB635fUkUU8LaO+HuZFPMFX/HfZMz4tsbmMn6VUA4o/gPNKo/aqawWBs/zq b/R4OL+x6vfrWcqXZeHMcyLoEcituXDbSWMdUhSeqvQuQHDXaeOsd+eqNJfdVzVDLr fnZqzFTVG4Wi9mMON3ta29HQlbPm7fpdmIYjXivk= 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.19 17/46] mmc: omap_hsmmc: fix DMA API warning Date: Fri, 28 Dec 2018 12:52:11 +0100 Message-Id: <20181228113125.777296138@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181228113124.971620049@linuxfoundation.org> References: <20181228113124.971620049@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.19-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 @@ -2066,7 +2066,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 | MMC_CAP_CMD23; @@ -2096,6 +2095,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);