From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752336AbcFFRdX (ORCPT ); Mon, 6 Jun 2016 13:33:23 -0400 Received: from anholt.net ([50.246.234.109]:47560 "EHLO anholt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751773AbcFFRdW (ORCPT ); Mon, 6 Jun 2016 13:33:22 -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: <20160606042635.GU16910@localhost> References: <1465007351-5559-1-git-send-email-eric@anholt.net> <20160606042635.GU16910@localhost> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Mon, 06 Jun 2016 10:33:18 -0700 Message-ID: <87a8iy6x41.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 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? Maybe this was poorly worded. How about: 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. >> 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(struc= t 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 resi= de > for those cases 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. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJXVbPeAAoJELXWKTbR/J7ocNAP+wd+u1GOs88YaX/hGPTDIKCH RoIwd/3fWwd5aGIXI3V3Wx5CgQFpmAZ7JSikkvXr7DtUg24GKchBoZZ+D3jw4Iyi nkvpOEF5X8K7b3xMp4A18D329Sj0FmuqoFVk1l8lKecoXGsIAnc8HZfT+ZvtlBhS VzieUcjzvr9ze57jcq1kV2AIn5yt3ErsFEgkj+u9EXjKH2sxoW08e2SPBOqFUeeL cFl0DKrwPhFdPF8CrgbYk4A1IltoYrL4JPzUDPh53riqR5t2wpKGVNxp6YkfI+sd Z5TnIutFKh8nCPBDDZPWNfsG8/SEPevsftM863w94QoNoKrMcnpiLwUf5+USzjhw ulj5gMyUNVQ+6ld69bR5y0AKOlzxtfj0r6T9Uo8QMAOG+8GVGOMrwjuuxV8E7sZI kepuCZ9yQ0b8nYwhbGMyy3ieE2xjPwkLhLZnZDHH48gvvUrtXGcaBIB9tZtC+bbx i0WdTq3YSUAo41AUAEJllOiizNdQAFdlWtH2yqUDahEvJ8xhlvfLoxPH0v79pabR tzQsjZOzOef55S7WmsjDpPEgDtQ/wj6chMl81XCunaX2UyBkCK27gQ63wND++RnR ieyuWK6iiZlyCVshPxuRTMnRy7cJbkTyOEfpn2W/WiIom+Y28xOZvSscMw4pRgr0 EX0GBY+Nrj6hVgnjz1Ku =5a88 -----END PGP SIGNATURE----- --=-=-=-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: eric@anholt.net (Eric Anholt) Date: Mon, 06 Jun 2016 10:33:18 -0700 Subject: [PATCH] dmaengine: bcm2835: Fix polling for completion of DMA with interrupts masked. In-Reply-To: <20160606042635.GU16910@localhost> References: <1465007351-5559-1-git-send-email-eric@anholt.net> <20160606042635.GU16910@localhost> Message-ID: <87a8iy6x41.fsf@eliezer.anholt.net> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Vinod Koul writes: > 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? Maybe this was poorly worded. How about: 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. >> 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. >> >> Signed-off-by: Eric Anholt >> --- >> drivers/dma/bcm2835-dma.c | 24 +++++++++++++++++++----- >> 1 file changed, 19 insertions(+), 5 deletions(-) >> >> 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(struct dma_chan *chan, >> struct virt_dma_desc *vd; >> enum dma_status ret; >> unsigned long flags; >> + u32 residue; >> >> ret = dma_cookie_status(chan, cookie, txstate); >> - if (ret == DMA_COMPLETE || !txstate) >> + if (ret == DMA_COMPLETE) > > Why do you change this? txstate can be NULL, so no point calculating reside > for those cases 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. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 818 bytes Desc: not available URL: