Commit Graph

12273 Commits

Author SHA1 Message Date
Guennadi Liakhovetski 3051607efb kcps: fix 0 module CPC case
If a module contains 0 as its CPC value, the consumption calculation
routine will assign a "safe" maximum value to keep the DSP running at
the maximum clock rate. This works when constructing a pipeline, but
when a pipeline is torn down, returning the maximum clock rate leads
to the clock being reduced to a small value. Fix this by detecting
such cases in pipeline termination code.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-07-16 15:29:47 +03:00
Guennadi Liakhovetski 3f84f32088 drc: make modular on MTL and LNL
Export missing symbols for modular DRC builds and select it as a
module on MTL and LNL. DRC isn't built by default, so we cannot
use CONFIG_LIBRARY_DEFAULT_MODULAR for it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-07-16 15:29:47 +03:00
Guennadi Liakhovetski c06ad78195 drc: enable building as an llext module
Add support for LLEXT building to drc. Since multiband DRC calls
functions from DRC, we cannot so far build it if DRC is configured as
a module. In the future it should be possible to build both as
modules and to export symbols between them.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-07-16 15:29:47 +03:00
Guennadi Liakhovetski b22ccafcc9 llext: export symbols, required for modular DRC
Export additional symbols, required for building DRC as an LLEXT
object.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-07-16 15:29:47 +03:00
Guennadi Liakhovetski 87e973d32f llext: disable when testing reproducible builds
So far we cannot build identical LLEXT modules under Linux and
Windows, build a monolithic firmware for this test.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-07-16 15:29:47 +03:00
Guennadi Liakhovetski cf2a616492 llext: remove logging during module freeing
When pipelines are destroyed, component drivers' .reset() and .free()
are called. If those drivers were loaded dynamically their memory is
then unmapped. But logging takes place in a low priority task, so it
is important that no logging is done from those methods.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-07-16 15:29:47 +03:00
Guennadi Liakhovetski ba5ff444d1 rimage: don't overwrite maximum module instance counts
Use maximum instance count from TOML when building a manifest.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-07-16 15:29:47 +03:00
Guennadi Liakhovetski 3f19277dfd llext: add maximum instance count support
Maximum instance count cannot be zero, they have to be supplied by
respective modules.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-07-16 15:29:47 +03:00
Guennadi Liakhovetski 58bedd9a13 samples: (cosmetic) clean up Kconfig spacing
Use consistent TABs and spaces in src/samples/audio/Kconfig

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-07-16 15:29:47 +03:00
Guennadi Liakhovetski 9d01d8c8f2 ipc4: a failure to find a driver might not be fatal
When ipc4_get_drv() fails to find a driver, it might mean, that the
driver needs to be linked dynamically. Printing an error in such a
case wrongly fails CI testing.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-07-16 15:29:47 +03:00
Guennadi Liakhovetski a98fb5c79c llext: fix Windows builds
Under windows the Python interpreter has to be called explicitly.
Without it an attempt to execute a Python script fails silently.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Suggested-by: Marc Herbert <marc.herbert@intel.com>
2024-07-16 15:29:47 +03:00
Pierre-Louis Bossart 6382963fb5 topology2: force all SoundWire link-side copiers to use S24_LE
Using S32_LE wastes bandwdith for no good reason, we should use 24
bits on the link to maximize bus efficiency with the 9.6 MHz bus
clock.

There is no need for a kernel-side change, the dailink fixup already
changes the dailink format based on the topology information.

Link: https://github.com/thesofproject/sof/issues/8960
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2024-07-15 18:54:45 +03:00
Adrian Warecki 5c725697d8 copier: Add bind function to configure sink buffers params
Setting the sink buffers parameters in the copier_update_params function is
not sufficient. If a sink buffer is attached during copier operation, the
module will not set buffers parameters. Add bind function to configure sink
buffers parameters.

There is no need to configure sink buffers parameters on each copy. We are
assured that they were configured at the time of bind. Remove
ipc4_update_buffer_format from the copier_module_copy function.

