Skip to content

[SKIP SOF-TEST] native loadable up-down-mixer take 2 - #8210

Closed
pjdobrowolski wants to merge 5 commits into
thesofproject:mainfrom
pjdobrowolski:sof_pawelxd_loadable_udm
Closed

[SKIP SOF-TEST] native loadable up-down-mixer take 2#8210
pjdobrowolski wants to merge 5 commits into
thesofproject:mainfrom
pjdobrowolski:sof_pawelxd_loadable_udm

Conversation

@pjdobrowolski

Copy link
Copy Markdown
Contributor

This is second approach to native sof loadable modules. This time are used zephyr's linker scripts to create separate archive for modules and put them into specific for module sections. After that cmake files, using objcopy put code for up-down-mixer to udm.mod file which is being sign by rimage.

Full process of building module is automated and run by python building scripts:
xtensa-build-zephyr.py -u mtl -k ../keys/<used_key_for_project>

@pjdobrowolskipjdobrowolski changed the title Sof pawelxd loadable udmnative loadable up-down-mixer take 2Sep 18, 2023
@pjdobrowolski
pjdobrowolski marked this pull request as draft September 18, 2023 07:27
};

DECLARE_MODULE_ADAPTER(up_down_mixer_interface, up_down_mixer_comp_uuid, up_down_mixer_comp_tr);
SOF_MODULE_INIT(up_down_mixer, sys_comp_module_up_down_mixer_interface_init);

@marcinszkudlinskimarcinszkudlinskiSep 18, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to have ability to use module in 2 ways - as a loadable OR as a built-in
It may be a kConfig option

quick suggestion (may be incorrect syntax, just a rough example):

choice
prompt "up down mixer module"
config NO_UP_DOWN_MIXER
bool "up down mixer not available"
config BUILT_IN_UP_DOWN_MIXER
bool "up down mixer as a bullt in module"
config LOADABLE_IN_UP_DOWN_MIXER
bool "up down mixer as a loadable module"
endchoice

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux Kconfig uses a tristate variable for modules
y = builtin
n = not built
m = module
We shoudl do the same to simplify our Kconfigs.

Comment threadzephyr/CMakeLists.txt
${SOF_SAMPLES_PATH}/audio/detect_test.c
)

if(CONFIG_IPC_MAJOR_3)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conversion of a specific module to loadable should be in separate commit than the loadable module infrastructure

.affinity_mask = 1,
}
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DITTO

* \brief Type definition of the package entry point.
* \note internal purpose.
*/
typedef int (ModulePackageEntryPoint)(uint32_t costam);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

english please ;)

DEFINE_MODULE_PACKAGE_ENTRY_POINT(MODULE)

