Skip to content

Fix two more RP1 DMA bugs #6734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 20, 2025
Merged

Conversation

pelwell
Copy link
Contributor

@pelwell pelwell commented Mar 20, 2025

Two bugs discovered while investigating #6733:

  1. axi_desc_put should not assume that all the LLIs owned by the descriptor have been initialised.
  2. It is not illegal for a memory address or transfer length to be word-odd (not a multiple of 4). However, it is illegal for the transfer length to not be a multiple of the device/register width.

pelwell added 2 commits March 20, 2025 16:44
axi_desc_put often gets called in error paths, and so can't assume that
the descriptor passed in has been completely initialised. Guard against
unallocated LLIs.

See: raspberrypi#6733

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Remove a bogus memory alignment check - transfers will be run bytewise
if needed - and add a check that the overall length is multiple of the
register size, otherwise there is residue.

See: raspberrypi#6733

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
@@ -798,6 +794,11 @@ static int dw_axi_dma_set_hw_desc(struct axi_dma_chan *chan,
return -EINVAL;
}

if (len % reg_width) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Thinking aloud, not an issue at the moment) I wonder if use-cases that have memory buffers spanning a page boundary with odd alignment are broken when using this driver - and this error message makes this case known.

But fixing this means rewriting dw_axi_dma_chan_prep_[cyclic|slave]_sg to dynamically allocate hardware descriptors inside for_each_sg().

@pelwell pelwell merged commit fc2c8c5 into raspberrypi:rpi-6.12.y Mar 20, 2025
12 checks passed
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Mar 25, 2025
kernel: fixup! dmaengine: dw-axi-dmac: Fixes for RP1
See: raspberrypi/linux#6729

kernel: drm/vc4: Correct arithmetic for shifting between columns of SAND images
See: raspberrypi/linux#6730

kernel: Adding Pisound Micro kernel module based on rpi-6.12.y
See: raspberrypi/linux#6731

kernel: Fix two more RP1 DMA bugs
See: raspberrypi/linux#6734

kernel: dts: bcm2712-rpi: Add uart0_nodma
See: raspberrypi/linux#6365
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Mar 25, 2025
kernel: fixup! dmaengine: dw-axi-dmac: Fixes for RP1
See: raspberrypi/linux#6729

kernel: drm/vc4: Correct arithmetic for shifting between columns of SAND images
See: raspberrypi/linux#6730

kernel: Adding Pisound Micro kernel module based on rpi-6.12.y
See: raspberrypi/linux#6731

kernel: Fix two more RP1 DMA bugs
See: raspberrypi/linux#6734

kernel: dts: bcm2712-rpi: Add uart0_nodma
See: raspberrypi/linux#6365
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants