Skip to content
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

arm64/imx9: Add DMA memory allocator #12228

Merged
merged 2 commits into from
Apr 30, 2024

Conversation

pussuw
Copy link
Contributor

@pussuw pussuw commented Apr 24, 2024

Summary

Add a DMA memory allocator for iMX9. Can be used for FAT sector buffers, peripheral DMA buffers and so forth. Separate, properly aligned buffers are needed for cache line alignment.

Impact

Add cache safe DMA buffers

Testing

imx93-evk:nsh

arch/arm64/src/imx9/imx9_lpspi.c Outdated Show resolved Hide resolved
@acassis
Copy link
Contributor

acassis commented Apr 24, 2024

@xiaoxiang781216 is there some way to fix it:

E: Failed to fetch https://packages.microsoft.com/ubuntu/22.04/prod/dists/jammy/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'https://packages.microsoft.com/ubuntu/22.04/prod jammy InRelease' is no longer signed.
Error: Process completed with exit code 100.

@simbit18
Copy link
Contributor

@acassis https://www.githubstatus.com/

microsoft/linux-package-repositories#130 (comment)

@pussuw pussuw force-pushed the imx9_dma_alloc branch 3 times, most recently from 841378c to bc41dcd Compare April 25, 2024 11:49
pussuw added 2 commits April 30, 2024 11:35
Add a simple allocator for DMA safe memory. It will provide contiguous
blocks of memory with D-Cache line size alignment.

NOTE: The optimal granule size is the D-Cache line size (64), but due
to restrictions in the granule allocator this would result in a maximum
block size of 2K only, thus use 256B granules instead givin 8K max block
size.

Once the granule allocator is fixed this limitation can be removed.
Using user allocated buffers for DMA transfers is not safe for two reasons:
- User space memory is virtual memory, DMA needs physical memory
- User memory buffer alignment cannot be guaranteed -> cache line ops
  are not safe
@xiaoxiang781216 xiaoxiang781216 merged commit 3b5b755 into apache:master Apr 30, 2024
26 checks passed
@pussuw pussuw deleted the imx9_dma_alloc branch April 30, 2024 12:30
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.

5 participants