[Letux-kernel] [PATCH] omap: aess: fw: skip fw header for fw_data

H. Nikolaus Schaller hns at goldelico.com
Wed Feb 14 11:05:15 CET 2024

Hi Patrik,

> Am 13.02.2024 um 22:40 schrieb Patrik Dahlström <risca at dalakolonin.se>:
> I believe the original intent was for this member to point to the
> beginning of fw *data*, but here it is actually set to the beginning of
> the entire fw including header.
> fw_data is later directly written to PMEM, and all the other *MEM areas.
> When we later try to start the DSP firmware, it will try and "run" the
> fw header and probably lock up.
> Fix this by taking into account the size of the fw header when saving
> the pointer. This makes reading out the PMEM area from debugfs work
> without any issues

Yes, I can confirm that it fixes the PMEM issues on PandaES!

Still there is no sound but also no crash or bug reports from the kernel.
Or kernel being stuck waiting for something.

This means that the AE DSP firmware is up and running and reading/cooperating
with the shared memory buffers.

Maybe now the tools from


(especially abe_check) can now run and reveal additional information.

> Signed-off-by: Patrik Dahlström <risca at dalakolonin.se>
> ---
> sound/soc/ti/aess/omap-aess-fw.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/sound/soc/ti/aess/omap-aess-fw.c b/sound/soc/ti/aess/omap-aess-fw.c
> index 8daff9fb1488..48cd6d7e3d33 100644
> --- a/sound/soc/ti/aess/omap-aess-fw.c
> +++ b/sound/soc/ti/aess/omap-aess-fw.c
> @@ -658,7 +658,7 @@ static int aess_load_fw(struct snd_soc_component *component,
> dev_info(aess->dev, "AESS Firmware version %x\n", aess->fw_hdr.version);
> /* store AESS firmware for later context restore */
> - aess->fw_data = fw_data;
> + aess->fw_data = fw_data + sizeof(struct fw_header);

For the reasons why we need this now, I have compared the code of
the working 3.15 kernel.

First of all there is no addition of the struct fw_header size.

Another change we have made was to drop the data parameter from
passed to omap_aess_load_fw(*aess, *data). The reason is that
this fw_data is already available through *aess.

Nicely the parameter description said:
* @data: Pointer on the AESS firmware (after the header)

I looked where the 3.15 calculates the "after the header".

It uses

	const void *fw_data = snd_soc_fw_get_data(hdr);

So this must return the binary blob address after the header.

And indeed include/sound/soc-fw.h:

	return ptr + sizeof(*hdr);

But this is not the DSP firmware header but the header to wrap
parts of the overall firmware binary.

We have replaced this by snd_soc_tplg_get_data() which is the
modern variant. This adds the topology header size (a different
hdr struct!).

On the other hand aess_load_fw() stores a copy of the header
in aess->fw_hdr. So it must be part of the packed binary.

Ah, I get it...

Look here:


The 3.15 kernel takes the aess->fw_data as fw_ptr.

And reads out the sizes of the components by autoincrementing
this fw_ptr before using it as pmem_ptr!

Then the pmem_ptr becomes fw_data + sizeof(struct fw_header).

On the other hand the v6.8-rc4 version as we currently have it:


where we simply read out the sizes but do *not* advance the

So the addition of + sizeof(struct fw_header) should happen
here on a slightly lower driver level. Note that this also
influences cmem_ptr, dmem_ptr and smem_ptr in the same way
as you original patch.

In total we have to fix the patch "omap: aess: aess_ini: take bank sizes from new header"

For inclusion in the Letux tree I'll modify your very great patch,
because you have found the issue! A small step for the source code
but a big step for Pyra-mankind :)

The WIP version is here:


BR and thanks,

More information about the Letux-kernel mailing list