Repository navigation
utilities: Add bounded bitmap accessors - #377
Open
bentheredonethat wants to merge 4 commits into
Open
bentheredonethat wants to merge 4 commits into
bentheredonethat wants to merge 4 commits into
Conversation
arnopo
requested changes
Nov 10, 2026
bentheredonethat
force-pushed
the
bitmap-bounded-accessors
branch
from
November 10, 2026 14:38
265d423 to
7ecf6da
Compare
Contributor
Author
|
@arnopo updated per your review |
bentheredonethat
force-pushed
the
bitmap-bounded-accessors
branch
from
November 10, 2026 14:41
7ecf6da to
6e13a0d
Compare
arnopo
requested changes
Nov 12, 2026
Contributor
Author
|
@arnopo The Linux IRQ migration is now in a separate commit from the bounded accessor definitions, ahead of the deprecation commit. The build and bitmap tests pass for both static and shared libraries. |
bentheredonethat
force-pushed
the
bitmap-bounded-accessors
branch
from
November 17, 2026 15:30
6e13a0d to
7c18432
Compare
arnopo
reviewed
Nov 18, 2026
arnopo
left a comment
Contributor
There was a problem hiding this comment.
one minor update requested else looks good to me
bentheredonethat
force-pushed
the
bitmap-bounded-accessors
branch
from
November 18, 2026 16:03
7c18432 to
3723671
Compare
arnopo
approved these changes
Nov 18, 2026
| #ifndef __METAL_UTILITIES__H__ | ||
| #define __METAL_UTILITIES__H__ | ||
|
|
||
| #include <errno.h> |
Collaborator
There was a problem hiding this comment.
Should be <metal/errno.h>
Add bitmap operations with unsigned bit indices and an explicit size. Set and clear return -EINVAL for invalid indices; boolean queries return false without accessing storage when out of range. Migrate bitmap searches to bounded operations while preserving search and allocation behavior. Assisted-by: Codex:GPT-6 Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Migrate Linux IRQ callers to the bounded bitmap operations. Check set and clear return values, release the IRQ lock, and log and return on failure before notifying the IRQ thread. Assisted-by: Codex:GPT-6 Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Mark the four legacy accessors deprecated and document their bounded replacements. Preserve signatures and behavior, and avoid calling a deprecated accessor from the legacy clear query. Assisted-by: Codex:GPT-6 Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Cover word boundaries, partial-word sizes, invalid indices, unchanged storage, and zero-size access. Expect false for invalid boolean queries and -EINVAL for invalid mutation operations. Report each failing operation with its bit index, bitmap size, expected result, and actual result. Restore logging settings after the test. Assisted-by: Codex:GPT-6 Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
bentheredonethat
force-pushed
the
bitmap-bounded-accessors
branch
from
November 23, 2026 15:46
3723671 to
33237f8
Compare
iuliana-prodan
approved these changes
Nov 23, 2026
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.
The existing bitmap accessors accept signed bit IDs without a bitmap size, so invalid IDs can access storage outside the bitmap. OpenAMP's remoteproc notification bitmap needs bounded operations for allocation and rollback.
Add metal_bitmap_set(), metal_bitmap_clear(), metal_bitmap_is_set(), and metal_bitmap_is_clear() with unsigned bit IDs and an explicit size in bits. Reject out-of-range IDs with -EINVAL before accessing storage. Set and clear return zero on success; queries return one or zero for valid IDs.
Deprecate the four unbounded accessors while preserving their signatures and behavior. Migrate bitmap searches and Linux IRQ callers to the bounded accessors without changing search semantics or circular allocation behavior.
Add cross-platform tests for word boundaries, partial-word bitmap sizes, out-of-range IDs, unchanged storage on failure, and zero-size access.
Note that is per OpenAMP/open-amp#707 this is created