Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

teburd
Copy link
Collaborator

@teburd teburd commented Nov 17, 2023

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

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]>
@zephyrbot zephyrbot added the area: DMA Direct Memory Access label Nov 17, 2023
@teburd
Copy link
Collaborator Author

teburd commented Nov 17, 2023

@pbalsundar

@@ -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);
Copy link
Collaborator

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) {
Copy link
Collaborator

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.

Copy link

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.

@github-actions github-actions bot added the Stale label Apr 16, 2024
@github-actions github-actions bot closed this Apr 30, 2024
@teburd teburd reopened this Apr 30, 2024
@github-actions github-actions bot removed the Stale label May 1, 2024
Copy link

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.

@github-actions github-actions bot added the Stale label Jun 30, 2024
@github-actions github-actions bot closed this Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: DMA Direct Memory Access Stale
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants