Repository navigation
cavs-ipc: modify IPC ack handling for IPC4 #6239
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,15 @@ DECLARE_SOF_UUID("ipc-task", ipc_task_uuid, 0x8fa1d42f, 0xbc6f, 0x464b, | |
|
|
||
| /* No private data for IPC */ | ||
|
|
||
|
|
||
| #if CONFIG_IPC_MAJOR_4 | ||
| #if CAVS_VERSION < CAVS_VERSION_1_8 | ||
| #error "Invalid configuration for IPC4." | ||
| #endif | ||
| #define IPC4_EARLY_ACK 1 /* ack with DONE immediately */ | ||
|
Contributor
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. Basically with this you made sure that IPC4_EARLY_ACK is only defined in case CONFIG_IPC_MAJOR_4 and when CONFIG_IPC_MAJOR_4 is set the IPC4_EARLY_ACK is also. You can just use the CONFIG_IPC_MAJOR_4 in place of IPC4_EARLY_ACK
Collaborator
Author
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. True, but I kind of prefer to have more meaning in the ifdefs. It makes the code body more readable. Well, avoiding ifdefs to begin with would be even better, but if you have to do it, having some semantics seems helpful. But yeah, style issue. |
||
| #endif | ||
|
|
||
|
|
||
| #if CONFIG_DEBUG_IPC_COUNTERS | ||
| static inline void increment_ipc_received_counter(void) | ||
| { | ||
|
|
@@ -185,6 +194,15 @@ enum task_state ipc_platform_do_cmd(struct ipc *ipc) | |
| hdr = mailbox_validate(); | ||
| #endif | ||
|
|
||
| #ifdef IPC4_EARLY_ACK | ||
| /* | ||
| * notify host that we have received the message and | ||
| * do this before we send the response | ||
| */ | ||
| ipc_write(IPC_DIPCTDR, ipc_read(IPC_DIPCTDR) | IPC_DIPCTDR_BUSY); | ||
| ipc_write(IPC_DIPCTDA, ipc_read(IPC_DIPCTDA) | IPC_DIPCTDA_DONE); | ||
|
Contributor
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. According to cAVS 2.5 HW Arch Spec, IPC flow should be implemented as follows:
Replacing 3. and 4. will violate the architecture flow. At present cAVS closed-source solution, BUSY and DONE are triggered after processing message from host and before writing response. It seems to be the best way.
Collaborator
Author
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. Thanks @pblaszko ! Indeed, this is what @ujfalusi also commented in last Friday in #6239 (comment) . And yes, this seems to be the correct thing. The key seems to be whether busy+done clearance is done before or after the response is sent. We are err'ing towards the direction that host/kernel should handle even the case where busy+done is cleared only at the end (i.e. the original sequence). |
||
| #endif | ||
|
|
||
| /* perform command */ | ||
| ipc_cmd(hdr); | ||
|
Contributor
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. Right, I see. the reply is sent as a new message within One way to be safer is to add a flag to |
||
|
|
||
|
|
@@ -204,9 +222,11 @@ void ipc_platform_complete_cmd(struct ipc *ipc) | |
| #if CAVS_VERSION == CAVS_VERSION_1_5 | ||
| ipc_write(IPC_DIPCT, ipc_read(IPC_DIPCT) | IPC_DIPCT_BUSY); | ||
| #else | ||
| #ifndef IPC4_EARLY_ACK | ||
| ipc_write(IPC_DIPCTDR, ipc_read(IPC_DIPCTDR) | IPC_DIPCTDR_BUSY); | ||
| ipc_write(IPC_DIPCTDA, ipc_read(IPC_DIPCTDA) | IPC_DIPCTDA_DONE); | ||
| #endif | ||
| #endif | ||
|
|
||
| #if CONFIG_DEBUG_IPC_COUNTERS | ||
| increment_ipc_processed_counter(); | ||
|
|
||
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.
Are you sure about this? If yes, then it should be a separate patch deprecating
CAVS_VERSION_1_5?In current code we only have checks:
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.
Probably not, if this approach is ok, maybe we need to keep the 1.5 support around for IPC4.