From 4a3d2811b1ac9b5c4a0fcdb6693495c788f05506 Mon Sep 17 00:00:00 2001 From: Baofeng Tian Date: Fri, 18 Aug 2023 09:55:14 +0800 Subject: [PATCH 1/4] audio: add a config to sof and zephyr code this config will be used to add or remove -fno-inline-functions into compiler build option. Signed-off-by: Baofeng Tian --- Kconfig.sof | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Kconfig.sof b/Kconfig.sof index 453c5348b8dd..859078d2aed7 100644 --- a/Kconfig.sof +++ b/Kconfig.sof @@ -114,6 +114,13 @@ config COMPILER_WORKAROUND_CACHE_ATTR There is a weird optimization bug with gcc10x and gcc8.1 (with -O2 flags) on IMX platforms. See PR #4605. +config COMPILER_INLINE_FUNCTION_OPTION + bool + default y if CAVS_VERSION_2_5 || ACE + default n + help + When enabled, -fno-inline-function option is not passed to compiler + rsource "src/Kconfig" # See zephyr/modules/Kconfig From 5c970dfc8a429f251bbd9f9dc0f9e5594ac078ee Mon Sep 17 00:00:00 2001 From: Baofeng Tian Date: Fri, 18 Aug 2023 10:03:50 +0800 Subject: [PATCH 2/4] audio: sof: remove -fno-inline-functions option for cavs2.5 and ace remove this build option for sof build cavs2.5 and ace platform with enable COMPILER_INLINE_FUNCTION_OPTION. Signed-off-by: Baofeng Tian --- src/arch/xtensa/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/arch/xtensa/CMakeLists.txt b/src/arch/xtensa/CMakeLists.txt index 1d9bac023bac..148b5b195588 100644 --- a/src/arch/xtensa/CMakeLists.txt +++ b/src/arch/xtensa/CMakeLists.txt @@ -98,7 +98,11 @@ else() endif() # C & ASM flags -target_compile_options(sof_options INTERFACE ${stdlib_flag} -fno-inline-functions ${XTENSA_C_ASM_FLAGS}) +if(CONFIG_COMPILER_INLINE_FUNCTION_OPTION) + target_compile_options(sof_options INTERFACE ${stdlib_flag} ${XTENSA_C_ASM_FLAGS}) +else() + target_compile_options(sof_options INTERFACE ${stdlib_flag} -fno-inline-functions ${XTENSA_C_ASM_FLAGS}) +endif() # C flags # TODO: Generator expressions are supported only with Make and Ninja, From c12224d4cd8da76ce3e549d6d613d9b9d78a6208 Mon Sep 17 00:00:00 2001 From: Baofeng Tian Date: Fri, 18 Aug 2023 10:09:32 +0800 Subject: [PATCH 3/4] audio: zephyr: add -fno-inline-functions option to zephyr code By enable/disable COMPILER_INLINE_FUNCTION_OPTION to control add or remove -fno-inline-functions build option for sof zephyr code. Signed-off-by: Baofeng Tian --- zephyr/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 07558fa1f178..c29d14e080b8 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -799,8 +799,9 @@ set(VERSION_H_PATH ${GENERATED_DIRECTORY}/sof_versions.h) find_package(Python3 COMPONENTS Interpreter) set(PYTHON3 "${Python3_EXECUTABLE}") -# We don't know why we have this https://github.com/thesofproject/sof/issues/5212 +if (NOT CONFIG_COMPILER_INLINE_FUNCTION_OPTION) target_compile_options(SOF INTERFACE -fno-inline-functions) +endif() # SOF needs `typeof`, `__VA_ARGS__` and maybe other GNU C99 # extensions. TODO other flags required ? From 7780e4a837bc8b96b21e7fdf2438c7279e893034 Mon Sep 17 00:00:00 2001 From: Baofeng Tian Date: Tue, 15 Aug 2023 11:32:21 +0800 Subject: [PATCH 4/4] audio: dai: fix the error reported by CI after enable inline after enable inline build option, CI build is reporting not initialize this structure, init it to remove the error. Signed-off-by: Baofeng Tian --- src/audio/dai-zephyr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/audio/dai-zephyr.c b/src/audio/dai-zephyr.c index 12e4dfd50fd3..ced4df6f397c 100644 --- a/src/audio/dai-zephyr.c +++ b/src/audio/dai-zephyr.c @@ -555,6 +555,8 @@ static int dai_verify_params(struct dai_data *dd, struct comp_dev *dev, struct sof_ipc_stream_params hw_params; int ret; + memset(&hw_params, 0, sizeof(hw_params)); + ret = dai_common_get_hw_params(dd, dev, &hw_params, params->direction); if (ret < 0) { comp_err(dev, "dai_verify_params(): dai_verify_params failed ret %d", ret);