From: "Arnd Bergmann" <arnd@arndb.de>
To: "James Clark" <james.clark@linaro.org>, "Christoph Hellwig" <hch@lst.de>
Cc: "Mark Brown" <broonie@kernel.org>,
"Vladimir Oltean" <olteanv@gmail.com>,
oe-kbuild-all@lists.linux.dev,
"Larisa Grigore" <larisa.grigore@nxp.com>,
"Frank Li" <Frank.li@nxp.com>,
linux-spi@vger.kernel.org, imx@lists.linux.dev,
linux-kernel@vger.kernel.org, "kernel test robot" <lkp@intel.com>,
"Marek Szyprowski" <m.szyprowski@samsung.com>,
"Robin Murphy" <robin.murphy@arm.com>,
iommu@lists.linux.dev
Subject: Re: [PATCH] dma-mapping: Stub out dma_{alloc,free,map}_pages() API
Date: Mon, 16 Jun 2025 15:48:50 +0200 [thread overview]
Message-ID: <9788991a-ac37-4fde-81db-c55035d00f27@app.fastmail.com> (raw)
In-Reply-To: <f723d490-c228-42d5-9f9f-158df54a092d@linaro.org>
On Mon, Jun 16, 2025, at 15:23, James Clark wrote:
> On 16/06/2025 2:19 pm, Christoph Hellwig wrote:
>> On Mon, Jun 16, 2025 at 02:15:56PM +0100, James Clark wrote:
>>>> Yes it does, it has a few modes that don't require it. Presumably we can't
>>>> just add a depends into the kconfig for all devices because they might not
>>>> be using DMA.
>>>
>>> *for all the different variants of spi-fsl-dpsi devices I mean
>>
>> This is drivers/spi/spi-fsl-dspi.c?
>>
>> Yes, looks like it is one of those rare devices supporting a DMA and
>> non-DMA mode. But everything seems nicely guarded off using
>> "dspi->devtype_data->trans_mode == DSPI_DMA_MODE" checks there. So
>> wrap them into a little helper using IS_ENABLED(CONFIG_HAS_DMA) and
>> everything should be sorted out.
>
> Sure, I don't mind doing it.
>
> But separately to that, I still think making the stubs consistent would
> save people a lot of time diagnosing build failures if they switch
> existing code to any of those 3 functions. Principle of Least
> Astonishment and all that.
As far as I can tell, the difference here is that the
dma_alloc_coherent()/dma_free_coherent() calls all get stubbed
out, so the 827 drivers using those can all build cleanly on
mk68knommu, shnommu and UML, while dma_alloc_noncoherent()/
dma_free_noncoherent() are only used on 15 files that are all
guarded by some other Kconfig dependency at the moment and won't
build on the those platforms.
I agree that it would be best to treat the coherent/noncoherent
cases the same, and I also think the existing stubs are a bit
silly, but just removing them would likely require fixing
hundreds of drivers with added Kconfig or IS_ENABLED() checks.
Maybe we can actually remove CONFIG_NO_DMA/CONFIG_HAS_DMA
entirely and remove all the checks for CONFIG_HAS_DMA?
My guess is that this would only lead to a small code size
increase on the affected targets, but since they are not
actually trying to do DMA, and they all have a very limited
set of drivers they actually use, it won't break existing
code.
Arnd
next prev parent reply other threads:[~2025-06-16 13:49 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-13 9:28 [PATCH v2 0/5] spi: spi-fsl-dspi: Target mode improvements James Clark
2025-06-13 9:28 ` [PATCH v2 1/5] spi: spi-fsl-dspi: Clear completion counter before initiating transfer James Clark
2025-06-13 9:28 ` [PATCH v2 2/5] spi: spi-fsl-dspi: Use non-coherent memory for DMA James Clark
2025-06-15 16:31 ` kernel test robot
2025-06-16 11:17 ` [PATCH] dma-mapping: Stub out dma_{alloc,free,map}_pages() API James Clark
2025-06-16 11:21 ` James Clark
2025-06-16 11:28 ` Arnd Bergmann
2025-06-16 11:29 ` Christoph Hellwig
2025-06-16 12:06 ` Mark Brown
2025-06-16 12:08 ` Christoph Hellwig
2025-06-16 12:11 ` Mark Brown
2025-06-16 12:14 ` Christoph Hellwig
2025-06-16 13:05 ` Mark Brown
2025-06-16 13:12 ` Christoph Hellwig
2025-06-16 13:10 ` James Clark
2025-06-16 13:13 ` Christoph Hellwig
2025-06-16 13:14 ` James Clark
2025-06-16 13:15 ` James Clark
2025-06-16 13:19 ` Christoph Hellwig
2025-06-16 13:23 ` James Clark
2025-06-16 13:48 ` Arnd Bergmann [this message]
2025-06-16 18:33 ` Arnd Bergmann
2025-06-17 4:48 ` Christoph Hellwig
2025-06-17 7:53 ` Arnd Bergmann
2025-06-17 8:26 ` Arnd Bergmann
2025-06-17 15:55 ` Jason Gunthorpe
2025-06-16 11:56 ` [PATCH v2 2/5] spi: spi-fsl-dspi: Use non-coherent memory for DMA Robin Murphy
2025-06-16 13:06 ` James Clark
2025-06-13 9:28 ` [PATCH v2 3/5] spi: spi-fsl-dspi: Increase DMA buffer size James Clark
2025-06-13 9:28 ` [PATCH v2 4/5] spi: spi-fsl-dspi: Store status directly in cur_msg->status James Clark
2025-06-13 9:29 ` [PATCH v2 5/5] spi: spi-fsl-dspi: Report FIFO overflows as errors James Clark
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=9788991a-ac37-4fde-81db-c55035d00f27@app.fastmail.com \
--to=arnd@arndb.de \
--cc=Frank.li@nxp.com \
--cc=broonie@kernel.org \
--cc=hch@lst.de \
--cc=imx@lists.linux.dev \
--cc=iommu@lists.linux.dev \
--cc=james.clark@linaro.org \
--cc=larisa.grigore@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=lkp@intel.com \
--cc=m.szyprowski@samsung.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=olteanv@gmail.com \
--cc=robin.murphy@arm.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
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