Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751264AbdLZSpc (ORCPT ); Tue, 26 Dec 2017 13:45:32 -0500 Received: from mail-co1nam03on0137.outbound.protection.outlook.com ([104.47.40.137]:15666 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750822AbdLZSp3 (ORCPT ); Tue, 26 Dec 2017 13:45:29 -0500 From: Trent Piepho To: "linux-mtd@lists.infradead.org" , "linux@armlinux.org.uk" , "broonie@kernel.org" , "cyrille.pitchen@wedev4u.fr" , "dwmw2@infradead.org" , "computersforpeace@gmail.com" , "boris.brezillon@free-electrons.com" , "vigneshr@ti.com" , "richard@nod.at" , "marek.vasut@gmail.com" CC: "linux-spi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "nicolas.ferre@microchip.com" , "robh@kernel.org" , "radu.pirea@microchip.com" , "devicetree@vger.kernel.org" Subject: Re: [PATCH 0/3] mtd: spi-nor: fix DMA-unsafe buffer issue between MTD and SPI Thread-Topic: [PATCH 0/3] mtd: spi-nor: fix DMA-unsafe buffer issue between MTD and SPI Thread-Index: AQHTfHXFw6hvEl9zL0SstW+hyzuciaNV+niA Date: Tue, 26 Dec 2017 18:45:28 +0000 Message-ID: <1514313927.26695.19.camel@impinj.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=tpiepho@impinj.com; x-originating-ip: [216.243.31.162] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;SN4PR0601MB3759;7:6kw5swFGiDk/afwWsbquLC0KdDF3CXxS183l4POwudDIt6EgM8GDNQGjfBGPlzPINIcGtapIV95v/WDT3YKW6bIo5ExwUem/CRpGyA+E4ZOyMyx7t9eWVNB0cJdG392KhDHZfZBWgYq7MZdY0bQLCa/kMEcFviF7Bk6sUZS4WQt81lEEUp7fUOmnnBfZjiKvvpTKfH71hy+lW/oYolhaV3O32P/+mUKVS4oUunyMM+6710BrYOEIhViEOJoBjaBs x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 2409cba0-a0d4-4a44-6d89-08d54c90d58b x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7153060);SRVR:SN4PR0601MB3759; x-ms-traffictypediagnostic: SN4PR0601MB3759: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(788757137089); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501075)(3002001)(10201501046)(93006095)(93001095)(6041268)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(6072148)(201708071742011);SRVR:SN4PR0601MB3759;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:SN4PR0601MB3759; x-forefront-prvs: 053315510E x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(396003)(346002)(366004)(39840400004)(376002)(24454002)(189003)(199004)(377424004)(2900100001)(3660700001)(4326008)(305945005)(25786009)(7736002)(103116003)(3280700002)(2906002)(14454004)(81156014)(54906003)(97736004)(229853002)(6486002)(478600001)(66066001)(6436002)(8676002)(81166006)(6512007)(68736007)(106356001)(105586002)(86362001)(8936002)(4001150100001)(110136005)(36756003)(316002)(5660300001)(59450400001)(6246003)(7416002)(5250100002)(6506007)(2950100002)(39060400002)(2501003)(76176011)(6116002)(53936002)(2201001)(99286004)(102836004)(3846002)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:SN4PR0601MB3759;H:SN4PR0601MB3759.namprd06.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; x-microsoft-antispam-message-info: lj6po3wXzwbw/Sw68wpmU/fkrC++Yxop2HLTny9p1+YHz7b8P/EC8fjDcAOh1Jcu74tnd0mEIY80FM2q1eSg/w== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-ID: <9F4DA121DFBF5C468E6931A7F02B59B9@namprd06.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: impinj.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2409cba0-a0d4-4a44-6d89-08d54c90d58b X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Dec 2017 18:45:28.3698 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 6de70f0f-7357-4529-a415-d8cbb7e93e5e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR0601MB3759 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id vBQIjbl2031060 Content-Length: 1535 Lines: 31 On Sun, 2017-12-24 at 05:36 +0100, Cyrille Pitchen wrote: > this series tries to solve a long time issue of compatibility between the > MTD and SPI sub-systems about whether we should use DMA-safe memory. Can this should replace SoC specific fixes like: c687c46e9e45 spi: spi-ti-qspi: Use bounce buffer if read buffer is not DMA'ble 7094576ccdc3 spi: atmel: fix corrupted data issue on SAM9 family SoCs Or, since this only fixes instances of DMA-unsafe buffers used in access to SPI NOR flash chips, and since there are other SPI master interface users, those chip specific fixes in some/all spi master drivers are still needed to fix transfers not originated via spi-nor? Or are all the previous fixes necessary because of spi-nor flash (via ubifs or jffs2) and once that's fixed via this series there are no more originators of dma-unsafe buffers? > The SPI sub-system has already implemented a work-around on its side, > based on the spi_map_buf() function. However this function has its own > limitation too. Especially, even if it builds a 'struct scatterlist' from > a vmalloc'ed buffer, calling dma_map_sg() is still not safe on all > architectures. Especially, on ARM cores using either VIPT or VIVT data > caches, dma_map_sg() doesn't take the cache aliases issue into account. > Then numerous crashes were reported for such architectures. Could the above issue also be fixed via calls to flush_kernel_vmap_range() and invalidate_kernel_vmap_range() to keep the data cache valid? Or is there a reason that won't work?