Commit Graph

3556 Commits

Author SHA1 Message Date
Guennadi Liakhovetski d5081da8fe interrupt: reduce the use of the container_of() macro
Instead of passing a pointer to the interrupt descriptor, embedded in
a cascading interrupt object and then using container_of() to get
back to the cascading interrupt, pass a pointer to it directly to
functions.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski ac456d0a13 interrupt: support arbitrary interrupt controller cascading
When registering a cascading interrupt controller as a child of
another interrupt controller, no new child descriptor has to be
allocated, instead the embedded into the cascading interrupt
controller object descriptor has to be used.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski f0e5094c4a interrupt: switch from bitfields to dynamic interrupt mapping
Currently on cAVS platforms the two kinds of interrupts are treated
differently: the native DSP interrupts and "level" interrupts,
multiplexed by cascading interrupt controllers. For the latter
bitfields are used with both the parent DSP interrupt and the child
multiplexed interrupt numbers encoded in them. This is inflexible and
doesn't scale when more cascading interrupt controllers are added.
This patch switches over from using those bitfields to dynamically
mapping cascaded interrupts into a single plain interrupt number
space. Specifically this patch does the following:

- For interrupt conttrollers it adds an .irq_base field, which is the
  base for child interrupts, multiplexed by this controller.

- An interrupt mapping function interrupt_get_irq() is added, which
  uses the name of the cascading interrupt controller and an
  interrupt number on that controller to create a logical interrupt
  number.

- All uses of SOF_IRQ() and SOF_ID_IRQ() and related bitfield-
  manipulation macros are removed.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski 3f416a3e02 interrupt: call the interrupt handler only for enabled descriptors
