Commit Graph

7125 Commits

Author SHA1 Message Date
Marc Herbert e3494f5662 xtensa-build-zephyr: make "tree" optional
"tree" is very useful but it's not critical, not worth failing the build
for.

Also remove a single quote from the help message as it breaks parsing
in one simple editor I use (jed) and possibly others.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-13 22:28:09 +01:00
Zhang Keqiao f6bc279da6 topology1: add a test topology sof-adl-nocodec-ci build support
We plan to test the CI test topology on ADL-P nocodec device, so
add the topology build support in cmake list.

Signed-off-by: Zhang Keqiao <keqiao.zhang@intel.com>
2021-09-13 15:44:52 +01:00
Allen-KH Cheng 7f2169201c kconfig: select XTENSA_EXCLUSIVE for mt8195
there is no s32c1i instructions in mt8195.

it will use exclusive instructions.
(XCHAL_HAVE_EXCLUSIVE is defined in core-isa.h)

Select CONFIG_XTENSA_EXCLUSIVE by default for mt8195.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-13 15:17:16 +01:00
Curtis Malainey a0acad3414 CMake: require version 3.13
Without CMP0079 we cannot conditionally include libraries against SOF in
sub directories without seriously restructuring the project. This is
because the old policy requires the link target must be created in the
same folder. This does not work well from a configuration standpoint for
3P audio libraries trying to keep their config in src/audio/*. Rather
than enable the policy, lets simply upgrade since 3.13 is widely
available.

With this upgrade we can also remove the two version dependent checks at
the top of our scripts.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-09-10 17:19:29 +01:00
Allen-KH Cheng 9a09b97c28 scripts: Add mt8195 to build script
Add mt8195 to build script.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-10 17:13:06 +01:00
Allen-KH Cheng a43193bb3f Kconfig: add mt8195 to Kconfig
add mt8195 to Kconfig
add mediatek config for mtk platform

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-10 17:13:06 +01:00
Allen-KH Cheng a944603502 build: remove unused files from build system
Removes the files added to build system by mistake.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-10 17:13:06 +01:00
Allen-KH Cheng 954149cdfb drivers: mtk: remove superfluous variable for mt8195
For GCC compile error,
error: variable 'ret' set but not use

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-10 17:13:06 +01:00
Allen-kh Cheng 83093dadea xtensa: add atomic and spinlock function with exclusive
In mp_asm.S, if XCHAL_HAVE_EXCLUSIVE is defined,
it will use exclusive instructions,
else it will use s32c1i instructions.

It supports S32C1I and exclusive instruction in xthal_compare_and_set() API.
Refer to xtos-simc-mutex.c, xtos_mutex_p structure is similar to spinlock_t.

For dsp design, we cannot use s32c1i intrcutions in mt8195.

In order to not affect other platform, add CONFIG_XTENSA_EXCLUSIVE and __XCC__
compile options.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-10 17:09:56 +01:00
Allen-KH Cheng 1e8feb2cf3 xtensa: add mt8195 MPU setup
Override the default MPU setup.
This table matches the mt8195 memory map

Add xtensa/mpuasm.h, for mpu_write_map opcode

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-10 17:09:56 +01:00
Allen-KH Cheng d15debf011 xtensa: exception: Add XCHAL_INTLEVEL5_MASK
This results in a compiler error
when xtensa configuration has no IRQ level 5.
Make it use core-isa.h.

Error:
invalid register 'EPC5' for 'rsr' instruction
Error:
invalid register 'EPS5' for 'rsr' instruction

For mt8195, we don't support those instrucations

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-10 17:09:56 +01:00
Marc Herbert 9452af0a5e xtensa-build-zephyr: add zephyr_fetch_and_switch() example
Add example that shows how to submit any Zephyr commit to SOF PR
testing.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-10 13:35:36 +01:00
Marc Herbert 4d3192c266 xtensa-build-zephyr: add option to stop after cloning Zephyr
This is needed by CI to clone only once and then take control of the
iteration over platform builds. CI already does all that but by
copy/paste/diverge of this clone() function.

Once cloning Zephyr in CI code is de-duplicated and uses this new
clone-only feature instead, it will be possible to submit any Zephyr
commit to SOF testing.  In other words it will make failed attempt
https://github.com/thesofproject/sof/pull/4728 possible

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-10 13:35:36 +01:00
Keyon Jie a7367f4fc0 library: memory: align it to the latest cavs version
Make the size of buffer zone calculated at linking stage, to align to
the latest cavs version.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-09-10 12:07:59 +01:00
Keyon Jie ba95d8d306 cmocka: align to the new heap management
Align to the new heap memory map and allocator, smaller SYSTEM and
RUNTIME zones are used on apollolake now.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-09-10 12:07:59 +01:00
Keyon Jie fc255ac943 cavs: memory: make full use of HPSRAM
Make size of the buffer zone calculated at the linking stage, to make
full use of all HPSRAM memories.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-09-10 12:07:59 +01:00
Guennadi Liakhovetski 83e65d325a Revert "alloc: fix a wrong index calculation in heap buffer"
This reverts commit ffff0b0610.
Both heap and memmap->buffer are of type struct mm_heap so their
difference is already a number of struct mm_heap sized elements
between them. Dividing by sizeof(struct mm_heap) again is wrong.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-09-10 09:56:18 +08:00
Marc Herbert 9a231915ea .github/zephyr: add -Werror
Because we can. This would have caught this regression from
commit 287a5f9a2b ("ssp: mclk/bclk turned off unexpectedly")

-DEXTRA_CFLAGS is not very well documented but it is what Zephyr uses,
try `git -C zephyr grep -C 5 EXTRA_CFLAGS and see.

```
sof/src/drivers/intel/ssp/ssp.c: In function 'ssp_set_config_tplg':
sof/zephyr/include/sof/trace/trace.h:44:11: warning:
                   too many arguments for format [-Wformat-extra-args]
   44 |    printk("%llu: " format "\n", platform_timer_get(NULL), \
      |           ^~~~~~~~
  ...
sof/src/drivers/intel/ssp/ssp.c:763:4: note: in expansion of macro 'dai_info'
  763 |    dai_info(dai, "ssp_set_config(): hw_free stage:
                     ignore since there is still user", dai->index);
```

Using -Werror only in CI avoids slowing down developers with temporary
warnings they intend on fixing later (but before submission)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-09 15:48:18 +01:00
Marc Herbert a0ab594045 zephyr/docker-build.sh: pass arguments through to xtensa-build-zephyr.sh
Allows passing compilation flags and any other argument.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-09 15:48:18 +01:00
Marc Herbert 88327f618c xtensa-build-zephyr: support passing through CMake arguments
Like this:

  xtensa-build-zephyr.sh -a -- -DEXTRA_CFLAGS='-Werror -Wextra'

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-09 15:48:18 +01:00
Marc Herbert aec08eaf7e xtensa-build-zephyr: extract new parse_args() function from main()
main() was growing too big. Zero functional change.

Also rename the too generic "build()" to build_all()

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-09 15:48:18 +01:00
Keyon Jie 1e2d574356 zephyr: wrapper: hardcode SIZEs to unblock building
We have change the size of runtime_shared zone to be decided at link
stage, here hardcode HEAP_RUNTIME_SHARED_SIZE to unblock the Zephyr
building.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-09-09 09:36:31 +01:00
Keyon Jie 15e06515e2 rimage: update rimage for more cavs platforms
246ea6469a config: skl: change image_size to the real SRAM size
9c9e07c650 config: kbl: change image_size to the real SRAM size
44b37d19a2 config: sue: change image_size to the real SRAM size
580e4d674e config: tgl-cavs: change image_size to the real SRAM size

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-09-09 09:36:31 +01:00
Keyon Jie 1966f64eb6 buffer: remove the unneeded size check
The allocator will return failure if the request size is too big, remove
the unsuitable check here.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-09-09 09:36:31 +01:00
Pierre-Louis Bossart 8fc5247289 topology: move IMX and MTK topologies out of Intel list
Not sure why they were intertwined, let's separate them out to avoid
git conflicts with integration.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2021-09-08 20:19:41 +01:00
Pierre-Louis Bossart 24ad7ea0fa topology: sof-glk-es8336: initial support
This topology is used on GLK and TGL. variations include:
- DMIC supported on TGL and not on GLK
- TGL uses SSP0 instead of SSP2

APL support was added only based on user reports. This assumes the
same topology as GLK but was not tested.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2021-09-08 20:19:41 +01:00
Kai Vehmanen d3faab3d16 xtensa-build-zephyr: re-enable XCC build for Intel cAVS hw
The regression in Zephyr mainline is fixed with
https://github.com/zephyrproject-rtos/zephyr/pull/38374 , so
the XCC build can be renabled for cAVS targets.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-09-08 18:35:05 +01:00
Keyon Jie ffff0b0610 alloc: fix a wrong index calculation in heap buffer
The calculation 'heap - memmap->buffer + 1' is wrong and may lead to
index overflow when we have multiple buffer mm_heap, it should be
'(heap - memmap->buffer) / sizeof(struct mm_heap) + 1'.

Move the calculation to the end of the brace and make the logic simpler.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-09-08 17:09:43 +08:00
Marc Herbert 5af05ff58e ssp.c: fix recent arg count regression in dai_info()
Fixes "too many arguments for format [-Wformat-extra-args]" in recent
commit 287a5f9a2b ("ssp: mclk/bclk turned off unexpectedly")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-08 15:45:34 +08:00
Marc Herbert 6bedd8e742 xtensa-build-zephyr: fix RIMAGE_KEY when building multiple platforms
RIMAGE_KEY was global and leaking from one platform to the next

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-07 20:22:39 +01:00
Guennadi Liakhovetski 36cb5b32d8 platform: (cosmetic) make all timer objects static
All platform.c files contain timer objects, and some also arch_timers
and most platforms define those objects as global. Make them static.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-09-07 14:37:34 +01:00
Guennadi Liakhovetski ac5ba211ba pipeline: stop all connected pipelines on xrun
When an xrun occurs we currently stop the affected pipelines, which
also leads to stopping the pipeline task. However, the stream can be
using several pipelines, all of which have to be stopped. If not
stopped, tasks belonging to those pipelines will continue to be
scheduled. This patch collects all connected pipelines and stops them
all.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-09-07 13:34:31 +01:00
Guennadi Liakhovetski e23bd336d4 host: (cosmetic) simplify function return flow
Remove redundant initialisation, re-use the same return statement.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-09-07 13:34:31 +01:00
Guennadi Liakhovetski e38b07db97 zephyr: (cosmetic) fix indentation
Fix indentation in edf_schedule.c

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-09-07 13:34:31 +01:00
Allen-KH Cheng 7eda2d509e topology1: add sof-mt8195-mt6359-rt1019-rt5682 topology
Add sof-mt8195-mt6359-rt1019-rt5682 topology

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-07 13:33:01 +01:00
Allen-KH Cheng 3342311c8e topology1: add afe config
Add afe config for mt8195

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-07 13:33:01 +01:00
Allen-KH Cheng 5ae624cf4e topology1: add afe tokens
Add afe tokens for mt8195

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-07 13:33:01 +01:00
Allen-KH Cheng e9ae9e07ca topology1: add afe.m4
Add afe.m4 for afe related define

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-07 13:33:01 +01:00
Allen-KH Cheng 16975ced60 topology1: add sof-mt8195-mt6359-rt1019-rt5682.m4
Add sof-mt8195-mt6359-rt1019-rt5682.m4 for mt8195

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-07 13:33:01 +01:00
Allen-KH Cheng afc39d10a5 topology1: add mt8195.m4
Add mt8195 pipelines and components

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-07 13:33:01 +01:00
Allen-KH Cheng 7625eda9b0 platform: mtk: compile afe support for mt8195
The AFE is a audio hw interface on the mt8195 platform.
This commit brings the compile support for the AFE.

The audio front-end essentially consists of voice and audio data paths

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-07 13:33:01 +01:00
Allen-KH Cheng 5b5936fba6 platform: mt8195: add afe-platform support
Add memif data for afe
Add common and regs header for afe
Add afe platform for mt8195 audio/dsp

AFE: the abbreviation for Audio Front End

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-07 13:33:01 +01:00
Allen-KH Cheng 1b7f8ed2a6 drivers: mtk: add afe driver for mtk mt8195
Add afe driver for memif/sinegen.
Add afe-dai.c/afe-drv.c/afe-memif.c for afe common driver

AFE : Audio Front End

The audio front-end essentially consists of voice and audio data paths.

frontend (memif) :
  memory interface,
  UL (uplink for capture),
  DL(downlink for playback)
backend:
  TDM In,
  TMD out,
  DMIC,
  GASRC, etc
interconn:
  inter-connection,
  connect frontends
  backends as DSP path

Note:
TEST_SGEN macro define is just for test

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-07 13:33:01 +01:00
Allen-KH Cheng db3979a545 mt8195: add compile support for mt8195
Add mt8195 driver and platform compile support.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-07 13:33:01 +01:00
Allen-KH Cheng f0e96ac4df platform: mtk: add support for mt8195 platform
Add support for platform drivers :
idc, irq, timer, clk dma.

Add mtk mt8195 platform initialization.

1. MT8195 includes one Cadence HiFi-4  DSP,
which support for four 32x32-bit MACs,
some support for 72-bit accumulators,
limited ability to support eight 32x16-bit MACs,
a fourth VLIW slot and the ability to issue two 64-bit loads per cycle.
2. 25 interrupts
3. Clock Rate: DSP can operate at
720 MHz (0P75 V)/540 MHz (0P65 V)/370 MHz (0P6 V)/220 MHz (0P55 V)
4. DRAM: it can access data on DRAM by DMA or by CPU directly (through Cache).
5. 32x32-bit MACs
6. Supports SPM(System Power Manager) to control power sequence

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-07 13:33:01 +01:00
Allen-KH Cheng b6b6fa23ce platform: mtk: add memory layout for mt8195
Add memory layout and register address for mtk mt8195

mt8195:
Cache
   I-Cache: 32KB, 4-way Associativity
   D-Cache: 128KB, 4-way Associativity
External Memory
    DRAM: DSP can access DRAM which shared with CPU
    L2TCM: 256KB DSP SRAM POOL

Currently, use
phy addr:0x60000000, size:0x1000000
dma phy addr: 0x61000000, size: 0x0100000

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-07 13:33:01 +01:00
Allen-KH Cheng 0cad7a04fb drivers: mtk: add drivers for mt8195
Add irq, ipc and timer drivers for mtk mt8195

About mt8195:
Two domains of IRQ:
IRQ_EXT_DOMAIN0 and IRQ_EXT_DOMAIN1

IRQ num: 25 interrupts
IPC: use mbx0 and mbx1 to transfer ipc msg

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-07 13:33:01 +01:00
Allen-KH Cheng ef37ebaabf configs: mtk: add default config for mt8195
Add default config for mt8195 platform.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-07 13:33:01 +01:00
Allen-KH Cheng 01050c1a21 platform: mtk: add xtensa headers for mt8195
Add xtensa headers for mtk mt8195 platform.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-07 13:33:01 +01:00
Guennadi Liakhovetski 82857a78ba ipc: fix a IPC completion race
A race currently exists in IPC completion code. When processing the
pipeline TRIG_START command on timer-domain pipelines, processing is
postponed to the pipeline task. Usually the IPC task continues and
completes before the pipeline task. The IPC task notes, that the
command is processed in the pipeline context and doesn't send a
reply to the host. Then the pipeline task executes the command and
notifies the host.

However, occasionally the timer interrupt occurs while the IPC task
is still active. It will start processing the IPC command in the
pipeline context and reply to the host. The host then can send the
next IPC command before the IPC task in the firmware has completed.
This then produces an error trace:

ERROR schedule_edf_task(), task already queued or running 3

and the IPC is dropped.

This commit fixes the race by making sure in asynchronous cases the
last of the two contexts notifies the host.

BugLink: https://github.com/thesofproject/sof/issues/4706
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-09-07 10:52:46 +01:00