capsules/gpio_async: enforce grant/single-process #2562
Merged
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.
Pull Request Overview
This is one of the capsules blocking #2462.
In contrast to the other PRs in the #2462 series, there's not really so much
meaning to "owning" an Async GPIO peripheral, so this PR effectively
just virtualizes the peripheral rather than enforcing single-process semantics.
Current GPIO HIL semantics notify all processes of interrupts to any
pin with interrupts configured (and it's left to higher layers to filter
activity based on which pin generated their interrupt). For Async GPIO,
this is awkward to virtualize (or not), as there is no owning process of
a pin for activity interrupts, but there is for configuration result
interrupts.
Note, however, that the underlying hardware likely can't handle multiple
concurrent configurations from multiple apps.
For now then, this capsule tracks a configuration while it is in flight
and notifies the correct process that their configuration has succeeded.
It does not track pin "owners", and notifies all apps of events on pins
(which is the same behavior as the regular gpio capsule).
In the rare case where two apps attempt concurrent configuration
requests, the later app will receive
EBUSY
. A retry loop should besufficient for most apps to handle this case.
Testing Strategy
Compiling.
TODO or Help Wanted
Not sure I love the 'notify all apps of all GPIO events' behavior, but
I believe we made that call because assigning owners to each pin
would incur non-trivial memory overhead. Might be worth thinking
through whether the same argument holds for Aysnc GPIO, but this
PR probably isn't the best place for that discussion.
Documentation Updated
/docs
, or no updates are required.Formatting
make prepush
.