From 3775a93def6f61c1a9b716030aea0aeabf8991e3 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Tue, 3 Dec 2024 08:29:05 -0800 Subject: [PATCH 1/9] src/ipc3: Don't fail on trace messages when CONFIG_TRACE=n Zephyr builds don't use the older trace protocol, but for now still need to work with IPC3 kernel layers that expect it to be present. Just return a noop success from trace messages when not configured, otherwise the -EINVAL will propagate to the other side and abort the firmware load. Signed-off-by: Andy Ross --- src/ipc/ipc3/handler.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ipc/ipc3/handler.c b/src/ipc/ipc3/handler.c index 1a4ca43d70fe..12f2ba3a34a4 100644 --- a/src/ipc/ipc3/handler.c +++ b/src/ipc/ipc3/handler.c @@ -967,9 +967,11 @@ static int ipc_glb_trace_message(uint32_t header) #else static int ipc_glb_trace_message(uint32_t header) { - /* traces are disabled - CONFIG_TRACE is not set */ - - return -EINVAL; + /* Return success, as the protocol provides no way to inform + * the kernel that we don't support dtrace. It will just see + * no output. + */ + return 0; } #endif From 1de65784df8cd4d118664cf16b8c354d357c88db Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Mon, 16 Dec 2024 15:56:52 -0800 Subject: [PATCH 2/9] src/init: Support CONFIG_LOG_MODE_MINIMAL When CONFIG_LOG_MODE_MINIMAL is chosen this function doesn't exist. Minimal logging is actually really useful when debugging: it's a synchronous logging mode (especially useful for winstream logging where it becomes safe against DSP hangs or latchups) using the same logging API, but with no buffering/filtering/timestamping, and is backed by the platform printk() implementation. We want to support this. Signed-off-by: Andy Ross --- src/init/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init/init.c b/src/init/init.c index 530e82a537de..9ff13c5d8b12 100644 --- a/src/init/init.c +++ b/src/init/init.c @@ -287,7 +287,7 @@ static int primary_core_init(int argc, char *argv[], struct sof *sof) interrupt_init(sof); #endif /* __ZEPHYR__ */ -#ifdef CONFIG_ZEPHYR_LOG +#if defined(CONFIG_ZEPHYR_LOG) && !defined(CONFIG_LOG_MODE_MINIMAL) log_set_timestamp_func(default_get_timestamp, sys_clock_hw_cycles_per_sec()); #endif From 7acca63169c3dcd6240848dd5f82e77c2e2b7aa9 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Mon, 16 Dec 2024 17:02:45 -0800 Subject: [PATCH 3/9] include/interrupt.h: Zephyr build fixups This header may be included in situations where there is no log context declared, but still needs to expand a tr_err() macro. Declare the "zephyr" context as a default. (Though really this is not a runtime error and should probably be handled with a BUILD_ASSERT()). Also, there was a growing "enumerate all the Zephyr platforms" preprocessor #if expression that can be simplified to just the IMX8M device that needs special treatment. Signed-off-by: Andy Ross --- zephyr/include/rtos/interrupt.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/zephyr/include/rtos/interrupt.h b/zephyr/include/rtos/interrupt.h index 3dfa7ccec7db..d0e3dd772b7c 100644 --- a/zephyr/include/rtos/interrupt.h +++ b/zephyr/include/rtos/interrupt.h @@ -30,6 +30,7 @@ static inline int interrupt_register(uint32_t irq, void(*handler)(void *arg), vo return arch_irq_connect_dynamic(irq, 0, (void (*)(const void *))handler, arg, 0); #else + LOG_MODULE_DECLARE(zephyr, CONFIG_SOF_LOG_LEVEL); tr_err(&zephyr_tr, "Cannot register handler for IRQ %u: dynamic IRQs are disabled", irq); return -EOPNOTSUPP; @@ -48,17 +49,15 @@ static inline void interrupt_unregister(uint32_t irq, const void *arg) static inline int interrupt_get_irq(unsigned int irq, const char *cascade) { -#if defined(CONFIG_LIBRARY) || defined(CONFIG_ACE) || defined(CONFIG_CAVS) || \ - defined(CONFIG_ZEPHYR_POSIX) || (defined(CONFIG_IMX) && !defined(CONFIG_IMX8M)) || \ - defined(CONFIG_AMD) - return irq; -#else +#ifdef CONFIG_IMX8M if (cascade == irq_name_level2) return SOC_AGGREGATE_IRQ(irq, IRQ_NUM_EXT_LEVEL2); if (cascade == irq_name_level5) return SOC_AGGREGATE_IRQ(irq, IRQ_NUM_EXT_LEVEL5); return SOC_AGGREGATE_IRQ(0, irq); +#else + return irq; #endif } From 17ec23f52aeac0f1fe249f5773b6cf62b0328d85 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Tue, 17 Dec 2024 08:05:44 -0800 Subject: [PATCH 4/9] drivers: Add missing SOF_DMA_ renaming These symbols got renamed in commit 1d73fb3d759f ("treewide: prefix RTOS lib/dma.h DMA_ definitions with SOF_DMA_"), but these spots were apparently dead code and missed it. They're being resurrected, so fix them up. Signed-off-by: Andy Ross --- posix/include/sof/lib/dma.h | 3 +++ src/audio/dai-legacy.c | 4 ++-- src/drivers/mediatek/afe/afe-dai.c | 2 +- xtos/include/sof/lib/dma.h | 4 ++++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/posix/include/sof/lib/dma.h b/posix/include/sof/lib/dma.h index 43214cc14ae5..ffae21574916 100644 --- a/posix/include/sof/lib/dma.h +++ b/posix/include/sof/lib/dma.h @@ -97,6 +97,9 @@ enum dma_cb_status { DMA_CB_STATUS_END, }; +#define SOF_DMA_CB_STATUS_RELOAD DMA_CB_STATUS_RELOAD +#define SOF_DMA_CB_STATUS_END DMA_CB_STATUS_END + /* DMA interrupt commands */ enum dma_irq_cmd { DMA_IRQ_STATUS_GET = 0, diff --git a/src/audio/dai-legacy.c b/src/audio/dai-legacy.c index 5065c3f21ca1..b212bb9ebdac 100644 --- a/src/audio/dai-legacy.c +++ b/src/audio/dai-legacy.c @@ -99,7 +99,7 @@ static void dai_dma_cb(void *arg, enum notify_id type, void *data) comp_dbg(dev, "dai_dma_cb()"); - next->status = DMA_CB_STATUS_RELOAD; + next->status = SOF_DMA_CB_STATUS_RELOAD; /* stop dma copy for pause/stop/xrun */ if (dev->state != COMP_STATE_ACTIVE || dd->xrun) { @@ -107,7 +107,7 @@ static void dai_dma_cb(void *arg, enum notify_id type, void *data) dai_trigger(dd->dai, COMP_TRIGGER_STOP, dev->direction); /* tell DMA not to reload */ - next->status = DMA_CB_STATUS_END; + next->status = SOF_DMA_CB_STATUS_END; } /* is our pipeline handling an XRUN ? */ diff --git a/src/drivers/mediatek/afe/afe-dai.c b/src/drivers/mediatek/afe/afe-dai.c index ee6b9cff0d8e..a0b3450515a9 100644 --- a/src/drivers/mediatek/afe/afe-dai.c +++ b/src/drivers/mediatek/afe/afe-dai.c @@ -100,7 +100,7 @@ const struct dai_driver afe_dai_driver = { .type = SOF_DAI_MEDIATEK_AFE, .uid = SOF_UUID(afe_dai_uuid), .tctx = &afe_dai_tr, - .dma_dev = DMA_DEV_AFE_MEMIF, + .dma_dev = SOF_DMA_DEV_AFE_MEMIF, .ops = { .trigger = afe_dai_drv_trigger, .set_config = afe_dai_drv_set_config, diff --git a/xtos/include/sof/lib/dma.h b/xtos/include/sof/lib/dma.h index 95e408124f0c..7cfd6cecdc2b 100644 --- a/xtos/include/sof/lib/dma.h +++ b/xtos/include/sof/lib/dma.h @@ -87,6 +87,7 @@ struct comp_buffer; #define SOF_DMA_DEV_SAI DMA_DEV_SAI #define SOF_DMA_DEV_ESAI DMA_DEV_ESAI #define SOF_DMA_DEV_MICFIL DMA_DEV_MICFIL +#define SOF_DMA_DEV_AFE_MEMIF DMA_DEV_AFE_MEMIF /* DMA access privilege flag */ #define DMA_ACCESS_EXCLUSIVE 1 @@ -106,6 +107,9 @@ enum dma_cb_status { DMA_CB_STATUS_END, }; +#define SOF_DMA_CB_STATUS_RELOAD DMA_CB_STATUS_RELOAD +#define SOF_DMA_CB_STATUS_END DMA_CB_STATUS_END + /* DMA interrupt commands */ enum dma_irq_cmd { DMA_IRQ_STATUS_GET = 0, From 27080b0bc255171333851f6850c2599b50ffc585 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Tue, 17 Dec 2024 13:29:58 -0800 Subject: [PATCH 5/9] zephyr/app: Clean up Zephyr kconfig defaults Things had gotten a little messy here. The CPU_MASK_PIN_ONLY and SMP_BOOT_DELAY options are in fact not generic to all Zephyr builds; they both depend on SMP, and in fact don't exist otherwise, producing a build failure if the board defconfig doesn't turn it off. Create an application "Kconfig" file (which SOF hasn't used so far), which allows the dependencies for these settings to be more cleanly expressed. Similarly CONFIG_TRACE=y won't build with Zephyr, and all boards were turning it off independently. Move that to the prj.conf level. And likewise CONFIG_ZEPHYR_LOG, while not strictly required for a Zephyr build, is pervasively enabled (except on ACP6? What does that device use for logging?), so it belongs in the global file. Signed-off-by: Andy Ross --- app/Kconfig | 8 ++++++++ app/boards/acp_6_0_adsp.conf | 1 - app/boards/imx8qm_mek_mimx8qm6_adsp.conf | 2 -- app/boards/imx8qxp_mek_mimx8qx6_adsp.conf | 2 -- app/boards/imx8ulp_evk_mimx8ud7_adsp.conf | 2 -- app/boards/imx93_evk_mimx9352_a55.conf | 1 - app/boards/imx95_evk_mimx9596_m7_ddr.conf | 1 - app/boards/intel_adsp_ace15_mtpm.conf | 2 -- app/boards/intel_adsp_ace20_lnl.conf | 2 -- app/boards/intel_adsp_ace30_ptl.conf | 2 -- app/boards/intel_adsp_ace30_ptl_sim.conf | 1 - app/boards/intel_adsp_cavs25.conf | 2 -- app/boards/intel_adsp_cavs25_tgph.conf | 2 -- app/boards/native_sim_libfuzzer.conf | 7 +------ app/prj.conf | 8 ++------ 15 files changed, 11 insertions(+), 32 deletions(-) create mode 100644 app/Kconfig diff --git a/app/Kconfig b/app/Kconfig new file mode 100644 index 000000000000..1ea5b4d46f61 --- /dev/null +++ b/app/Kconfig @@ -0,0 +1,8 @@ +config SCHED_CPU_MASK_PIN_ONLY + default y if SMP + +config SMP_BOOT_DELAY + default y if SMP + +source "Kconfig.zephyr" + diff --git a/app/boards/acp_6_0_adsp.conf b/app/boards/acp_6_0_adsp.conf index d56937f651c9..2e4332e31dcd 100644 --- a/app/boards/acp_6_0_adsp.conf +++ b/app/boards/acp_6_0_adsp.conf @@ -5,7 +5,6 @@ CONFIG_DCACHE_LINE_SIZE=128 CONFIG_DYNAMIC_INTERRUPTS=y CONFIG_SHARED_INTERRUPTS=n CONFIG_ZEPHYR_LOG=n -CONFIG_TRACE=n CONFIG_DMA=y CONFIG_ZEPHYR_NATIVE_DRIVERS=n CONFIG_AMS=n diff --git a/app/boards/imx8qm_mek_mimx8qm6_adsp.conf b/app/boards/imx8qm_mek_mimx8qm6_adsp.conf index 6e741fa7a270..6c8eb26b6e9a 100644 --- a/app/boards/imx8qm_mek_mimx8qm6_adsp.conf +++ b/app/boards/imx8qm_mek_mimx8qm6_adsp.conf @@ -2,8 +2,6 @@ CONFIG_IMX8=y CONFIG_HAVE_AGENT=n CONFIG_FORMAT_CONVERT_HIFI3=n CONFIG_KPB_FORCE_COPY_TYPE_NORMAL=n -CONFIG_ZEPHYR_LOG=y -CONFIG_TRACE=n CONFIG_DMA=y CONFIG_DMA_NXP_EDMA_ENABLE_HALFMAJOR_IRQ=y CONFIG_SHARED_INTERRUPTS=y diff --git a/app/boards/imx8qxp_mek_mimx8qx6_adsp.conf b/app/boards/imx8qxp_mek_mimx8qx6_adsp.conf index d3e3c3c8be79..e6b3ce395c39 100644 --- a/app/boards/imx8qxp_mek_mimx8qx6_adsp.conf +++ b/app/boards/imx8qxp_mek_mimx8qx6_adsp.conf @@ -2,8 +2,6 @@ CONFIG_IMX8X=y CONFIG_HAVE_AGENT=n CONFIG_FORMAT_CONVERT_HIFI3=n CONFIG_KPB_FORCE_COPY_TYPE_NORMAL=n -CONFIG_ZEPHYR_LOG=y -CONFIG_TRACE=n CONFIG_DMA=y CONFIG_DMA_NXP_EDMA_ENABLE_HALFMAJOR_IRQ=y CONFIG_SHARED_INTERRUPTS=y diff --git a/app/boards/imx8ulp_evk_mimx8ud7_adsp.conf b/app/boards/imx8ulp_evk_mimx8ud7_adsp.conf index fdd6e7364c11..5df4c87d3c18 100644 --- a/app/boards/imx8ulp_evk_mimx8ud7_adsp.conf +++ b/app/boards/imx8ulp_evk_mimx8ud7_adsp.conf @@ -3,8 +3,6 @@ CONFIG_HAVE_AGENT=n CONFIG_FORMAT_CONVERT_HIFI3=n CONFIG_KPB_FORCE_COPY_TYPE_NORMAL=n -CONFIG_ZEPHYR_LOG=y -CONFIG_TRACE=n CONFIG_DMA=y CONFIG_DMA_NXP_EDMA_ENABLE_HALFMAJOR_IRQ=y diff --git a/app/boards/imx93_evk_mimx9352_a55.conf b/app/boards/imx93_evk_mimx9352_a55.conf index 4f3d12d5a2f8..7c0667da66b9 100644 --- a/app/boards/imx93_evk_mimx9352_a55.conf +++ b/app/boards/imx93_evk_mimx9352_a55.conf @@ -13,7 +13,6 @@ CONFIG_DCACHE_LINE_SIZE_DETECT=n CONFIG_DCACHE_LINE_SIZE=64 CONFIG_IMX93_A55=y -CONFIG_TRACE=n # DAI-related configurations CONFIG_SAI_HAS_MCLK_CONFIG_OPTION=y diff --git a/app/boards/imx95_evk_mimx9596_m7_ddr.conf b/app/boards/imx95_evk_mimx9596_m7_ddr.conf index 21aed31934af..aec33d7c7e91 100644 --- a/app/boards/imx95_evk_mimx9596_m7_ddr.conf +++ b/app/boards/imx95_evk_mimx9596_m7_ddr.conf @@ -1,5 +1,4 @@ CONFIG_DYNAMIC_INTERRUPTS=y -CONFIG_TRACE=n CONFIG_ZEPHYR_NATIVE_DRIVERS=y CONFIG_IMX95=y diff --git a/app/boards/intel_adsp_ace15_mtpm.conf b/app/boards/intel_adsp_ace15_mtpm.conf index 3908ca5d30d3..5341d14e4ddd 100644 --- a/app/boards/intel_adsp_ace15_mtpm.conf +++ b/app/boards/intel_adsp_ace15_mtpm.conf @@ -55,8 +55,6 @@ CONFIG_LIBRARY_BASE_ADDRESS=0xa0688000 # SOF / logging CONFIG_SOF_LOG_LEVEL_INF=y -CONFIG_TRACE=n -CONFIG_ZEPHYR_LOG=y # Zephyr / OS features CONFIG_DEBUG_COREDUMP=y diff --git a/app/boards/intel_adsp_ace20_lnl.conf b/app/boards/intel_adsp_ace20_lnl.conf index 7130665f78d0..022a3a9a40b6 100644 --- a/app/boards/intel_adsp_ace20_lnl.conf +++ b/app/boards/intel_adsp_ace20_lnl.conf @@ -43,8 +43,6 @@ CONFIG_LIBRARY_MANAGER=y # SOF / logging CONFIG_SOF_LOG_LEVEL_INF=y -CONFIG_TRACE=n -CONFIG_ZEPHYR_LOG=y # Zephyr / OS features CONFIG_COUNTER=y diff --git a/app/boards/intel_adsp_ace30_ptl.conf b/app/boards/intel_adsp_ace30_ptl.conf index 0be2f1802a54..d7c1979b63a4 100644 --- a/app/boards/intel_adsp_ace30_ptl.conf +++ b/app/boards/intel_adsp_ace30_ptl.conf @@ -38,9 +38,7 @@ CONFIG_INTEL_MODULES=y CONFIG_LIBRARY_MANAGER=y # SOF / logging -CONFIG_TRACE=n CONFIG_SOF_LOG_LEVEL_INF=y -CONFIG_ZEPHYR_LOG=y # Zephyr / OS features CONFIG_COUNTER=y diff --git a/app/boards/intel_adsp_ace30_ptl_sim.conf b/app/boards/intel_adsp_ace30_ptl_sim.conf index be8d2b52c59e..eb72fb6598cc 100644 --- a/app/boards/intel_adsp_ace30_ptl_sim.conf +++ b/app/boards/intel_adsp_ace30_ptl_sim.conf @@ -55,7 +55,6 @@ CONFIG_INTEL_ADSP_IPC=y # Temporary disabled options -CONFIG_TRACE=n CONFIG_PM_DEVICE=y CONFIG_PM_DEVICE_RUNTIME=n CONFIG_PM_DEVICE_POWER_DOMAIN=n diff --git a/app/boards/intel_adsp_cavs25.conf b/app/boards/intel_adsp_cavs25.conf index 1117c66437e4..72104567491a 100644 --- a/app/boards/intel_adsp_cavs25.conf +++ b/app/boards/intel_adsp_cavs25.conf @@ -35,9 +35,7 @@ CONFIG_INTEL_MODULES=y CONFIG_LIBRARY_MANAGER=n # SOF / logging -CONFIG_TRACE=n CONFIG_SOF_LOG_LEVEL_INF=y -CONFIG_ZEPHYR_LOG=y # Zephyr / OS features CONFIG_DEBUG_COREDUMP=y diff --git a/app/boards/intel_adsp_cavs25_tgph.conf b/app/boards/intel_adsp_cavs25_tgph.conf index 83dea362fb06..b29a7ba18970 100644 --- a/app/boards/intel_adsp_cavs25_tgph.conf +++ b/app/boards/intel_adsp_cavs25_tgph.conf @@ -34,9 +34,7 @@ CONFIG_INTEL_MODULES=y CONFIG_LIBRARY_MANAGER=n # SOF / logging -CONFIG_TRACE=n CONFIG_SOF_LOG_LEVEL_INF=y -CONFIG_ZEPHYR_LOG=y # Zephyr / OS features CONFIG_DEBUG_COREDUMP=y diff --git a/app/boards/native_sim_libfuzzer.conf b/app/boards/native_sim_libfuzzer.conf index 631130f99fc3..ece1e35845c9 100644 --- a/app/boards/native_sim_libfuzzer.conf +++ b/app/boards/native_sim_libfuzzer.conf @@ -8,9 +8,4 @@ CONFIG_SYS_HEAP_BIG_ONLY=y CONFIG_ZEPHYR_NATIVE_DRIVERS=y CONFIG_ARCH_POSIX_LIBFUZZER=y CONFIG_ZEPHYR_POSIX_FUZZ_TICKS=100 - -# Override incompatible options found in sof/app/prj.conf -# to silence build time warnings -# (strange why these are in app/prj.conf but not our problem here) -CONFIG_SMP_BOOT_DELAY=n -CONFIG_SCHED_CPU_MASK_PIN_ONLY=n +CONFIG_ZEPHYR_LOG=n diff --git a/app/prj.conf b/app/prj.conf index cd182e5be16c..e072f1df2fd2 100644 --- a/app/prj.conf +++ b/app/prj.conf @@ -15,6 +15,8 @@ CONFIG_HAVE_AGENT=n # We need more time to test and evaluate. CONFIG_MINIMAL_LIBC=y +CONFIG_ZEPHYR_LOG=y +CONFIG_TRACE=n CONFIG_LOG=y CONFIG_LOG_PRINTK=y # Log processing is offloaded to a low-priority thread. @@ -41,12 +43,6 @@ CONFIG_COMPILER_OPT="-fstrict-overflow" CONFIG_SCHED_DEADLINE=y CONFIG_SCHED_CPU_MASK=y -CONFIG_SMP_BOOT_DELAY=y - -# SOF code assumes system work queue and other system -# wide threads are pinned to a single core. -# CPU_MASK_PIN_ONLY must be set for all SOF builds. -CONFIG_SCHED_CPU_MASK_PIN_ONLY=y # Fix the sys ticks value until following bugs are solved: # - https://github.com/zephyrproject-rtos/zephyr/issues/46378 From ffbd25d08ab55b9a2ae17868fa9be0ec8a541a73 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Fri, 22 Nov 2024 18:20:00 -0800 Subject: [PATCH 6/9] drivers/mtk/afe: Update timestamp API This DMA driver was using timer_get_system() to generate timestamps, which is the Xtensa CCOUNT timer in legacy SOF but doesn't exist at all in Zephyr (well, you can read the SR directly). Use sof_cycle_get_64(), which is the portable API based on the clock hardware. Other DMA drivers do just fine with this. Signed-off-by: Andy Ross --- src/drivers/mediatek/afe/afe-memif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/mediatek/afe/afe-memif.c b/src/drivers/mediatek/afe/afe-memif.c index 3a9abf73f016..66638e126ff8 100644 --- a/src/drivers/mediatek/afe/afe-memif.c +++ b/src/drivers/mediatek/afe/afe-memif.c @@ -213,7 +213,7 @@ static int memif_status(struct dma_chan_data *channel, struct dma_chan_status *s if (!hw_ptr) { status->r_pos = 0; status->w_pos = 0; - status->timestamp = timer_get_system(timer_get()); + status->timestamp = sof_cycle_get_64(); return -EINVAL; } hw_ptr -= memif->dma_base; @@ -224,7 +224,7 @@ static int memif_status(struct dma_chan_data *channel, struct dma_chan_status *s status->r_pos = memif->rptr + memif->dma_base; status->w_pos = memif->wptr + memif->dma_base; - status->timestamp = timer_get_system(timer_get()); + status->timestamp = sof_cycle_get_64(); return 0; } From 25a74405e4082e34e6f179506e159e7f8e186e7f Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Tue, 3 Dec 2024 13:11:11 -0800 Subject: [PATCH 7/9] drivers/mediatek/afe: Handle zero-length allocation The older SOF allocator would return a valid pointer into the heap for a zero length block, but Zephyr's sys_heap returns a NULL. That's not an error and it will free() as a noop. Signed-off-by: Andy Ross --- src/drivers/mediatek/afe/afe-drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/mediatek/afe/afe-drv.c b/src/drivers/mediatek/afe/afe-drv.c index 5681638344a6..b9cf29eaa654 100644 --- a/src/drivers/mediatek/afe/afe-drv.c +++ b/src/drivers/mediatek/afe/afe-drv.c @@ -380,7 +380,7 @@ int afe_probe(struct mtk_base_afe *afe) afe->irqs_size = platform->irqs_size; afe->irqs = rzalloc(SOF_MEM_ZONE_RUNTIME_SHARED, 0, SOF_MEM_CAPS_RAM, sizeof(struct mtk_base_afe_irq) * afe->irqs_size); - if (!afe->irqs) + if (!afe->irqs && afe->irqs_size) goto err_alloc_dais; for (i = 0; i < afe->irqs_size; i++) From afd2bbf64e8588ed0aa3ec2e5c6b29e0da0019da Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Tue, 17 Dec 2024 07:36:18 -0800 Subject: [PATCH 8/9] drivers/mediatek/afe: Set initial state on DMA objects At the start of probe(), the expectation is that component objects go to COMP_STATE_INIT. This was being skipped. That used to be benign, I believe because the struct was allocated via a path that set it already. But now it fails with the Zephyr integration. Signed-off-by: Andy Ross --- src/drivers/mediatek/afe/afe-memif.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/drivers/mediatek/afe/afe-memif.c b/src/drivers/mediatek/afe/afe-memif.c index 66638e126ff8..5fdba9b17fd9 100644 --- a/src/drivers/mediatek/afe/afe-memif.c +++ b/src/drivers/mediatek/afe/afe-memif.c @@ -370,6 +370,7 @@ static int memif_probe(struct dma *dma) dma->chan[channel].dma = dma; /* TODO need divide to UL and DL for different index */ dma->chan[channel].index = channel; + dma->chan[channel].status = COMP_STATE_INIT; memif = rzalloc(SOF_MEM_ZONE_SYS_RUNTIME, 0, SOF_MEM_CAPS_RAM, sizeof(struct afe_memif_dma)); From 442420b4df6778ac845ef3167110d103b6ef8c83 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Tue, 17 Dec 2024 16:48:19 -0800 Subject: [PATCH 9/9] math: Fix dependencies in filter HiFi selection The intent of the dependencies on this choice seems to be that they apply only to certain components so the selection should be hidden if they aren't in use. But the logic was wrong: instead of enabling it if any component was enabled that needed it, it would hide the selection unless ALL such components were enabled. Which doesn't build. Fix. (Also I note the comment implies that other kconfigs should probably be in the list too, but not adding them out of conservatism as this is, again, just a hygiene thing.) Signed-off-by: Andy Ross --- src/math/Kconfig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/math/Kconfig b/src/math/Kconfig index 08e4f9a554f0..ccd7520f20a7 100644 --- a/src/math/Kconfig +++ b/src/math/Kconfig @@ -128,9 +128,7 @@ endmenu # this choice covers math iir, math fir, tdfb, and eqfir, eqiir. choice "FILTER_SIMD_LEVEL_SELECT" prompt "choose which SIMD level used for IIR/FIR/TDFB module" - depends on COMP_FIR - depends on COMP_IIR - depends on COMP_TDFB + depends on COMP_FIR || COMP_IIR || COMP_TDFB default FILTER_HIFI_MAX config FILTER_HIFI_MAX