From patchwork Fri Oct 20 03:12:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 10018881 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 82673602C8 for ; Fri, 20 Oct 2017 03:17:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AF3D28E96 for ; Fri, 20 Oct 2017 03:17:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F9C028E98; Fri, 20 Oct 2017 03:17:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07FB128E97 for ; Fri, 20 Oct 2017 03:17:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751398AbdJTDRA (ORCPT ); Thu, 19 Oct 2017 23:17:00 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:30213 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751125AbdJTDQ6 (ORCPT ); Thu, 19 Oct 2017 23:16:58 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie2.idc.renesas.com with ESMTP; 20 Oct 2017 12:16:41 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 0256A4E1CC; Fri, 20 Oct 2017 12:16:41 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.43,404,1503327600"; d="scan'208";a="259899040" Received: from mail-sg2apc01lp0247.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.247]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 20 Oct 2017 12:16:40 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=l58kH1Yrv+7sB1Rkkfy+LtNY8ejT5EWp5ON5p4NpaAo=; b=jfskiJpiebfJPDfL601qnIQ386GJEuDgoNF3TLXapKNnjqmcS97Q9rNebUOTkV5jrQbevx42wF9x5KtayFZkGt9H6OnpURJmMmQcHRr9VYo4dlp2w3OaNSfNpiyMjswCkOBmoJdD4SiFjajnDxIqTPAjMVsVWmmHRAGAp8/beOQ= Received: from localhost.localdomain (211.11.155.138) by SG2PR06MB0983.apcprd06.prod.outlook.com (2a01:111:e400:5213::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.156.4; Fri, 20 Oct 2017 03:16:38 +0000 From: Yoshihiro Shimoda To: wsa+renesas@sang-engineering.com, ulf.hansson@linaro.org Cc: linux-mmc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Yoshihiro Shimoda Subject: [PATCH v2 1/2] mmc: tmio: fix swiotlb buffer is full Date: Fri, 20 Oct 2017 12:12:41 +0900 Message-Id: <1508469162-12322-2-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508469162-12322-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1508469162-12322-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: KAXPR01CA0004.jpnprd01.prod.outlook.com (2603:1096:402:19::14) To SG2PR06MB0983.apcprd06.prod.outlook.com (2a01:111:e400:5213::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a4ead292-a0ad-44f7-d82b-08d51768fa55 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627075)(201703031133081)(48565401081)(2017052603229); SRVR:SG2PR06MB0983; X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB0983; 3:4RyiB6T3w0VSSWDBB1OTMv/eo6X2BC/1f5nHPaF6q1UaVEsMDIqsJ5Xqc04hI0eBNYc32K3eDt5uQp1k4jEK9gB9+6DB5uN8G53WLRHqvl9zWMEBj+IDDf8QdXkauSEiqOK0ArEF7yFAWg6ZBhISynp22/ieDMUStKg6AD3o3APhrJDiOksicR6AOJeEajYE/VFQeHD7+1hJkGn31ssZZ4dz+rndxRIFavwXqD0zT2YLZie3lO922LqKQyhoGGWa; 25:2QV42SoolvR1cG08KTZC0eDFfTSwg7X6tCAp8xapObpgOpHt8ouldPQ/h7TObQyYrtxpMHJ8p01BgOTynA5HuMMiqTFYY7DFYY00ZDHUaiiRzeDwyrCEladuloA35Sc+rGsVw6kBMcBpwBfC/q2jioXUfeImNrfugSfnXTa2j3offCJrvXyDI5TwAjB4pd19v7TmzOn3XLeyyRmgMAp5m14CLTuGImIbQ4lavNbkZ+cS7eZPE0gazjykoRUfR8lAgGb2FOJwhqoemixcWnT6TKBJ45GPgby2ahWOfdI9juMfGMwygcIxqnaz+JcvUK3RqJF5qZ2FdYBbj9uBt7ErLQ==; 31:XKrdVY3nBBKvjKIROv5NTZF+Wy/WwTQ1ba9LyNLvbULo/yxoDP4e0S6zD45C3PoUQUjc/TMbwTKqDUhbMXpHqRn3rY2qBVmLIrrTrKh0wRDmZNxvTd3EvzYuHRw6830TOuoowNt/mJk3wslYmCQxNcjExqdtGiMzBTXh1+RcCrR1jA5uwJKtHEfIAXuhginUDlwlIAL0dbId8gkb/GXEZBRuN0TlsE5tpLGPH4efkLU= X-MS-TrafficTypeDiagnostic: SG2PR06MB0983: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB0983; 20:lRaQTAcC04WQfx63SBXhCTRlFLtJBOgQSlz5+lXJiI34Dy+IDtu/MCUHT2D5KdFeI7aw67KGk9HmSZzY8ugYgcCywJPIYxgCCTPLSL31zp9yWDCH+qUIai6gD/a5CXhqSVMZfW0kydsw84aFB5Zrl6vo6vCRMKrGxFV+G0ZgXL/NQNna1LQ+QwO1XLHI+SdwZvfmIiI+AsifhnsQPgE75EGmVFRUW6Ct4sp4wMNEYHcz6hRwn9W2yDuZ+S+4NGW7fULiYmS9Y74+awgtbZgE64rv2xXU9wqiMYjGv7C57fIHoiybx/Ko2IZGDZIi+nZp/wQrxIodYlBNhwenPVaLDHPcjaOClHCA+Bv9wMiv1Cj6LK+MahxviVmpuMY23//LkDLdqGVTuZ9nY/Y1mKi33RevZhoVs/VKboaM6BrsH3H5qS9BiITxLj9vK+Yb5Ppgg8FG1a4tww269QT1+A9+/ziMyjwqBzwbxi2Og0pxxMlYmLyoXyYlquFj4Y2dZTt4; 4:zum5LLkLL5Mo8dLO7nCRzEJfvCjT9f0/28Chol/tD3YVaZaCZk/ryxog69b1LZthm6VdfcCubuj/HJADWyoyB+TYsxzhsBDhgpZ97ytWrjIkD0bcHj/XW7keQFbW84miAMjexG5cI/qPqHZaDU2Upki8csmvLWN2HzTT5fLr78mayiLDRPxRjGF2JXHgaJWt8IL4QHjHqVMVQfUMI7riYkjGBog30cx4zoiG7YJWNFPFJMYiUCgY7Z10rAfI6HCO X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(100000703101)(100105400095)(3231020)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061750153)(20161123555025)(20161123558100)(20161123562025)(20161123560025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SG2PR06MB0983; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SG2PR06MB0983; X-Forefront-PRVS: 0466CA5A45 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(6009001)(39860400002)(346002)(376002)(189002)(199003)(3846002)(50226002)(53936002)(6116002)(6666003)(78352004)(42882006)(2950100002)(106356001)(105586002)(5003940100001)(68736007)(498600001)(16526018)(107886003)(6512007)(97736004)(4326008)(189998001)(33646002)(48376002)(25786009)(66066001)(16586007)(76176999)(50986999)(36756003)(101416001)(316002)(5660300001)(81156014)(81166006)(6506006)(8676002)(6486002)(8936002)(50466002)(7736002)(305945005)(47776003)(2906002)(3720700003); DIR:OUT; SFP:1102; SCL:1; SRVR:SG2PR06MB0983; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:0; A:0; LANG:en; Received-SPF: None (protection.outlook.com: localhost.localdomain does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SG2PR06MB0983; 23:miLkrK6JaPYryXADP9jz9ftNQ9QBO0BXgwm9tM3Pk?= =?us-ascii?Q?6KwXDyupqQQ2lEbKbhhgZRzovbMDv3UgxY0ZW5FV4Xwa16bG1z7+oWlGfiEY?= =?us-ascii?Q?cMmad4m4BmljK7ldvfVnXT5rrqrPrG+2q1vzQtfW3X8ze2n+nK3Ri1jIBJi8?= =?us-ascii?Q?puQkJU/6+b1p7E0fLtDrETKek6dwGfP40UxttVTHoWMCIx6Oj6BBckUQqGJX?= =?us-ascii?Q?MyHUi+h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kpxcehr?= =?us-ascii?Q?Ztfis4V+MkjuXL6VDaWJBefdW3EYL8iQAeqfkIi5xw+O78VNBasMQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB0983; 6:OFeH5YiMiu1L4iBbxDIRpEefrs6wx8UsjlkLAHvdHQf8QEIzmEdgo8UyUUsHaW505S+9ciUs6ya9RX8rPRBO9c2/oQgVlsulaXlWsF7+k1zYGZSMPSBSKC93bMQ1tVg8W66l/0bSddEEINHInCXYHUYkOWzldxRPFRiZHMfbFOGH2Dflay8LQXPBo/gcNT70vTxPEyUhue9/z7MRlDo+4OYfM5wzJsQxk1MmN0IoJC6qi2sQo0gL85ak5aP5YNioFx1tPHw+rVAOh+ABgMxurXlpQlEgq1oJL797OruCExyRU+oOgLtuCnXK+w+Vr5GBiXnxl91eUfkaURUIFuieXQ==; 5:x1fjh3fjsD7wocfUEchRUxLHplIWnXOFyeYjHrCVSIraQD5eV7NVsb6JcGQOH/5DU5sp6Z5Qfv/TTv6cJa/xkK4S2PxlpJmzfMmNA9mlpmJCFLuQnf7YJKaZNUGkhb35d+mHkzbQAJ1H67nhPDWAbg==; 24:FuryUYWW7WTZ41FtRyYteIwmBY/NrMKEWCdEgditeSIOgEhO0BaQ1zp0cSub34h4rWqLIyJ4hPXqQXavoIq0o+9NGX1syiH2Pd6AUTM4gcY=; 7:stHE6mo9dgdgF2hgBcLG/wlds63gGL0femCwVcIPDQz3Mx6RNnW7CmyyhpxooHuwV6KZeXifWIgKZYMGaf48/F7BK+l41YCGmBNSUR5QWBSOrs5nGaKZEadw6cgLHQmDYkVxfdmo7nY1Da8hWE7W6/8WYDX2h0PqnKQ16N8n7X9kw3vekDNTNZRJZ6vKHS+e227TqnhXzz+i/9V+3SgD9dUz+GkM/pLqIzA2yQzdqhI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB0983; 20:ssYjZmReT/tqkb9oKXulibAaX4rw+egDV7i49oehYsMNdjtZLm1L8kjazc9lOCrIUzeqH6n1tW+PAgJNrM29Yg+SOTrYbFA5zbJrV+KeLI50Wr+4G41D2faGF8isj+jvS0L4cE5VgsjoUGF1UcnpD/peoYpRN8bfIPHEG5S9XXU= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2017 03:16:38.1291 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4ead292-a0ad-44f7-d82b-08d51768fa55 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB0983 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since the commit de3ee99b097d ("mmc: Delete bounce buffer handling") deletes the bounce buffer handling, a request data size will be referred to max_{req,seg}_size instead of MMC_QUEUE_BOUNCESZ (64k bytes). In other hand, renesas_sdhi_internal_dmac.c will set very big value of max_{req,seg}_size because the max_blk_count is set to 0xffffffff. And then, "swiotlb buffer is full" happens because swiotlb can handle a memory size up to 256k bytes only (IO_TLB_SEGSIZE = 128 and IO_TLB_SHIFT = 11). So, as a workaround, this patch avoids the issue by setting the max_{req,seg}_size up to 256k bytes if swiotlb is running. Reported-by: Dirk Behme Signed-off-by: Yoshihiro Shimoda Acked-by: Wolfram Sang Reviewed-by: Geert Uytterhoeven --- drivers/mmc/host/tmio_mmc_core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index a7293e1..9c4e619 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include "tmio_mmc.h" @@ -1215,6 +1216,18 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, mmc->max_blk_count = pdata->max_blk_count ? : (PAGE_SIZE / mmc->max_blk_size) * mmc->max_segs; mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; + /* + * Since swiotlb has memory size limitation, this will calculate + * the maximum size locally (because we don't have any APIs for it now) + * and check the current max_req_size. And then, this will update + * the max_req_size if needed as a workaround. + */ + if (swiotlb_max_segment()) { + unsigned int max_size = (1 << IO_TLB_SHIFT) * IO_TLB_SEGSIZE; + + if (mmc->max_req_size > max_size) + mmc->max_req_size = max_size; + } mmc->max_seg_size = mmc->max_req_size; _host->native_hotplug = !(pdata->flags & TMIO_MMC_USE_GPIO_CD ||