mailman.alsa-project.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

Sound-open-firmware

Thread Start a new thread
Download
Threads by month
  • ----- 2025 -----
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
sound-open-firmware@alsa-project.org

  • 4 participants
  • 1568 discussions
[Sound-open-firmware] [PATCH 1/2] agent: Add initial system monitoring agent.
by Liam Girdwood 21 Dec '17

21 Dec '17
Add a simple system monitoring agent that can detect when FW does not execute correctly. The assumption is that FW will always idle from time to time and this idling can be monitored by the SA. The FW wont idle if it's thrashing, continually interrupted, continually running work or continually rescheduling a task. The SA will emit trace and panic if idle is not entered for a specific time period. Signed-off-by: Liam Girdwood <liam.r.girdwood(a)linux.intel.com> --- src/include/reef/agent.h | 50 ++++++++++++ src/include/reef/debug.h | 1 + src/include/reef/reef.h | 4 + src/include/reef/trace.h | 1 + src/lib/Makefile.am | 3 +- src/lib/agent.c | 96 +++++++++++++++++++++++ src/platform/baytrail/include/platform/platform.h | 3 + 7 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 src/include/reef/agent.h create mode 100644 src/lib/agent.c diff --git a/src/include/reef/agent.h b/src/include/reef/agent.h new file mode 100644 index 0000000..53912b5 --- /dev/null +++ b/src/include/reef/agent.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2017, Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Liam Girdwood <liam.r.girdwood(a)linux.intel.com> + */ + +#ifndef __INCLUDE_REEF_AGENT__ +#define __INCLUDE_REEF_AGENT__ + +#include <stdint.h> +#include <stddef.h> +#include <reef/work.h> + +struct reef; + +/* simple agent */ +struct sa { + uint64_t last_idle; /* time of last idle */ + uint64_t ticks; + struct work work; +}; + +void sa_enter_idle(struct reef *reef); +void sa_init(struct reef *reef); + +#endif diff --git a/src/include/reef/debug.h b/src/include/reef/debug.h index 85f91d4..2c5c573 100644 --- a/src/include/reef/debug.h +++ b/src/include/reef/debug.h @@ -47,6 +47,7 @@ #define PANIC_EXCEPTION 6 #define PANIC_DEADLOCK 7 #define PANIC_STACK 8 +#define PANIC_IDLE 9 #define DEBUG diff --git a/src/include/reef/reef.h b/src/include/reef/reef.h index 842ad94..c872acc 100644 --- a/src/include/reef/reef.h +++ b/src/include/reef/reef.h @@ -36,6 +36,7 @@ #include <arch/reef.h> struct ipc; +struct sa; /* use same syntax as Linux for simplicity */ #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) @@ -64,6 +65,9 @@ struct reef { /* ipc */ struct ipc *ipc; + /* system agent */ + struct sa *sa; + /* private data */ void *arch_private; void *plat_private; diff --git a/src/include/reef/trace.h b/src/include/reef/trace.h index 9497f98..4656ef7 100644 --- a/src/include/reef/trace.h +++ b/src/include/reef/trace.h @@ -87,6 +87,7 @@ #define TRACE_CLASS_TONE (18 << 24) #define TRACE_CLASS_EQ_FIR (19 << 24) #define TRACE_CLASS_EQ_IIR (20 << 24) +#define TRACE_CLASS_SA (21 << 24) /* move to config.h */ #define TRACE 1 diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index b4521df..5a6dfbf 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -7,7 +7,8 @@ libcore_a_SOURCES = \ notifier.c \ trace.c \ dma-trace.c \ - schedule.c + schedule.c \ + agent.c libcore_a_CFLAGS = \ $(ARCH_CFLAGS) \ diff --git a/src/lib/agent.c b/src/lib/agent.c new file mode 100644 index 0000000..1ffee81 --- /dev/null +++ b/src/lib/agent.c @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2017, Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Liam Girdwood <liam.r.girdwood(a)linux.intel.com> + * + * System Agent - Simple FW Monitor that can notify host drivers in the event + * of any FW errors. The SA assumes that each core will enter the idle state + * from time to time (within a period of PLATFORM_IDLE_TIME). If the core does + * not enter the idle loop through looping forever or scheduling some work + * continuously then the SA will emit trace and panic(). + */ + +#include <reef/reef.h> +#include <reef/agent.h> +#include <reef/debug.h> +#include <reef/alloc.h> +#include <reef/clock.h> +#include <reef/trace.h> +#include <platform/timer.h> +#include <platform/platform.h> +#include <platform/clk.h> + +#define trace_sa(__e) trace_event_atomic(TRACE_CLASS_SA, __e) +#define trace_sa_value(__e) trace_value_atomic(__e) + +/* + * Notify the SA that we are about to enter idle state (WFI). + */ +void sa_enter_idle(struct reef *reef) +{ + struct sa *sa = reef->sa; + + sa->last_idle = platform_timer_get(platform_timer); +} + +static uint64_t validate(void *data, uint64_t delay) +{ + struct sa *sa = data; + uint64_t current; + uint64_t delta; + + current = platform_timer_get(platform_timer); + delta = current - sa->last_idle; + + /* were we last idle longer than timeout */ + if (delta > sa->ticks) { + trace_sa("tim"); + trace_sa_value(delta); + panic_dump_stack(PANIC_IDLE); + } + + return PLATFORM_IDLE_TIME; +} + +void sa_init(struct reef *reef) +{ + struct sa *sa; + + trace_sa("ini"); + + sa = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*sa)); + reef->sa = sa; + + /* set default tick timout */ + sa->ticks = clock_us_to_ticks(PLATFORM_WORKQ_CLOCK, PLATFORM_IDLE_TIME); + trace_sa_value(sa->ticks); + + /* set lst idle time to now to give time for boot completion */ + sa->last_idle = platform_timer_get(platform_timer) + sa->ticks; + work_init(&sa->work, validate, sa, WORK_ASYNC); + work_schedule_default(&sa->work, PLATFORM_IDLE_TIME); +} diff --git a/src/platform/baytrail/include/platform/platform.h b/src/platform/baytrail/include/platform/platform.h index bc90564..8b713df 100644 --- a/src/platform/baytrail/include/platform/platform.h +++ b/src/platform/baytrail/include/platform/platform.h @@ -94,6 +94,9 @@ struct reef; /* DMAC used for trace DMA */ #define PLATFORM_TRACE_DMAC DMA_ID_DMAC0 +/* DSP should be idle in this time frame */ +#define PLATFORM_IDLE_TIME 750000 + /* Platform defined panic code */ #define platform_panic(__x) \ shim_write(SHIM_IPCDH, (0xdead000 | (__x & 0xfff))) -- 2.14.1
1 1
0 0
[Sound-open-firmware] [PATCH V3] rimage: Fix some memory leak error
by Xiuli Pan 20 Dec '17

