From: EastL <EastL.Lee@mediatek.com>
To: Vinod Koul <vkoul@kernel.org>
Cc: Sean Wang <sean.wang@mediatek.com>, <robh+dt@kernel.org>,
<mark.rutland@arm.com>, <matthias.bgg@gmail.com>,
<dmaengine@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
<devicetree@vger.kernel.org>, <wsd_upstream@mediatek.com>,
<cc.hwang@mediatek.com>
Subject: Re: [PATCH v6 2/4] dmaengine: mediatek-cqdma: remove redundant queue structure
Date: Thu, 23 Jul 2020 10:34:10 +0800 [thread overview]
Message-ID: <1595471650.22392.12.camel@mtkswgap22> (raw)
In-Reply-To: <20200715061957.GA34333@vkoul-mobl>
On Wed, 2020-07-15 at 11:49 +0530, Vinod Koul wrote:
> On 02-07-20, 15:06, EastL Lee wrote:
>
> > static enum dma_status mtk_cqdma_tx_status(struct dma_chan *c,
> > dma_cookie_t cookie,
> > struct dma_tx_state *txstate)
> > {
> > - struct mtk_cqdma_vchan *cvc = to_cqdma_vchan(c);
> > - struct mtk_cqdma_vdesc *cvd;
> > - struct virt_dma_desc *vd;
> > - enum dma_status ret;
> > - unsigned long flags;
> > - size_t bytes = 0;
> > -
> > - ret = dma_cookie_status(c, cookie, txstate);
> > - if (ret == DMA_COMPLETE || !txstate)
> > - return ret;
> > -
> > - spin_lock_irqsave(&cvc->vc.lock, flags);
> > - vd = mtk_cqdma_find_active_desc(c, cookie);
> > - spin_unlock_irqrestore(&cvc->vc.lock, flags);
> > -
> > - if (vd) {
> > - cvd = to_cqdma_vdesc(vd);
> > - bytes = cvd->residue;
> > - }
> > -
> > - dma_set_residue(txstate, bytes);
>
> any reason why you want to remove setting residue?
Because Mediatek CQDMA HW can't support residue.
>
> > -static void mtk_cqdma_free_active_desc(struct dma_chan *c)
> > +static int mtk_cqdma_terminate_all(struct dma_chan *c)
> > {
> > struct mtk_cqdma_vchan *cvc = to_cqdma_vchan(c);
> > - bool sync_needed = false;
> > + struct virt_dma_chan *vc = to_virt_chan(c);
> > unsigned long pc_flags;
> > unsigned long vc_flags;
> > + LIST_HEAD(head);
> > +
> > + /* wait for the VC to be inactive */
> > + if (!wait_for_completion_timeout(&cvc->cmp, msecs_to_jiffies(3000)))
> > + return -EAGAIN;
> >
> > /* acquire PC's lock first due to lock dependency in dma ISR */
> > spin_lock_irqsave(&cvc->pc->lock, pc_flags);
> > spin_lock_irqsave(&cvc->vc.lock, vc_flags);
> >
> > - /* synchronization is required if this VC is active */
> > - if (mtk_cqdma_is_vchan_active(cvc)) {
> > - cvc->issue_synchronize = true;
> > - sync_needed = true;
> > - }
> > + /* get VDs from lists */
> > + vchan_get_all_descriptors(vc, &head);
> > +
> > + /* free all the VDs */
> > + vchan_dma_desc_free_list(vc, &head);
> >
> > spin_unlock_irqrestore(&cvc->vc.lock, vc_flags);
> > spin_unlock_irqrestore(&cvc->pc->lock, pc_flags);
>
> Good cleanup, do you need both these locks?
Yes, because we will have multiple vc to pc, it will need both lock.
next prev parent reply other threads:[~2020-07-23 2:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-02 7:06 [PATCH v6] dmaengine: mediatek-cqdma: add dt-bindings and remove redundant queue EastL Lee
2020-07-02 7:06 ` [PATCH v6 1/4] dt-bindings: dmaengine: Add MediaTek Command-Queue DMA controller bindings EastL Lee
2020-07-09 20:59 ` Rob Herring
2020-07-22 11:19 ` EastL
2020-07-02 7:06 ` [PATCH v6 3/4] dmaengine: mediatek-cqdma: add dma mask for capability EastL Lee
2020-07-03 14:54 ` Matthias Brugger
2020-07-02 7:06 ` [PATCH v6 4/4] dmaengine: mediatek-cqdma: fix compatible EastL Lee
2020-07-03 14:56 ` Matthias Brugger
[not found] ` <1593673564-4425-3-git-send-email-EastL.Lee@mediatek.com>
2020-07-15 6:19 ` [PATCH v6 2/4] dmaengine: mediatek-cqdma: remove redundant queue structure Vinod Koul
2020-07-23 2:34 ` EastL [this message]
2020-07-27 9:44 ` Vinod Koul
2020-08-06 6:27 ` EastL
Reply instructions:
You may reply publicly 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=1595471650.22392.12.camel@mtkswgap22 \
--to=eastl.lee@mediatek.com \
--cc=cc.hwang@mediatek.com \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=robh+dt@kernel.org \
--cc=sean.wang@mediatek.com \
--cc=vkoul@kernel.org \
--cc=wsd_upstream@mediatek.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).