From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pa0-x230.google.com ([2607:f8b0:400e:c03::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aN63y-0007fZ-NR for linux-mtd@lists.infradead.org; Sat, 23 Jan 2016 21:49:43 +0000 Received: by mail-pa0-x230.google.com with SMTP id uo6so61181687pac.1 for ; Sat, 23 Jan 2016 13:49:22 -0800 (PST) Date: Sat, 23 Jan 2016 13:49:18 -0800 From: Brian Norris To: =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= Cc: "Maciej W. Rozycki" , Ralf Baechle , Javier Martinez Canillas , Linux Kernel Mailing List , Fengguang Wu , Michael Ellerman , Luis de Bethencourt , Jeremy Kerr , Neelesh Gupta , "linux-mtd@lists.infradead.org" , David Woodhouse , Cyril Bur Subject: Re: [PATCH] mtd: bcm47xxsflash: use devm_ioremap_nocache() instead of KSEG0ADDR() Message-ID: <20160123214918.GC24744@localhost> References: <1444813494-14985-1-git-send-email-javier@osg.samsung.com> <20151104185341.GN7274@google.com> <20160107230513.GL109450@google.com> <20160108185120.GQ109450@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Sat, Jan 16, 2016 at 01:38:11AM +0100, Rafał Miłecki wrote: > So I wanted to stick to the cached mapping, [...] I mentioned this earlier on, but I don't feel like I've gotten a clear answer. Is a cached mapping actually safe here? From the looks of it, the memory mapping is a read-only memory-mapped flash, and flash writes / erasures are done through a different bus (register writes vis BCMA bus). So if we have a cached mapping of that memory, it doens't naturally synchronize with any write/erase operations. Doesn't this mean you might get stale data if you do a sequence of read / erase / read, for instance, since the 2nd read will return cached data from the 1st read? IIUC, this could be solved by: (a) using an uncached mapping or (b) explicitly invalidating the relevant region after doing flash writes or erasures But I wonder why you haven't seen any problems if you've been using KSEG0 (cached) this whole time. Maybe just luck? Or you don't actually write to the flash that much? Brian