Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1080019ybl; Wed, 14 Aug 2019 10:22:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUmlnJd77uH4UJsZVEx95S6XgpG5dn8gViGrfPzl4mQInT4pp5rRd3c640ACWpbPoyDrpF X-Received: by 2002:aa7:93aa:: with SMTP id x10mr1051968pff.83.1565803331539; Wed, 14 Aug 2019 10:22:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565803331; cv=none; d=google.com; s=arc-20160816; b=0H6DgXa709j6s+TcGSJoKwFvtbVXZ0P6JS5l5XbXEXGXQ9vm4PrQGW7dDHlHaM3FgB 5VGYAYxTmIhoRA92W77MXUTUaAR41LlFeXKw0QzR20llKyrFz5nk3jFkQIyaHEuP+7ZI pEKaAT9BKHp+znQXKelyq4yURi3mdVdS/28pI3fYuY1TIaHtKDFVB4iFqPHKd1/UVhi9 QWXvZV1c3bG0yaNC5tVBP2aDHV1L9Pps264eLNBktUEsDMdqrpHddT8GNZVsvMq5Iv8z FRrlcu+JqbQooMjiSPCx7wA+YwEKcKcZjtz36crMTXXnV11ykoz6ABJGo/Wq+Q8BPnSA pBIg== 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=OYGIfqwc+cxBxkyUbRNHkY/vmVS9s7YpCASeCharmhg=; b=bezYp5cwMnfiLNGioqHOmgJj3XOiE1riYCXRrGxbGYuzrhLFYcjh8R/4sLUW24hQlq sD8izTXbfG+K0ACdzEWc8ql4EbwmY4enNH+YeSbpBiSpBekh8zOaGcqvupFzjiuY2iuQ og3xauKvlPmJqiEFZuRXeP5HD1xn7olIzMHLXvt8U6SSXhWbxzipd6Ty3IjyYuKeMwPL wqvb1dsOwPEjH3tdsg+fLAni2vb2+kf1yLKFrNfXzn9yhWC2eO7oWgnBvvIIOAoaUVGF QDGp7z9RvoQOTfXiXAcUoa1qRLHrnbz6yTC3iG15BS3uzYeI1LqnngxjKHY+V05crgF2 6kYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Kpp1v6t/"; 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 m11si189243pgq.267.2019.08.14.10.21.55; Wed, 14 Aug 2019 10:22:11 -0700 (PDT) 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="Kpp1v6t/"; 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 S1729907AbfHNRVZ (ORCPT + 99 others); Wed, 14 Aug 2019 13:21:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:60404 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730389AbfHNRJv (ORCPT ); Wed, 14 Aug 2019 13:09:51 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 B376A208C2; Wed, 14 Aug 2019 17:09:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802590; bh=zhxAZGvoqo0f1xdBBUnCSimhFegjwoKQYTfVfwVAH1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kpp1v6t/7V98Ena4/CpbZ+kidzpbp1hFDGtuEABsBmz/+PijIIQwIjFfQWD2bWPSu gR6DTJhgafxpTNFht4CDmcZFJxMZRdgn+aO2aHA2B6y/rt4gyNq69sKT2tGZjMybYY bERXQXOtzAYx53rsbfAQ9CEeKY4ASZzOacQjevQI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kevin Hao , Ulf Hansson Subject: [PATCH 4.19 11/91] mmc: cavium: Set the correct dma max segment size for mmc_host Date: Wed, 14 Aug 2019 19:00:34 +0200 Message-Id: <20190814165750.138291701@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165748.991235624@linuxfoundation.org> References: <20190814165748.991235624@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Kevin Hao commit fa25eba6993b3750f417baabba169afaba076178 upstream. We have set the mmc_host.max_seg_size to 8M, but the dma max segment size of PCI device is set to 64K by default in function pci_device_add(). The mmc_host.max_seg_size is used to set the max segment size of the blk queue. Then this mismatch will trigger a calltrace like below when a bigger than 64K segment request arrives at mmc dev. So we should consider the limitation of the cvm_mmc_host when setting the mmc_host.max_seg_size. DMA-API: thunderx_mmc 0000:01:01.4: mapping sg segment longer than device claims to support [len=131072] [max=65536] WARNING: CPU: 6 PID: 238 at kernel/dma/debug.c:1221 debug_dma_map_sg+0x2b8/0x350 Modules linked in: CPU: 6 PID: 238 Comm: kworker/6:1H Not tainted 5.3.0-rc1-next-20190724-yocto-standard+ #62 Hardware name: Marvell OcteonTX CN96XX board (DT) Workqueue: kblockd blk_mq_run_work_fn pstate: 80c00009 (Nzcv daif +PAN +UAO) pc : debug_dma_map_sg+0x2b8/0x350 lr : debug_dma_map_sg+0x2b8/0x350 sp : ffff00001770f9e0 x29: ffff00001770f9e0 x28: ffffffff00000000 x27: 00000000ffffffff x26: ffff800bc2c73180 x25: ffff000010e83700 x24: 0000000000000002 x23: 0000000000000001 x22: 0000000000000001 x21: 0000000000000000 x20: ffff800bc48ba0b0 x19: ffff800bc97e8c00 x18: ffffffffffffffff x17: 0000000000000000 x16: 0000000000000000 x15: ffff000010e835c8 x14: 6874207265676e6f x13: 6c20746e656d6765 x12: 7320677320676e69 x11: 7070616d203a342e x10: 31303a31303a3030 x9 : 303020636d6d5f78 x8 : 35363d78616d5b20 x7 : 00000000000002fd x6 : ffff000010fd57dc x5 : 0000000000000000 x4 : ffff0000106c61f0 x3 : 00000000ffffffff x2 : 0000800bee060000 x1 : 7010678df3041a00 x0 : 0000000000000000 Call trace: debug_dma_map_sg+0x2b8/0x350 cvm_mmc_request+0x3c4/0x988 __mmc_start_request+0x9c/0x1f8 mmc_start_request+0x7c/0xb0 mmc_blk_mq_issue_rq+0x5c4/0x7b8 mmc_mq_queue_rq+0x11c/0x278 blk_mq_dispatch_rq_list+0xb0/0x568 blk_mq_do_dispatch_sched+0x6c/0x108 blk_mq_sched_dispatch_requests+0x110/0x1b8 __blk_mq_run_hw_queue+0xb0/0x118 blk_mq_run_work_fn+0x28/0x38 process_one_work+0x210/0x490 worker_thread+0x48/0x458 kthread+0x130/0x138 ret_from_fork+0x10/0x1c Signed-off-by: Kevin Hao Fixes: ba3869ff32e4 ("mmc: cavium: Add core MMC driver for Cavium SOCs") Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/cavium.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/mmc/host/cavium.c +++ b/drivers/mmc/host/cavium.c @@ -1046,7 +1046,8 @@ int cvm_mmc_of_slot_probe(struct device mmc->max_segs = 1; /* DMA size field can address up to 8 MB */ - mmc->max_seg_size = 8 * 1024 * 1024; + mmc->max_seg_size = min_t(unsigned int, 8 * 1024 * 1024, + dma_get_max_seg_size(host->dev)); mmc->max_req_size = mmc->max_seg_size; /* External DMA is in 512 byte blocks */ mmc->max_blk_size = 512;