Skip to content

IPC4 error code corrections#10808

Open
wjablon1 wants to merge 4 commits into
thesofproject:mainfrom
wjablon1:ipc_err_code_fix
Open

IPC4 error code corrections#10808
wjablon1 wants to merge 4 commits into
thesofproject:mainfrom
wjablon1:ipc_err_code_fix

Conversation

@wjablon1
Copy link
Copy Markdown
Contributor

These commits correct a bunch of error codes to improve compliance with the IPC4 protocol. This allows me to re-enable older tests that are shared with the reference firmware. Some of the fixes seem sound, while others seem more arbitrary, especially the change from MOD_INVALID_ID to INVALID_RESOURCE_ID. Those may reflect the reference firmware's design or implementation rather than an intentional protocol decision. Therefore, if any of these changes are unacceptable or incompatible with the driver, please let me know. I will try to address those issues elsewhere.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates IPC4 reply/status handling to better match IPC4 protocol expectations, mainly by correcting error codes returned from IPC4 module and BaseFW-related handlers to improve compliance and re-enable shared reference-firmware tests.

Changes:

  • Replace several uses of IPC4_MOD_INVALID_ID with IPC4_INVALID_RESOURCE_ID in IPC4 module config/large-config paths.
  • Add explicit validation that the BaseFW module only supports instance 0 (for large-config get).
  • Adjust module-message default handling to return IPC4_UNKNOWN_MESSAGE_TYPE for unknown commands, and explicitly mark some module commands as IPC4_UNAVAILABLE.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/ipc/ipc4/handler-user.c Updates module-message error/status returns and adds BaseFW instance validation for large-config get.
src/audio/base_fw_intel.c Changes default error code returned by Intel BaseFW vendor get-large-config handler.

Comment on lines 819 to +824
} else {
drv = ipc4_get_comp_drv(config->primary.r.module_id);
}

if (!drv)
return IPC4_MOD_INVALID_ID;
return IPC4_INVALID_RESOURCE_ID;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines 1179 to +1184
} else {
drv = ipc4_get_comp_drv(config.primary.r.module_id);
}

if (!drv)
return IPC4_MOD_INVALID_ID;
return IPC4_INVALID_RESOURCE_ID;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread src/audio/base_fw_intel.c
extended_param_id.full = param_id;

uint32_t ret = IPC4_ERROR_INVALID_PARAM;
uint32_t ret = IPC4_INVALID_REQUEST;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread src/ipc/ipc4/handler-user.c Outdated
Comment on lines +1279 to +1280
case SOF_IPC4_MOD_SET_DX:
case SOF_IPC4_MOD_SET_D0IX:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about this change? You didn't mention it in the commit message.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those messages are known but unsupported. Hence they had to be moved here so that they don’t fall into the UNKNOWN_MESSAGE_TYPE default case (because the default error code has changed).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are supported but are handled in handler-kernel.c. This won't cause an error and can probably stay, it's just a bit misleading.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I will fix this. Thanks!

wjablon1 added 4 commits May 26, 2026 12:42
Improve IPC4 protocol adherence by return IPC4_UNKNOWN_MESSAGE_TYPE
for unsupported module IPCs instead of reporting them as IPC4_UNAVAILABLE

Signed-off-by: Wojciech Jablonski <wojciech.jablonski@intel.com>
Error code INVALID_PARAM is more generic and shall be used when
a supported operation contains an invalid value in its data structure.
For unsupported operations, INVALID_REQUEST shall be used instead.

Signed-off-by: Wojciech Jablonski <wojciech.jablonski@intel.com>
In the context of Config Get/Set, when the target module instance cannot
be resolved, FW should report INVALID_RESOURCE_ID. MOD_INVALID_ID should
be reserved for other module-related IPCs.

Signed-off-by: Wojciech Jablonski <wojciech.jablonski@intel.com>
Only 0th instance of BaseFW module is available. Report an error for any
other instance

Signed-off-by: Wojciech Jablonski <wojciech.jablonski@intel.com>
@wjablon1 wjablon1 force-pushed the ipc_err_code_fix branch from 8326009 to f15a1c1 Compare May 26, 2026 11:14
@lgirdwood
Copy link
Copy Markdown
Member

@ujfalusi and @bardliao pls do comment re driver

@ujfalusi
Copy link
Copy Markdown
Contributor

@ujfalusi and @bardliao pls do comment re driver

The kernel does not care much about the error code itself, it treats identically and will show up in kernel log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants