linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Serge Semin <fancer.lancer@gmail.com>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: Frank Li <Frank.Li@nxp.com>,
	Serge Semin <Sergey.Semin@baikalelectronics.ru>,
	gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com,
	l.stach@pengutronix.de, linux-imx@nxp.com,
	linux-pci@vger.kernel.org, dmaengine@vger.kernel.org,
	lznuaa@gmail.com, vkoul@kernel.org, lorenzo.pieralisi@arm.com,
	robh@kernel.org, kw@linux.com, bhelgaas@google.com,
	shawnguo@kernel.org
Subject: Re: [PATCH v3 1/6] dmaengine: dw-edma: fix dw_edma_probe() can't be call globally
Date: Wed, 9 Mar 2022 22:01:23 +0300	[thread overview]
Message-ID: <20220309190123.dnivojpqhl52o5vc@mobilestation> (raw)
In-Reply-To: <20220309181233.GC134091@thinkpad>

On Wed, Mar 09, 2022 at 11:42:33PM +0530, Manivannan Sadhasivam wrote:
> Hey,
> 
> On Wed, Mar 09, 2022 at 04:39:40PM +0300, Serge Semin wrote:
> > Hello Frank
> > 
> > On Mon, Mar 07, 2022 at 04:47:45PM -0600, Frank Li wrote:
> > > "struct dw_edma_chip" contains an internal structure "struct dw_edma" that is
> > > used by the eDMA core internally. This structure should not be touched
> > > by the eDMA controller drivers themselves. But currently, the eDMA
> > > controller drivers like "dw-edma-pci" allocates and populates this
> > > internal structure then passes it on to eDMA core. The eDMA core further
> > > populates the structure and uses it. This is wrong!
> > > 
> > > Hence, move all the "struct dw_edma" specifics from controller drivers
> > > to the eDMA core.
> > 
> > Thanks for the patchset. Alas it has just drawn my attention on v3
> > stage, otherwise I would have given to you my thoughts stright away on
> > v1. Anyway first of all a cover letter would be very much appropriate
> > to have a general notion about all the changes introduced in the set.
> > 
> 
> +1 for cover letter.
> 
> > Secondly I've just been working on adding the eDMA platform support
> > myself, so you have been just about a week ahead of me submitting my
> > changes.
> 
> Welcome to the ship :) We (me and my colleague) were also working on eDMA
> support for Qcom platform, so jumped in.
> 
> >  My work contains some of the modifications done by you (but
> > have some additional fixes too) so I'll need to rebase it on top of
> > your patchset when it's finished. Anyway am I understand correctly,
> > that you've also been working on the DW PCIe driver alteration so one
> > would properly initialize the eDMA-chip data structure? If so have you
> > sent the patchset already?  Could you give me a link and add me to Cc
> > in the emailing thread? (That's where the cover letter with all the
> > info and related patchsets would be very helpful.)
> > 
> 

> https://lore.kernel.org/linux-pci/20220309120149.GB134091@thinkpad/T/#m979eb506c73ab3cfca2e7a43635ecdaec18d8097
> 
> But this patch got dropped in v3 as the ep support for imx driver has not landed
> yet.

I see. Ok then.

> 
> > Thirdly regarding this patch. Your modification is mainly correct, but
> > I would suggest to change the concept. Instead of needlessly converting
> > the code to using the dw_edma_chip structure pointer within the DW eDMA
> > driver, it would be much easier in modification and more logical to
> > keep using the struct dw_edma pointer. Especially seeing dw_edma
> > structure is going to be a pure private data. So to speak what I would
> > suggest is to have the next pointers setup:
> > 
> 

> I'm afraid that this will not work for all cases (unless I miss something). As
> Zhi Li pointed out, there are places where only chip pointer will be passed and
> we'd need to extract the private data (dw_edma) from it.
> 
> Tbh I also considered your idea but because of the above mentioned issue and
> also referring to other implementations like gpiochip, I settled with Frank's
> idea of copying the fields.

