Commit 9ac7d72
ipc4: logging: Add dynamic log level control via logs_mask
Implement dynamic log level selection based on the logs_mask field from
the IPC4_ENABLE_LOGS command, allowing the host to control firmware
logging verbosity at runtime.
Previously, logging was enabled with a fixed compile-time level
(CONFIG_SOF_LOG_LEVEL), preventing dynamic control. This change parses
the logs_mask[0] bits 0-4 to determine the requested log level and
passes it to the backend.
Mask bit mapping to Zephyr log levels:
- bit 0 (critical/error) -> LOG_LEVEL_ERR (1)
- bit 1 (high/warning) -> LOG_LEVEL_WRN (2)
- bit 2 (medium) -> LOG_LEVEL_INF (3)
- bit 3 (low/info) -> LOG_LEVEL_INF (3)
- bit 4 (verbose/debug) -> LOG_LEVEL_DBG (4)
The highest set bit determines the maximum log level. This allows the
host to request ERROR-only logging for quiet operation, or DEBUG for
verbose troubleshooting, without firmware recompilation.
Additionally, log_backend_enable() is now always called (it is
idempotent and safe for reconfiguration), removing the previous check
that prevented level changes on already-active backends.
A TODO comment documents that the mask handling should be improved with
proper macros or structs in the future for better code maintainability,
but the current implementation is sufficient.
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>1 parent 49464c7 commit 9ac7d72
1 file changed
+42
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
143 | 173 | | |
144 | 174 | | |
145 | 175 | | |
146 | 176 | | |
147 | 177 | | |
148 | | - | |
149 | | - | |
150 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
151 | 190 | | |
152 | 191 | | |
153 | 192 | | |
| |||
0 commit comments