20 Dec '17
From: Pan Xiuli <xiuli.pan(a)linux.intel.com> Handle pointers and memory when error happens. Signed-off-by: Pan Xiuli <xiuli.pan(a)linux.intel.com> --- V2: rebase on the HEAD V3: add ret value to avoid uninitialized use of ret Signed-off-by: Pan Xiuli <xiuli.pan(a)linux.intel.com> --- rimage/rimage.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/rimage/rimage.c b/rimage/rimage.c index af57f5a..af4a7d0 100644 --- a/rimage/rimage.c +++ b/rimage/rimage.c @@ -208,10 +208,11 @@ static int write_elf_data(struct image *image) goto out; } - free(image->prg); - free(image->section); - out: + if (image->prg) + free(image->prg); + if (image->section) + free(image->section); return ret; } @@ -283,6 +284,8 @@ found: if (image.in_fd == NULL) { fprintf(stderr, "error: unable to open %s for reading %d\n", image.in_file, errno); + ret = -EINVAL; + goto out; } /* open outfile for writing */ @@ -291,14 +294,19 @@ found: if (image.out_fd == NULL) { fprintf(stderr, "error: unable to open %s for writing %d\n", image.out_file, errno); + ret = -EINVAL; + goto out; } /* write data */ ret = write_elf_data(&image); +out: /* close files */ - fclose(image.out_fd); - fclose(image.in_fd); + if (image.in_fd) + fclose(image.in_fd); + if (image.out_fd) + fclose(image.out_fd); return ret; } -- 2.7.4
2 1
0 0
[Sound-open-firmware] [PATCH V2] rimage: Fix some memory leak error
by Xiuli Pan 20 Dec '17

