From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933637AbdKPKpR (ORCPT ); Thu, 16 Nov 2017 05:45:17 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:45546 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933448AbdKPKpK (ORCPT ); Thu, 16 Nov 2017 05:45:10 -0500 Date: Thu, 16 Nov 2017 10:45:08 +0000 From: Mark Brown To: Radu Pirea Cc: linux-spi@vger.kernel.org, nicolas.ferre@microchip.com, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 2/2] spi: atmel: Fix DMA transfers data corruption Message-ID: <20171116104508.rm7xdabyvucowlaj@sirena.org.uk> References: <1510763732-10151-1-git-send-email-radu.pirea@microchip.com> <1510763732-10151-3-git-send-email-radu.pirea@microchip.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ji7ullfpqmq5lehg" Content-Disposition: inline In-Reply-To: <1510763732-10151-3-git-send-email-radu.pirea@microchip.com> X-Cookie: Nothing is but what is not. User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --ji7ullfpqmq5lehg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Nov 15, 2017 at 06:35:32PM +0200, Radu Pirea wrote: > +#ifdef CONFIG_SOC_SAM_V4_V5 > + /* > + * On Atmel SoCs based on ARM9 cores, the data cache follows the VIVT > + * model, hence the cache aliases issue can occur when buffers are > + * allocated from DMA-unsafe areas, by vmalloc() for instance, where > + * cache coherency is not taken into account or at least not handled > + * completely (cache lines of aliases are not flushed and invalidated). > + * This is not a theorical issue: it was reproduced when trying to mount > + * a UBI file-system on a at91sam9g35ek board. > + */ > + flush_kernel_vmap_range((void *)xfer->rx_buf, xfer->len); > +#endif Shouldn't we be fixing this in the DMA mapping operations for the SoC, won't this affect everything that does DMA on this platform and not just this driver? I'd expect that dma_map_sg() and so on would do the right thing. --ji7ullfpqmq5lehg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAloNbDMACgkQJNaLcl1U h9CbVgf+OTSWM/5qKqpMbeoI5L7NGwtE5pKuMTpZKVm9Qw+Fz9A+C8cVK6+rIi4A WVvdlxSmjSV4Bj1Mhbf81DRoHqAX8lyPIS6L2cx31og75C9InHnSqpiQiYyHihGk F21XhJYEgNZ4fEoRso3bHtCwWCgmy1OFJdaJ1ZZ99WEe/SeSt/wUPevVv8QM5Naf Hpb8X03PaN6f7XkbG7xN6op1pzypgtVAEwLe4sg+JCEkdtHwKtKkXWIt5uRRPBuy vipTT8z3DSHHWitTb/05p+9Vi9e+f5b4yp1mgggN7c/aKjNoNBNuSftZNQrGIPQz B+IbnSklGi6aIQna0lyL0IsCWrueBw== =8Ely -----END PGP SIGNATURE----- --ji7ullfpqmq5lehg--