Skip to content

ipc4: use fixed-width types in ipc4_audio_fromat - #11126

Open
dbaluta wants to merge 1 commit into
thesofproject:mainfrom
dbaluta:fix_enums
Open

ipc4: use fixed-width types in ipc4_audio_fromat#11126
dbaluta wants to merge 1 commit into
thesofproject:mainfrom
dbaluta:fix_enums

Conversation

@dbaluta

@dbaluta dbaluta commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

struct ipc4_audio_format used bare enum members. On ARM EABI targets (e.g i.MX95 Cortex-M7) the toolchain defaults to -fshort-enums, which shrinks the enum-typed members. This makes host-supplied channels_count/valid_bit_depth be on the wrong offset.

Fix this by using fixed uint32_t type instead of enums. Note that the same struct on the Linux kernel side uses uint32_t so this patch also aligns ipc4_audio_format structs on FW side / Host side.

This patch is the first one in a series preparing IPC4 support for IMX platforms.

struct ipc4_audio_format used bare enum members. On ARM EABI targets (e.g
i.MX95 Cortex-M7) the toolchain defaults to -fshort-enums, which shrinks the
enum-typed members. This makes host-supplied channels_count/valid_bit_depth
be on the wrong offset.

Fix this by using fixed uint32_t type instead of enums. Note that the
same struct on the Linux kernel side uses uint32_t so this patch
also aligns ipc4_audio_format structs on FW side / Host side.

Signed-off-by; Daniel Baluta <daniel.baluta@nxp.com>
Copilot AI lite review requested due to automatic review settings August 25, 2026 12:12

Copilot AI left a comment

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.

Pull request overview

This PR fixes an IPC4 ABI layout hazard on targets that default to -fshort-enums (e.g., some ARM EABI toolchains) by ensuring struct ipc4_audio_format uses fixed-width 32-bit storage for fields that must match host-provided offsets, aligning the firmware-side definition with the Linux kernel’s uint32_t-based layout.

Changes:

  • Replace enum-typed members in struct ipc4_audio_format with uint32_t to prevent toolchain-dependent enum sizing from shifting subsequent fields.
  • Preserve intent/type meaning via inline comments indicating the corresponding enum for each now-uint32_t field.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Typo fromat in git commit, but otherwise looks good. Great to see more IPC4 targets coming up!

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.

5 participants