dmaengine Archive on lore.kernel.org
 help / color / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: dmaengine@vger.kernel.org, Michal Simek <michal.simek@xilinx.com>,
	Hyun Kwon <hyun.kwon@xilinx.com>,
	Tejas Upadhyay <tejasu@xilinx.com>,
	Satish Kumar Nagireddy <SATISHNA@xilinx.com>
Subject: Re: [PATCH v2 2/4] dma: xilinx: dpdma: Add the Xilinx DisplayPort DMA engine driver
Date: Sat, 9 Nov 2019 23:29:08 +0530
Message-ID: <20191109175908.GI952516@vkoul-mobl> (raw)
In-Reply-To: <20191107021400.16474-3-laurent.pinchart@ideasonboard.com>

Hi Laurent,

it is dmaengine: xxx not dma: xxx :-)

On 07-11-19, 04:13, Laurent Pinchart wrote:

> +/*
> + * DPDMA descriptor placement
> + * --------------------------
> + * DPDMA descritpor life time is described with following placements:
> + *
> + * allocated_desc -> submitted_desc -> pending_desc -> active_desc -> done_list
> + *
> + * Transition is triggered as following:
> + *
> + * -> allocated_desc : a descriptor allocation
> + * allocated_desc -> submitted_desc: a descriptor submission
> + * submitted_desc -> pending_desc: request to issue pending a descriptor
> + * pending_desc -> active_desc: VSYNC intr when a desc is scheduled to DPDMA
> + * active_desc -> done_list: VSYNC intr when DPDMA switches to a new desc

Well this tells me driver is not using vchan infrastructure, the
drivers/dma/virt-dma.c is common infra which does pretty decent list
management and drivers do not need to open code this.

Please convert the driver to use virt-dma

> +static struct dma_async_tx_descriptor *
> +xilinx_dpdma_chan_prep_slave_sg(struct xilinx_dpdma_chan *chan,
> +				struct scatterlist *sgl)
> +{
> +	struct xilinx_dpdma_tx_desc *tx_desc;
> +	struct xilinx_dpdma_sw_desc *sw_desc, *last = NULL;
> +
> +	if (chan->allocated_desc)
> +		return &chan->allocated_desc->async_tx;

This seems wrong, you are supposed to prepare a new descriptor based on
sg list provided, returning allocated without preparing seems wrong to
me!

> +static dma_cookie_t xilinx_dpdma_tx_submit(struct dma_async_tx_descriptor *tx)
> +{
> +	struct xilinx_dpdma_chan *chan = to_xilinx_chan(tx->chan);
> +	struct xilinx_dpdma_tx_desc *tx_desc = to_dpdma_tx_desc(tx);
> +	struct xilinx_dpdma_sw_desc *sw_desc;
> +	dma_cookie_t cookie;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&chan->lock, flags);
> +
> +	if (chan->submitted_desc) {
> +		cookie = chan->submitted_desc->async_tx.cookie;

submit should give a new cookie not for already submitted descriptor!

> +		goto out_unlock;
> +	}
> +
> +	cookie = dma_cookie_assign(&tx_desc->async_tx);

yes this is correct :-)

> +
> +	/*
> +	 * Assign the cookie to descriptors in this transaction. Only 16 bit
> +	 * will be used, but it should be enough.
> +	 */
> +	list_for_each_entry(sw_desc, &tx_desc->descriptors, node)
> +		sw_desc->hw.desc_id = cookie;
> +
> +	if (tx_desc != chan->allocated_desc)
> +		dev_err(chan->xdev->dev, "desc != allocated_desc\n");
> +	else
> +		chan->allocated_desc = NULL;
> +	chan->submitted_desc = tx_desc;

submitted should be a list, we can submit multiple...

> +static void xilinx_dpdma_issue_pending(struct dma_chan *dchan)
> +{
> +	struct xilinx_dpdma_chan *chan = to_xilinx_chan(dchan);
> +
> +	xilinx_dpdma_chan_start(chan);

what if channel is already started?
-- 
~Vinod

  reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07  2:13 [PATCH v2 0/4] dma: Add Xilinx ZynqMP DPDMA driver Laurent Pinchart
2019-11-07  2:13 ` [PATCH v2 1/4] dt: bindings: dma: xilinx: dpdma: DT bindings for Xilinx DPDMA Laurent Pinchart
2019-11-13 13:24   ` Rob Herring
2019-11-07  2:13 ` [PATCH v2 2/4] dma: xilinx: dpdma: Add the Xilinx DisplayPort DMA engine driver Laurent Pinchart
2019-11-09 17:59   ` Vinod Koul [this message]
2019-11-07  2:13 ` [PATCH v2 3/4] dma: xilinx: dpdma: Add debugfs support Laurent Pinchart
2019-11-07  2:14 ` [PATCH v2 4/4] arm64: dts: zynqmp: Add DPDMA node Laurent Pinchart

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=20191109175908.GI952516@vkoul-mobl \
    --to=vkoul@kernel.org \
    --cc=SATISHNA@xilinx.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=hyun.kwon@xilinx.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=michal.simek@xilinx.com \
    --cc=tejasu@xilinx.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

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