From patchwork Tue Nov 6 03:40:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Gong X-Patchwork-Id: 10669541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 06F5814E2 for ; Tue, 6 Nov 2018 03:40:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAE132A140 for ; Tue, 6 Nov 2018 03:40:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE4F62A15E; Tue, 6 Nov 2018 03:40:29 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 5631A2A140 for ; Tue, 6 Nov 2018 03:40:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729571AbeKFNDe (ORCPT ); Tue, 6 Nov 2018 08:03:34 -0500 Received: from mail-eopbgr00071.outbound.protection.outlook.com ([40.107.0.71]:37448 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727049AbeKFNDe (ORCPT ); Tue, 6 Nov 2018 08:03:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GlZOYfTiRjfQIe9RRyfEyLue9Rb+3lWuscyF3A57a3Y=; b=Gv6QtO5E8iL+fDIzZRFRSOthI5LmAeH0topYtPWY7eRgrXvWj0i8REVpKqA7eYVcLQE6EFluhlN/MhdDv8OTfshsVq0fpJUzExz7TNtokIwz5inyGL8P2TtyN9G7hpgwgnqh6F9pxT8CoZpnDEwKj4lHdXJoN4MhYYJkyS29ElM= Received: from DB7PR04MB4538.eurprd04.prod.outlook.com (52.135.138.28) by DB7PR04MB5068.eurprd04.prod.outlook.com (20.176.235.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.20; Tue, 6 Nov 2018 03:40:25 +0000 Received: from DB7PR04MB4538.eurprd04.prod.outlook.com ([fe80::1d00:effc:853f:267]) by DB7PR04MB4538.eurprd04.prod.outlook.com ([fe80::1d00:effc:853f:267%3]) with mapi id 15.20.1294.032; Tue, 6 Nov 2018 03:40:25 +0000 From: Robin Gong To: "vkoul@kernel.org" , "l.stach@pengutronix.de" CC: "dmaengine@vger.kernel.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx Subject: [PATCH v3 1/4] Revert "dmaengine: imx-sdma: Use GFP_NOWAIT for dma allocations" Thread-Topic: [PATCH v3 1/4] Revert "dmaengine: imx-sdma: Use GFP_NOWAIT for dma allocations" Thread-Index: AQHUdYJzJ1kUZnKPWkeZZUj9fayqWg== Date: Tue, 6 Nov 2018 03:40:25 +0000 Message-ID: <1541504525-25720-2-git-send-email-yibin.gong@nxp.com> References: <1541504525-25720-1-git-send-email-yibin.gong@nxp.com> In-Reply-To: <1541504525-25720-1-git-send-email-yibin.gong@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK0PR04CA0004.apcprd04.prod.outlook.com (2603:1096:203:36::16) To DB7PR04MB4538.eurprd04.prod.outlook.com (2603:10a6:5:35::28) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yibin.gong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB7PR04MB5068;6:waVr69dmqMYWZYChkvEA1TNftLPywcaktH/SG3YI4tHkkUbu9hRwrjN8toB+I/mYU80b5M4ZHhhQF/SQyM22FEWj/tYbr2zUDN9juNvLP+H45Rpc95eo0FqLSXTHY33lY1j6Ju/e90KN2taIdxbnTZG9hVCYE77UCiQ2TP7pcFisLuAhpY7Tb6MurxJHv0rUbI0thdWbWzsh0i7/39w4STSXqb2slLaKitlATxzrvUjGe8rxLt2HuzelwcKIb3fffeU3mLSl7GtC182kW2mUvzCEuavBjrRIC6r72OoK9uWNVxFC+1WmzmsR7RWMIFm8yk8Otp/bF8PPjmJp8QyH26TE7VPoxu/Tbl56v+zv+gBZ+doPRBRA80rLleNBCziW4CFH+UMj33POawghxhPn1wG+6bX53f96LOrN8SifVjyhG0UOfoXh/5wxPn7Euorq1jDIWqgujMJ3TbkWqPO/Hw==;5:xAgQMpfMfpnNu8QTPv/JOc5aYIIRSADTYgNOgXuJupWJshaAmRPPl4FnrSrDRQM95cXpFoKQiyveOMkiRNwJWDt512mQYtiheFgmk0l4SRuUCAu2YPRU8aU79JMm0M9XqouuyvPGwNuRMl+ytNTgTCfDh3sOeIfauitU+WheXHA=;7:l2SywgWodq2TPDVU2cM67F7ORd475vleavd5grC0QRUy46AVBzhKsfdlNLGP2VkXmmtTOz2ixVOL8gmhFONXYI12D9x/1kc2Tls8gkdlfD5i/RMnvz3JbMS6mWmGO5gAVV1acq2b2VS27jwnNHVgXQ== x-ms-office365-filtering-correlation-id: d9b1abf5-6c1a-4fcc-3f16-08d64399960c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:DB7PR04MB5068; x-ms-traffictypediagnostic: DB7PR04MB5068: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231382)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:DB7PR04MB5068;BCL:0;PCL:0;RULEID:;SRVR:DB7PR04MB5068; x-forefront-prvs: 0848C1A6AA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(346002)(396003)(376002)(366004)(39860400002)(189003)(199004)(52116002)(7736002)(36756003)(305945005)(256004)(8676002)(6486002)(386003)(68736007)(6116002)(102836004)(97736004)(5660300001)(6512007)(66066001)(2501003)(478600001)(3846002)(2900100001)(6436002)(53936002)(2906002)(6506007)(316002)(26005)(14454004)(8936002)(71190400001)(71200400001)(186003)(50226002)(86362001)(99286004)(486006)(25786009)(4326008)(76176011)(476003)(105586002)(54906003)(110136005)(81156014)(2616005)(106356001)(81166006)(446003)(11346002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR04MB5068;H:DB7PR04MB4538.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: oynwJmHo2C+SdDv1PTRaPJMiL6JkZa9OcslafyHi5z4q920/aH9Mh08jwZxO9aL+YLLESCbg/ixkhLqt4bBl0QOIJG160tOfixJriMqLSs28P7cu4FcPeMfkYmn4OiDR0Be9ZIwNdcAbM8KN26mEH4NnKPf7uH9NKnqjG1rem+mXhbo53Cg8ExSaL34SB3pL/4WuSFZIAeT0Sl978o4LMT5TM1DGeP6iSFV94kIpsUvDw3ELqeICK7Kuj1Qaqvqd5Eabgz2KMudTWdi+K2EzkSdDkegb8OAYsV0zb8/03NLQUjmyfhzvMzW8GgCMllT0bx7z3WFbQZzD4TqvFPkgCRTeETtK9zYysSSZTAazxMY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9b1abf5-6c1a-4fcc-3f16-08d64399960c X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2018 03:40:25.0629 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB5068 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lucas Stach This reverts commit c1199875d327, as this depends on another commit that is going to be reverted. Signed-off-by: Lucas Stach Signed-off-by: Robin Gong --- drivers/dma/imx-sdma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index b4ec2d2..3bca5e0 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -1194,8 +1194,8 @@ static int sdma_alloc_bd(struct sdma_desc *desc) { int ret = 0; - desc->bd = dma_pool_alloc(desc->sdmac->bd_pool, GFP_NOWAIT, - &desc->bd_phys); + desc->bd = dma_pool_alloc(desc->sdmac->bd_pool, GFP_ATOMIC, + &desc->bd_phys); if (!desc->bd) { ret = -ENOMEM; goto out; From patchwork Tue Nov 6 03:40:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Gong X-Patchwork-Id: 10669547 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A355F14E2 for ; Tue, 6 Nov 2018 03:41:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9339E2A183 for ; Tue, 6 Nov 2018 03:41:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 875482A189; Tue, 6 Nov 2018 03:41:20 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 1A3752A183 for ; Tue, 6 Nov 2018 03:41:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387450AbeKFNET (ORCPT ); Tue, 6 Nov 2018 08:04:19 -0500 Received: from mail-eopbgr00069.outbound.protection.outlook.com ([40.107.0.69]:62644 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387424AbeKFNER (ORCPT ); Tue, 6 Nov 2018 08:04:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l9MxGiFI+LqEa8FAvV4u+HcapLd0LIgTYCjt86e9SaI=; b=K9myo+nvhkt6EGZG6XD6rLzbFIqoZHNLGVrYSRSYyypUiCPpEHRmfAIm7b7S+yvfB5yjngjH4pwtlNbYJfWyPJUbdSDZsoJ0MaIA9xj2RoIWq6CwNz0+OiJzzMe05QIgjpNbFhHMkd86LuMeHWM3ZiotjEGs/KmC+sH5tDv3k3Y= Received: from DB7PR04MB4538.eurprd04.prod.outlook.com (52.135.138.28) by DB7PR04MB5226.eurprd04.prod.outlook.com (20.176.236.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.21; Tue, 6 Nov 2018 03:40:28 +0000 Received: from DB7PR04MB4538.eurprd04.prod.outlook.com ([fe80::1d00:effc:853f:267]) by DB7PR04MB4538.eurprd04.prod.outlook.com ([fe80::1d00:effc:853f:267%3]) with mapi id 15.20.1294.032; Tue, 6 Nov 2018 03:40:28 +0000 From: Robin Gong To: "vkoul@kernel.org" , "l.stach@pengutronix.de" CC: "dmaengine@vger.kernel.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx Subject: [PATCH v3 2/4] Revert "dmaengine: imx-sdma: alloclate bd memory from dma pool" Thread-Topic: [PATCH v3 2/4] Revert "dmaengine: imx-sdma: alloclate bd memory from dma pool" Thread-Index: AQHUdYJ2bDLbdd0rSkGoiw5ixWtFhQ== Date: Tue, 6 Nov 2018 03:40:28 +0000 Message-ID: <1541504525-25720-3-git-send-email-yibin.gong@nxp.com> References: <1541504525-25720-1-git-send-email-yibin.gong@nxp.com> In-Reply-To: <1541504525-25720-1-git-send-email-yibin.gong@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK0PR04CA0004.apcprd04.prod.outlook.com (2603:1096:203:36::16) To DB7PR04MB4538.eurprd04.prod.outlook.com (2603:10a6:5:35::28) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yibin.gong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB7PR04MB5226;6:Ktt/6CQLuFlZzOOIitwpE0uQrHx5QbTqFDJKZKYq0U4Ag6FH9HecNIjfwHmhVlQC3HzceGIVdhFarLoTaWSUuYzdSABJpYvBU6+2vYgj2Nf7WntFr+WNnelUMBm3ekIMHh72OA0V5vuDA8SK51RtcFow7OZalS1dtp1NfqeEa1quflXybVPEYEIwQrYP9HVJygvfF5glJc5XHk6Be5Nj57AL/tpjQRB9MK8gegVC81JzFpr12vwrIFxKjWbIRgh+LxTAIRTCcbCMJy8Gz/5LN3cQTg3UAekc1anAeBMyz6shDtGnZS7cBtR/BrYy6i78ReTsU+R2FpZKv39YFV0Gz6qZFffmoHxkJH3C/M8TODABAO4gP+eUF3LE7DI8FF4DM6J8RknJurRKtjJY7zeYDT589QiCknVueZAanTHftApkUQh4+0u3lRvdOChmV4jPOv9nrSMaKClLIaWOebRZjA==;5:qGWA3iYGHgpkOoOJVmrz+J2Mb7TXlevIIfnfoRJbXbZMaG7AaMuXYiYeFp3W+Xh7kK/eoqgvrg1B6ErqDLz5qr4Pa5I1R7x69jH6Z9rODBVw+kAr8JqjmWAjn2pv//HwNVRHN9IQtlFp/grnh47F7GvGWgPfqHIOP2MJYEwi+gc=;7:NHZk6Z/SnYQ+q842B0rRazdvoyhbx7KnvpOAONmxkYchD1HyqGqaxEVn93XkM0JOSgiWlu5V+N+r2W3y5O3Npj7MYRN8sCVbqpE1L8IQSSvr25kGKmM9SnCQ9FJdIOeM6K1NznKH3gTgJHCWJ5tFsA== x-ms-office365-filtering-correlation-id: 25666b70-c02f-49d8-e3ec-08d64399986c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:DB7PR04MB5226; x-ms-traffictypediagnostic: DB7PR04MB5226: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231382)(944501410)(52105095)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(201708071742011)(7699051)(76991095);SRVR:DB7PR04MB5226;BCL:0;PCL:0;RULEID:;SRVR:DB7PR04MB5226; x-forefront-prvs: 0848C1A6AA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(376002)(366004)(346002)(136003)(396003)(189003)(199004)(81166006)(54906003)(316002)(186003)(446003)(25786009)(478600001)(2501003)(71200400001)(6116002)(3846002)(2906002)(71190400001)(110136005)(99286004)(7736002)(11346002)(305945005)(6486002)(4326008)(476003)(86362001)(50226002)(6506007)(14444005)(486006)(6512007)(106356001)(36756003)(386003)(5660300001)(26005)(105586002)(256004)(2616005)(66066001)(102836004)(8936002)(68736007)(76176011)(53936002)(52116002)(6436002)(14454004)(8676002)(97736004)(81156014)(2900100001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR04MB5226;H:DB7PR04MB4538.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: g99c0H1PvC5vQDFo/DMHJvcOic8hYQGNpZHoW/FqMkgJ5G5dRN6vGA8i5GAlLUMvN+D4YVB9FL1aXaNl250h9YnstGueRrpP37sU8s00mndZAeSnzOvze9yrKIHuRT3h0el0L4YIdjzA5nzMH7RWUc4wvcvXps32zm0QKq+VuPUQ8WHeo8d7YpNj+FxFdRCaR3ZRUyaIgiCqluUd07smuL9+2zCxH1grBUg/VcBxIHBBfBuJt0eYW0vG1V0edbZjN4R2d5haRKoeHoqJAunG2twv3gAxBshguTqkH4ZtSOt33eTyo8iWl+en7k6a88ZTMVYNFYLL5u6FSEjQ415/utHrqREm2cOGaS9MTQ+v5Ss= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25666b70-c02f-49d8-e3ec-08d64399986c X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2018 03:40:28.7975 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB5226 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lucas Stach This reverts commit fe5b85c656bc. The SDMA engine needs the descriptors to be contiguous in memory. As the dma pool API is only able to provide a single descriptor per alloc invocation there is no guarantee that multiple descriptors satisfy this requirement. Also the code in question is broken as it only allocates memory for a single descriptor, without looking at the number of descriptors required for the transfer, leading to out-of-bounds accesses when the descriptors are written. Signed-off-by: Lucas Stach Signed-off-by: Robin Gong --- drivers/dma/imx-sdma.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 3bca5e0..8d2fec8 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -376,7 +375,6 @@ struct sdma_channel { u32 shp_addr, per_addr; enum dma_status status; struct imx_dma_data data; - struct dma_pool *bd_pool; }; #define IMX_DMA_SG_LOOP BIT(0) @@ -1192,10 +1190,11 @@ static int sdma_request_channel0(struct sdma_engine *sdma) static int sdma_alloc_bd(struct sdma_desc *desc) { + u32 bd_size = desc->num_bd * sizeof(struct sdma_buffer_descriptor); int ret = 0; - desc->bd = dma_pool_alloc(desc->sdmac->bd_pool, GFP_ATOMIC, - &desc->bd_phys); + desc->bd = dma_zalloc_coherent(NULL, bd_size, &desc->bd_phys, + GFP_ATOMIC); if (!desc->bd) { ret = -ENOMEM; goto out; @@ -1206,7 +1205,9 @@ static int sdma_alloc_bd(struct sdma_desc *desc) static void sdma_free_bd(struct sdma_desc *desc) { - dma_pool_free(desc->sdmac->bd_pool, desc->bd, desc->bd_phys); + u32 bd_size = desc->num_bd * sizeof(struct sdma_buffer_descriptor); + + dma_free_coherent(NULL, bd_size, desc->bd, desc->bd_phys); } static void sdma_desc_free(struct virt_dma_desc *vd) @@ -1272,10 +1273,6 @@ static int sdma_alloc_chan_resources(struct dma_chan *chan) if (ret) goto disable_clk_ahb; - sdmac->bd_pool = dma_pool_create("bd_pool", chan->device->dev, - sizeof(struct sdma_buffer_descriptor), - 32, 0); - return 0; disable_clk_ahb: @@ -1304,9 +1301,6 @@ static void sdma_free_chan_resources(struct dma_chan *chan) clk_disable(sdma->clk_ipg); clk_disable(sdma->clk_ahb); - - dma_pool_destroy(sdmac->bd_pool); - sdmac->bd_pool = NULL; } static struct sdma_desc *sdma_transfer_init(struct sdma_channel *sdmac, From patchwork Tue Nov 6 03:40:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Gong X-Patchwork-Id: 10669543 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5647E1751 for ; Tue, 6 Nov 2018 03:41:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43DF72A175 for ; Tue, 6 Nov 2018 03:41:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 379662A183; Tue, 6 Nov 2018 03:41:12 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 9D3D22A175 for ; Tue, 6 Nov 2018 03:41:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387439AbeKFNEQ (ORCPT ); Tue, 6 Nov 2018 08:04:16 -0500 Received: from mail-eopbgr80045.outbound.protection.outlook.com ([40.107.8.45]:37270 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387438AbeKFNEQ (ORCPT ); Tue, 6 Nov 2018 08:04:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+NnwEC0rxVN6NnxOgkYzXxmy+/x5b/Wq0UbA2wKvzEI=; b=EzzYqqNWzcmq8QCcant0OyN9YbzKiKU3q9zxKK5e7Le2PklPiuXOlcSKrAYCnmjihiW9TqassnTDrZr9u59Kp9kN2nRqo4f6MtOgDSU9ErJNxJCJ0jdBrI8n1yXzLrn6yibsinMtUXxIH3UeoDJjyxef7MMuDMYckwFuGw0vDuc= Received: from DB7PR04MB4538.eurprd04.prod.outlook.com (52.135.138.28) by DB7PR04MB5226.eurprd04.prod.outlook.com (20.176.236.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.21; Tue, 6 Nov 2018 03:40:34 +0000 Received: from DB7PR04MB4538.eurprd04.prod.outlook.com ([fe80::1d00:effc:853f:267]) by DB7PR04MB4538.eurprd04.prod.outlook.com ([fe80::1d00:effc:853f:267%3]) with mapi id 15.20.1294.032; Tue, 6 Nov 2018 03:40:34 +0000 From: Robin Gong To: "vkoul@kernel.org" , "l.stach@pengutronix.de" CC: "dmaengine@vger.kernel.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx Subject: [PATCH v3 3/4] dmaengine: imx-sdma: implement channel termination via worker Thread-Topic: [PATCH v3 3/4] dmaengine: imx-sdma: implement channel termination via worker Thread-Index: AQHUdYJ5+b+p8TNZeUq758Hi+4T5ow== Date: Tue, 6 Nov 2018 03:40:33 +0000 Message-ID: <1541504525-25720-4-git-send-email-yibin.gong@nxp.com> References: <1541504525-25720-1-git-send-email-yibin.gong@nxp.com> In-Reply-To: <1541504525-25720-1-git-send-email-yibin.gong@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK0PR04CA0004.apcprd04.prod.outlook.com (2603:1096:203:36::16) To DB7PR04MB4538.eurprd04.prod.outlook.com (2603:10a6:5:35::28) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yibin.gong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB7PR04MB5226;6:qhVWPrpFccFaMfNTldXHLpBOZLlUPXzWxXZw9iBE/b+VRQvzJvGbVP2elLArWpSO1NkiS+q71NxowgS0wYUkExXPLAECkZI5ji83uAiRc4aLBC43z6LRCMx81glC9PiKEOfl5U5XIb74jOqLTGPVYJHhPuO1fdYsHelYkHyWqybM7F2nKCg2a68HmnGSgQJE4WKxJ+paPB7P4hELcsDIYgjuQferwLDLR6AbkmC2FInoGhSdaVm0PZHPDkEFC9YkKLiJtuh8t2lKXOxqrmvbQZwCAOutXXODLo9YXWAvkQex2SGNUYCB4YXXdiMG//U3gTqC4yppwDy33B510OWG1JkqU4Z685kQl2m6FlILaer6lf8Lhnt4SKA9iy37Ae8LhGSrCLay/NKeYYkZMVp5vQ9QzU8Atr7GjyGbf7GpEfEVj4MrihdpKXt7uJshOmoLmkBy0aWx18hWW3mSKHkWXw==;5:xmiUT+Qy10BlhbiHHm3NruZN5viG35S9Tjn0ttH6Hz7WQiMvSWYuQSz+Xe2dg/jUcszrbo17x3XXbTME9u/DrjlDFu7M7xE9jBS0qQFeVr5HR1Q7M9zIAdxtrb68H4JkMIYLSXM4hoXRcea85fMEDoB3El2VsLUghGPc8SKchq0=;7:TDShqoGq6lPCAyCALioFOAI6UTdFgXGKOWTamFlRKszXt5vlrQkbM/qFeE1K9yaMwkOG+2SLeLGgVZt8O5qLA0jB2CcDw/XF9YpWawIKHRNqC3k5IkshEwCDU+4/r14Mz0p8jgrklackzi5VW/j5cQ== x-ms-office365-filtering-correlation-id: 6f8199df-37ec-4dd8-4ff4-08d643999a99 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:DB7PR04MB5226; x-ms-traffictypediagnostic: DB7PR04MB5226: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231382)(944501410)(52105095)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(201708071742011)(7699051)(76991095);SRVR:DB7PR04MB5226;BCL:0;PCL:0;RULEID:;SRVR:DB7PR04MB5226; x-forefront-prvs: 0848C1A6AA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(376002)(366004)(346002)(136003)(396003)(189003)(199004)(81166006)(54906003)(316002)(186003)(446003)(25786009)(478600001)(2501003)(71200400001)(6116002)(3846002)(2906002)(71190400001)(110136005)(99286004)(7736002)(11346002)(305945005)(6486002)(4326008)(476003)(86362001)(50226002)(6506007)(14444005)(486006)(6512007)(106356001)(36756003)(386003)(5660300001)(26005)(105586002)(256004)(2616005)(66066001)(102836004)(8936002)(68736007)(76176011)(53936002)(52116002)(6436002)(14454004)(8676002)(97736004)(81156014)(2900100001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR04MB5226;H:DB7PR04MB4538.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: KwdepO45fm6vmCZm2mEu8sp2AIMlGH6Tie7G08PsX4gN2lfMzhqfK/jkhpLvd+XmbC9+f1HA7YjItRQp6dyV23ailkquZbSZy3erbAFJyC9wmyj8Yh9euJz3YVcPk+JbkTxMc6dwOC//nST32aEJkyzHzNaGIud+LnbsWEAj4tBZOQhiFXzL9riS9djF9UCYdHKwf4yBT/iH4cvf32W+jnD/fzS5N4hC61FhWIPSXYL/6oKYFo/JzaCfr2CYyRhxX4lMaLlfWH6WTRiUUuYJPv0ydJ4XET6nxmjvn6jie4kotQo0D+eta050wHB+tHvn49TAXxqPMecTtTtHxXH88ZdVx7EjPUp8tyqpWQjxktg= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f8199df-37ec-4dd8-4ff4-08d643999a99 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2018 03:40:33.9822 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB5226 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lucas Stach The dmaengine documentation states that device_terminate_all may be asynchronous and need not wait for the active transfers to stop. This allows us to move most of the functionality currently implemented in the sdma channel termination function to run in a worker, outside of any atomic context. Moving this out of atomic context has two benefits: we can now sleep while waiting for the channel to terminate, instead of busy waiting and the freeing of the dma descriptors happens with IRQs enabled, getting rid of a warning in the dma mapping code. As the termination is now async, we need to implement the device_synchronize dma engine function which simply waits for the worker to finish its execution. Signed-off-by: Lucas Stach Signed-off-by: Robin Gong --- drivers/dma/imx-sdma.c | 51 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 8d2fec8..03d46f1 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -375,6 +376,7 @@ struct sdma_channel { u32 shp_addr, per_addr; enum dma_status status; struct imx_dma_data data; + struct work_struct terminate_worker; }; #define IMX_DMA_SG_LOOP BIT(0) @@ -1025,31 +1027,49 @@ static int sdma_disable_channel(struct dma_chan *chan) return 0; } - -static int sdma_disable_channel_with_delay(struct dma_chan *chan) +static void sdma_channel_terminate_work(struct work_struct *work) { - struct sdma_channel *sdmac = to_sdma_chan(chan); + struct sdma_channel *sdmac = container_of(work, struct sdma_channel, + terminate_worker); unsigned long flags; LIST_HEAD(head); - sdma_disable_channel(chan); - spin_lock_irqsave(&sdmac->vc.lock, flags); - vchan_get_all_descriptors(&sdmac->vc, &head); - sdmac->desc = NULL; - spin_unlock_irqrestore(&sdmac->vc.lock, flags); - vchan_dma_desc_free_list(&sdmac->vc, &head); - /* * According to NXP R&D team a delay of one BD SDMA cost time * (maximum is 1ms) should be added after disable of the channel * bit, to ensure SDMA core has really been stopped after SDMA * clients call .device_terminate_all. */ - mdelay(1); + usleep_range(1000, 2000); + + spin_lock_irqsave(&sdmac->vc.lock, flags); + vchan_get_all_descriptors(&sdmac->vc, &head); + sdmac->desc = NULL; + spin_unlock_irqrestore(&sdmac->vc.lock, flags); + vchan_dma_desc_free_list(&sdmac->vc, &head); +} + +static int sdma_disable_channel_async(struct dma_chan *chan) +{ + struct sdma_channel *sdmac = to_sdma_chan(chan); + + sdma_disable_channel(chan); + + if (sdmac->desc) + schedule_work(&sdmac->terminate_worker); return 0; } +static void sdma_channel_synchronize(struct dma_chan *chan) +{ + struct sdma_channel *sdmac = to_sdma_chan(chan); + + vchan_synchronize(&sdmac->vc); + + flush_work(&sdmac->terminate_worker); +} + static void sdma_set_watermarklevel_for_p2p(struct sdma_channel *sdmac) { struct sdma_engine *sdma = sdmac->sdma; @@ -1287,7 +1307,9 @@ static void sdma_free_chan_resources(struct dma_chan *chan) struct sdma_channel *sdmac = to_sdma_chan(chan); struct sdma_engine *sdma = sdmac->sdma; - sdma_disable_channel_with_delay(chan); + sdma_disable_channel_async(chan); + + sdma_channel_synchronize(chan); if (sdmac->event_id0) sdma_event_disable(sdmac, sdmac->event_id0); @@ -1993,6 +2015,8 @@ static int sdma_probe(struct platform_device *pdev) sdmac->channel = i; sdmac->vc.desc_free = sdma_desc_free; + INIT_WORK(&sdmac->terminate_worker, + sdma_channel_terminate_work); /* * Add the channel to the DMAC list. Do not add channel 0 though * because we need it internally in the SDMA driver. This also means @@ -2044,7 +2068,8 @@ static int sdma_probe(struct platform_device *pdev) sdma->dma_device.device_prep_slave_sg = sdma_prep_slave_sg; sdma->dma_device.device_prep_dma_cyclic = sdma_prep_dma_cyclic; sdma->dma_device.device_config = sdma_config; - sdma->dma_device.device_terminate_all = sdma_disable_channel_with_delay; + sdma->dma_device.device_terminate_all = sdma_disable_channel_async; + sdma->dma_device.device_synchronize = sdma_channel_synchronize; sdma->dma_device.src_addr_widths = SDMA_DMA_BUSWIDTHS; sdma->dma_device.dst_addr_widths = SDMA_DMA_BUSWIDTHS; sdma->dma_device.directions = SDMA_DMA_DIRECTIONS; From patchwork Tue Nov 6 03:40:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Gong X-Patchwork-Id: 10669545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9493214E2 for ; Tue, 6 Nov 2018 03:41:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 854CE2A183 for ; Tue, 6 Nov 2018 03:41:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78B112A189; Tue, 6 Nov 2018 03:41:14 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 211082A183 for ; Tue, 6 Nov 2018 03:41:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387438AbeKFNES (ORCPT ); Tue, 6 Nov 2018 08:04:18 -0500 Received: from mail-eopbgr80045.outbound.protection.outlook.com ([40.107.8.45]:37270 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387450AbeKFNES (ORCPT ); Tue, 6 Nov 2018 08:04:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=d9rTtDYbiL7B8vl8dIg1hMsywgfV6CT5SUFuHUvESOc=; b=eA4BBthvT+UBsx/SDKUo0eAnH5YMTwpuQKysR/NanuBlrpNpaYM6fyRl67BSd1OhAcGW7X2hw4L2Fsw9IMFcOAkB+JkM533JM2qsjsf8JEjKz2cScbg09TaLJEtXQSRvWPBjnzm7yhMdvUUpieRTN737jwh2Dswqpj5HdoiJHSs= Received: from DB7PR04MB4538.eurprd04.prod.outlook.com (52.135.138.28) by DB7PR04MB5226.eurprd04.prod.outlook.com (20.176.236.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.21; Tue, 6 Nov 2018 03:40:37 +0000 Received: from DB7PR04MB4538.eurprd04.prod.outlook.com ([fe80::1d00:effc:853f:267]) by DB7PR04MB4538.eurprd04.prod.outlook.com ([fe80::1d00:effc:853f:267%3]) with mapi id 15.20.1294.032; Tue, 6 Nov 2018 03:40:37 +0000 From: Robin Gong To: "vkoul@kernel.org" , "l.stach@pengutronix.de" CC: "dmaengine@vger.kernel.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx Subject: [PATCH v3 4/4] dmaengine: imx-sdma: use GFP_NOWAIT for dma descriptor allocations Thread-Topic: [PATCH v3 4/4] dmaengine: imx-sdma: use GFP_NOWAIT for dma descriptor allocations Thread-Index: AQHUdYJ7NPRe1R2FAUCQpmyE6px9sw== Date: Tue, 6 Nov 2018 03:40:37 +0000 Message-ID: <1541504525-25720-5-git-send-email-yibin.gong@nxp.com> References: <1541504525-25720-1-git-send-email-yibin.gong@nxp.com> In-Reply-To: <1541504525-25720-1-git-send-email-yibin.gong@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK0PR04CA0004.apcprd04.prod.outlook.com (2603:1096:203:36::16) To DB7PR04MB4538.eurprd04.prod.outlook.com (2603:10a6:5:35::28) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yibin.gong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB7PR04MB5226;6:/5YnU1lUWk1P85ykz/nviQ04XfhwFbBEra8DPRRjAZHE8FqFjJA3TwsNHomeMQi2RzrIg0YkqKXfQNCZurYZtkGMT5aUN+zA2HuhDTCBo2npC4WINkVRuCJwDBMjzFBR9QWaKtG5jX+JX62jwzpln1TOCrNcNe8prRMyf5zPHPIQSSeyYhpgxMqp2BHi3/bbV7ZME9rBRcUXEvHp6ZcutYiJwUMXLZBC8RUVsXRTQW94ueYPE2ox1XtB/VoOVgaJp8zAPIVGTBCEpEPbEVd2bHUUw9u66h2poPJd5n5LbZf6oJjI9wdAqWrfuyoIQxkQSnrDr/Lpcsy1qAdyIA/vwBH6QTfMtIOFrpn1Eaq/zyPPZn5ESxRODQsIaC1r7kIIopw6HO/n4upHtAj0q14sm+N9QD3FKGqE94ntRj4tay0Boyw+PT4W341FrURfC/Rf4bCEEHD9CGaX/Iy/MaWQ5Q==;5:wLDq9E9YvFfK/mPj/qy72q/w0I2R20+iMRtsKc1EdWNrYWo5NHI64SQowBKfSMeM3o5bJKdyLstLquaPaxusDEE3acPN0w1SOCCeJK3dLce2/t0R1ys12MRngcZj6S5S0emH0G9XE11oTWRzEeI1TcEMn1xot8RoaYy7uC8ahpw=;7:oshJKcqhsX7tjSvzodD4W551D7EPzziIdiotHl2XGD6/zFfanYVCnDFv2IJHAm1EO97a1xvQFn1inqFUp5Zl04t9euw0brDPgcFzpMO6w0CAg5W2xKtCi8CM0W2MBXUOOyU0IA60weRsbjc8VC5TyA== x-ms-office365-filtering-correlation-id: a025e653-68c8-4bec-f4fe-08d643999d92 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:DB7PR04MB5226; x-ms-traffictypediagnostic: DB7PR04MB5226: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231382)(944501410)(52105095)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(201708071742011)(7699051)(76991095);SRVR:DB7PR04MB5226;BCL:0;PCL:0;RULEID:;SRVR:DB7PR04MB5226; x-forefront-prvs: 0848C1A6AA x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(376002)(366004)(346002)(136003)(396003)(189003)(199004)(81166006)(54906003)(316002)(186003)(446003)(25786009)(478600001)(2501003)(71200400001)(6116002)(3846002)(2906002)(71190400001)(110136005)(99286004)(7736002)(11346002)(305945005)(6486002)(4326008)(476003)(86362001)(50226002)(6506007)(14444005)(486006)(6512007)(106356001)(36756003)(386003)(5660300001)(26005)(105586002)(256004)(2616005)(66066001)(102836004)(8936002)(68736007)(76176011)(53936002)(52116002)(6436002)(14454004)(8676002)(97736004)(81156014)(2900100001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR04MB5226;H:DB7PR04MB4538.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: jlUL/6X95PDp8fzB35DF/KAZchkMa7JLkeqgSDCSRc0dLuTasjL5WQwE+GXWGIAcMGjBMV8+7pP51cRuTA2rGkcn5of7lzm/S+HzK2TaLnI8R+Np9awnbWmpDRt4fK8pTXNkHxazOqKD7xcCBYllf0cq8F4IJgFAFF5n4nB0570lussEPWm3m4N0OOCXb4Zbma+E2aBfWe2p1j8jG0n6AsIEcU8lb+Ab/mUQ/+jv7kfjsvSIKyG1MbTPI7/D5woOwwz2EuUylYzq75Ak/QZvqf8fv/dQY+bAj1Xjq4ZtwRbM1Iri6fhyIVbLIEnA9oTRwppF3lpFvZdXtgOh1nQz2E6jHMpL6hzuVzTD4yQwsso= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a025e653-68c8-4bec-f4fe-08d643999d92 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2018 03:40:37.6698 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB5226 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lucas Stach DMA buffer descriptors aren't allocated from atomic context, so they can use the less heavyweigth GFP_NOWAIT. Signed-off-by: Lucas Stach Signed-off-by: Robin Gong --- drivers/dma/imx-sdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 03d46f1..cb1b44d 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -1214,7 +1214,7 @@ static int sdma_alloc_bd(struct sdma_desc *desc) int ret = 0; desc->bd = dma_zalloc_coherent(NULL, bd_size, &desc->bd_phys, - GFP_ATOMIC); + GFP_NOWAIT); if (!desc->bd) { ret = -ENOMEM; goto out;