From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751137AbcFGFRb (ORCPT ); Tue, 7 Jun 2016 01:17:31 -0400 Received: from mga03.intel.com ([134.134.136.65]:44958 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750705AbcFGFRa (ORCPT ); Tue, 7 Jun 2016 01:17:30 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,431,1459839600"; d="asc'?scan'208";a="117299499" Date: Tue, 7 Jun 2016 10:54:05 +0530 From: Vinod Koul To: Eric Anholt Cc: linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Stephen Warren , Lee Jones , dmaengine@vger.kernel.org Subject: Re: [PATCH] dmaengine: bcm2835: Fix polling for completion of DMA with interrupts masked. Message-ID: <20160607052405.GC16910@localhost> References: <1465007351-5559-1-git-send-email-eric@anholt.net> <20160606042635.GU16910@localhost> <87a8iy6x41.fsf@eliezer.anholt.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="yZnyZsPjQYjG7xG7" Content-Disposition: inline In-Reply-To: <87a8iy6x41.fsf@eliezer.anholt.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --yZnyZsPjQYjG7xG7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 06, 2016 at 10:33:18AM -0700, Eric Anholt wrote: > Vinod Koul writes: >=20 > > On Fri, Jun 03, 2016 at 07:29:11PM -0700, Eric Anholt wrote: > >> The tx_status hook is supposed to be safe to call from interrupt > >> context, but it wouldn't ever return completion for the last transfer, > >> meaning you couldn't poll for DMA completion with interrupts masked. > > > > and why is that? >=20 > Maybe this was poorly worded. How about: >=20 > The tx_status hook is supposed to be safe to call from interrupt > context. However, the current transfer currently only gets marked > complete by the IRQ handler, so if interrupts were masked then polling > for completion would never finish. Sound better :) >=20 > >> This fixes IRQ handling for bcm2835's DSI1, which requires using the > >> DMA engine to write its registers due to a bug in the AXI bridge. > >>=20 > >> Signed-off-by: Eric Anholt > >> --- > >> drivers/dma/bcm2835-dma.c | 24 +++++++++++++++++++----- > >> 1 file changed, 19 insertions(+), 5 deletions(-) > >>=20 > >> diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c > >> index 6149b27c33ad..320461c578e3 100644 > >> --- a/drivers/dma/bcm2835-dma.c > >> +++ b/drivers/dma/bcm2835-dma.c > >> @@ -570,16 +570,16 @@ static enum dma_status bcm2835_dma_tx_status(str= uct dma_chan *chan, > >> struct virt_dma_desc *vd; > >> enum dma_status ret; > >> unsigned long flags; > >> + u32 residue; > >> =20 > >> ret =3D dma_cookie_status(chan, cookie, txstate); > >> - if (ret =3D=3D DMA_COMPLETE || !txstate) > >> + if (ret =3D=3D DMA_COMPLETE) > > > > Why do you change this? txstate can be NULL, so no point calculating re= side > > for those cases >=20 > The point was to go into the "Calculate where we're at in our current > DMA (if the current DMA is the one we're asking about status for)" path, > so that we could note when the DMA is complete even when there's no > txstate passed in. Can you explain what you mean by current DMA! The claulation is always done for 'descriptor' represnted by the cookie. So it doesnt not matter...! Thanks --=20 ~Vinod --yZnyZsPjQYjG7xG7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXVlp1AAoJEHwUBw8lI4NH0f8QAIK6SVDdKjTBrQYIfaCKvtH4 BCGs6Z51faZlrzVjVZ2rF3pu6SBfUI3z/ICy6+k6l2923ly10jia4npmkk7YK93p tX/FV33o6bSbeO7IgD5hv6jlMRD/yhKJ1FQNihDCtWMqD4iz/MwatOsG0V84+7Yd XlEYLARuJ5+RZqkqiW0q3sCrG5EQbJ5Y2o9RIdMqtx7LcGdSbyxK/BKYlmcbG2qN Pq33GIYA3bi+Ya5JvX4/28eJBA1OPybKE2Dv7h21exzQtf5bEIDm7kFLmsJiixzD YFOmh5drXmOqjdEENE+kmTc8ExvNrxw5xm0G1tNLW+iSDdvgwnLwb/l1ZpnK8/Nq P9Af39HyNNiEgM97xRgubjzkENL8sK6l6O65SiZY/3QSEUPoqjPjxej8ZqzoSNkP lvDB1EgqAZTYBv94KXTS2sk69/eDT8+jBaeQvNjRnu/+z7JqCuQc2pf/xhw8Vxhq 04i0a9iVsF51ZAqJYUNh+cGaEq7aITdt8xNdIqxOkRACxPO+UzV6NrO9HTQ0gKaq XKcL0oFnOmQbL3qDjdD/sbA2h4PcJJV9wRdby5E7aUUnW77Y5unAamMOSuaM6wE8 GAJCwtFiUnOTJc3gM0uIfzuCX0h2CwHFYOiRNu7HVZQgHEW5wg0RH12NvN7k3hGV YmPT844SsFzb0OTPe+q+ =vojR -----END PGP SIGNATURE----- --yZnyZsPjQYjG7xG7--