Repository navigation
Conversation
lgirdwood
left a comment
There was a problem hiding this comment.
Code Review Summary
Clean, well-split, bisectable 3-commit removal of the dead clock-change notification (NOTIFIER_ID_CPU_FREQ, NOTIFIER_ID_SSP_FREQ, NOTIFIER_CLK_CHANGE_ID(), struct clock_notify_data, CLOCK_NOTIFY_PRE/POST, and struct clock_info::notification_{id,mask}).
Verified across the tree:
- Zero remaining senders, receivers, or
struct clock_infoinitializers reference the removed symbols. - All remaining
notifier_{register,unregister,event}()callsites (including CMockanotifier_mocks.c) use symbolicNOTIFIER_ID_*enumerators and0 .. NOTIFIER_ID_COUNT - 1bounds. - Casting
(unsigned int)type < NOTIFIER_ID_COUNTinnotifier_{register,unregister}()cleanly avoids-Wtype-limitswhen the enum's underlying type is unsigned while still catching negative integers. - Commit prefixes/messages,
Signed-off-by:trailers, CI checks, and strict Doxygen (WARN_AS_ERROR = FAIL_ON_WARNINGS) all pass with no blocking issues.
Minor Cleanup / Follow-up Notes
src/kernel/lib/clk.c:13(unmodified in PR): Still has an unused#include <sof/lib/notifier.h>left over from whenclock_set_freq()used to post clock notifications — could be dropped alongside Commit 2 (clk: remove the notification fields from struct clock_info), which removes the same unused header fromzephyr/lib/clk.cand the platformclk.cfiles.src/schedule/ll_schedule_xtos.c: Unused#include <rtos/clk.h>at line 15, double blank line at lines 758–759, andSOF_SCHEDULER_FREE_IRQ_ONLY(insrc/include/sof/schedule/schedule.h:76) now having zero remaining consumers in the tree.zephyr/include/rtos/clk.h:8: File-level Doxygen@briefstill mentions"and notification interfaces".src/include/sof/lib/notifier.h:23: Informational LLEXT ABI note onenum notify_idrenumbering (EXPORT_SYMBOL(notifier_register)/EXPORT_SYMBOL(notifier_unregister)).
| @@ -15,7 +15,6 @@ | |||
| #include <rtos/clk.h> | |||
There was a problem hiding this comment.
Nit (unused include): <rtos/clk.h> was only needed here for struct clock_notify_data and CLOCK_NOTIFY_POST (sof_cycle_get_64*() comes from <rtos/timer.h> on line 13), so this include can be dropped too:
| #include <rtos/clk.h> |
There was a problem hiding this comment.
The whole file is gone now: patch 1 removes the XTOS LL scheduler, see the reply to your XTOS comment.
|
|
||
| domain_unregister(sch->domain, NULL, 0); | ||
|
|
||
| if (!(flags & SOF_SCHEDULER_FREE_IRQ_ONLY)) | ||
| notifier_unregister(sch, NULL, | ||
| NOTIFIER_CLK_CHANGE_ID(sch->domain->clk)); | ||
|
|
||
| irq_local_enable(irq_flags); |
There was a problem hiding this comment.
Follow-up note: scheduler_free_ll() was the last consumer of SOF_SCHEDULER_FREE_IRQ_ONLY (defined in src/include/sof/schedule/schedule.h:76) — and of the flags parameter on scheduler_ops::scheduler_free — anywhere in the tree (tools/testbench/utils.c:208 only calls schedule_free(0)). Fine to leave for a separate cleanup patch if preferred.
(Also minor nit at lines 758–759 below: removing notifier_register() left two consecutive blank lines before return 0;.)
There was a problem hiding this comment.
The file is removed in patch 1, so the blank lines go with it. SOF_SCHEDULER_FREE_IRQ_ONLY and the flags argument of the scheduler free operation now have no user. Removing them changes the scheduler API, so I left that for a separate cleanup; it is listed under "Not in this part" in the description.
| uint32_t message; | ||
| }; | ||
|
|
||
| struct freq_table { |
There was a problem hiding this comment.
Doc nit (line 8 above): Now that CLOCK_NOTIFY_*, struct clock_notify_data, and notification_{id,mask} are removed from this header, consider updating the @file Doxygen brief at line 8 (@brief RTOS DSP clock frequency management and notification interfaces.) to drop "and notification".
There was a problem hiding this comment.
Done in patch 3: the description now reads "RTOS DSP clock frequency management interfaces."
| enum notify_id { | ||
| NOTIFIER_ID_CPU_FREQ = 0, /* struct clock_notify_data * */ | ||
| NOTIFIER_ID_SSP_FREQ, /* struct clock_notify_data * */ | ||
| NOTIFIER_ID_KPB_CLIENT_EVT, /* struct kpb_event_data * */ |
There was a problem hiding this comment.
Note (LLEXT symbol ABI): All in-tree callers use symbolic NOTIFIER_ID_* constants, so renumbering from 0 is completely safe for in-tree builds. Just noting that since notifier_register and notifier_unregister are exported via EXPORT_SYMBOL() (src/lib/notifier.c:70,107), any cached/standalone .llext binaries (copier, kpb) compiled against pre-#11513 headers must be rebuilt (expected, especially as notifier is internal and being removed in Phase 5).
There was a problem hiding this comment.
Agreed. I added an "LLEXT modules" section to the description: LLEXT modules that use the notifier must be rebuilt against the new headers, and the in-tree modules are rebuilt with the firmware.
lgirdwood
left a comment
There was a problem hiding this comment.
the xtos logic is no longer used in main as Zephyr is the only supported RTOS, could this vbe further simplified with full xtos removal at this stage ?
The XTOS LL scheduler (ll_schedule_xtos.c) is the last scheduler left from the XTOS firmware build, which has been removed: Zephyr is the only supported RTOS. ACP 6.0 is the only platform that still builds it, when the DMA domain is off, which is its default. All other platforms use the Zephyr LL scheduler (zephyr_ll.c). Remove it and enable the DMA domain on ACP 6.0, so ACP 6.0 uses the Zephyr LL scheduler with the Zephyr DMA domain, the configuration that was already supported for it. The platform code needs no change: on Zephyr, scheduler_init_ll(), timer_domain_init() and dma_multi_chan_domain_init() already map to the Zephyr scheduler and domains. The Zephyr LL scheduler and its kernel half are now built for every platform. ACP 6.0 does not build on main (the IPC3 DAI code and the HS DAI driver fail to compile), and its errors are unchanged. The XTOS LL scheduler also registered for the clock change notification, which nothing sends. It was the only receiver, so this is also part of removing the notifier, which is not usable from user space (Phase 5 of the kernel / user-space partition). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Every platform sets notification_id and notification_mask in its clock information, to NOTIFIER_ID_CPU_FREQ and its core mask, but nothing reads them: no clock driver sends a clock change notification. Remove the fields, and the notifier.h includes that only the clock tables needed. The generic clock code (src/kernel/lib/clk.c) included notifier.h too, left from when clock_set_freq() sent the notification, so drop it there as well. This is part of removing the notifier, which is not usable from user space (Phase 5 of the kernel / user-space partition). No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Nothing sends NOTIFIER_ID_CPU_FREQ or NOTIFIER_ID_SSP_FREQ, and nothing registers for them any more. Remove the event IDs, NOTIFIER_CLK_CHANGE_ID(), and the notification payload struct clock_notify_data with its CLOCK_NOTIFY_PRE and CLOCK_NOTIFY_POST messages. The notifier checked and walked the IDs from NOTIFIER_ID_CPU_FREQ, which was 0. It now starts from 0. The other IDs are renumbered; they are internal to the firmware. This is part of removing the notifier, which is not usable from user space (Phase 5 of the kernel / user-space partition). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
71b592e to
08f6161
Compare
|
Updated, re-verified on d9b1a78:
|
Phase 5 of #11306 (kernel / user-space partition), fourth part: remove the clock change notification, which nothing sends, and the XTOS LL scheduler, its only receiver.
Background
The notifier has two clock events,
NOTIFIER_ID_CPU_FREQandNOTIFIER_ID_SSP_FREQ, with astruct clock_notify_datapayload.ll_schedule_xtos.c). It registers to recalculate the start times of its tasks when the clock changes.notification_idandnotification_maskin itsstruct clock_info, but nothing reads them.The notifier is not usable from user space, and Phase 5 removes it. These events are dead, so they go first.
The XTOS LL scheduler is the last scheduler left from the XTOS firmware build, which has been removed: Zephyr is the only supported RTOS. Only ACP 6.0 still builds it, when its DMA domain is off (the default). All other platforms use the Zephyr LL scheduler.
Patches
schedule: remove the XTOS LL scheduler.scheduler_init_ll(),timer_domain_init()anddma_multi_chan_domain_init()already map to the Zephyr scheduler and domains.clk: removenotification_idandnotification_maskfromstruct clock_info, in the Zephyr and hostrtos/clk.h. Also remove thenotifier.hincludes that only the clock tables needed (the Zephyr, i.MX, AMD and MTK platforms), and the one the generic clock code (src/kernel/lib/clk.c) kept from whenclock_set_freq()sent the notification.notifier: removeNOTIFIER_ID_CPU_FREQ,NOTIFIER_ID_SSP_FREQ,NOTIFIER_CLK_CHANGE_ID(),struct clock_notify_data, andCLOCK_NOTIFY_PREandCLOCK_NOTIFY_POST.NOTIFIER_ID_CPU_FREQ, which was 0; it now starts from 0.Functional change
LLEXT modules
notifier_register()andnotifier_unregister()are exported to LLEXT modules, and they take an event ID. The renumbering changes those IDs, so LLEXT modules that use the notifier, built against the old headers, must be rebuilt. The in-tree modules are rebuilt with the firmware.Not in this part
SOF_SCHEDULER_FREE_IRQ_ONLY, and theflagsargument of the schedulerfreeoperation, have no user left after patch 1. Removing them changes the scheduler API, so that is a separate cleanup.#errortexts that name XTOS: a separate cleanup;Kconfig.xtos: options the legacy driver platforms still select, removed with the legacy drivers;_xtos_*interrupt calls: the legacy SOF interrupt API, which only the AMD platforms without native drivers use, removed with the legacy drivers.NOTIFIER_ID_VADhas no receiver in the tree either, but it is the only output of thewebrtc_vadmodule, andwebrtc_ns2can send it too. Removing it needs a decision on how these modules report voice activity, so it is left for a later part.Testing
CONFIG_SOF_USERSPACE_PROXY=n;os_linux_overlay.conf;llext_relocatable.conf;app/debug_stream_overlay.conf, and PTL with that overlay and user-space LL.clk.cof each platform. In the images, only the functions that index the clock tables change (platform_clock_init(),clock_get_freq(),clock_set_freq(), andcore_kcps_adjust()on MTL), becausestruct clock_infois 8 bytes smaller;notifier.c, and the callers of the notifier, whose event ID constants are renumbered (DAI, KPB, the KPB service, the detect test, mic privacy).--strict, for the builds (same 16 baseline sources) and for the sources;All of the above, and the documentation build as in CI (no warnings, at every commit), was run on d9b1a78 (current main).
Changes since the last push
src/kernel/lib/clk.cdrops itsnotifier.hinclude too (patch 2);rtos/clk.hfile description no longer mentions notifications (patch 3);🤖 Generated with Claude Code