Message ID | 20181108110653.21063-7-tudor.ambarus@microchip.com |
---|---|
State | Changes Requested |
Headers | show
Return-Path: <linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mGUOCAxq"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="0DHTYGMJ"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="LFqJqUuc"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42rL9r4vKZz9sBh for <incoming@patchwork.ozlabs.org>; Thu, 8 Nov 2018 22:08:16 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=O6ggk3kajCAi6cMbYd0qJCL9vLG2xY5svC1BlxmTQk0=; b=mGUOCAxq+Y19CZ JfeoJJTfRh2GRYTFHYucU9ADK9ZxH1bz7AxwWu4D4G29o+ZAhMWuRCymS8xTvZz1Tv72UNakt7jgS Q9UZ5SnTGUDZwPrQu+I0zh7RcHXOVao9K+Gq+hOKufrNfCQtOx6+Wk8zwinIoyNfQ7wxVjyF0AyoK przzWTn6+52tylCeR7qHm6oHWzhacordWAmiadT/n3HrwQDiv2AqjKEJkFmjtw1nE29USXZO4Thmw kMqkvU0V9iQ1dhtNpOB4P2e/v9BCjZGbPIFoO73nUEHihHE7VKiGbJTH01h+QHsev7epQl6XTbwca vbt8/0Z8uQfzoyOT931A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKiAU-00088k-8U; Thu, 08 Nov 2018 11:08:10 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKiA1-0007Yb-2C for linux-mtd@bombadil.infradead.org; Thu, 08 Nov 2018 11:07:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=MIME-Version:Content-Transfer-Encoding: Content-Type:In-Reply-To:References:Message-ID:Date:Subject:CC:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ujGeNwKnBBNth9TQEarokvBHVcrIHUBSuqugoirl30E=; b=0DHTYGMJsnyivCV2tldJuMWQUq ZzAlzF9xgoQGNrcHKeMZvXyKnApgbYX0ZytulvW6FS/2wIznGSy+5pGFh2mE9csSJT8oVucTo2hYT Dt+Yq0IlYJWjXmuXdSo1XM4U6hGA0TFOYdgM+8lT9k7wLVOgYNzuSeRmGam4FmE7E0FeYxRta+atI l8jv9+RVL/TCxXUq/GT3pr/ycsEOl4HUj423lIDHsnSDBM6XhR0PKCAEiMZOSYe7VVm/7NN/FTa96 /5AO/Qt8Nak/J0ztp7Kltf87aDXN3bG6Uq9iWp2oZTARL6xdyNDwcJKReR1g5PnJvah8myX1lxaNn ybsOE7ig==; Received: from esa4.microchip.iphmx.com ([68.232.154.123]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKi9x-0000Pn-Gz for linux-mtd@lists.infradead.org; Thu, 08 Nov 2018 11:07:39 +0000 X-IronPort-AV: E=Sophos;i="5.54,478,1534834800"; d="scan'208";a="22538410" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 08 Nov 2018 04:07:26 -0700 Received: from NAM04-CO1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.49) with Microsoft SMTP Server (TLS) id 14.3.352.0; Thu, 8 Nov 2018 04:07:25 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ujGeNwKnBBNth9TQEarokvBHVcrIHUBSuqugoirl30E=; b=LFqJqUucLxpQ28sSQxsZZvRCrtr4qplorYQ7toE6FdistWGP4g2dmYZB76YsK84WZOFHKzHni/fuRuC5d4QM5dNt+DCqoiN0XSsvrg3EoeUffSPq0Krld8vi1fzOJBrk5zkrL/jLKvfP2qbBaoZOOcyRP8yNKyaeCgUY+I1KtmU= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.99.146) by BN6PR11MB1396.namprd11.prod.outlook.com (10.173.33.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.23; Thu, 8 Nov 2018 11:07:19 +0000 Received: from BN6PR11MB1842.namprd11.prod.outlook.com ([fe80::11b7:21db:803a:7cfa]) by BN6PR11MB1842.namprd11.prod.outlook.com ([fe80::11b7:21db:803a:7cfa%5]) with mapi id 15.20.1294.034; Thu, 8 Nov 2018 11:07:18 +0000 From: <Tudor.Ambarus@microchip.com> To: <boris.brezillon@bootlin.com>, <marek.vasut@gmail.com>, <dwmw2@infradead.org>, <computersforpeace@gmail.com>, <richard@nod.at> Subject: [PATCH 6/7] mtd: spi-nor: ensure memory used for nor->read() is DMA safe Thread-Topic: [PATCH 6/7] mtd: spi-nor: ensure memory used for nor->read() is DMA safe Thread-Index: AQHUd1M2wAqiY3uSNU+NjW/xsbm74g== Date: Thu, 8 Nov 2018 11:07:18 +0000 Message-ID: <20181108110653.21063-7-tudor.ambarus@microchip.com> References: <20181108110653.21063-1-tudor.ambarus@microchip.com> In-Reply-To: <20181108110653.21063-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0401CA0009.eurprd04.prod.outlook.com (2603:10a6:800:4a::19) To BN6PR11MB1842.namprd11.prod.outlook.com (2603:10b6:404:103::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Tudor.Ambarus@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BN6PR11MB1396; 6:s7di6cv625aeH+0da3i1SAQ384UE5P3BmZWsa/PSmpyMuxxW6oGyh6tyzyi6LivaZh1S3kFeja2pCUB9CMSKgPhBwNZol5NHNl4HF++GL0ErOlh4RGbK1HGXde34MpDfVepTXJAGQLBC6Yzv5htUk7gFsONDxHhMQgJZuil6ZbbUwhma8E99bNm1hfd/3tBpgCAdvXJGPVJXIT2KTWaA1pgDcPWV4DyXZMkmyUjpuCU7wEx6hzBjcersj2vYCVWeFtMtcM3Nm5I/NGS3C3QqxmSn8jDYZ6Gbf/eCXRPllaMLgSN7QqB836dJldorbKHMqCSvlPSYDiGTQF4Ab9qp0lE3Jz/OD6L+YPEuJW6avnHJSVbEwXC+7/pNdJl93aaSvyF9P40AOqfZ1GyGNlnW43Of5gVs8UiTPgqgxH7ne/uuCl/dA5Pb1g+4A+P8+daMr3TgdwPvW6Ik6vtrngw/ww==; 5:dHgUkgmXjeZ/2lZgUOk9r0bZXNc8LjiDoWpR5VG6fRd7tq9lDpbJwrEFAOjVsIGa3L/ciyx4odR6Zbn6fLhn7ESvEvGvPndIz8E+K23QBCCESdnkSTjXCercgLzcjsdtwjaAabxnOf/jPy2tSgQbkpGcg8TlzhTEhkkzmz2GNMc=; 7:honVUWZ5ukL5LJ66iZzJgAX71XbMMhNqiynPn+sjMRpStp17lbe1ILXEUSQ9gT+XcErWcRc6UAYN+UFfg2jcUYfRs+Nq5WltXHdi6BCHRg10lbVzAQ7xetcr8y8YTnSZXG1tLPpjy8Og+LFhl4FkMQ== x-ms-office365-filtering-correlation-id: 0342f76e-9a24-4652-9a25-08d6456a5939 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:BN6PR11MB1396; x-ms-traffictypediagnostic: BN6PR11MB1396: x-microsoft-antispam-prvs: <BN6PR11MB13961CBCC57EEFB82D4F2CDEF0C50@BN6PR11MB1396.namprd11.prod.outlook.com> x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(3231382)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:BN6PR11MB1396; BCL:0; PCL:0; RULEID:; SRVR:BN6PR11MB1396; x-forefront-prvs: 0850800A29 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(346002)(39860400002)(396003)(376002)(366004)(189003)(199004)(25786009)(99286004)(2900100001)(6436002)(4326008)(2501003)(76176011)(5660300001)(8936002)(1076002)(6116002)(3846002)(478600001)(81156014)(8676002)(81166006)(97736004)(2201001)(52116002)(86362001)(39060400002)(66066001)(53936002)(71190400001)(72206003)(71200400001)(107886003)(6486002)(305945005)(14454004)(7736002)(6506007)(186003)(256004)(476003)(386003)(102836004)(105586002)(106356001)(26005)(486006)(110136005)(6512007)(68736007)(54906003)(2906002)(2616005)(316002)(36756003)(11346002)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR11MB1396; H:BN6PR11MB1842.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: MFBS/j63ZVHIL8mrZkJcHNZ32MFZagau0pMhFzNIIUAYhLXJdjdHUtX3soZc0t3nmkDqJGektmpdJLd9Z0q9I+sho8OB3p/Xy95AcmjW3zRcvEMgjul1egXPID0ZHAapzVWF71jTAqQ2mpPylTaP+6X5h4t+aDMWGZGCScOE39TgHwo6esNZ8C2jdyCXUJiqOXtt0/bLgQT67HxzeFvXGg+wnscXMaKQBHf9mY6JJ4S+ZK5ysgK40TAmLTjA71pk3xScd3LdXWYGc5e6FFL8rsdrMitXkDpbdUo/mfBbwxy49hGba4nNrS7sBOxrJget2VJ+G4xZmD5SIf/IwQWjIkFXpbKGRt6HXXwgodgknAE= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 0342f76e-9a24-4652-9a25-08d6456a5939 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Nov 2018 11:07:18.9124 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1396 X-OriginatorOrg: microchip.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181108_060737_716707_2ACDBD7D X-CRM114-Status: GOOD ( 10.94 ) X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.4.2 on merlin.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [68.232.154.123 listed in list.dnswl.org] -0.1 DKIMWL_WL_MED DKIMwl.org - Whitelisted Medium sender X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list <linux-mtd.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-mtd>, <mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-mtd/> List-Post: <mailto:linux-mtd@lists.infradead.org> List-Help: <mailto:linux-mtd-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-mtd>, <mailto:linux-mtd-request@lists.infradead.org?subject=subscribe> Cc: yogeshnarayan.gaur@nxp.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Tudor.Ambarus@microchip.com, cyrille.pitchen@wedev4u.fr Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" <linux-mtd-bounces@lists.infradead.org> Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org |
Series |
mtd: spi-nor: fixes found when debugging smpt
|
expand
|
On Thu, 8 Nov 2018 11:07:18 +0000 <Tudor.Ambarus@microchip.com> wrote: > Use GFP_DMA to ensure that the memory we allocate for transfers in > nor->read() can be DMAed. See my comment on patch 5.
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 2eaa21c85483..a13fc82bade5 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -2238,7 +2238,7 @@ static int spi_nor_read_sfdp_dma_unsafe(struct spi_nor *nor, u32 addr, void *dma_safe_buf; int ret; - dma_safe_buf = kmalloc(len, GFP_KERNEL); + dma_safe_buf = kmalloc(len, GFP_KERNEL | GFP_DMA); if (!dma_safe_buf) return -ENOMEM; @@ -3053,7 +3053,7 @@ static int spi_nor_parse_smpt(struct spi_nor *nor, /* Read the Sector Map Parameter Table. */ len = smpt_header->length * sizeof(*smpt); - smpt = kzalloc(len, GFP_KERNEL); + smpt = kzalloc(len, GFP_KERNEL | GFP_DMA); if (!smpt) return -ENOMEM; @@ -3140,7 +3140,7 @@ static int spi_nor_parse_sfdp(struct spi_nor *nor, if (header.nph) { psize = header.nph * sizeof(*param_headers); - param_headers = kmalloc(psize, GFP_KERNEL); + param_headers = kmalloc(psize, GFP_KERNEL | GFP_DMA); if (!param_headers) return -ENOMEM;
Use GFP_DMA to ensure that the memory we allocate for transfers in nor->read() can be DMAed. spi_nor_read_sfdp() calls spi_nor_read_raw(), which calls nor-read(). The latter might be implemented by the m25p80 driver which is on top of the spi-mem layer. spi-mem requires DMA-able in/out buffers, let's make sure they are. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> --- drivers/mtd/spi-nor/spi-nor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)