Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S945586AbcJaSgg (ORCPT ); Mon, 31 Oct 2016 14:36:36 -0400 Received: from anholt.net ([50.246.234.109]:44367 "EHLO anholt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S945061AbcJaSgf (ORCPT ); Mon, 31 Oct 2016 14:36:35 -0400 From: Eric Anholt To: Michael Zoran , gregkh@linuxfoundation.org Cc: swarren@wwwdotorg.org, lee@kernel.org, mzoran@crowfest.net, daniels@collabora.com, noralf@tronnes.org, popcornmix@gmail.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: vc04_services: setup DMA and coherent mask In-Reply-To: <20161028171159.23973-1-mzoran@crowfest.net> References: <20161028171159.23973-1-mzoran@crowfest.net> User-Agent: Notmuch/0.22.2+1~gb0bcfaa (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Mon, 31 Oct 2016 11:36:31 -0700 Message-ID: <87twbsqsb4.fsf@eliezer.anholt.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2671 Lines: 74 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Michael Zoran writes: > Setting the DMA mask is optional on 32 bit but > is mandatory on 64 bit. Set the DMA mask and coherent > to force all DMA to be in the 32 bit address space. > > This is considered a "good practice" and most drivers > already do this. > > Signed-off-by: Michael Zoran > --- > .../staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 10 ++++= ++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835= _arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c > index a5afcc5..6fa2b5a 100644 > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c > @@ -97,6 +97,16 @@ int vchiq_platform_init(struct platform_device *pdev, = VCHIQ_STATE_T *state) > int slot_mem_size, frag_mem_size; > int err, irq, i; >=20=20 > + /* > + * Setting the DMA mask is necessary in the 64 bit environment. > + * It isn't necessary in a 32 bit environment but is considered > + * a good practice. > + */ > + err =3D dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); I think a better comment here would be simply: /* VCHI messages between the CPU and firmware use 32-bit bus addresses. */ explaining why the value is chosen (once you know that the 32 bit restriction exists, reporting it is obviously needed). I'm curious, though: what failed when you didn't set it? > + > + if (err < 0) > + return err; > + > (void)of_property_read_u32(dev->of_node, "cache-line-size", > &g_cache_line_size); > g_fragments_size =3D 2 * g_cache_line_size; > --=20 > 2.10.1 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJYF48vAAoJELXWKTbR/J7oVncQAI7TIirtd9szCnUo+3ZDfJra Jczq8kuEm6CiAcfGmriySOVJ935SisN0Fh9o1PhkPlpPENZsy9K2jCcLMUJNLKws Pf65rwZEmyVOMF883XHtMsR5l4t1tFUocw0sJ77VdTkWy1Aw6DE6/XtTM7HhkmOJ GvSIIwx7hkkALIDTV4DCY1k81AiAxxeR/JT1Wg8biu/sZ5PB0shZKZ4+ZyPj1Ax7 dOrKxvpmhZV0BvuykyYUJYYToBXpo9ERD6ZSnweumiPRkQHJG48FbrmtNMSf48IA uKquB27UbPcvAdAaAMGt/KCFdV4RsxP4rv1ozNoCWoyWc7jY8/zrEKSyjpJfsgNS vRaxhMRLcNu1tPrnCiFJmzKV7I4jgCU19gnxDB84LbFXRc+eBhY9r8NfoF9uDNFV gAGJByMhhtXzigKY3MNfQDk9E4nZWQtGME02cw3yntK1BQQoIl1JkrGGzo0E9LKR igvNPkxW/X08sQVD7pgIM6RAaDcBdGssKRQV7oSt8pfWjoHXguw+ne7F3bkwNcq/ hcgF5V5H+74W6qgmyNVbDlt+Wr3PcNwrO2/CIgWfYWIDqIInJGrKYNd1GWkoZAfx B6hB1LNbmw+JGmCithLO3L8a6ahHBMk8MGi2Fs15OqlHmSK3IkABKSqE74AxJ4t2 udXOuqYSh2WgUphJVZmv =55SX -----END PGP SIGNATURE----- --=-=-=--