Re: mmc vs highmem, was: Re: [PATCH 2/2] blk-mq: ensure a q_usage_counter reference is held when splitting bios

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 24, 2024, at 14:49, Linus Walleij wrote:
> On Mon, Jan 22, 2024 at 10:26 AM Arnd Bergmann <arnd@xxxxxxxx> wrote:
>
>> I found five drivers that have a legacy platform device
>> definition without a DMA mask:
>>
>> arch/m68k/coldfire/device.c: "sdhci-esdhc-mcf"
>> arch/arm/mach-omap1/devices.c: "mmci-omap" (slave DMA)
>> arch/sh/boards/board-sh7757lcr.c: "sh_mmcif" (slave DMA)
>> arch/sh/boards/mach-ecovec24/setup.c: sh_mmcif" (slave DMA)
>> arch/sh/boards/mach-*/setup.c: "sh_mobile_sdhi" (slave DMA)
>> drivers/misc/cb710/core.c: "cb710-mmc" (pio-only)
>>
>> None of these embedded platforms actually have highmem,
>> though the omap1 machine may run a kernel that has highmem
>> support enabled.
>>
>> Most of the others only support DT based probing after we
>> removed a lot of old board files a year ago, so they will
>> always have a 32-bit mask set at probe time.
>
> For sh_mmcif I just added dma_mask and coherent_dma_mask
> as DMA_BIT_MASK(32) in the boardfile

I think technically it's wrong to set the DMA mask
for the sh_mmcif device. The mask is set correctly
for the dmaengine driver, which is used correctly in

        ret = dma_map_sg(chan->device->dev, sg, data->sg_len,
                         DMA_FROM_DEVICE);

Since SH never has highmem, I don't think there is
anything that needs to be done for these.

Also for cb710, there is no DMA, and highmem gets
handled correctly through using sg_miter_next() etc.

> and I consider doing it
> for pretty much all of them: If they
> - Run without HIGHMEM enabled and
> - With highmem are bouncing buffers around to PKMAP (right?) when
>   BLK_BOUNCE_HIGH is set

> That kind of indicates that they are
> probably 32bit DMA capable, pretty much as the device trees
> assumes in most cases.

> This avoids doing Kconfig trickery, make it runtime handled
> and we can delete BLK_BOUNCE_HIGH as that branch is
> never taken and just refuse to probe if dma_mask == 0.

We can probably treat this as two different issues now:

a) drivers that don't set a DMA mask get the block layer
   bounce buffers, and as far as I can tell none of these
   actually need the bounce buffers, so we can already
   remove the BLK_BOUNCE_HIGH setting without causing
   a chance in behavior. cb710 is likely to see a
   small performance improvement when used on highmem
   systems without BLK_BOUNCE_HIGH but it's a very slow
   and old device, so nobody will notice

b) drivers that use sg_virt() instead of kmap_local_page()
   or sg_iter are currently broken if they run on on
   systems using highmem, as there is no bounce buffer
   when the DMA mask is set. Some of these may have
   used BLK_BOUNCE_HIGH in the past before the conversion
   to DT probing.

It's the second point that requires the Kconfig dependency.

      Arnd





[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux