Skip to content

ace: copier: hda: synchronized FPI updates of HD-A gateways - #7964

Merged
lgirdwood merged 3 commits into
thesofproject:mainfrom
tmleman:topic/upstream/pr/copier/gtw/fpi_sync_group
Aug 7, 2023
Merged

lgirdwood merged 3 commits into
thesofproject:mainfrom
tmleman:topic/upstream/pr/copier/gtw/fpi_sync_group

Conversation

@tmleman

@tmleman tmleman commented Jul 18, 2023

Copy link
Copy Markdown
Contributor

This PR adds synchronized FPI updates of HD-A gateways. Driver can define group of such gateways via module init IPC. The driver may also specify an update period for each group, different than the default one determined by the system tick frequency.

In addition, a change has been introduced that makes it possible to read config size in module init function. Each module receive its own configuration at creation (MODULE_INIT IPC). In case of a gateway those configurations can contain additional value (aux_conf). The only way to check if such config was received is to compare size of the data received via ipc and standard configuration size.

Comment thread src/include/sof/audio/component.h Outdated

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.

can we please leave out the formatting changes to see it is easy to see that only 1 field is added? And btw won't this break IPC3? Should this be within #if CONFIG_MAJOR_IPC4?

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.

can comp_ipc_config be changed? not sure why not left some redundancy space for later adding, like uint32_t valid_fmt to align internal usage.

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.

@btian1 can you explain exactly what you mean? Sorry, but I don't quite understand what your comment means.

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.

I mean:

  1. comp_ipc_config, normally, should not add or remove, it need keep stable, since driver and sof both need this, if change, may need change synchronous in SOF and driver。
  2. this structure should have some redundant space for future extension, then for this change, you just need change a variable name, instead of adding a new variable with IPC4 limited.
    uint32_t reserved[4];

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.

From what I saw in code struct comp_ipc_config is internal SOF struct and its not expose to driver. It's created on FW side during module initialization and therefore I assume that is safe to add new value to it.

https://github.com/thesofproject/sof/blob/main/src/ipc/ipc4/helper.c#L81-L105

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.

I did not have a change to check driver, just guess driver side also have a similar copy, if not, how to pass it from driver to fw(sof)?
@ranj063 , do we need update driver side as well?

Comment thread src/include/sof/audio/component.h Outdated
@tmleman
tmleman force-pushed the topic/upstream/pr/copier/gtw/fpi_sync_group branch 2 times, most recently from 5ea79a2 to 2c001b6 Compare July 19, 2023 09:43
lyakh
lyakh previously requested changes Jul 19, 2023
Comment thread src/audio/copier/copier_host.c Outdated
Comment thread src/audio/copier/copier_host.c Outdated
Comment thread src/audio/copier/copier_host.c Outdated
Comment thread src/audio/copier/copier_host.c Outdated

@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.

Copier is getting complicated, but nothing really to complain about in the patch. It seems copier is the right place for this, and the extension handling looks correct. I have one minor nit on whether the 64bit wrap-around should be handled or not, but that's a minor thing.

Comment thread src/audio/host-zephyr.c Outdated
Comment thread src/audio/host-zephyr.c Outdated

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.

Having timer logic without wrap-around handling is always a bit iffy, but given we have explicit 64bit counter, it would seem this is safe. Even with a 10x faster system clock, this would still take thousands of years to wrap around. I think current uptime record holder is still the one Cisco switch that is around 26 years now, so we have some safety margin -> https://en.wikipedia.org/wiki/Uptime

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ack, worth an inline comment here so that no one tries to fix later on.

@tmleman
tmleman force-pushed the topic/upstream/pr/copier/gtw/fpi_sync_group branch 2 times, most recently from 8604ef8 to bedc34b Compare July 19, 2023 14:44
Comment thread src/audio/copier/copier_host.c Outdated
Comment thread src/audio/copier/copier_host.c Outdated

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@tmleman only minor things here and we are good to merge.