When multiple interrupt handlers share the same interrupt, only
those, that enabled the interrupt on a specific CPU, have to be
called on that CPU.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski 1712beab30 spi: remove the unused irq field
The SPI driver only supports the DMA mode, its IRQ line isn't used
and the IRQ number in Sue Creek data is wrong. Remove the field
completely.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski fe5886808b idc: add an irq private data member
Use the platform provided IDC IRQ number only once and save the
number in a private field. This relies on the fact, that the
interrupt number is the same on all cores.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski d79c9190e9 schedule: add an irq private data member
Use the platform provided scheduler IRQ number only once and save the
number in a private field.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski fb7bf77c51 interrupt: use the parent IRQ instead of SOF_IRQ_NUMBER()
Where available, use the IRQ number of the parent instead of
extracting it from the child's interrupt, using SOF_IRQ_NUMBER().

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski 19ac2359c8 interrupt: SOF_IRQ_NUMBER() for DSP interrupts is not needed
DSP interrupts have their own interrupt number in parent interrupt
bits, therefore using SOF_IRQ_NUMBER() for them is redundant.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski 6f238763fa interrupt: stop using SOF_IRQ_CPU()
The only two uses of SOF_IRQ_CPU() are currently in irq_mask() and
irq_unmask() on cAVS. However, those functions are always called
after interrupt_get_parent(), which makes sure, that the CPU, encoded
into the IRQ is the same as the current one. Therefore we can also
just use the current CPU in irq_mask() and irq_unmask().

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski 4d3d2083f7 interrupt: add a cpu argument to interrupt_(un)mask()
Most interrupts in SOF are handled completely locally: they are
registered, enabled, disabled, and handled on one and the same core.
There is only one case, where interrupts have to be unmasked on a
different core: in idc_enable_interrupts(). To make this possible
without using the CPU field in the IRQ bitfield we add a "cpu"
argument to interrupt_mask() and interrupt_unmask() functions.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski a9f313955e interrupt: add controller mask and unmask operations
Add interrupt controller .mask() and .unmask() operations. Use them
instead of platform_interrupt_mask() and platform_interrupt_unmask().

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski 7b01b4f7c1 cavs: eliminate per-core interrupt controller descriptors
Currently cascading interrupt controller descriptors are registered
per core. This works well with Xtensa's "levelN" IRQ controllers
because their child interrupt lines can be masked per core. However
generic interrupt controllers do not have such a capability, which
makes registering them per core meaningless and error-prone. Switch
over to global IRQ descriptors, allocating them from non-cacheable
memory to avoid having to manually synchronise them at run-time.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski 241eea8a70 cavs: fix wrong interrupt masking
To mask an interrupt ILMXSD has to be written, not ILXMCD.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski bed0b9f865 cavs: optimise the interrupt handler
Instead of checking one bit at a time, use ffs() to only handle set
bits in the interrupt status. Also fix the unhandled interrupt
detection logic: complain only if no handler has been found for a
given interrupt.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski 3f2fb7bb56 interrupt: introduce a list of interrupt controllers
Add a list of interrupt controllers, that will be allocated
at run-time from non-cacheable memory, and functions to perform such
a registration and to search through the list.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski ffc14323f3 interrupt: add a macro to distinguish DSP interrupts
Until now cavs/interrupt.c used to call interrupt_get_parent() where
it had to verify whether an interrupt was a DSP interrupt or a
cascaded one. That function is rather heavy - it takes a spin-lock,
scans a list of all cascading interrupt controllers and checks their
interrupt numbers. Whereas that check can be performed much easier
and faster by simply checking the "level" field of the IRQ token.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski 9d4307fb5a interrupt: remove an unused function parameter
platform_interrupt_mask() and platform_interrupt_unmask() have a
"mask" parameter, that is actually never used. It is only used on
baytrail, but the only use of those functions on that platform is
from the ssp.c driver, where mask is fixed to 1. Besides the meaning
of that parameter was unclear: it would be logical to assume, that it
is a bitmask that has to be applied to a masking register, but often
those functions were called with mask=0, which makes no sense. This
patch removes that parameter.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski 45f29f0bec interrupt: unify interrupt_clear() and interrupt_set() functions
Currently the SOF API in addition to interrupt_clear() and
interrupt_set() functions also has platform_interrupt_clear() and
platform_interrupt_set(). Those functions are partially overlapping
and their choice is confusing. Unify them to only use the former
variant - without the platform_ prefix.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski d229b1ba21 cavs: don't call known dummy function
platform_interrupt_clear() is a dummy function on cAVS platforms, no
need to call it in cAVS-specific drivers.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski 31cf4f084b byt, hsw: call arch_interrupt_clear() directly
Platform interrupt handling code should call arch_interrupt_clear()
directly, no need to use the interrupt_clear() wrapper.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski 0e80be7d52 xtensa: only enable interrupts after allocating context
Enabling interrupts before allocating context for them can at least
in theory lead to such an interrupt being triggered and then
attempting to access the context. Fix the order for task interrupts.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski f2e76acd48 interrupt: add a parameter to interrupt_unregister()
Sharing interrupts is currently implemented by inserting an interrupt
ID field into the interrupt bitmask. We want to get rid of bitmasked
interrupt numbers, therefore that method has to be replaced. This
patch uses an approach, similar to the Linux kernel: we pass the
interrupt handler argument to the interrupt_unregister() function to
be compared to the argument, used when registering the interrupt
handler. This means, that users must use unique arguments when
registering interrupts, but this is anyway the case in most cases. We
also add a check for this to interrupt_register().

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Guennadi Liakhovetski 1af90b4ee1 interrupt: introduce a separate struct for cascading interrupts
Currently each interrupt descriptor has an array of list heads, that
can be used to cascade further interrupts to it. But most interrupts
are simple decide interrupts, that cannot have children. This patch
introduces a separate type for interrupt controllers, that can indeed
have children.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-07-26 13:31:05 +01:00
Zhang Keqiao fd6208d65b topology: sof-cml-demux-rt5682: revise physical link iDisp1 ID
to align with machine driver

The physical link iDisp1 ID for HDMI should be changed to 3,4,5
to align with machine driver. ID 2 is defined for DMIC16k.

Signed-off-by: Zhang Keqiao <keqiao.zhang@linux.intel.com>
2019-07-25 13:38:47 +02:00
Paul Olaru 57f21581e4 platform: imx8: Fix exception mailbox offset
Tried to diagnose a DSP panic, did not work due to this wrong offset.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-07-25 08:33:13 +03:00
Marcin Rajwa 8256465955 host: fix wrong check for irq
This patch fixes the incorrect check of period irq in
host_period_bytes.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-07-25 00:32:53 +02:00
Marcin Rajwa 6119126d90 ipc: align stream.h with kernel
This change is to align sof_ipc_stream_params with its
kernel equivalent. The change is needed in both kernel
and FW because FW needs to use host_period_bytes which
where previously used to inform host about period IRQ.
Therefore now we introduce new member for it period_irq
and let host_period_bytes keep the proper value.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-07-25 00:32:53 +02:00
Keyon Jie 9bacb24725 alloc: allocate real continuous blocks in alloc_cont_blocks()
When a block is used, we need reset the searching, to get the real
continuous blocks as required, here fix it.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2019-07-25 00:03:11 +02:00
Bartosz Kokoszko de2e08a07a pipeline: refine pipeline_free() function
This change allows us to free components and pipelines
in any order. Added setting component pointer to NULL
after comp_free() invocation. In pipeline_free() there is
a incovation of pipeline_comp_free() only if component
pointer is not NULL.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-07-24 23:01:06 +02:00
Janusz Jankowski 9d7aea477b testbench: add missing trace classes
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-07-24 22:33:25 +02:00
Janusz Jankowski 7fb9372d29 logger: add missing trace classes
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-07-24 22:33:25 +02:00
Janusz Jankowski 3d5cc36b1b trace: deduplicate TRACE_CLASS defines
These traces shouldn't be duplicated, they should be in
more public header because they are used outside of FW.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-07-24 22:33:25 +02:00
Tomasz Lauda a513ac7251 debug: use IS_ENABLED macro instead of defining new one
Uses IS_ENABLED(CONFIG_GDB_DEBUG) instead of defining
new GDB_DEBUG macro.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-20 10:03:30 +02:00
Tomasz Lauda bdd0f4fa66 arch: xtensa: add missing #include <config.h> to debug-vector.S
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-20 10:03:30 +02:00
Tomasz Lauda 3860b90c9e config: replace #ifdef with #if for CONFIG_* defines
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-20 10:03:30 +02:00
Tomasz Lauda c4778aa375 ipc: kernel: user: revert usage of __packed macro
Reverts usage of __packed macro in ipc, kernel and user
headers. These headers are not only used by firmware,
so they shouldn't have any dependency on it.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-20 10:03:30 +02:00
Tomasz Lauda e20dcd9ff4 spinlock: move DEBUG_LOCKS and DEBUG_LOCKS_VERBOSE to Kconfig
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-20 10:03:30 +02:00
Tomasz Lauda 16df30a73d arch: xtensa: remove level 6 irq define from xtos
We don't have any platform with level 6 interrupt support.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-20 10:03:30 +02:00
Tomasz Lauda 7299afe35c arch: xtensa: use CONFIG_BOOT_LOADER instead of platforms
Changes cmake script to use CONFIG_BOOT_LOADER instead
of specific platform configs when choosing whether to
build bootloader.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-20 10:03:30 +02:00
Tomasz Lauda 4b82db8a62 memory: remove static assert for HEAP_BUF_ALIGNMENT
Removes static assert for HEAP_BUF_ALIGNMENT, because it
doesn't make sense anymore to keep it. The value of this
define has been changed to PLATFORM_DCACHE_ALIGN, so it
will always be valid.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-20 10:03:30 +02:00
Tomasz Lauda eff2f46415 memory: make HEAP_BUF_ALIGNMENT macro to use PLATFORM_DCACHE_ALIGN
It adds another abstraction layer, so we don't need to directly use
xtos define.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-20 10:03:30 +02:00
Tomasz Lauda 3fcd4e5a03 cache: move PLATFORM_DCACHE_ALIGN to cache.h
All cache related defines should be kept inside
dedicated cache header. Also changes sizeof(uint32_t)
to sizeof(void *), so the header could be included
from assembly files.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-20 10:03:30 +02:00
Tomasz Lauda 4b5110b88b dma-trace: use dedicated trace_buffer_error_atomic macro
Creates trace_buffer_error_atomic macro and changes
usage in dma-trace.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-20 10:03:30 +02:00
Tomasz Lauda 5740092514 edf_schedule: change wrong trace function
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-20 10:03:30 +02:00
Tomasz Lauda 88c6626655 pipeline: change wrong trace function in pipeline_reset
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-20 10:03:30 +02:00
Tomasz Lauda 10464ece03 platform: remove PLATFORM_TIMER_START_OFFSET
Removes PLATFORM_TIMER_START_OFFSET define from
platforms, because it's deprecated and not used
anymore.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-20 10:03:30 +02:00
Tomasz Lauda 3b580ac836 suecreek: remove #include <config.h> from linker script
Removes #include <config.h> from linker script, because it's
not used.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-20 10:03:30 +02:00
Bartosz Kokoszko f79a1a0afc mux: return PPL_STATUS_PATH_STOP in mux_trigger()
This commit does not change FW behaviour since
both COMP_STATUS_STATE_ALREADY_SET and PPL_STATUS_PATH_STOP
defines are equal to 1. It just makes code more clear.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-07-20 08:29:34 +02:00
Tomasz Lauda 14b23ba5d3 task: move task structure and defines to the right header
Moves task structure and defines to the sof/task.h,
where they should be from the beginning. sof/schedule.h is
just for scheduler related things.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-07-19 15:50:35 +02:00