Repository navigation
[RFC] Implement APIs for coherent access of shared objects #4702
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
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
b308b2c
buffer: rename buffer_invalidate/writeback APIs
ranj063 b41c4e6
multicore: coherent: Add APIs for coherent access to shared objects
ranj063 77b59df
multicore: buffer: use coherent APIs
ranj063 cdbb2fc
host: use buffer acquire/release API
ranj063 78cc2ae
dai: use buffer acquire/release
ranj063 48cd865
mixer: use buffer acquire/release
ranj063 9491e57
component: use buffer acquire/release
ranj063 10f07f9
ipc-helper: use buffer acquire/release
ranj063 ce7d768
src: use buffer acquire/release
ranj063 d204630
asrc: use buffer acquire/release
ranj063 43c1213
pipeline: use buffer acquire/release
ranj063 c6b379b
crossover: use buffer acquire/release
ranj063 2e8696d
google_hotword_detec: use buffer acquire/release
ranj063 6aac6ee
tone: use buffer acquire/release
ranj063 433dfb9
kpb: use buffer_acquire/release
ranj063 4f0717a
mux: use buffer acquire/release
ranj063 407744b
selector: use buffer acquire/release
ranj063 708ec8e
smart_amp: use buffer_acquire/release
ranj063 515181a
detect_test: use buffer acquire/release
ranj063 3dcae7c
smart_amp_test: use buffer acquire/release
ranj063 5b77437
buffer: deprecate buffer_lock/unlock
ranj063 6b82d00
APL: increase the size of 256 bytes heap
ranj063 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,4 @@ CONFIG_INTEL_SSP=y | |
| CONFIG_INTEL_ALH=y | ||
| CONFIG_LP_MEMORY_BANKS=1 | ||
| CONFIG_HP_MEMORY_BANKS=46 | ||
| CONFIG_INCOHERENT=y | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,28 +45,18 @@ struct comp_buffer *buffer_alloc(uint32_t size, uint32_t caps, uint32_t align) | |
| return NULL; | ||
| } | ||
|
|
||
| buffer->lock = rzalloc(SOF_MEM_ZONE_RUNTIME_SHARED, 0, SOF_MEM_CAPS_RAM, | ||
| sizeof(*buffer->lock)); | ||
| if (!buffer->lock) { | ||
| rfree(buffer); | ||
| tr_err(&buffer_tr, "buffer_alloc(): could not alloc lock"); | ||
| return NULL; | ||
| } | ||
|
|
||
| buffer->stream.addr = rballoc_align(0, caps, size, align); | ||
| if (!buffer->stream.addr) { | ||
| rfree(buffer->lock); | ||
| rfree(buffer); | ||
| tr_err(&buffer_tr, "buffer_alloc(): could not alloc size = %u bytes of type = %u", | ||
| size, caps); | ||
| return NULL; | ||
| } | ||
|
|
||
| buffer_init(buffer, size, caps); | ||
|
|
||
| coherent_init(buffer, c); | ||
| list_init(&buffer->source_list); | ||
| list_init(&buffer->sink_list); | ||
| spinlock_init(buffer->lock); | ||
|
|
||
| return buffer; | ||
| } | ||
|
|
@@ -145,7 +135,7 @@ int buffer_set_params(struct comp_buffer *buffer, struct sof_ipc_stream_params * | |
| bool buffer_params_match(struct comp_buffer *buffer, struct sof_ipc_stream_params *params, | ||
| uint32_t flag) | ||
| { | ||
| assert(params && buffer); | ||
| assert(params); | ||
|
|
||
| if ((flag & BUFF_PARAMS_FRAME_FMT) && | ||
| buffer->stream.frame_fmt != params->frame_fmt) | ||
|
|
@@ -177,14 +167,13 @@ void buffer_free(struct comp_buffer *buffer) | |
| /* In case some listeners didn't unregister from buffer's callbacks */ | ||
| notifier_unregister_all(NULL, buffer); | ||
|
|
||
| coherent_free(buffer, c); | ||
| rfree(buffer->stream.addr); | ||
| rfree(buffer->lock); | ||
| rfree(buffer); | ||
| } | ||
|
|
||
| void comp_update_buffer_produce(struct comp_buffer *buffer, uint32_t bytes) | ||
| { | ||
| uint32_t flags = 0; | ||
| struct buffer_cb_transact cb_data = { | ||
| .buffer = buffer, | ||
| .transaction_amount = bytes, | ||
|
|
@@ -202,15 +191,13 @@ void comp_update_buffer_produce(struct comp_buffer *buffer, uint32_t bytes) | |
| return; | ||
| } | ||
|
|
||
| buffer_lock(buffer, &flags); | ||
| buffer = buffer_acquire_irq(buffer); | ||
|
|
||
| audio_stream_produce(&buffer->stream, bytes); | ||
|
|
||
| notifier_event(buffer, NOTIFIER_ID_BUFFER_PRODUCE, | ||
| NOTIFIER_TARGET_CORE_LOCAL, &cb_data, sizeof(cb_data)); | ||
|
|
||
| buffer_unlock(buffer, flags); | ||
|
|
||
| addr = buffer->stream.addr; | ||
|
|
||
| buf_dbg(buffer, "comp_update_buffer_produce(), ((buffer->avail << 16) | buffer->free) = %08x, ((buffer->id << 16) | buffer->size) = %08x", | ||
|
|
@@ -220,11 +207,12 @@ void comp_update_buffer_produce(struct comp_buffer *buffer, uint32_t bytes) | |
| buf_dbg(buffer, "comp_update_buffer_produce(), ((buffer->r_ptr - buffer->addr) << 16 | (buffer->w_ptr - buffer->addr)) = %08x", | ||
| ((char *)buffer->stream.r_ptr - addr) << 16 | | ||
| ((char *)buffer->stream.w_ptr - addr)); | ||
|
|
||
| buffer = buffer_release_irq(buffer); | ||
| } | ||
|
|
||
| void comp_update_buffer_consume(struct comp_buffer *buffer, uint32_t bytes) | ||
| { | ||
| uint32_t flags = 0; | ||
| struct buffer_cb_transact cb_data = { | ||
| .buffer = buffer, | ||
| .transaction_amount = bytes, | ||
|
|
@@ -242,15 +230,13 @@ void comp_update_buffer_consume(struct comp_buffer *buffer, uint32_t bytes) | |
| return; | ||
| } | ||
|
|
||
| buffer_lock(buffer, &flags); | ||
| buffer = buffer_acquire_irq(buffer); | ||
|
|
||
| audio_stream_consume(&buffer->stream, bytes); | ||
|
|
||
| notifier_event(buffer, NOTIFIER_ID_BUFFER_CONSUME, | ||
| NOTIFIER_TARGET_CORE_LOCAL, &cb_data, sizeof(cb_data)); | ||
|
|
||
| buffer_unlock(buffer, flags); | ||
|
|
||
| addr = buffer->stream.addr; | ||
|
|
||
| buf_dbg(buffer, "comp_update_buffer_consume(), (buffer->avail << 16) | buffer->free = %08x, (buffer->id << 16) | buffer->size = %08x, (buffer->r_ptr - buffer->addr) << 16 | (buffer->w_ptr - buffer->addr)) = %08x", | ||
|
|
@@ -259,4 +245,6 @@ void comp_update_buffer_consume(struct comp_buffer *buffer, uint32_t bytes) | |
| (buffer->id << 16) | buffer->stream.size, | ||
| ((char *)buffer->stream.r_ptr - addr) << 16 | | ||
| ((char *)buffer->stream.w_ptr - addr)); | ||
|
|
||
| buffer = buffer_release_irq(buffer); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
| } | ||
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
no need to assign