[PATCH v2 05/11] drm/tinydrm: Remove tinydrm_spi_max_transfer_size()

Noralf Trønnes noralf at tronnes.org
Tue Oct 15 16:55:48 UTC 2019



Den 15.10.2019 17.59, skrev Andy Shevchenko:
> On Tue, Oct 15, 2019 at 05:41:53PM +0200, Noralf Trønnes wrote:
>> Den 15.10.2019 16.32, skrev Andy Shevchenko:
>>> On Fri, Jul 19, 2019 at 05:59:10PM +0200, Noralf Trønnes wrote:
>>>> spi-bcm2835 can handle >64kB buffers now so there is no need to check
>>>> ->max_dma_len. The tinydrm_spi_max_transfer_size() max_len argument is
>>>> not used by any callers, so not needed.
>>>>
>>>> Then we have the spi_max module parameter. It was added because
>>>> staging/fbtft has support for it and there was a report that someone used
>>>> it to set a small buffer size to avoid popping on a USB soundcard on a
>>>> Raspberry Pi. In hindsight it shouldn't have been added, I should have
>>>> waited for it to become a problem first. I don't know it anyone is
>>>> actually using it, but since tinydrm_spi_transfer() is being moved to
>>>> mipi-dbi, I'm taking the opportunity to remove it. I'll add it back to
>>>> mipi-dbi if someone complains.
>>>>
>>>> With that out of the way, spi_max_transfer_size() can be used instead.
>>>>
>>>> The chosen 16kB buffer size for Type C Option 1 (9-bit) interface is
>>>> somewhat arbitrary, but a bigger buffer will have a miniscule impact on
>>>> transfer speed, so it's probably fine.
>>>
>>> This breaks the SPI PXA2xx case I'm using. The world is not a Pi:e.
>>>
>>> [  388.445752] mi0283qt spi-PRP0001:01: DMA disabled for transfer length 153600 greater than 65536
>>> [  388.634437] mi0283qt spi-PRP0001:01: DMA disabled for transfer length 153600 greater than 65536
>>> [  388.822933] mi0283qt spi-PRP0001:01: DMA disabled for transfer length 153600 greater than 65536
>>>
>>> The crucial thing is to check the transfer size against maximum DMA length
>>> of the master.
>>>
>>
>> Isn't this a spi controller driver problem?
> 
> It doesn't matter. This patch made a regression. Before it worked,
> now it doesn't.
> 
>> spi_max_transfer_size() tells the client what the maximum transfer
>> length is. The controller driver can use ctlr->max_transfer_size if it
>> has restrictions.
> 
> It might be a problem of the SPI core.
> 
>> AFAIUI max_dma_len is used when splitting up the buffer for the sg table
>> in spi_map_buf().
> 
>>> Please, fix.
> 
> Should I send the revert?
> 

Please do.

I still believe that this papers over a controller driver
bug/shortcoming, but there could be more drivers that have the same
problem so it's better to revert to the old behaviour. I guess the
problem is that not many controller drivers are tested with buffers
bigger than max_dma_len (64kB in this case, same as for the Pi).

If I have the revert by tomorrow, then I can apply it before Maxime
sends the -rc PR to Dave on Thursday.

Noralf.


More information about the dri-devel mailing list