Re: [PATCH] dma: fix DMA sync for drivers not calling dma_set_mask*()

From: Alexander Lobakin
Date: Thu May 09 2024 - 11:17:51 EST


From: Steven Price <steven.price@xxxxxxx>
Date: Thu, 9 May 2024 16:11:26 +0100

> On 09/05/2024 15:46, Alexander Lobakin wrote:
>> There are several reports that the DMA sync shortcut broke non-coherent
>> devices.
>> dev->dma_need_sync is false after the &device allocation and if a driver
>> didn't call dma_set_mask*(), it will still be false even if the device
>> is not DMA-coherent and thus needs synchronizing. Due to historical
>> reasons, there's still a lot of drivers not calling it.
>> Invert the boolean, so that the sync will be performed by default and
>> the shortcut will be enabled only when calling dma_set_mask*().
>>
>> Reported-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
>> Closes: https://lore.kernel.org/lkml/46160534-5003-4809-a408-6b3a3f4921e9@xxxxxxxxxxx
>> Reported-by: Steven Price <steven.price@xxxxxxx>
>> Closes: https://lore.kernel.org/lkml/010686f5-3049-46a1-8230-7752a1b433ff@xxxxxxx
>> Fixes: 32ba8b823252 ("dma: avoid redundant calls for sync operations")
>> Signed-off-by: Alexander Lobakin <aleksander.lobakin@xxxxxxxxx>
>
> Tested-by: Steven Price <steven.price@xxxxxxx>

Thank!

>
> Thanks for the quick fix.
>
> Note that the fixes hash (32ba8b823252) is not the one in linux-next -
> that's f406c8e4b770. If the branch is getting rebased then no problem, I
> just thought I should point that out.

Oh crap, it really should be f406. Wrong tree again >_<

Chris, would you fix it when applying or I should resend?

>
> Thanks,
> Steve

Thanks,
Olek