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: <VE1PR04MB66388F89015F774EE3FFF69D89850@VE1PR04MB6638.eurprd04.prod.outlook.com>
Date:   Mon, 8 Jun 2020 15:08:45 +0000
From:   Robin Gong <yibin.gong@....com>
To:     Mark Brown <broonie@...nel.org>
CC:     "mark.rutland@....com" <mark.rutland@....com>,
        "robh+dt@...nel.org" <robh+dt@...nel.org>,
        "catalin.marinas@....com" <catalin.marinas@....com>,
        "vkoul@...nel.org" <vkoul@...nel.org>,
        "will.deacon@....com" <will.deacon@....com>,
        "shawnguo@...nel.org" <shawnguo@...nel.org>,
        "festevam@...il.com" <festevam@...il.com>,
        "s.hauer@...gutronix.de" <s.hauer@...gutronix.de>,
        "martin.fuzzey@...wbird.group" <martin.fuzzey@...wbird.group>,
        "u.kleine-koenig@...gutronix.de" <u.kleine-koenig@...gutronix.de>,
        "dan.j.williams@...el.com" <dan.j.williams@...el.com>,
        "matthias.schiffer@...tq-group.com" 
        <matthias.schiffer@...tq-group.com>,
        "linux-spi@...r.kernel.org" <linux-spi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "kernel@...gutronix.de" <kernel@...gutronix.de>,
        dl-linux-imx <linux-imx@....com>,
        "dmaengine@...r.kernel.org" <dmaengine@...r.kernel.org>
Subject: RE: [PATCH v9 RESEND 01/13] spi: imx: add dma_sync_sg_for_device
 after fallback from dma

On 2020/06/08 22:35 Mark Brown <broonie@...nel.org> wrote:
> On Sun, Jun 07, 2020 at 07:21:05AM +0800, Robin Gong wrote:
> > In case dma transfer failed and fallback to pio, tx_buf/rx_buf need to
> > be taken care cache since they have already been maintained by spi.c
> 
> Is this needed as part of this series?  This looks like an independent fix and it
> seems better to get this in independently.
But that's used to fix one patch [05/13]of the v8 patch set. To be honest, I'm also
not sure how to handle it so that I merged both into first v9....For now, I think you
are right, since 'fallback pio' patch could be independent this series. Will resend in
v10.
> 
> > Fixes: bcd8e7761ec9("spi: imx: fallback to PIO if dma setup failure")
> > Signed-off-by: Robin Gong <yibin.gong@....com>
> > Reported-by: Matthias Schiffer <matthias.schiffer@...tq-group.com>
> > Link:
> > https://lore.kernel.org/linux-arm-kernel/5d246dd81607bb6e5cb9af86ad4e5
> > 3f7a7a99c50.camel@...tq-group.com/
> 
> The Link is usually to the patch on the list.
Okay, will remove it.
> 
> > --- a/drivers/spi/spi-imx.c
> > +++ b/drivers/spi/spi-imx.c
> > @@ -1456,6 +1456,13 @@ static int spi_imx_pio_transfer(struct spi_device
> *spi,
> >  		return -ETIMEDOUT;
> >  	}
> >
> > +	if (transfer->rx_sg.sgl) {
> > +		struct device *rx_dev = spi->controller->dma_rx->device->dev;
> > +
> > +		dma_sync_sg_for_device(rx_dev, transfer->rx_sg.sgl,
> > +				       transfer->rx_sg.nents, DMA_TO_DEVICE);
> > +	}
> > +
> >  	return transfer->len;
> >  }
> 
> This is confusing - why are we DMA mapping to the device after doing a PIO
> transfer?
'transfer->rx_sg.sgl' condition check that's the case fallback PIO after DMA transfer
failed. But the spi core still think the buffer should be in 'device' while spi driver
touch it by PIO(CPU), so sync it back to device to ensure all received data flush to DDR.
  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