[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200609133627.GG4583@sirena.org.uk>
Date: Tue, 9 Jun 2020 14:36:27 +0100
From: Mark Brown <broonie@...nel.org>
To: Robin Murphy <robin.murphy@....com>
Cc: Robin Gong <yibin.gong@....com>,
"mark.rutland@....com" <mark.rutland@....com>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"matthias.schiffer@...tq-group.com"
<matthias.schiffer@...tq-group.com>,
"martin.fuzzey@...wbird.group" <martin.fuzzey@...wbird.group>,
"catalin.marinas@....com" <catalin.marinas@....com>,
"s.hauer@...gutronix.de" <s.hauer@...gutronix.de>,
"will.deacon@....com" <will.deacon@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-spi@...r.kernel.org" <linux-spi@...r.kernel.org>,
"vkoul@...nel.org" <vkoul@...nel.org>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
dl-linux-imx <linux-imx@....com>,
"festevam@...il.com" <festevam@...il.com>,
"u.kleine-koenig@...gutronix.de" <u.kleine-koenig@...gutronix.de>,
"dmaengine@...r.kernel.org" <dmaengine@...r.kernel.org>,
"dan.j.williams@...el.com" <dan.j.williams@...el.com>,
"shawnguo@...nel.org" <shawnguo@...nel.org>,
"kernel@...gutronix.de" <kernel@...gutronix.de>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v9 RESEND 01/13] spi: imx: add dma_sync_sg_for_device
after fallback from dma
On Tue, Jun 09, 2020 at 11:00:33AM +0100, Robin Murphy wrote:
> Ah, I think I understand what's going on now. That's... really ugly :(
> Looking at the SPI core code, I think a better way to handle this would be
> to have your fallback path call spi_unmap_buf() directly (or perform the
> same actions, if exporting that to drivers is unacceptable), then make sure
> ->can_dma() returns false after that such that spi_unmap_msg() won't try to
> unmap it again. That's a lot more reasonable than trying to fake up a
> DMA_TO_DEVICE transfer in the middle of a DMA_FROM_DEVICE operation on the
> same buffer.
Ideally the driver would be checking in can_dma() if the DMA controller
is able to perform transactions rather than letting things run as far as
trying to actually do the transfer, that's a whole lot cleaner and more
manageable than running into an error doing the transfer. I'm surprised
that there's no DMA API way to figure this out TBH.
We'll also need some handling for this changing at runtime, we're not
expecting this to be dynamic at all - we're expecting it to be a static
property of the controller/transfer combination, we didn't contemplate
this varying randomly at runtime. Instead of rechecking can_dma() we
ought to have a flag saying if we did the mapping (which the bodge Robin
suggests above could clear).
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists