lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1358761551.12502.39.camel@smile>
Date:	Mon, 21 Jan 2013 11:45:51 +0200
From:	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:	Vinod Koul <vinod.koul@...el.com>
Cc:	Andy Shevchenko <andriy.shevchenko@...ux.jf.intel.com>,
	Viresh Kumar <viresh.linux@...il.com>,
	linux-kernel@...r.kernel.org, spear-devel <spear-devel@...t.st.com>
Subject: Re: [PATCH 2/2] dw_dmac: return proper residue value

On Mon, 2013-01-21 at 00:49 -0800, Vinod Koul wrote: 
> On Mon, Jan 21, 2013 at 11:00:44AM +0200, Andy Shevchenko wrote:
> > Currently the driver returns full length of the active descriptor which is
> > wrong. We have to go throught the active descriptor and sum up the length of
> > unsent children in the chain along with the actual data in the DMA channel
> why do you mean by children here?

The list nodes chained under (active) &desc->tx_list.

> > registers.
> > 
> > The cyclic case is not handled by this patch due to len field in the descriptor
> > structure is left untouched by the original code.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> > ---
> >  drivers/dma/dw_dmac.c |   93 ++++++++++++++++++++++++++++++++++++++++++++++++-
> >  1 file changed, 92 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> > index d1b9ba2..4325c68 100644
> > --- a/drivers/dma/dw_dmac.c
> > +++ b/drivers/dma/dw_dmac.c
> > @@ -941,6 +941,97 @@ err_desc_get:
> >  	return NULL;
> >  }
> >  
> > +/* --------------------- Calculate residue ---------------------------- */
> > +
> > +static inline size_t dwc_get_rest(struct dw_dma_chan *dwc, struct dw_desc *desc)
> > +{
> > +	enum dma_transfer_direction direction = dwc->direction;
> > +
> > +	if (direction == DMA_MEM_TO_DEV || direction == DMA_MEM_TO_MEM)
> > +		return desc->len - (channel_readl(dwc, SAR) - desc->lli.sar);
> > +	else if (direction == DMA_DEV_TO_MEM)
> > +		return desc->len - (channel_readl(dwc, DAR) - desc->lli.dar);
> > +
> > +	return 0;
> hmmm, why not use BLOCK_TS value. That way you dont need to look at direction
> and along with burst can easily calculate residue...

Do you mean to read CTL hi/lo and do

desc->len - ctlhi.block_ts * ctllo.src_tr_width?

I think it could be not precise when memory-to-peripheral transfer is
going on. In that case you probably will have src_tr_width like 32 bits,
meanwhile peripheral may receive only byte stream.

-- 
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Intel Finland Oy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