20 Dec '17
From: Pan Xiuli <xiuli.pan(a)linux.intel.com> Handle pointers and memory when error happens. Signed-off-by: Pan Xiuli <xiuli.pan(a)linux.intel.com> --- V2: rebase on the HEAD Signed-off-by: Pan Xiuli <xiuli.pan(a)linux.intel.com> --- rimage/rimage.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/rimage/rimage.c b/rimage/rimage.c index af57f5a..f5b5404 100644 --- a/rimage/rimage.c +++ b/rimage/rimage.c @@ -208,10 +208,11 @@ static int write_elf_data(struct image *image) goto out; } - free(image->prg); - free(image->section); - out: + if (image->prg) + free(image->prg); + if (image->section) + free(image->section); return ret; } @@ -283,6 +284,7 @@ found: if (image.in_fd == NULL) { fprintf(stderr, "error: unable to open %s for reading %d\n", image.in_file, errno); + goto out; } /* open outfile for writing */ @@ -291,14 +293,18 @@ found: if (image.out_fd == NULL) { fprintf(stderr, "error: unable to open %s for writing %d\n", image.out_file, errno); + goto out; } /* write data */ ret = write_elf_data(&image); +out: /* close files */ - fclose(image.out_fd); - fclose(image.in_fd); + if (image.in_fd) + fclose(image.in_fd); + if (image.out_fd) + fclose(image.out_fd); return ret; } -- 2.7.4
1 0
0 0
[Sound-open-firmware] [PATCH 1/2] topology: sof: Fix a typo for pipe src capture
by Xiuli Pan 20 Dec '17

