atomic: hwspinlock backend for cxd56, rp2040, lc823450 - #19868
Draft
zhangyu-duck wants to merge 4 commits into
Draft
atomic: hwspinlock backend for cxd56, rp2040, lc823450#19868zhangyu-duck wants to merge 4 commits into
zhangyu-duck wants to merge 4 commits into
Conversation
zhangyu-duck
force-pushed
the
pr3-atomic-builtin
branch
from
August 17, 2026 14:43
4146820 to
e2c8ba1
Compare
🔗 Cross-repo PR dependenciesThe read-only Build run reported the following dependent PR(s) and fetched head SHA(s): CI run: https://github.com/apache/nuttx/actions/runs/32090737453 |
zhangyu-duck
force-pushed
the
pr3-atomic-builtin
branch
3 times, most recently
from
August 18, 2026 08:22
f0c81bb to
8b63c5f
Compare
🔗 Cross-repo PR dependenciesThe read-only Build run reported the following dependent PR(s) and fetched head SHA(s): CI run: https://github.com/apache/nuttx/actions/runs/32116047543 |
zhangyu-duck
force-pushed
the
pr3-atomic-builtin
branch
from
August 18, 2026 11:40
8b63c5f to
74df816
Compare
🔗 Cross-repo PR dependenciesThe read-only Build run reported the following dependent PR(s) and fetched head SHA(s): CI run: https://github.com/apache/nuttx/actions/runs/32132885300 |
zhangyu-duck
force-pushed
the
pr3-atomic-builtin
branch
from
August 19, 2026 05:20
74df816 to
fecc8e7
Compare
zhangyu-duck
force-pushed
the
pr3-atomic-builtin
branch
from
August 19, 2026 06:30
fecc8e7 to
7b15613
Compare
zhangyu-duck
marked this pull request as ready for review
August 19, 2026 06:35
zhangyu-duck
requested review from
acassis,
eren-terzioglu,
fdcavalcanti,
liuguo09 and
lupyuen
as code owners
August 19, 2026 06:35
zhangyu-duck
marked this pull request as draft
August 19, 2026 07:29
Contributor
|
please split the PR in separate PRs
|
zhangyu-duck
force-pushed
the
pr3-atomic-builtin
branch
5 times, most recently
from
August 24, 2026 06:51
9b1d55a to
afb4c2c
Compare
Use irq-based critical sections instead of spinlock_irq to avoid potential deadlock in atomic contexts. Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
Add hardware spinlock driver implementations for cxd56, rp2040, and lc823450 chips. These drivers provide the hwspinlock_ops_s interface used by the atomic hwspinlock backend. Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
Implement atomic_lock/atomic_unlock using hwspinlock when CONFIG_LIBC_ATOMIC_HWSPINLOCK is selected, and using up_irq_save/ up_irq_restore when CONFIG_LIBC_ATOMIC_IRQ is selected. Rename arch_atomic_irq.c to arch_atomic.c. The 64-bit atomic operations use spinlock (spin_lock_irqsave) regardless of the selected backend, ensuring multi-core safety. Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
Add per-chip atomic hwspinlock device definitions for cxd56, rp2040, and lc823450. These provide the hardware spinlock device used by the atomic hwspinlock backend for multi-core atomic operations. Replace CXD56_TESTSET/CXD56_TESTSET_WITH_HWSEM with CXD56_ATOMIC_WITH_HWSEM which selects LIBC_ATOMIC_HWSPINLOCK, bridging the old chip-specific testset mechanism to the new generic atomic backend framework. Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
zhangyu-duck
force-pushed
the
pr3-atomic-builtin
branch
from
August 24, 2026 07:22
afb4c2c to
0fdfe98
Compare
| #include <stdint.h> | ||
| #include <nuttx/irq.h> | ||
| #include <nuttx/macro.h> | ||
| #if defined(CONFIG_LIBC_ATOMIC_HWSPINLOCK) |
Contributor
There was a problem hiding this comment.
where you add LIBC_ATOMIC_HWSPINLOCK?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add hwspinlock-based atomic backend for multi-core capable chips:
LIBC_ATOMIC_HWSPINLOCKis selectedarch_atomic_irq.cback toarch_atomic.cwith combined IRQ + hwspinlock implementationThis PR depends on #19867 (multi-backend framework + builtin + API rename).
Stacked PR chain
Depends on #19867. This is PR 3 of 3:
Test
CI testbuild across ARM/RISC-V/SIM targets.
depends-on: apache/nuttx-apps/pull/3733