Skip to content

Create and use a new cacheline-aligned reference type#5744

Merged
bugadani merged 8 commits into
esp-rs:mainfrom
bugadani:dma-aligned
Jun 18, 2026
Merged

Create and use a new cacheline-aligned reference type#5744
bugadani merged 8 commits into
esp-rs:mainfrom
bugadani:dma-aligned

Conversation

@bugadani

@bugadani bugadani commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

The goal of this PR is to make the *DmaBuf types take the cacheline-wrapped descriptors/buffers by default, and allow a safe validating, as well as an unsafe fallback option to construct them.

The new reference type has safe cache operations and can represent data living in both internal RAM and PSRAM.

This reference type will be the base of most of our DMA internals - it validates slices/descriptor lists, it can safely implement cache operations because of its invariants, and hopefully will allow us to have higher perf by avoiding unnecessary writebacks as well. It makes constructing buffers a bit less friendly, but that's hidden from us by the macros currently.

This would have been part of #5728 but it's annoyingly big by itself.

Changelog

esp-hal/DMA

  • Added: esp_hal::dma::aligned::{InternalMemory, DmaAlignedMut} types.
  • Changed: DMA buffer types now take DmaAlignedMut-wrapped descriptor lists and buffers.

@Dominaezzz Dominaezzz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I know it's a draft but I couldn't look away from such big DMA changes....

Comment thread esp-hal/src/dma/aligned.rs Outdated
Comment thread esp-hal/src/dma/aligned.rs Outdated
@bugadani bugadani force-pushed the dma-aligned branch 20 times, most recently from 4d4fe06 to 2e59c37 Compare June 16, 2026 14:38
@bugadani bugadani marked this pull request as ready for review June 16, 2026 15:22

@Dominaezzz Dominaezzz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overall LGTM but I'll say the InternalMemory name is still really unfortunate

Comment thread esp-hal/src/dma/aligned.rs Outdated
Comment thread esp-hal/src/dma/aligned.rs Outdated
Comment thread esp-hal/src/dma/aligned.rs Outdated
Comment thread examples/peripheral/spi/loopback_dma_psram/src/main.rs
Comment thread esp-hal/src/dma/m2m.rs
Comment thread esp-hal/src/dma/mod.rs
Comment thread esp-hal/src/dma/aligned.rs Outdated
@bugadani bugadani force-pushed the dma-aligned branch 3 times, most recently from 4c54c4d to 3c7d958 Compare June 17, 2026 08:48
@bugadani

bugadani commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

/hil full

@github-actions

This comment was marked as outdated.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

Triggered full HIL run for #5744.

Run: https://github.com/esp-rs/esp-hal/actions/runs/27691042282

Status update: HIL (full) run is still in progress or status unknown.

@MabezDev

Copy link
Copy Markdown
Member

Not sure why the bot struggled here, HIL failed at the build stage, the tests need updating I think.

@bugadani

Copy link
Copy Markdown
Contributor Author

Not sure why the bot struggled here, HIL failed at the build stage, the tests need updating I think.

It's doing what I ask of it, I'm babysitting the process.

@MabezDev MabezDev added this pull request to the merge queue Jun 18, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 18, 2026
@bugadani bugadani enabled auto-merge June 18, 2026 10:11
@bugadani bugadani added this pull request to the merge queue Jun 18, 2026
Merged via the queue into esp-rs:main with commit e249bc3 Jun 18, 2026
23 checks passed
@bugadani bugadani deleted the dma-aligned branch June 18, 2026 11:35
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