Fixes: #9123

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-07-15 18:54:07 +03:00
Adrian Warecki da35d204a5 copier: Remove update of sink buffer format in copier_set_sink_fmt
Sink format can only be set when the sink buffer is not binded. Sink
buffer parameters will be set on binding. Remove redundant code.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-07-15 18:54:07 +03:00
Adrian Warecki 024df27b02 copier: Remove update source buffer format
A data producing component is responsible for setting a sink buffer
parameters. It is not necessary for the copier to override source buffer
parameters. Remove the code responsible for it.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-07-15 18:54:07 +03:00
Tobiasz Dryjanski b58df6d760 performance measurements: extend perf meas state ipc
Implement actual functionality for perf meas state ipc handling. This
enables changing the state of global performance measurements.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-07-10 17:20:31 +01:00
Tobiasz Dryjanski 44d9541811 performance measurements: add extended performance data get ipc
Implement extended global performance data get ipc which extracts
performance data from MW3

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-07-10 17:20:31 +01:00
Tobiasz Dryjanski bae9c86424 performance measurements: add global perf data get ipc
Implement global performance data get ipc which extracts performance data
from MW3

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-07-10 17:20:31 +01:00
Tobiasz Dryjanski fec6034cc8 performance measurements: global perf meas backend
Implement global performance measurement which measure performance of .copy
functions of multiple components.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-07-10 17:20:31 +01:00
Tobiasz Dryjanski 32132a7f12 performance measurements: enable performance measurements
Enable global performance measutements.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-07-10 17:20:31 +01:00
Tobiasz Dryjanski 2a216ae4f3 performance measurements: add CONFIG for perf meas
Add config to enable global performance measurements.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-07-10 17:20:31 +01:00
Tobiasz Dryjanski 11cf4dd8e3 memory window: add MW3 access macro
Add temporary macro for accessing memory window 3 data.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-07-10 17:20:31 +01:00
Tobiasz Dryjanski 11128a0237 component: add chunk size, ibs and obs to component struct
Add data to component struct for computing performance.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-07-10 17:20:31 +01:00
Tobiasz Dryjanski 73538628af performance measurement: add bitmap functionality based on bitarray
Implement wrapper to extend Zephyr's bitarray by adding a counter for
allocated bits. This bitmap will be used to allocate performance data
entries in memory window 3. Also adds new performance_monitor files.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-07-10 17:20:31 +01:00
Marcin Szkudlinski 2a9b40f8a6 fix: explicit usage of a local var in macro
Explicit usage of a local variable in a macro is not a
good practice.
Macros changed to use a variable as an argument

+ fix a warning "'flags' may be used uninitialized"

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-07-10 15:31:06 +03:00
Marcin Szkudlinski ac17c743d7 kconfig: add PIPELINE_2_0 flag
This flag enables changes to new pipeline structure,
known as pipeline2_0
It is required for certain new features, like DP_SCHEDULER.
The changes are incremental and at the moment pipeline 2.0
is fully backward compatible with legacy platforms, however
it generates some overhead in data and code, so it is useful to
turn if off if not needed

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-07-10 15:31:06 +03:00
Marcin Szkudlinski 5e5829eaeb buf: use a audio_buffer API instead of ring_buffer
This commit removes all direct calls to ring_buffer (formerly dp_queue)
from the code, replacing with a generic sof_audio_buffer API

Only direct call that stays is creation of ring_buffer, yet it will
soon be replaced also by a buffer factory

Legacy API from ring buffer is also removed, as it should not be used
anymore

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-07-10 15:31:06 +03:00
Marcin Szkudlinski fd45d83907 buf: add an abstract type struct audio_buffer.h
in pipeline2.0 there's more than one buffer type
to be used for passing audio data from one module
to another. However, each single buffer must provide
same API.
This commit introduces a common API for buffers and
at the same time connects it to ring_buffer.

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-07-10 15:31:06 +03:00
Marcin Szkudlinski ab50281de1 buf: Rename struct dp_queue to struct ring_buffer
as a follow-up of a prev commit, internal structures
should also be changed accordingly