What places are these? I see the only obstacle is the dw_edma_remove()
method. But it's easily fixable. Except that, everything else is more
or less straightforward (just a few methods need to have prototypes
converted to accepting dw_edma instead dw_edma_chip).

In order to make the code design more coherent, we need to split up
private data and device/platform info. As I see it dw_edma_chip is
nothing but a chip info data. The eDMA driver is supposed to mainly
use and pass it's private data, not the platform info. It will greatly
improve the code readability and maintainability. Such approach will
also prevent a temptation of adding new private data fields into the
dw_edma_chip structure since reaching the pointer to dw_edma will be
much easier that getting the dw_edma_chip data. In this case
dw_edma_chip will be something like i2c_board_info in i2c.

Ideally dw_edma_chip could be a temporarily defined device info, which
memory after the dw_edma_probe() method invocation could be freed. But
in order to implement that we'd need a bit more modifications
introduced.

Last but not least the approach suggested by me is easier to
implement, thus having easier review, easier backporting and causing
less potential bugs.

-Sergey

> 
> Thanks,
> Mani

  reply	other threads:[~2022-03-09 19:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 22:47 [PATCH v3 1/6] dmaengine: dw-edma: fix dw_edma_probe() can't be call globally Frank Li
2022-03-07 22:47 ` [PATCH v3 2/6] dmaengine: dw-edma-pcie: don't touch internal struct dw_edma Frank Li
2022-03-09 17:25   ` Serge Semin
2022-03-09 17:33     ` Zhi Li
2022-03-07 22:47 ` [PATCH v3 3/6] dmaengine: dw-edma: Fix programming the source & dest addresses for ep Frank Li
2022-03-07 22:47 ` [PATCH v3 4/6] dmaengine: dw-edma: Don't rely on the deprecated "direction" member Frank Li
2022-03-07 22:47 ` [PATCH v3 5/6] dmaengine: dw-edma: add flags at struct dw_edma_chip Frank Li
2022-03-10  7:44   ` Manivannan Sadhasivam
2022-03-10 17:00     ` Zhi Li
2022-03-18 18:40       ` Zhi Li
2022-03-18 19:28         ` Manivannan Sadhasivam
2022-03-10  7:55   ` Manivannan Sadhasivam
2022-03-07 22:47 ` [PATCH v3 6/6] PCI: endpoint: functions/pci-epf-test: Support PCI controller DMA Frank Li
2022-03-09 11:44   ` Manivannan Sadhasivam
2022-03-09 20:44     ` Zhi Li
2022-03-09 13:39 ` [PATCH v3 1/6] dmaengine: dw-edma: fix dw_edma_probe() can't be call globally Serge Semin
2022-03-09 16:37   ` Zhi Li
2022-03-09 18:09     ` Serge Semin
2022-03-09 18:12   ` Manivannan Sadhasivam
2022-03-09 19:01     ` Serge Semin [this message]
2022-03-10  6:22       ` Manivannan Sadhasivam
2022-03-10  8:41         ` Serge Semin
2022-03-10  8:56           ` Manivannan Sadhasivam
2022-03-10 10:51             ` Serge Semin
  -- strict thread matches above, loose matches on Subject: below --
2022-03-07 16:24 Frank Li

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=20220309190123.dnivojpqhl52o5vc@mobilestation \
    --to=fancer.lancer@gmail.com \
    --cc=Frank.Li@nxp.com \
    --cc=Sergey.Semin@baikalelectronics.ru \
    --cc=bhelgaas@google.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=hongxing.zhu@nxp.com \
    --cc=kw@linux.com \
    --cc=l.stach@pengutronix.de \
    --cc=linux-imx@nxp.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=lznuaa@gmail.com \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=robh@kernel.org \
    --cc=shawnguo@kernel.org \
    --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
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).