Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc. Zephyrization fixups #9731

Merged
merged 9 commits into from
Dec 19, 2024
8 changes: 8 additions & 0 deletions app/Kconfig
Original file line number Diff line number Diff line change
@@ -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"

1 change: 0 additions & 1 deletion app/boards/acp_6_0_adsp.conf
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@ CONFIG_DCACHE_LINE_SIZE=128
CONFIG_DYNAMIC_INTERRUPTS=y
Copy link
Collaborator

Choose a reason for hiding this comment

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

@andyross Ack. CONFIG_TRACE was working with Zephyr at some point, but basicly as Intel has moved to native logging, this code is likely to have bitrotted. For Intel, we are ok to remove it. It was useful at start, but now that there is plenty of infra available in Zephyr (and plenty of examples in SOF how to use it), I don't think it's the worth keeping around anymore. And if it doesn't work anymore, seems like a clear case.

CONFIG_SHARED_INTERRUPTS=n
CONFIG_ZEPHYR_LOG=n
CONFIG_TRACE=n
CONFIG_DMA=y
CONFIG_ZEPHYR_NATIVE_DRIVERS=n
CONFIG_AMS=n
2 changes: 0 additions & 2 deletions app/boards/imx8qm_mek_mimx8qm6_adsp.conf
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions app/boards/imx8qxp_mek_mimx8qx6_adsp.conf
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions app/boards/imx8ulp_evk_mimx8ud7_adsp.conf
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion app/boards/imx93_evk_mimx9352_a55.conf
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion app/boards/imx95_evk_mimx9596_m7_ddr.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CONFIG_DYNAMIC_INTERRUPTS=y
CONFIG_TRACE=n
CONFIG_ZEPHYR_NATIVE_DRIVERS=y
CONFIG_IMX95=y

2 changes: 0 additions & 2 deletions app/boards/intel_adsp_ace15_mtpm.conf
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions app/boards/intel_adsp_ace20_lnl.conf
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions app/boards/intel_adsp_ace30_ptl.conf
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion app/boards/intel_adsp_ace30_ptl_sim.conf
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions app/boards/intel_adsp_cavs25.conf
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions app/boards/intel_adsp_cavs25_tgph.conf
Original file line number Diff line number Diff line change
@@ -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
7 changes: 1 addition & 6 deletions app/boards/native_sim_libfuzzer.conf
Original file line number Diff line number Diff line change
@@ -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
8 changes: 2 additions & 6 deletions app/prj.conf
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions posix/include/sof/lib/dma.h
Original file line number Diff line number Diff line change
@@ -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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Apologies @andyross , I was testing with all AMD/MTK/NXP/Intel targets in upstream, but right, definitions not used in upstream were very likely missed.

/* DMA interrupt commands */
enum dma_irq_cmd {
DMA_IRQ_STATUS_GET = 0,
4 changes: 2 additions & 2 deletions src/audio/dai-legacy.c
Original file line number Diff line number Diff line change
@@ -99,15 +99,15 @@ 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) {
/* stop the DAI */
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 ? */
2 changes: 1 addition & 1 deletion src/drivers/mediatek/afe/afe-dai.c
Original file line number Diff line number Diff line change
@@ -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,
2 changes: 1 addition & 1 deletion src/drivers/mediatek/afe/afe-drv.c
Original file line number Diff line number Diff line change
@@ -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++)
5 changes: 3 additions & 2 deletions src/drivers/mediatek/afe/afe-memif.c
Original file line number Diff line number Diff line change
@@ -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;
}

@@ -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));
2 changes: 1 addition & 1 deletion src/init/init.c
Original file line number Diff line number Diff line change
@@ -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)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ack, this has been missed. Minimal support indeed a good addition!

log_set_timestamp_func(default_get_timestamp,
sys_clock_hw_cycles_per_sec());
#endif
8 changes: 5 additions & 3 deletions src/ipc/ipc3/handler.c
Original file line number Diff line number Diff line change
@@ -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

4 changes: 1 addition & 3 deletions src/math/Kconfig
Original file line number Diff line number Diff line change
@@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

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

FYI @singalsu

default FILTER_HIFI_MAX

config FILTER_HIFI_MAX
4 changes: 4 additions & 0 deletions xtos/include/sof/lib/dma.h
Original file line number Diff line number Diff line change
@@ -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,
9 changes: 4 additions & 5 deletions zephyr/include/rtos/interrupt.h
Original file line number Diff line number Diff line change
@@ -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
}

Loading