/*
* #define DECLARE_LOADABLE_MODULE(MODULE, MODULE_FACTORY) \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why commeted out?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

during development we decided to drop that header file.

struct sof_module_api_build_info udm_build_info __attribute__((section(".buildinfo"))) = {
ADSP_BUILD_INFO_FORMAT,
{
((0x3FF & 5) << 20) |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prepare a macro for those shifts

Comment threadzephyr/CMakeLists.txt Outdated


# Compile up_down_mixer as loadable module
sof_loadable_library(udm ${SOF_AUDIO_PATH}/up_down_mixer/up_down_mixer.toml)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more meaningful name (updwmix) instead of udm

}
};

extern struct module_interface up_down_mixer_interface;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this forward really needed? Maybe move declaration of sof_module_api_build_info to the end of the file?

.type = { .load_type = SOF_MAN_MOD_TYPE_MODULE,
.domain_ll = 1 },
.affinity_mask = 1,
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent


#include <sof/audio/module_adapter/iadk/adsp_stddef.h>
#include <sof/audio/module_adapter/iadk/adsp_stddef.h>
#include <sof/audio/module_adapter/library/module_api_ver.h>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't look right. You haven't changed anything in the header, so there's no reason why it now need that additional header

@marc-hbmarc-hb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks but I'm pretty sure the plan for /lib/firmare/intel/sof/ is to use --use-platform-subdir like this:

sof/scripts/xtensa-build-zephyr.py --use-platform-subdir mtl
build-sof-staging |-- sof | +-- mtl | |-- community | | +-- sof-mtl.ri sha256=401e8360bd1a...
| |-- sof-mtl.ldc sha256=516ad1320ec8...
| |-- loadable_module1.ri
| |-- loadable_module2.ri
| +-- loadable_module3.ri

EDIT: maybe --use-platform-subdir should be ON by default?

@plbossart

Copy link
Copy Markdown
Member

The 'base fw' and loadable modules can be signed with different keys, so we absolutely do not want them to land in the same directory - the loadable modules MUST be in a key-specific directory.

@marc-hb

Copy link
Copy Markdown
Collaborator

@plbossart you're referring to --key-type-subdir.

I was talking about --use-platform-subdir which avoids the ugly sof-{file}-lib.ri rename hack.

They're not mutually exclusive.

In any case we need a tiny bit of plain english documentation to be reviewed and approved first, we don't want people to have to search and read python or kernel code[*] to try and fail to guess the /lib/firmware/intel/sof/ structure.

This can be as simple as 1-2 pages with the output of a sample "tree" command with a few plain English words around it. Let's stop making the same mistake over and over again:

[*] from @plbossarthttps://github.com/thesofproject/linux/blob/topic/sof-dev/sound/soc/sof/intel/pci-mtl.c#L39

@pjdobrowolski

Copy link
Copy Markdown
ContributorAuthor

I appreciate your engagement but this is still a draft.

@marc-hb

Copy link
Copy Markdown
Collaborator

In any case we need a tiny bit of plain english documentation to be reviewed and approved first, we don't want people to have to search and read python or kernel code[*] to try and fail to guess the /lib/firmware/intel/sof/ structure.

Thank you @kv2019i !

So according to that sof-docs PR, the path for loadable modules is: sof-ipc4-lib/PLAT/community/UUID.bin

Comment on lines +31 to +41
/*!
* \def STR(s)
* intermediate macro for Stringification
* \note internal purpose only. Consider to use XSTR(s) for Stringification.
*/
#define STR(s) #s
/*!
* \def XSTR(s)
* Stringification macro
*/
#define XSTR(s) STR(s)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to be careful here as I would imagine these common macros should come from Zephyr.

* \note internal purpose.
*/
#define DEFINE_MODULE_PACKAGE_ENTRY_POINT(MODULE) \
volatile sof_module_api_build_info MODULE_PACKAGE_ENTRY_BUILD_INFO_NAME(MODULE) BUILD_INFO_SECTION = \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this need to be volatile ?

@@ -0,0 +1,86 @@
version = [3, 0]

[adsp]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw, @aiChaoSONG is looking at having an #include <platform.toml> for all the non module stuff. This will help simplify

};

DECLARE_MODULE_ADAPTER(up_down_mixer_interface, up_down_mixer_comp_uuid, up_down_mixer_comp_tr);
SOF_MODULE_INIT(up_down_mixer, sys_comp_module_up_down_mixer_interface_init);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux Kconfig uses a tristate variable for modules
y = builtin
n = not built
m = module
We shoudl do the same to simplify our Kconfigs.

softwareckiand others added 4 commits September 25, 2023 09:13
Added toml file to enable building up down mixer as loadable module.
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Updated zephyr revision to the top of 006 branch
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
updated zephyr to mtl-006
updated rimage to mtl-006
@pjdobrowolski
pjdobrowolskiforce-pushed the sof_pawelxd_loadable_udm branch 4 times, most recently from c662f6d to 58c0bdfCompareSeptember 28, 2023 06:44
@marc-hbmarc-hb changed the title native loadable up-down-mixer take 2[SKIP SOF-TEST] native loadable up-down-mixer take 2Sep 28, 2023
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Sign up for freeto 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.

7 participants

@pjdobrowolski@plbossart@marc-hb@lyakh@lgirdwood@marcinszkudlinski@softwarecki