On 10.01.2022 10:09, Christoph Hellwig wrote:
On Thu, Jan 06, 2022 at 08:17:44PM -0800, Florian Fainelli wrote:
From: Rafał Miłecki <rafal@xxxxxxxxxx>
For bus devices to be fully usable it's required to set their DMA
parameters.
For years it has been missing and remained unnoticed because of
mips_dma_alloc_coherent() silently handling the empty coherent_dma_mask.
Kernel 4.19 came with a lot of DMA changes and caused a regression on
the bcm47xx. Starting with the commit f8c55dc6e828 ("MIPS: use generic
dma noncoherent ops for simple noncoherent platforms") DMA coherent
allocations just fail. Example:
[ 1.114914] bgmac_bcma bcma0:2: Allocation of TX ring 0x200 failed
[ 1.121215] bgmac_bcma bcma0:2: Unable to alloc memory for DMA
[ 1.127626] bgmac_bcma: probe of bcma0:2 failed with error -12
[ 1.133838] bgmac_bcma: Broadcom 47xx GBit MAC driver loaded
This change fixes above regression in addition to the MIPS bcm47xx
commit 321c46b91550 ("MIPS: BCM47XX: Setup struct device for the SoC").
How did it take so long to notice this?
I noticed it 3 years ago and sent semi-fix that wasn't accepted (for
probably a good reason) back then:
[PATCH wireless-drivers-next] bcma: get SoC device struct & copy its DMA params to the subdevices
https://patchwork.kernel.org/project/linux-wireless/patch/20190121101121.24555-1-zajec5@xxxxxxxxx/
Since then OpenWrt carried on above fix as a downstream patch.
I guess OpenWrt is the only active user of that code.
Thanks a lot Florian for bringing that upstream.