-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
dma: Allow for driver implemented channel pooling #65390
Conversation
DMA channels can be viewed as a pool of resources in some instances. When using struct dma_context the default channel request/release use an atomic bit flag to indicate channel availability and this works well in most cases. In some cases however, when channel counts are low and peripheral counts high it might be beneficial to allow for thread pends to occur on channel requests on a mutex or semaphore. Signed-off-by: Tom Burdick <[email protected]>
@@ -313,6 +313,9 @@ struct dma_context { | |||
typedef int (*dma_api_config)(const struct device *dev, uint32_t channel, | |||
struct dma_config *config); | |||
|
|||
typedef int (*dma_api_request_channel)(const struct device *dev, void *filter_param); | |||
typedef int (*dma_api_release_channel)(const struct device *dev, uint32_t channel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so these two shall used in pair, right? suggest to document this.
@@ -557,6 +562,11 @@ static inline int z_impl_dma_request_channel(const struct device *dev, | |||
/* dma_context shall be the first one in dev data */ | |||
struct dma_context *dma_ctx = (struct dma_context *)dev->data; | |||
|
|||
/* Driver has overridden the default implementation */ | |||
if (api->request_channel) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible that move to application to handle the soc level? as for DMA driver, it does not know how many request need to shared/can be shared. it is related to SOC integartion.
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
DMA channels can be viewed as a pool of resources in some instances. When using struct dma_context the default channel request/release use an atomic bit flag to indicate channel availability and this works well in most cases.
In some cases however, when channel counts are low and peripheral counts high it might be beneficial to allow for thread pends to occur on channel requests on a mutex or semaphore.
Related to #61444