dmaengine Archive on lore.kernel.org
 help / color / Atom feed
From: Radhey Shyam Pandey <radheys@xilinx.com>
To: Nicholas Graumann <nick.graumann@gmail.com>
Cc: Vinod Koul <vkoul@kernel.org>,
	"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
	Michal Simek <michals@xilinx.com>,
	"andrea.merello@gmail.com" <andrea.merello@gmail.com>,
	Appana Durga Kedareswara Rao <appanad@xilinx.com>,
	"mcgrof@kernel.org" <mcgrof@kernel.org>,
	"dmaengine@vger.kernel.org" <dmaengine@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH -next 7/8] dmaengine: xilinx_dma: Check for both idle and halted state in axidma stop_transfer
Date: Fri, 27 Sep 2019 16:53:11 +0000
Message-ID: <CH2PR02MB7000D0EF8E2B2C11C58B7235C7810@CH2PR02MB7000.namprd02.prod.outlook.com> (raw)
In-Reply-To: <20190927135720.GA16057@lnx-nickg>

> -----Original Message-----
> From: Nicholas Graumann <nick.graumann@gmail.com>
> Sent: Friday, September 27, 2019 7:27 PM
> To: Radhey Shyam Pandey <radheys@xilinx.com>
> Cc: Vinod Koul <vkoul@kernel.org>; dan.j.williams@intel.com; Michal Simek
> <michals@xilinx.com>; andrea.merello@gmail.com; Appana Durga
> Kedareswara Rao <appanad@xilinx.com>; mcgrof@kernel.org;
> dmaengine@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH -next 7/8] dmaengine: xilinx_dma: Check for both idle
> and halted state in axidma stop_transfer
> 
> On Fri, Sep 27, 2019 at 06:48:29AM +0000, Radhey Shyam Pandey wrote:
> > > -----Original Message-----
> > > From: Vinod Koul <vkoul@kernel.org>
> > > Sent: Thursday, September 26, 2019 10:51 PM
> > > To: Radhey Shyam Pandey <radheys@xilinx.com>
> > > Cc: dan.j.williams@intel.com; Michal Simek <michals@xilinx.com>;
> > > nick.graumann@gmail.com; andrea.merello@gmail.com; Appana Durga
> > > Kedareswara Rao <appanad@xilinx.com>; mcgrof@kernel.org;
> > > dmaengine@vger.kernel.org; linux-kernel@vger.kernel.org
> > > Subject: Re: [PATCH -next 7/8] dmaengine: xilinx_dma: Check for both
> idle
> > > and halted state in axidma stop_transfer
> > >
> > > On 05-09-19, 22:07, Radhey Shyam Pandey wrote:
> > > > From: Nicholas Graumann <nick.graumann@gmail.com>
> > > >
> > > > When polling for a stopped transfer in AXI DMA mode, in some cases
> the
> > > > status of the channel may indicate IDLE instead of HALTED if the
> > > > channel was reset due to an error.
> > > >
> > > > Signed-off-by: Nicholas Graumann <nick.graumann@gmail.com>
> > > > Signed-off-by: Radhey Shyam Pandey
> > > <radhey.shyam.pandey@xilinx.com>
> > > > ---
> > > >  drivers/dma/xilinx/xilinx_dma.c | 5 +++--
> > > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/drivers/dma/xilinx/xilinx_dma.c
> > > b/drivers/dma/xilinx/xilinx_dma.c
> > > > index b5dd62a..0896e07 100644
> > > > --- a/drivers/dma/xilinx/xilinx_dma.c
> > > > +++ b/drivers/dma/xilinx/xilinx_dma.c
> > > > @@ -1092,8 +1092,9 @@ static int xilinx_dma_stop_transfer(struct
> > > xilinx_dma_chan *chan)
> > > >
> > > >  	/* Wait for the hardware to halt */
> > > >  	return xilinx_dma_poll_timeout(chan, XILINX_DMA_REG_DMASR,
> > > val,
> > > > -				       val & XILINX_DMA_DMASR_HALTED, 0,
> > > > -				       XILINX_DMA_LOOP_COUNT);
> > > > +				       val | (XILINX_DMA_DMASR_IDLE |
> > > > +					      XILINX_DMA_DMASR_HALTED),
> > >
> > > The condition was bitwise AND and now is OR.. ??
> >
> > Ah, it should be same as before . Only _IDLE mask should be in OR.
> >
> > Also on second thought to this patch- we need to describe which error
> > scenario "in some cases the status of the channel may indicate IDLE
> > instead of HALTED" as mentioned in commit description.
> >
> > @Nick: Can you comment?
> >
> In regard to the mask question, yes, this looks like a bug.
> We should be AND'ing with the mask like before.
> 
> As far as the state, usually when we saw the IDLE state when invoking
> dmaengine_terminate_all on a channel that had errors. I have not
> proved this, but I believe what happened was the following:

