From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752534AbcFGGKo (ORCPT ); Tue, 7 Jun 2016 02:10:44 -0400 Received: from anholt.net ([50.246.234.109]:49134 "EHLO anholt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752290AbcFGGKn (ORCPT ); Tue, 7 Jun 2016 02:10:43 -0400 From: Eric Anholt To: Vinod Koul 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. In-Reply-To: <20160607052405.GC16910@localhost> References: <1465007351-5559-1-git-send-email-eric@anholt.net> <20160606042635.GU16910@localhost> <87a8iy6x41.fsf@eliezer.anholt.net> <20160607052405.GC16910@localhost> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Mon, 06 Jun 2016 23:10:38 -0700 Message-ID: <87k2i1leap.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-Type: text/plain Content-Transfer-Encoding: quoted-printable Vinod Koul writes: > 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(st= ruct dma_chan *chan, >> >> struct virt_dma_desc *vd; >> >> enum dma_status ret; >> >> unsigned long flags; >> >> + u32 residue; >> >>=20=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 r= eside >> > 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...! By current I mean the current descriptor that has been submitted to the hardware, in bcm2835_chan->desc. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJXVmVfAAoJELXWKTbR/J7oL4MQAI7VMPiaZ4eEEMF/DHHony1W n++iJCYX6VagVRShxPk1v9Ui+UA3XxplpaL0TjHlCV7vQTlAWZDZL8abEzF7qog6 VH2S4wQIDJCwuXSE8cQPYbVaqvnlYdpQ0+me0B6XnUkx+MSUhmiANvSJkPZRzKQB 3ABFQM4tiUtri+0tS18nw+FaKdf90KBvtmWBu/htMtflffddTMH7iTrm09el3Z2W x1YWcfkFi8DrZ2awLvq7BU4Rg6jJ2HXMaxqudBNFkubE/ywuEldKx4FJKIEnU/q+ TbA8QOV05ZISCJ04bgiMoOJ0PGIxX1H5xj5QnPn0zLN1Jr28CN3hr/ov0KobnteI klCE0zm4RPuHYugdRbeRWuDHYwosXQOwFOAAZNUEZoql7nk1/B0fgRvTmuj7UvWZ Vg5SeIjdwzv/K3tYzV03ATI9VX3HSlDMA085gZqU5d+V1NdGBv3X16mNzsmCh23V DOFqifmSbm9uvSYcz/P4SOtmBCzeg4JAJZHBhf0h1KYXOSQOlbGBdm0vBDqxGp7b hcr06lTEjAsQL+d8W3SxmLg8GNv4yk5bcHXGM5HVni7BmgmoIrt6C1J8/ZSzORmH /vp9TL0wsRf8AP75xSO139cRO/CCPBOlll4gyTjpcwvM2U8nvG/qpc/aG4wsHnpY ZOttmRgL4w7lPrHCTP/P =oeLn -----END PGP SIGNATURE----- --=-=-=--