Skip to content

[FEATURE] Implement SOF_IPC4_FW_PARAM_SYSTEM_TIME to sync host and FW timestamps #8016

Closed

Description

@kv2019i

Is your feature request related to a problem? Please describe.
Host is sending SOF_IPC4_FW_PARAM_SYSTEM_TIME to synchronize the host and DSP timestamps so that timestamps in logs can be compared directly.

Describe the solution you'd like
Implement IPC4 handle to set the timestamp epoch and implement a custom timestamp generator and set this using Zephyr log_set_timestamp_func() (in order for logging subsystem to use this timestamp).

Describe alternatives you've considered
Setting the Zephyr kernel time is one option, but there is currently no API to do this from applications and this could create many issues (i.e. time going back for kernel code).

Additional context
Add any other context or screenshots about the feature request here.

Activity

  1. added
    enhancementNew feature or request
    IPC4Issues observed with IPC4 (same IPC as Windows)
    on Aug 8, 2023
  2. kv2019i commented on Aug 8, 2023

    @kv2019i
    CollaboratorAuthor

    @btian1 this is one potential, please assign to yourself if you have bandwidth

  3. plbossart commented on Aug 8, 2023

    @plbossart
    Member

    @ujfalusi and I already discussed this, I can't recall what the outcome was and where this discussion took place.

  4. ujfalusi commented on Aug 9, 2023

    @ujfalusi
    Contributor

    @plbossart , @kv2019i, the kernel is sending the time when the mtrace is enabled.
    The message setup starts here:
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/sof/ipc4-mtrace.c#n433
    and the send is
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/sof/ipc4-mtrace.c#n444

    The epoch is adjusted as per specification, but I'm no longer sure if we should do that and just send the time directly.

  5. ujfalusi commented on Aug 9, 2023

    @ujfalusi
    Contributor

    This is the SOF/Zephyr side handling of the message, right?

  6. added this to the v2.7 milestone on Aug 16, 2023
  7. lgirdwood commented on Aug 16, 2023

    @lgirdwood
    Member

    @kv2019i IIUC, driver is sending the message but we need to make sure we get teh message to Zephyr. @abonislawski @mwasko @nashif we will need this for PSS.

  8. kv2019i commented on Sep 6, 2023

    @kv2019i
    CollaboratorAuthor

    @alex-cri @lgirdwood @mengdonglin proposing to move to v2.8 . work not yet started, so this did not make the v2.7 cut

  9. modified the milestones: v2.7, v2.8 on Sep 6, 2023
  10. RanderWang commented on Nov 7, 2023

    @RanderWang
    Collaborator

    @plbossart , @kv2019i, the kernel is sending the time when the mtrace is enabled. The message setup starts here: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/sof/ipc4-mtrace.c#n433 and the send is https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/sof/ipc4-mtrace.c#n444

    The epoch is adjusted as per specification, but I'm no longer sure if we should do that and just send the time directly.

    @ujfalusi we need the kernel and FW work in the same time domain. In kernel log, the time is increased from the OS boot up, but the time sent for fw is UTC, epoch is 1601-01-01 00:00:00, so the time domain is still different, can we change the time to kernel log so that easy for us to check the time between kernel log and fw log ?

    [    6.366234] sof-audio-pci-intel-tgl 0000:00:1f.3: ipc tx      : MOD_LARGE_CONFIG_SET [data size: 76]
    [    6.366559] sof-audio-pci-intel-tgl 0000:00:1f.3: ipc tx reply: MOD_LARGE_CONFIG_SET
    [    6.366593] sof-audio-pci-intel-tgl 0000:00:1f.3: ipc tx done : MOD_LARGE_CONFIG_SET [data size: 76]
    
  11. ujfalusi commented on Nov 7, 2023

    @ujfalusi
    Contributor

    The IPC4 specification is explicitly tells that the epoch for the set time is 1601-01-01 00:00:00, this is why the kernel driver converts it.

  12. lgirdwood commented on Nov 10, 2023

    @lgirdwood
    Member

    We can spell this out with some comments if needed. TBH using an epoch in FW is a waste of cycles, we shoulds use native timer value and do any epoch conversion in host.

  13. modified the milestones: v2.8, v2.9 on Dec 1, 2023
  14. kv2019i commented on Dec 1, 2023

    @kv2019i
    CollaboratorAuthor

    No consensus in the review this week, pushing to v2.9, but let's try to get to main this month in any case.

  15. assigned and unassigned on Jan 9, 2024
  16. marc-hb commented on Jan 12, 2024

    @marc-hb
    Collaborator

    All merged, close?

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

Metadata

Metadata

Assignees

Labels

IPC4Issues observed with IPC4 (same IPC as Windows)enhancementNew feature or request

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions