[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <8ca6a46e-551a-4400-965f-f4ad60bff072@app.fastmail.com>
Date: Thu, 25 Jan 2024 10:47:26 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Linus Walleij" <linus.walleij@...aro.org>,
"Christoph Hellwig" <hch@....de>, "Ulf Hansson" <ulf.hansson@...aro.org>
Cc: "linux-mmc @ vger . kernel . org" <linux-mmc@...r.kernel.org>,
linux-kernel@...r.kernel.org,
Michał Mirosław <mirq-linux@...e.qmqm.pl>
Subject: Re: [PATCH] mmc: core Drop BLK_BOUNCE_HIGH
On Thu, Jan 25, 2024, at 09:50, Linus Walleij wrote:
> The MMC core sets BLK_BOUNCE_HIGH for devices where dma_mask
> is unassigned.
>
> For the majority of MMC hosts this path is never taken: the
> OF core will unconditionally assign a 32-bit mask to any
> OF device, and most MMC hosts are probed from device tree,
> see drivers/of/platform.c:
>
> of_platform_device_create_pdata()
> dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> if (!dev->dev.dma_mask)
> dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
>
> of_amba_device_create()
> dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
>
> MMC devices that are probed from ACPI or PCI will likewise
> have a proper dma_mask assigned.
>
> The only remaining devices that could have a blank dma_mask
> are platform devices instantiated from board files.
>
> These are mostly used on systems without CONFIG_HIGHMEM
> enabled which means the block layer will not bounce, and in
> the few cases where it is enabled it is not used anyway:
> for example some OMAP2 systems such as Nokia n800/n810 will
> create a platform_device and not assign a dma_mask, however
> they do not have any highmem, so no bouncing will happen
> anyway: the block core checks if max_low_pfn >= max_pfn
> and this will always be false.
>
> Should it turn out there is a platform_device with blank
> DMA mask actually using CONFIG_HIGHMEM somewhere out there
> we should set dma_mask for it, not do this trickery.
>
> Signed-off-by: Linus Walleij <linus.walleij@...aro.org>
Acked-by: Arnd Bergmann <arnd@...db.de>
I think it's worth mentioning the cb710 example here, which
uses a platform device as a child of a PCI device and
does not assign a DMA mask nor use DMA.
This one will see a change in behavior, meaning that the
blockdev buffers are no longer bounced. As far as I can
tell, this is fine because the driver appears to correctly
use the sg_iter infrastructure for mapping data pages,
but it would be good to have this confirmed by
Michał Mirosław because this code path has probably never
been tested without BLK_BOUNCE_HIGH.
Adding Michał to Cc.
Arnd
Powered by blists - more mailing lists