20 Dec '17
From: Pan Xiuli <xiuli.pan(a)linux.intel.com> Should be src capture here in capture pipe. Signed-off-by: Pan Xiuli <xiuli.pan(a)linux.intel.com> --- topology/sof/pipe-src-capture.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/topology/sof/pipe-src-capture.m4 b/topology/sof/pipe-src-capture.m4 index 9484ca8..c843a6c 100644 --- a/topology/sof/pipe-src-capture.m4 +++ b/topology/sof/pipe-src-capture.m4 @@ -14,7 +14,7 @@ include(`local.m4') # Host "Passthrough Playback" PCM uses pipeline DMAC and channel # with 4 sink and 0 source periods -W_PCM_PLAYBACK(Passthrough Capture, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 4, 0, 2) +W_PCM_CAPTURE(Passthrough Capture, PIPELINE_DMAC, PIPELINE_DMAC_CHAN, 4, 0, 2) # # SRC Configuration -- 2.7.4
2 2
0 0
[Sound-open-firmware] [PATCH] Volume: Code cleanup for minimum gain value limiting
by Seppo Ingalsuo 20 Dec '17

20 Dec '17
This patch changes the condition for limiting the smallest gain to eliminate a never executed code part when VOL_MIN is defined as zero. The variable v is unsigned integer so less than zero is not possible. The functionality is not modified by this patch. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo(a)linux.intel.com> --- src/audio/volume.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/volume.c b/src/audio/volume.c index 6130563..3b3e2aa 100644 --- a/src/audio/volume.c +++ b/src/audio/volume.c @@ -427,7 +427,7 @@ static inline void volume_set_chan(struct comp_dev *dev, int chan, uint32_t vol) * multiplication overflow with the 32 bit value. Non-zero MIN option * can be useful to prevent totally muted small volume gain. */ - if (v < VOL_MIN) + if (v <= VOL_MIN) v = VOL_MIN; if (v > VOL_MAX) -- 2.11.0
2 1
0 0
[Sound-open-firmware] [PATCH] Change type of size in trace_work() callback from uint32_t to int32_t.
by yan.wang@linux.intel.com 20 Dec '17

20 Dec '17
From: Yan Wang <yan.wang(a)linux.intel.com> This variable is set by the return value of dma_copy_to_host_nowait(). Unsigned type will mislead error checking. Signed-off-by: Yan Wang <yan.wang(a)linux.intel.com> --- src/lib/dma-trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/dma-trace.c b/src/lib/dma-trace.c index ea63ab4..1fbd050 100644 --- a/src/lib/dma-trace.c +++ b/src/lib/dma-trace.c @@ -48,7 +48,7 @@ static uint64_t trace_work(void *data, uint64_t delay) struct dma_sg_config *config = &d->config; unsigned long flags; uint32_t avail = buffer->avail; - uint32_t size; + int32_t size; uint32_t hsize; uint32_t lsize; -- 2.7.4
2 1
0 0
[Sound-open-firmware] [PATCH 1/2] trace: dma: Make sure we can trace platform device initialisation.
by Liam Girdwood 19 Dec '17

19 Dec '17
Currently the trace initialisation must be performed after DMAC init has completed. This means we miss the trace output from any platform device initialisation. Split the DMA trace initialisation into two parts so the trace buffer is allocated early on and can accept messages meaning we dont miss any device initialisation trace. Signed-off-by: Liam Girdwood <liam.r.girdwood(a)linux.intel.com> --- src/include/reef/dma-trace.h | 3 +- src/lib/dma-trace.c | 61 ++++++++++++++++------------------------ src/platform/baytrail/platform.c | 4 ++- 3 files changed, 30 insertions(+), 38 deletions(-) diff --git a/src/include/reef/dma-trace.h b/src/include/reef/dma-trace.h index 2bd115e..4b17953 100644 --- a/src/include/reef/dma-trace.h +++ b/src/include/reef/dma-trace.h @@ -64,7 +64,8 @@ struct dma_trace_data { spinlock_t lock; }; -int dma_trace_init(struct dma_trace_data *d); +int dma_trace_init_early(struct dma_trace_data *d); +int dma_trace_init_complete(struct dma_trace_data *d); int dma_trace_host_buffer(struct dma_trace_data *d, struct dma_sg_elem *elem, uint32_t host_size); int dma_trace_enable(struct dma_trace_data *d); diff --git a/src/lib/dma-trace.c b/src/lib/dma-trace.c index a147219..0dccf7e 100644 --- a/src/lib/dma-trace.c +++ b/src/lib/dma-trace.c @@ -115,12 +115,9 @@ out: return DMA_TRACE_PERIOD; } -int dma_trace_init(struct dma_trace_data *d) +int dma_trace_init_early(struct dma_trace_data *d) { struct dma_trace_buf *buffer = &d->dmatb; - int ret; - - trace_buffer("dtn"); /* allocate new buffer */ buffer->addr = rballoc(RZONE_RUNTIME, RFLAGS_NONE, DMA_TRACE_LOCAL_SIZE); @@ -129,14 +126,6 @@ int dma_trace_init(struct dma_trace_data *d) return -ENOMEM; } - /* init DMA copy context */ - ret = dma_copy_new(&d->dc, PLATFORM_TRACE_DMAC); - if (ret < 0) { - trace_buffer_error("edm"); - rfree(buffer->addr); - return ret; - } - bzero(buffer->addr, DMA_TRACE_LOCAL_SIZE); /* initialise the DMA buffer */ @@ -149,13 +138,32 @@ int dma_trace_init(struct dma_trace_data *d) d->copy_in_progress = 0; list_init(&d->config.elem_list); - work_init(&d->dmat_work, trace_work, d, WORK_ASYNC); spinlock_init(&d->lock); trace_data = d; return 0; } +int dma_trace_init_complete(struct dma_trace_data *d) +{ + struct dma_trace_buf *buffer = &d->dmatb; + int ret; + + trace_buffer("dtn"); + + /* init DMA copy context */ + ret = dma_copy_new(&d->dc, PLATFORM_TRACE_DMAC); + if (ret < 0) { + trace_buffer_error("edm"); + rfree(buffer->addr); + return ret; + } + + work_init(&d->dmat_work, trace_work, d, WORK_ASYNC); + + return 0; +} + int dma_trace_host_buffer(struct dma_trace_data *d, struct dma_sg_elem *elem, uint32_t host_size) { @@ -193,15 +201,8 @@ static void dtrace_add_event(const char *e, uint32_t length) margin = buffer->end_addr - buffer->w_ptr; - /* validate */ - if (margin <= 0) { - trace_buffer_error("emm"); - return; - } - /* check for buffer wrap */ if (margin > length) { - /* no wrap */ memcpy(buffer->w_ptr, e, length); buffer->w_ptr += length; @@ -223,15 +224,11 @@ void dtrace_event(const char *e, uint32_t length) struct dma_trace_buf *buffer = NULL; unsigned long flags; - if (trace_data == NULL || length == 0) - return; - - if (!trace_data->enabled) + if (trace_data == NULL || + length > DMA_TRACE_LOCAL_SIZE / 8 || length == 0) return; buffer = &trace_data->dmatb; - if (buffer == NULL) - return; spin_lock_irq(&trace_data->lock, flags); dtrace_add_event(e, length); @@ -253,16 +250,8 @@ void dtrace_event(const char *e, uint32_t length) void dtrace_event_atomic(const char *e, uint32_t length) { - struct dma_trace_buf *buffer = NULL; - - if (trace_data == NULL || length == 0) - return; - - if (!trace_data->enabled) - return; - - buffer = &trace_data->dmatb; - if (buffer == NULL) + if (trace_data == NULL || + length > DMA_TRACE_LOCAL_SIZE / 8 || length == 0) return; dtrace_add_event(e, length); diff --git a/src/platform/baytrail/platform.c b/src/platform/baytrail/platform.c index 12f7de5..cd884a8 100644 --- a/src/platform/baytrail/platform.c +++ b/src/platform/baytrail/platform.c @@ -297,6 +297,8 @@ int platform_init(struct reef *reef) trace_point(TRACE_BOOT_PLATFORM_IPC); ipc_init(reef); + dma_trace_init_early(&reef->ipc->dmat); + /* init DMACs */ trace_point(TRACE_BOOT_PLATFORM_DMA); dmac0 = dma_get(DMA_ID_DMAC0); @@ -359,7 +361,7 @@ int platform_init(struct reef *reef) #endif /* Initialize DMA for Trace*/ - dma_trace_init(&reef->ipc->dmat); + dma_trace_init_complete(&reef->ipc->dmat); return 0; } -- 2.14.1
1 1
0 0
[Sound-open-firmware] [PATCH] pipeline: docs: Add some comments to further document the pipeline core
by Liam Girdwood 19 Dec '17

19 Dec '17
Add more descriptive documentation to help document the pipeline core. Signed-off-by: Liam Girdwood <liam.r.girdwood(a)linux.intel.com> --- src/audio/pipeline.c | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c index 3cfffb6..94d91b5 100644 --- a/src/audio/pipeline.c +++ b/src/audio/pipeline.c @@ -196,6 +196,7 @@ static void disconnect_downstream(struct pipeline *p, struct comp_dev *start, static void pipeline_cmd_update(struct pipeline *p, struct comp_dev *comp, int cmd) { + /* only required by the scheduling component */ if (p->sched_comp != comp) return; @@ -345,7 +346,11 @@ int pipeline_buffer_connect(struct pipeline *p, return 0; } -/* call op on all downstream components - locks held by caller */ +/* Walk the graph downstream from start component in any pipeline and perform + * the operation on each component. Graph walk is stopped on any component + * returning an error ( < 0) and returns immediately. Components returning a + * positive error code also stop the graph walk on that branch causing the + * walk to return to a shallower level in the graph. */ static int component_op_downstream(struct op_data *op_data, struct comp_dev *start, struct comp_dev *current, struct comp_dev *previous) @@ -422,7 +427,11 @@ static int component_op_downstream(struct op_data *op_data, return err; } -/* call op on all upstream components - locks held by caller */ +/* Walk the graph upstream from start component in any pipeline and perform + * the operation on each component. Graph walk is stopped on any component + * returning an error ( < 0) and returns immediately. Components returning a + * positive error code also stop the graph walk on that branch causing the + * walk to return to a shallower level in the graph. */ static int component_op_upstream(struct op_data *op_data, struct comp_dev *start, struct comp_dev *current, struct comp_dev *previous) @@ -496,6 +505,8 @@ static int component_op_upstream(struct op_data *op_data, return err; } +/* walk the graph upstream from start component in any pipeline and prepare + * the buffer context for each inactive component */ static int component_prepare_buffers_upstream(struct comp_dev *start, struct comp_dev *current, struct comp_buffer *buffer) { @@ -534,6 +545,8 @@ static int component_prepare_buffers_upstream(struct comp_dev *start, return err; } +/* walk the graph downstream from start component in any pipeline and prepare + * the buffer context for each inactive component */ static int component_prepare_buffers_downstream(struct comp_dev *start, struct comp_dev *current, struct comp_buffer *buffer) { @@ -725,6 +738,10 @@ int pipeline_reset(struct pipeline *p, struct comp_dev *host) * end point(s) to the downstream components in a single operation. * i.e. the period data is processed from upstream end points to downstream * "comp" recursively in a single call to this function. + * + * The copy operation is for this pipeline only (as pipelines are scheduled + * individually) and it stops at pipeline endpoints (where a component has no + * source or sink components) or where this pipeline joins another pipeline. */ static int pipeline_copy_from_upstream(struct comp_dev *start, struct comp_dev *current) @@ -779,6 +796,10 @@ copy: * downstream end point component(s) in a single operation. * i.e. the period data is processed from this component to downstream * end points recursively in a single call to this function. + * + * The copy operation is for this pipeline only (as pipelines are scheduled + * individually) and it stops at pipeline endpoints (where a component has no + * source or sink components) or where this pipeline joins another pipeline. */ static int pipeline_copy_to_downstream(struct comp_dev *start, struct comp_dev *current) @@ -827,6 +848,10 @@ out: return err; } +/* walk the graph to downstream active components in any pipeline to find + * the first active DAI and return it's timestamp. + * TODO: consider pipeline with multiple DAIs + */ static int timestamp_downstream(struct comp_dev *start, struct comp_dev *current, struct sof_ipc_stream_posn *posn) { @@ -868,7 +893,10 @@ downstream: return res; } - +/* walk the graph to upstream active components in any pipeline to find + * the first active DAI and return it's timestamp. + * TODO: consider pipeline with multiple DAIs + */ static int timestamp_upstream(struct comp_dev *start, struct comp_dev *current, struct sof_ipc_stream_posn *posn) { @@ -938,7 +966,8 @@ static void xrun(struct comp_dev *dev, void *data) } -/* travel down stream from start and run func for each component of type */ +/* walk the graph downstream from start component in any pipeline and run + * function <func> for each component of type <type> */ static void pipeline_for_each_downstream(struct pipeline *p, enum sof_comp_type type, struct comp_dev *current, void (*func)(struct comp_dev *, void *), void *data) @@ -964,7 +993,8 @@ static void pipeline_for_each_downstream(struct pipeline *p, } } -/* travel up stream from start and run func for each component of type */ +/* walk the graph upstream from start component in any pipeline and run + * function <func> for each component of type <type> */ static void pipeline_for_each_upstream(struct pipeline *p, enum sof_comp_type type, struct comp_dev *current, void (*func)(struct comp_dev *, void *), void *data) -- 2.14.1
1 0
0 0
[Sound-open-firmware] [PATCH] lock: Add deadlock detection.
by Liam Girdwood 19 Dec '17

19 Dec '17
Add a debug option that can detect deadlock and panic(). The deadlock detection attempts to acquire a lock several times before giving up and causing a panic() taht dumps the deadlock details. Signed-off-by: Liam Girdwwod <liam.r.girdwood(a)linux.intel.com> --- src/include/reef/debug.h | 1 + src/include/reef/lock.h | 71 ++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 57 insertions(+), 15 deletions(-) diff --git a/src/include/reef/debug.h b/src/include/reef/debug.h index 70a7802..7551fc5 100644 --- a/src/include/reef/debug.h +++ b/src/include/reef/debug.h @@ -45,6 +45,7 @@ #define PANIC_PLATFORM 4 #define PANIC_TASK 5 #define PANIC_EXCEPTION 6 +#define PANIC_DEADLOCK 7 #define DEBUG diff --git a/src/include/reef/lock.h b/src/include/reef/lock.h index deb0fb7..fd415ae 100644 --- a/src/include/reef/lock.h +++ b/src/include/reef/lock.h @@ -35,6 +35,7 @@ #define __INCLUDE_LOCK__ #define DEBUG_LOCKS 0 +#define DEBUG_LOCKS_VERBOSE 0 #include <stdint.h> #include <arch/spinlock.h> @@ -62,19 +63,33 @@ * grep -rn lock --include *.c | grep 439 * src/lib/alloc.c:439: spin_lock_irq(&memmap.lock, flags); * - * Every lock entry and exit shows LcE and LcX in trace alonside the lock + * Every lock entry and exit shows LcE and LcX in trace alongside the lock * line numbers in hex. e.g. * * 0xfd60 [11032.730567] delta [0.000004] lock LcE * 0xfd70 [11032.730569] delta [0.000002] value 0x00000000000000ae * - * Deadlock would be a LcE without a subsequent LcX. + * Deadlock can be confirmed in rmbox :- * + * Debug log: + * debug: 0x0 (00) = 0xdead0007 (-559087609) |....| + * .... + * Error log: + * using 19.20MHz timestamp clock + * 0xc30 [26.247240] delta [26.245851] lock DED + * 0xc40 [26.247242] delta [0.000002] value 0x00000000000002b4 + * 0xc50 [26.247244] delta [0.000002] value 0x0000000000000109 + * + * DED means deadlock has been detected and the DSP is now halted. The first + * value after DEA is the line number where deadlock occurs and the second + * number is the line number where the lock is allocated. These can be grepped + * like above. */ #if DEBUG_LOCKS #define DBG_LOCK_USERS 8 +#define DBG_LOCK_TRIES 10000 #define trace_lock(__e) trace_error_atomic(TRACE_CLASS_LOCK, __e) #define tracev_lock(__e) tracev_event_atomic(TRACE_CLASS_LOCK, __e) @@ -84,22 +99,29 @@ extern uint32_t lock_dbg_atomic; extern uint32_t lock_dbg_user[DBG_LOCK_USERS]; -#define spin_lock_dbg() \ - trace_lock("LcE"); \ - trace_lock_value(__LINE__); - -#define spin_unlock_dbg() \ - trace_lock("LcX"); \ - trace_lock_value(__LINE__); \ - /* all SMP spinlocks need init, nothing todo on UP */ #define spinlock_init(lock) \ arch_spinlock_init(lock); \ (lock)->user = __LINE__; -/* does nothing on UP systems */ -#define spin_lock(lock) \ - spin_lock_dbg(); \ +/* panic on deadlock */ +#define spin_try_lock_dbg(lock) \ + do { \ + int __tries; \ + for (__tries = DBG_LOCK_TRIES; __tries > 0; __tries--) { \ + if (arch_try_lock(lock)) \ + break; /* lock acquired */ \ + } \ + if (__tries == 0) { \ + trace_lock_error("DED"); \ + trace_lock_value(__LINE__); \ + trace_lock_value((lock)->user); \ + panic(PANIC_DEADLOCK); /* lock not acquired */ \ + } \ + } while (0); + +#if DEBUG_LOCKS_VERBOSE +#define spin_lock_log(lock) \ if (lock_dbg_atomic) { \ int __i = 0; \ int __count = lock_dbg_atomic >= DBG_LOCK_USERS \ @@ -111,8 +133,27 @@ extern uint32_t lock_dbg_user[DBG_LOCK_USERS]; trace_lock_value((lock_dbg_atomic << 24) | \ lock_dbg_user[__i]); \ } \ - } \ - arch_spin_lock(lock); + } + +#define spin_lock_dbg() \ + trace_lock("LcE"); \ + trace_lock_value(__LINE__); + +#define spin_unlock_dbg() \ + trace_lock("LcX"); \ + trace_lock_value(__LINE__); + +#else +#define spin_lock_log(lock) +#define spin_lock_dbg() +#define spin_unlock_dbg() +#endif + +/* does nothing on UP systems */ +#define spin_lock(lock) \ + spin_lock_dbg(); \ + spin_lock_log(lock); \ + spin_try_lock_dbg(lock); #define spin_unlock(lock) \ arch_spin_unlock(lock); \ -- 2.14.1
1 0
0 0
[Sound-open-firmware] [PATCH 1/3] topology: test: Refine name for test generator.
by Xiuli Pan 19 Dec '17

19 Dec '17
From: Pan Xiuli <xiuli.pan(a)linux.intel.com> We have 5 critical arguments in the test generator but only used 3 for the naming, this will make some files be overwritten. Refine the name method to let these 5 arguments show in the tplg name. Also we decide the pipe type in one of the argument, test-ssp.m4 and test-src-ssp.m4 are almost the same, just remove one. Signed-off-by: Pan Xiuli <xiuli.pan(a)linux.intel.com> --- topology/test/test-src-ssp.m4 | 90 ------------------------------------------- topology/test/test-ssp.m4 | 2 +- topology/test/tplg-build.sh | 4 +- 3 files changed, 3 insertions(+), 93 deletions(-) delete mode 100644 topology/test/test-src-ssp.m4 diff --git a/topology/test/test-src-ssp.m4 b/topology/test/test-src-ssp.m4 deleted file mode 100644 index 4a0723e..0000000 --- a/topology/test/test-src-ssp.m4 +++ /dev/null @@ -1,90 +0,0 @@ -# -# Topology for pass through pipeline -# - -# Include topology builder -include(`local.m4') -include(`build.m4') - -# Include TLV library -include(`common/tlv.m4') - -# Include Token library -include(`sof/tokens.m4') - -# Include Baytrail DSP configuration -include(`dsps/byt.m4') - -# -# Machine Specific Config - !! MUST BE SET TO MATCH TEST MACHINE DRIVER !! -# -# TEST_PIPE_NAME - Pipe name -# TEST_DAI_LINK_NAME - BE DAI link name e.g. "NoCodec" -# TEST_SSP_PORT - SSP port number e.g. 2 -# TEST_SSP_FORMAT - SSP data format e.g s16le -# TEST_PIPE_FORMAT - Pipeline format e.g. s16le -# TEST_SSP_BCLK - SSP BCLK in Hz -# TEST_SSP_PHY_BITS - SSP physical slot size -# TEST_SSP_DATA_BITS - SSP data slot size -# - -# -# Define the pipeline -# -# PCM0 <--> SRC <--> SSP TEST_SSP_PORT -# - -# Passthrough playback pipeline 1 on PCM 0 using max 2 channels of s24le. -# Schedule 48 frames per 1000us deadline on core 0 with priority 0 -# Use DMAC 0 channel 1 for PCM audio playback data - -PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-playback.m4, - 1, 0, 2, TEST_PIPE_FORMAT, - 48, 1000, 0, 0, 0, 1, - SSP, TEST_SSP_PORT, TEST_SSP_FORMAT, 2) - - -# Passthrough playback pipeline 2 on PCM 0 using max 2 channels of s24le. -# Schedule 48 frames per 1000us deadline on core 0 with priority 0 -# Use DMAC 0 channel 1 for PCM audio playback data - -PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-capture.m4, - 2, 0, 2, TEST_PIPE_FORMAT, - 48, 1000, 0, 0, 0, 1, - SSP, TEST_SSP_PORT, TEST_SSP_FORMAT, 2) - -# -# DAI configuration -# -# SSP port TEST_SSP_PORT is our only pipeline DAI -# - -# playback DAI is SSP TEST_SSP_PORT using 2 periods -# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0 -DAI_ADD(sof/pipe-dai-playback.m4, - 1, SSP, TEST_SSP_PORT, - PIPELINE_SOURCE_1, 2, TEST_SSP_FORMAT, - 48, 1000, 0, 0) - -# capture DAI is SSP TEST_SSP_PORT using 2 periods -# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0 -DAI_ADD(sof/pipe-dai-capture.m4, - 2, SSP, TEST_SSP_PORT, - PIPELINE_SINK_2, 2, TEST_SSP_FORMAT, - 48, 1000, 0, 0) - -# PCM Passthrough -PCM_DUPLEX_ADD(Passthrough, 3, 0, 0, PIPELINE_PCM_1, PIPELINE_PCM_2) - -# -# BE configurations - overrides config in ACPI if present -# -# Clocks masters wrt codec -# -# TEST_SSP_DATA_BITS bit I2S using TEST_SSP_PHY_BITS bit sample conatiner on SSP TEST_SSP_PORT -# -DAI_CONFIG(SSP, TEST_SSP_PORT, TEST_DAI_LINK_NAME, I2S, TEST_SSP_DATA_BITS, - DAI_CLOCK(mclk, 19200000, slave), - DAI_CLOCK(bclk, TEST_SSP_BCLK, slave), - DAI_CLOCK(fsync, 48000, slave), - DAI_TDM(2, TEST_SSP_PHY_BITS, 3, 3)) diff --git a/topology/test/test-ssp.m4 b/topology/test/test-ssp.m4 index ff2756e..92e91bf 100644 --- a/topology/test/test-ssp.m4 +++ b/topology/test/test-ssp.m4 @@ -31,7 +31,7 @@ include(`dsps/byt.m4') # # Define the pipeline # -# PCM0 <---> SSP TEST_SSP_PORT +# PCM0 <-- TEST_PIPE_NAME pipe --> SSP TEST_SSP_PORT # # Passthrough playback pipeline 1 on PCM 0 using max 2 channels of s24le. diff --git a/topology/test/tplg-build.sh b/topology/test/tplg-build.sh index 5c81638..a73335a 100755 --- a/topology/test/tplg-build.sh +++ b/topology/test/tplg-build.sh @@ -12,7 +12,7 @@ M4_FLAGS="-I ../ -I ../m4" # Simple component test cases # can be used on components with 1 sink and 1 source. -SIMPLE_TESTS=(test-ssp test-src-ssp) +SIMPLE_TESTS=(test-ssp) # process m4 simple tests - # simple_test(name, pipe_name, be_name, format, dai_id, dai_format, dai_phy_bits, dai_data_bits dai_bclk) @@ -29,7 +29,7 @@ SIMPLE_TESTS=(test-ssp test-src-ssp) function simple_test { for i in ${SIMPLE_TESTS[@]} do - TFILE="$i$5-$4-48k-$1" + TFILE="$i$5-$2-$4-$6-48k-$1" echo "M4 pre-processing test $i -> ${TFILE}" m4 ${M4_FLAGS} \ -DTEST_PIPE_NAME="$2" \ -- 2.7.4
4 6
0 0
  • ← Newer
  • 1
  • ...
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • ...
  • 157
  • Older →

HyperKitty Powered by HyperKitty version 1.3.8.