Skip to content

kernel/user partition, Phase 5 part 2: mic privacy state without the notifier - #11503

Draft
lgirdwood wants to merge 1 commit into
thesofproject:mainfrom
lgirdwood:kernel-user/phase5b
Draft

lgirdwood wants to merge 1 commit into
thesofproject:mainfrom
lgirdwood:kernel-user/phase5b

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Phase 5 of #11306 (kernel / user-space partition), second part: mic privacy state changes no longer go through the notifier. This changes behaviour, see below.

Background

The mic privacy manager tells the copiers about mic privacy state changes with a NOTIFIER_ID_MIC_PRIVACY_STATE_CHANGE event.

  • Producers: the DMIC and firmware-managed mic privacy interrupts, the IRQ enable path, the base firmware's mic privacy IPC, and DAI resume after D3. All of them are kernel code.
  • Consumers: the copiers with mic privacy. On copiers on other cores, the notifier delivers the event through IDC, also from the interrupts.

The notifier is not usable from user space, and Phase 5 removes it.

What changes

  • The state word: the kernel posts the state as a single atomic word: an 8-bit sequence number, the mic disable state and the DMA data zeroing wait time.
    • The wait time is the 16-bit DDZWT field, which the copier turns into its ramp time.
    • The word lives in the sysuser partition, so the copiers can read it from user-space LL threads.
  • Taking it: each copier with mic privacy takes the word at the start of its next copy (copier_process()), in its own LL thread, on any core. No IDC is needed.
  • Which states: a copier records the sequence number when it configures mic privacy, where it registered for the notifier, so it only takes the states posted since then.
  • The transitions: fade in from muted, fade out otherwise, and the ramp time are unchanged.
  • Removed: NOTIFIER_ID_MIC_PRIVACY_STATE_CHANGE.

This follows the same pattern as the KPB draining requests in #11497.

Behaviour changes

  • Timing: a copier applies a state change at its next copy, so within one LL period. With the notifier, the copier's state changed in the interrupt or IDC handler.
  • Stopped copiers: a copier that is not running takes the latest state when it runs again, instead of every change in turn.
    • With the notifier, a mute followed by an unmute while a copier was stopped left it fading out, because the unmute only applies to a muted copier.
    • Now it stays unmuted, which matches the mic.

Not in this part

The copier still calls kernel functions of the mic privacy manager when it configures mic privacy (mic_privacy_enable_dmic_irq(), mic_privacy_get_dma_zeroing_wait_time()). And mic_privacy_process(), which runs in the copier, is in the kernel file. Both are on the Phase 5 list, as is re-enabling mic privacy for user-space LL.

Testing

  • Builds: tgl, tgl-h, mtl, lnl, ptl, wcl, nvl, imx8, imx8x, imx8m, imx8m_cm7, imx8ulp, imx95 and qemu_xtensa, and the extra CI configurations:

    • native_sim IPC3/IPC4 stub builds;
    • imx93 64-bit;
    • PTL with each userspace overlay;
    • PTL with CONFIG_SOF_USERSPACE_PROXY=n;
    • PTL and MTL with os_linux_overlay.conf;llext_relocatable.conf;
    • PTL and TGL with app/debug_stream_overlay.conf, and PTL with that overlay and user-space LL.

    PTL and WCL build mic privacy.

  • Object changes: as expected, and nothing else:

    • copier.c and mic_privacy_manager_intel.c in the PTL and WCL builds;
    • notifier.c everywhere, because the notifier ID count changes;
    • the PTL kernel object hash tables, which is layout.
  • Signing: rimage runs for every Intel platform, and the generated configs are unchanged.

  • Cadence xt-clang (RI-2022.10): MTL, PTL and NVL compile.

  • ZTest: the unit tests pass, run as in CI (22 of 22 configurations).

  • Host: the host library and the cmocka unit tests build and pass for all nine defconfigs and the library config.

  • Testbench and tools: pass.

  • Include checker: passes with --strict, for the builds and for the sources.

  • Failing platforms: the platforms that already fail on main (acp_6_0, acp_7_0, acp_7_x, mt8186, mt8188, mt8195, mt8196, mt8365) have unchanged error sets.

All of the above was run on d9b1a78 (current main).

Not tested on hardware yet

The mic privacy path has not run on hardware. It needs a PTL or WCL board with a mic privacy switch, or a host that sends the mic privacy IPC.

🤖 Generated with Claude Code

The mic privacy manager tells the copiers about mic privacy state
changes with a notifier event. The events come from the mic privacy
interrupts, the base firmware IPC and DAI resume, all kernel code, and
reach copiers on other cores through IDC. The notifier is not usable
from user space, and Phase 5 of the kernel / user-space partition
removes it.

Post the state in a single atomic word instead: a sequence number,
the mic disable state and the DMA data zeroing wait time, the 16-bit
DDZWT field. Each copier with mic privacy takes it at the start of its
next copy, in its own LL thread, on any core. As with the notifier,
which the copier registered for when it configured mic privacy, a
copier only takes the states posted since then.

A copier that is not running takes the latest state when it runs
again, instead of every change in turn. With the notifier, a mute
followed by an unmute while a copier was stopped left it fading out:
the unmute only applies to a muted copier. Now it stays unmuted.

Remove NOTIFIER_ID_MIC_PRIVACY_STATE_CHANGE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
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.

2 participants