@lyakh

lyakh commented Jul 27, 2023

Copy link
Copy Markdown
Collaborator

@tmleman only minor things here and we are good to merge.

@lgirdwood I think #7964 (comment) is rather significant

@tmleman
tmleman force-pushed the topic/upstream/pr/copier/gtw/fpi_sync_group branch 2 times, most recently from a7333dc to 6fe50b3 Compare July 27, 2023 15:03
@tmleman
tmleman requested a review from lyakh July 27, 2023 15:05
Comment thread src/audio/Kconfig Outdated
Comment thread src/audio/copier/copier_host.c Outdated
@lyakh
lyakh dismissed their stale review July 28, 2023 09:18

the allocation is uncached now, but it still should be documented, why no locking on the global list is required

@lgirdwood

Copy link
Copy Markdown
Member

@tmleman can you check the internal CI results. Thanks !

Comment thread src/include/sof/audio/component.h Outdated

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.

can comp_ipc_config be changed? not sure why not left some redundancy space for later adding, like uint32_t valid_fmt to align internal usage.

Comment thread src/audio/copier/copier_host.c Outdated
Comment thread src/audio/copier/copier_host.c Outdated
@tmleman
tmleman force-pushed the topic/upstream/pr/copier/gtw/fpi_sync_group branch from 6fe50b3 to 7f91757 Compare August 1, 2023 10:39
@tmleman
tmleman requested review from btian1 and lyakh August 1, 2023 10:41
tmleman added 2 commits August 2, 2023 10:31
This patch temporary extends comp_ipc_config struct by the value of
input configuration size. Each module receive its own configuration at
creation (MODULE_INIT IPC). In case of a gateway those configuration can
contain additional value (aux_conf). The only way to check if such
config was received is to compare size of the data received via ipc and
standard configuration size.

This solution is temporary because ultimately it would be necessary to
transfer to each module the size of the received configuration along
with a pointer to the configuration itself. Just like the test is in the
case of a module adapter.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Comment style correction after adding a new field in the structure.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
@tmleman
tmleman force-pushed the topic/upstream/pr/copier/gtw/fpi_sync_group branch from 7f91757 to e2c2c87 Compare August 2, 2023 08:31
@tmleman

tmleman commented Aug 2, 2023 •

Copy link
Copy Markdown
Contributor Author

23ww31.4 Update: rebase

Comment thread src/include/sof/audio/component.h Outdated

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.

I mean:

  1. comp_ipc_config, normally, should not add or remove, it need keep stable, since driver and sof both need this, if change, may need change synchronous in SOF and driver。
  2. this structure should have some redundant space for future extension, then for this change, you just need change a variable name, instead of adding a new variable with IPC4 limited.
    uint32_t reserved[4];

Comment thread src/include/ipc4/copier.h Outdated
@tmleman
tmleman force-pushed the topic/upstream/pr/copier/gtw/fpi_sync_group branch from d30996e to df361ca Compare August 3, 2023 09:15
@tmleman

tmleman commented Aug 3, 2023

Copy link
Copy Markdown
Contributor Author

23ww31.5 Update: removing the ugly workaround and replacing it with an implementation resistant to incorrect values in IPC payload.

This patch add synchronized FPI updates of HD-A gateways. Driver can
define group of such gateways via module init IPC. The driver may also
specify an update period for each group, different than the default one
determined by the system tick frequency.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
@tmleman
tmleman force-pushed the topic/upstream/pr/copier/gtw/fpi_sync_group branch from df361ca to ecbd00a Compare August 3, 2023 10:00
@tmleman
tmleman requested review from btian1 and ranj063 August 3, 2023 13:53
Comment thread src/include/ipc4/copier.h Outdated
@lgirdwood
lgirdwood merged commit f222070 into thesofproject:main Aug 7, 2023
@tmleman
tmleman deleted the topic/upstream/pr/copier/gtw/fpi_sync_group branch December 17, 2025 12:14
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.

6 participants