As per IP produce guide pg021, once DMACR[RS] is set to 0x0
the halted bit in the DMA Status register should asserts to
0x1 when the DMA engine is halted. Also the DMA may be the
in IDLE state, there may be active data on the AXI interface.

I think for now we can skip this patchset in v2 and repost it
when a proper root cause is done.

> 
> New transactions were queued when chan->err was set, causing
> xilinx_dma_chan_reset to be invoked which ultimately results in the
> hardware being in an IDLE state by the time xilinx_dma_terminate_all
> gets around to invoking stop_transfer. At that point, stop_transfer is
> going to time out waiting for the hardware to indicate it has HALTED and
> ultimately will time out.
> 
> 
> In any case, xilinx_dma_stop_transfer should be fine with the hardware
> being in an IDLE state to indicate that the active transfer is stopped.
> Case in point: The CDMA core also covered by this driver only has an
> IDLE bit and no HALTED bit in its DMASR, and it checks for just the IDLE
> bit in xilinx_cdma_stop_transfer().
> > >
> > > > +				       0, XILINX_DMA_LOOP_COUNT);
> > > >  }
> > > >
> > > >  /**
> > > > --
> > > > 2.7.4
> > >
> > > --
> > > ~Vinod

  reply index

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05 16:36 [PATCH -next 0/8] AXI DMA driver improvements Radhey Shyam Pandey
2019-09-05 16:36 ` [PATCH -next 1/8] dmaengine: xilinx_dma: Remove desc_callback_valid check Radhey Shyam Pandey
2019-09-05 16:36 ` [PATCH -next 2/8] dmaengine: xilinx_dma: Merge get_callback and _invoke Radhey Shyam Pandey
2019-09-05 16:36 ` [PATCH -next 3/8] dmaengine: xilinx_dma: Introduce xilinx_dma_get_residue Radhey Shyam Pandey
2019-09-25 21:01   ` Vinod Koul
2019-09-26  5:52     ` Radhey Shyam Pandey
2019-09-26 17:18       ` Vinod Koul
2019-09-27  5:16         ` Radhey Shyam Pandey
2019-10-01 12:03           ` Radhey Shyam Pandey
2019-09-05 16:37 ` [PATCH -next 4/8] dmaengine: xilinx_dma: Add callback_result support Radhey Shyam Pandey
2019-09-05 16:37 ` [PATCH -next 5/8] dmaengine: xilinx_dma: Remove residue from channel data Radhey Shyam Pandey
2019-09-05 16:37 ` [PATCH -next 6/8] dmaengine: xilinx_dma: Print debug message when no free tx segments Radhey Shyam Pandey
2019-09-05 16:37 ` [PATCH -next 7/8] dmaengine: xilinx_dma: Check for both idle and halted state in axidma stop_transfer Radhey Shyam Pandey
2019-09-26 17:21   ` Vinod Koul
2019-09-27  6:48     ` Radhey Shyam Pandey
2019-09-27 13:57       ` Nicholas Graumann
2019-09-27 16:53         ` Radhey Shyam Pandey [this message]
2019-09-05 16:37 ` [PATCH -next 8/8] dmaengine: xilinx_dma: Clear desc_pendingcount in xilinx_dma_reset Radhey Shyam Pandey

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CH2PR02MB7000D0EF8E2B2C11C58B7235C7810@CH2PR02MB7000.namprd02.prod.outlook.com \
    --to=radheys@xilinx.com \
    --cc=andrea.merello@gmail.com \
    --cc=appanad@xilinx.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=michals@xilinx.com \
    --cc=nick.graumann@gmail.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

dmaengine Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dmaengine/0 dmaengine/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dmaengine dmaengine/ https://lore.kernel.org/dmaengine \
		dmaengine@vger.kernel.org
	public-inbox-index dmaengine

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.dmaengine


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git