The commit, however, does not change names of variables
in the code that use struct ring_buffer.

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-07-10 15:31:06 +03:00
Marcin Szkudlinski 65ddefc559 buf: Rename dp_queue.c to ring_buffer.c
dp_queue was created as a buffer to handle
special needs for DP modules.
However, in pipeline2.0 there will be more usecases
for it - as in fact it is a lockless cross-core
cached ring buffer.
This commit does rename dp_queue to more adequate name
It also moves the file to "buffers" directory, a place
for all implementations of buffers in pipeline 2.0

The commit, however, does not change names of structures
because git/github does not handle complex changes like
rename and modification correctly

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-07-10 15:31:06 +03:00
Kai Vehmanen 64e335e0b1 App: Boards: Set CONFIG_COMP_DRC=y for PTL platform
The DRC component was not included to build. This component is used in
upstream HDA generic topology, so must be enabled. See commit
727ad82997 ("Tools: Topology2: Add IIR, FIR, DRC to HDA analog
playback").

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-07-09 16:43:16 +03:00
Curtis Malainey 9ce6b74cc2 ipc3: fix type usage bug
This is effectively a no-op, but does not look good. It runs the risk of
a type divergence when a major ABI update comes. So lets just use the
right type in the right place.
2024-07-09 11:55:47 +01:00
Damian Nikodem d3ae43cfa7 cadence: unification of cadence module naming
This change improves and standardizes the naming convention of the
cadence module during its creation.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
2024-07-09 11:06:14 +03:00
Kai Vehmanen d01320a6cb schedule: zephyr_domain: include domain block in ll time tracking
Include the possible domain block time when measuring the time it takes
to complete one iteration of the low-latency scheduler thread loop. The
ll timer metrics are typically used for initial system debug and it can
be misleading when domain block events are not counted in reported
average/max numbers.

Change the timing code to start measurement immediately after
domain thread semaphore is taken.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-07-05 14:38:45 +01:00
Andy Ross 17f46a71ee uuid: Use new UUID registry pervasively
Strip out all the literall UUID management from existing C code (the
API itself still works for any out-of-tree or test code users) and
exclusively use the new, much simpler, SOF_DEFINE_REG_UUID() macro
which sources IDs from the registry by name.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross 51a5fb9c80 uuid: Add app-global UUID registry
Add a very simple uuid-registry.txt file containing all known UUIDs in
the tree, use it to generate a C header (the script validates it in
the process) that can then be used for a simplified
SOF_DEFINE_REG_UUID() mechanism that avoids the risk and temptation
temptation of components incorrectly implementing UUIDs.

The intent is that in the longer term, this file can be used by other
downstream tooling (manifest and topology generation) to more easily
reference known IDs by name in a way that avoids duplication and
error.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross 55b80ddb76 amd: uuids: Renumber acp_sw_audio and acp_clk UUIDs
These two drivers both got cloned UUIDs from the acp_hs component,
which is illegal.

Renumber them.  This is relatively safe, as clock and DMA drivers are
specific to a platform and not referenced via external files like
topology.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross 547b6cb7ef rembrandt/acp_sw_audio_dai: Regenerate UUID
This DAI driver got labelled with the same UUID as the "hsdai"
component, which is illegal.  Generate a new UUID.

This is relatively safe, as DAIs are fixed with hardware and don't get
referenced by ID in external topology.  Still frustrating to have to
do.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross 8d32cef155 library/schedule: Renumber UUIDs
The library code edf_sched and ll_sched_lib components were generated
with UUIDs that collide with the core EDF scheduler component, which
is illegal.  This is test code though and doesn't need to match
external artifacts, so just renumber.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross a3e72be7dc uuid: Resolve colliding UUIDs via naming
In a few cases we have multiple component code trying to reuse the
same UUID value for differing purposes and with different names.  But
we can resolve that by sharing names rather than changing a permanent
UUID assignment:

* Post-name-normalization, the "dai-legacy" and "dai-zephyr"
  components share a single UUID with different names (they both used
  to be "dai"), AND with the trace context of another "dai" that has a
  different (!)  ID value in src/lib.  Fix this by using a single UUID
  for the former two that collide, and renaming the latter "dai_lib".

* A single UUID got cut/pasted between the irq drivers of mt8195, imx
  "irqsteer" and imx "generic".  Since these will never be used in a
  single image, give them all the single name "interrupt" and let them
  share the UUID value.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross ad9c0e06a5 uuid: Resolve colliding UUID names
If UUIDs are by definition unique, then the stored names that refer to
them must also be unique (otherwise there's no value in trying to
assign unique identifiers to them in the first place).  Fix this up by
changing names (not IDs) where needed.

The common antipatterns here are:

1. Cut-and-paste copies of drivers where the UUID values themselves
   were changed for the new driver but the code around them was not.
   These are resolved by including the platform/variant name in the
   UUID name.

2. Variant UUIDs for IPC3/IPC4 builds.  The reason isn't clear to me,
   but some drivers build with different UUID values depending on the
   build-time protocol configuration.  But these then name themselves
   identically, producing a collision.  Resolved by putting a "4"
   suffix on the IPC4 symbol name.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross fdb039ef5f everywhere: Normalize UUID naming
UUIDs are defined with both a string name (used mostly just for trace
output on legacy xtos builds) and a symbol name used as a global
variable to tie the struct to e.g. component driver definitions.  And
because human beings are allowed to type them in, they have been
somewhat inconsistently defined.  Normalize them so the string name
and the symbol name match (the symbol has a "_uuid" suffix).

Some of these rules are fairly regular:

* Some of the component drivers added a "_comp" to the global symbol
  name and some didn't.  Strip the ones that included it.

* Some naming liked dashes where underscores would be present in a
  symbol name (e.g. "dw-dma" for dw_dma_uuid).  Unify the conventions
  so all name strings are valid C symbols.

* Applying those rules produces a collision between "dai" UUIDs
  defined in dai.c, dai_legacy.c and dai_zephyr.c, so the latter two
  have been renamed to "dai_legacy" and "dai_zephyr".

And in a handful of spots the code just wasn't consistent.  These
UUIDs have been manually renamed, generally trying to pick a name the
corresponds to the original string name, or to the C file that defines
them if that seems impractical:

    Orig. String Name      Orig. Symbol     New Unified Name
    =================      ============     ================
    Maxim DSM              smart_amp        maxim_dsm
    Passthru Amp           smart_amp        passthru_smart_amp
    agent_work             agent_work_task  agent_work
    cadence_codec          cadence          cadence_codec
    channel_map            chmap            chmap
    comp_task              idc_comp_task    idc_comp
    component              comp             component
    dp_schedule            dp_sched         dp_sched
    dts_codec              dts              dts
    edf_schedule           edf_sched        edf_sched
    google_hotword_detect  ghd              google_hotword
    ipcgw                  ipcgtw           ipcgw
    irq_818x               irq_mt818x       irq_mt818x
    kd_test                keyword          keyword
    ll_schedule            ll_sched         ll_sched
    memory                 mem              mem
    micfil_dai             micfil           micfil
    mix_in                 mixin            mixin
    mix_out                mixout           mixout
    modules                intel            modules
    passthrough_codec      passthrough      passthrough
    pga                    volume           volume
    posix_ipc_task         ipc_task         ipc_task
    schedule               sch              schedule
    spi_completion         spi_compl_task   spi_completion
    waves_codec            waves            waves
    zll_schedule           zll_sched        zll_sched

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross 321d32b77d uuid: Use Zephyr ITERABLE sections for the UUID table
Zephyr has a similar trick to the .static_uuids trick SOF had been
playing that works in a (mostly) portable way and has some nice
features like runtime FOREACH iteration.

Use that for the UUID table, allowing it to be linked in globally in
Zephyr builds in a uniform way.

Also includes some general cleanup to try to reduce the amount of
backslashery required to express the various macros.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross a3c1b75808 uuid: Rename DECLARE_SOF(_RT)?_UUID() -> SOF_DEFINE_UUID()
Complete the unification of the diverged UUID APIs with a big rename.
Call it "DEFINE" instead of "DECLARE" since this is in fact a C struct
definition and not just a declaration of a type or extern symbol.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross 49420a9e8e lib/uuid: Remove redundant API
DECLARE_SOF_UUID() and the newer DECLARE_SOF_RT_UUID() were doing
exactly the same thing.  They create a sof_uuid_entry struct to link
into the ".static_uuids" section, which is treated specially by the
linker and not included in the firmware binary.

The only difference is the "_RT_" function also create a duplicate of
that struct that lives in .rodata to which it assigns the same symbol
name as DECLARE_SOF_UUID() uses (and creates an internal "_ldc" symbol
for the hidden struct) that is usable at runtime (hence the name).

But SOF is linked with -fdata-sections, so the extra struct will be
dropped at link time anyway if unused.  And the symbol name is
identical and visible in both variants even though it's only legally
used in one.

There's no reason to carry two different APIs around, unify.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross defc8e489b lib/uuid: Add warning note about endianness
Stumbled on this.  Too hard to fix with the existing macros and very
low priority given existing DSP architectures, but IMHO important to
note.

Also remove the spurious extra zero byte from the entity_name
initializer.  String literals are already null-terminated and string
initializers are already defined to zero-fill the trailing bytes.
This is a noop, except that it will cause the compiler to emit a
string length overflow warning one byte earlier than necessary.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross 0868b1f71e zephyr: Remove legacy logging artifacts
The sof-logger/smex tools and the .ldc formats are all dead code in
Zephyr builds.  The logging/trace macros don't emit the correct
metadata anymore, using Zephry logging instead (and I don't think they
ever did?), and the resulting .ldc files are degenerate containing
just the header and the records for component UUIDs, which nothing
uses.

Save a few milliseconds of build time and a few bytes of output, and
free up the evolution path by not having to support legacy tools.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Pierre-Louis Bossart c97bba3d3b topology2: fix HDMI dailink offsets for RT711-based RVPs
removing NUM_HDMIS=0 was not enough, the offsets need to be modified
as well.

While we're at it, make sure all RT711-based RVPs use the same
formatting, ADL had the setting buried in the middle of the chain of
macros.

Closes: https://github.com/thesofproject/linux/issues/5094
Fixes: 75ed6960b8 ("topology2: enable HDMI for all SoundWire production topologies")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2024-07-05 15:09:54 +03:00
Kai Vehmanen 997e536a73 zephyr: shell: add initial SOF custom commands
One of the benefits and common ways to use the Zephyr shell
subsystem is definition of application specific commands.

This commit adds the initial SOF custom command,
"sof test_inject_sched_gap". This new command allows to inject
scheduling gaps into low-latency timer scheduler execution,
using the domain_block() SOF interface. Optional argument
can be used to specify duration of the block in micro seconds.

The intent is to stress test a SOF configuration and test how
the system behaves when audio pipeline is briefly starved.

Example log of what is observed when test_inkect_sched_gap is
run:

[    0.052431] <inf> ll_schedule: zephyr_domain_thread_fn: ll core 0 timer avg 3674, max 4326, overruns 0
[    0.052831] <inf> ll_schedule: zephyr_domain_thread_fn: ll core 0 timer avg 3673, max 4318, overruns 0
~$
~$ sof test_inject_sched_gap 12000
[    0.052968] <inf> ll_schedule: zephyr_domain_block: Blocking LL scheduler
[    0.052973] <inf> ll_schedule: zephyr_domain_unblock: Unblocking LL scheduler
[    0.052973] <inf> host_comp: host_get_copy_bytes_normal: comp:1 0x10004 no bytes to copy, available samples: 0, free_samples: 384
[    0.053231] <inf> ll_schedule: zephyr_domain_thread_fn: ll core 0 timer avg 4074, max 437230, overruns 1

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-07-04 15:05:13 +01:00
Guennadi Liakhovetski f5659857a8 build: use CONFIG_64BIT for symbol exporting
Symbols like __udivdi3 aren't available in 64-bit builds, use
CONFIG_64BIT to hide them.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-07-04 14:58:50 +01:00