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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YZJbLol1llm+puDT@pendragon.ideasonboard.com>
Date:   Mon, 15 Nov 2021 15:05:50 +0200
From:   Laurent Pinchart <laurent.pinchart@...asonboard.com>
To:     Arnd Bergmann <arnd@...nel.org>
Cc:     Vinod Koul <vkoul@...nel.org>, Arnd Bergmann <arnd@...db.de>,
        Andy Gross <agross@...nel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Baolin Wang <baolin.wang7@...il.com>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Chunyan Zhang <zhang.lyra@...il.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Hyun Kwon <hyun.kwon@...inx.com>,
        Jaroslav Kysela <perex@...ex.cz>,
        Jon Hunter <jonathanh@...dia.com>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Laxman Dewangan <ldewangan@...dia.com>,
        Manivannan Sadhasivam <mani@...nel.org>,
        Mark Brown <broonie@...nel.org>,
        Michal Simek <michal.simek@...inx.com>,
        Nicolas Saenz Julienne <nsaenz@...nel.org>,
        Orson Zhai <orsonzhai@...il.com>,
        Robert Jarzmik <robert.jarzmik@...e.fr>,
        Scott Branden <sbranden@...adcom.com>,
        Takashi Iwai <tiwai@...e.com>,
        Thierry Reding <thierry.reding@...il.com>,
        ALSA Development Mailing List <alsa-devel@...a-project.org>,
        bcm-kernel-feedback-list <bcm-kernel-feedback-list@...adcom.com>,
        dmaengine@...r.kernel.org,
        dri-devel <dri-devel@...ts.freedesktop.org>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        linux-arm-msm <linux-arm-msm@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-mmc <linux-mmc@...r.kernel.org>,
        linux-mtd <linux-mtd@...ts.infradead.org>,
        "moderated list:BROADCOM BCM2835 ARM ARCHITECTURE" 
        <linux-rpi-kernel@...ts.infradead.org>,
        "open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>,
        linux-spi <linux-spi@...r.kernel.org>,
        linux-staging@...ts.linux.dev,
        "open list:TEGRA ARCHITECTURE SUPPORT" <linux-tegra@...r.kernel.org>
Subject: Re: [PATCH 08/11] dmaengine: xilinx_dpdma: stop using slave_id field

Hi Arnd,

On Mon, Nov 15, 2021 at 01:38:07PM +0100, Arnd Bergmann wrote:
> On Mon, Nov 15, 2021 at 12:49 PM Laurent Pinchart wrote:
> > On Mon, Nov 15, 2021 at 11:21:30AM +0100, Arnd Bergmann wrote:
> > > On Mon, Nov 15, 2021 at 10:14 AM Laurent Pinchart wrote:
> > > > On Mon, Nov 15, 2021 at 09:54:00AM +0100, Arnd Bergmann wrote:
> > > > > @@ -1285,11 +1287,13 @@ static int xilinx_dpdma_config(struct dma_chan *dchan,
> > > > >       spin_lock_irqsave(&chan->lock, flags);
> > > > >
> > > > >       /*
> > > > > -      * Abuse the slave_id to indicate that the channel is part of a video
> > > > > -      * group.
> > > > > +      * Abuse the peripheral_config to indicate that the channel is part
> > > >
> > > > Is it still an abuse, or is this now the right way to pass custom data
> > > > to the DMA engine driver ?
> > >
> > > It doesn't make the driver any more portable, but it's now being
> > > more explicit about it. As far as I can tell, this is the best way
> > > to pass data that cannot be expressed through the regular interfaces
> > > in DT and the dmaengine API.
> > >
> > > Ideally there would be a generic way to pass this flag, but I couldn't
> > > figure out what this is actually doing, or whether there is a better
> > > way. Maybe Vinod has an idea.
> >
> > I don't think we need a generic API in this case. The DMA engine is
> > specific to the display device, I don't foresee a need to mix-n-match.
> 
> Right. I wonder if there is even a point in using the dmaengine API
> in that case, I think for other single-purpose drivers we tend to just
> integrate the functionality in the client driver. No point changing this
> now of course, but it does feel odd.

I agree, and that's what I would have done as well, if it wasn't for the
fact that the DMA engine also supports a second client for audio. This
isn't supported in upstream yet. We could still have created an ad-hoc
solution, possibly based on the components framework, but the DMA engine
subsystem wasn't a bad fit.

> From my earlier reading of the driver, my impression was that this
> is just a memory-to-memory device, so it could be used that way
> as well, but does need a flag when working on the video memory.
> I couldn't quite make sense of that though.

It's only memory-to-device (video and audio). See figures 33-1 and 33-16
in https://www.xilinx.com/support/documentation/user_guides/ug1085-zynq-ultrascale-trm.pdf

> > >         /*
> > >          * Use the peripheral_config to indicate that the channel is part
> > >          * of a video group. This requires matching use of the custom
> > >          * structure in each driver.
> > >          */
> > >         pconfig = config->peripheral_config;
> > >         if (WARN_ON(config->peripheral_size != 0 &&
> > >                     config->peripheral_size != sizeof(*pconfig)))
> > >                 return -EINVAL;
> >
> > How about
> >
> >         if (WARN_ON(config->peripheral_config &&
> >                     config->peripheral_size != sizeof(*pconfig)))
> >
> > >
> > >         spin_lock_irqsave(&chan->lock, flags);
> > >         if (chan->id <= ZYNQMP_DPDMA_VIDEO2 &&
> > >             config->peripheral_size == sizeof(*pconfig))
> >
> > And here you can test pconfig != NULL.
> 
> Good idea. Changed now, using 'if (pconfig)' without the '!= NULL'
> in both expressions.

Sounds good to me.

-- 
Regards,

Laurent Pinchart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