ASoC: Intel: Skylake: Add DSP muti-core support
Subsystems (3)
cover ASoC: Intel: Skylake: Add DSP muti-core support
This series adds support for managing multiple DSP cores. SW is responsible for powering up/down cores in DSP and we do that using refcount. 1st patch introduces core infrastructure change in driver and then adds support in SKL and BXT
Jayachandran B (3):
ASoC: Intel: Skylake: Add DSP muti-core infrastructure
ASoC: Intel: Skylake: Support multi-core in Skylake
ASoC: Intel: Skylake: Support multi-core in Broxton
sound/soc/intel/skylake/bxt-sst.c | 160 ++++++++++++++------- sound/soc/intel/skylake/skl-sst-dsp.c | 252 ++++++++++++++++++++++++---------- sound/soc/intel/skylake/skl-sst-dsp.h | 96 ++++++++----- sound/soc/intel/skylake/skl-sst-ipc.h | 11 ++ sound/soc/intel/skylake/skl-sst.c | 91 +++++++----- 5 files changed, 424 insertions(+), 186 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/3 ASoC: Intel: Skylake: Add DSP muti-core infrastructure
From: Jayachandran B <[email protected]>
The DSP can have more than one cores. In that case the secondary core has to be managed by the driver. This patch adds the changes to driver infrastructure to support multiple core.
A new object skl_dsp_cores is introduced to support multiple core. Helpers skl_dsp_get_core() skl_dsp_put_core() help to managed the cores.
Many of the power_up/down and DSP APIs take additional argument of core_id. The primary core, 0 is always powered up first and then on demand second core.
--- sound/soc/intel/skylake/bxt-sst.c | 22 +-- sound/soc/intel/skylake/skl-sst-dsp.c | 252 ++++++++++++++++++++++++---------- sound/soc/intel/skylake/skl-sst-dsp.h | 96 ++++++++----- sound/soc/intel/skylake/skl-sst-ipc.h | 11 ++ sound/soc/intel/skylake/skl-sst.c | 16 ++- 5 files changed, 277 insertions(+), 120 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +13 -9
@@ -58,7 +58,7 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx, ctx->dsp_ops.stream_tag = stream_tag;memcpy (ctx->dmab.area, fwdata, fwsize); - ret =skl_dsp_core_power_up (ctx); + ret =skl_dsp_core_power_up (ctx,SKL_DSP_CORE0_MASK );if (ret <0 ) {dev_err (ctx->dev,"Boot dsp core failed ret: %d\n" , ret); goto base_fw_load_failed;
@@ -68,7 +68,7 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx,sst_dsp_shim_write (ctx,SKL_ADSP_REG_HIPCI ,SKL_ADSP_REG_HIPCI_BUSY | (BXT_IPC_PURGE_FW | ((stream_tag -1 ) <<9 ))); - ret =skl_dsp_start_core (ctx); + ret =skl_dsp_start_core (ctx,SKL_DSP_CORE0_MASK );if (ret <0 ) {dev_err (ctx->dev,"Start dsp core failed ret: %d\n" , ret); ret = -EIO ;
@@ -118,7 +118,8 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx, base_fw_load_failed: ctx->dsp_ops.cleanup (ctx->dev, &ctx->dmab, stream_tag); -skl_dsp_disable_core (ctx); +skl_dsp_core_power_down (ctx,SKL_DSP_CORE_MASK (1 )); +skl_dsp_disable_core (ctx,SKL_DSP_CORE_MASK (1 ));return ret; }
@@ -183,14 +184,14 @@ static int bxt_load_base_firmware(struct sst_dsp *ctx)sst_dsp_shim_read (ctx,BXT_ADSP_ERROR_CODE ), sst_dsp_shim_read(ctx, BXT_ADSP_FW_STATUS)); -skl_dsp_disable_core (ctx); +skl_dsp_disable_core (ctx,SKL_DSP_CORE0_MASK ); }else {dev_dbg (ctx->dev,"Firmware download successful\n" ); ret =wait_event_timeout (skl->boot_wait, skl->boot_complete,msecs_to_jiffies (SKL_IPC_BOOT_MSECS ));if (ret ==0 ) {dev_err (ctx->dev,"DSP boot fail, FW Ready timeout\n" ); -skl_dsp_disable_core (ctx); +skl_dsp_disable_core (ctx,SKL_DSP_CORE0_MASK ); ret = -EIO ; }else {skl_dsp_set_state_locked (ctx,SKL_DSP_RUNNING );
@@ -204,7 +205,7 @@ sst_load_base_firmware_failed:return ret; } -static int bxt_set_dsp_D0 (struct sst_dsp *ctx) +static int bxt_set_dsp_D0 (struct sst_dsp *ctx,unsigned int core_id) {struct skl_sst *skl = ctx->thread_context;int ret;
@@ -219,7 +220,7 @@ static int bxt_set_dsp_D0(struct sst_dsp *ctx)return ret; } - ret =skl_dsp_enable_core (ctx); + ret =skl_dsp_enable_core (ctx,SKL_DSP_CORE0_MASK );if (ret <0 ) {dev_err (ctx->dev,"enable dsp core failed ret: %d\n" , ret);return ret;
@@ -243,7 +244,7 @@ static int bxt_set_dsp_D0(struct sst_dsp *ctx)return 0 ; } -static int bxt_set_dsp_D3 (struct sst_dsp *ctx) +static int bxt_set_dsp_D3 (struct sst_dsp *ctx,unsigned int core_id) {struct skl_ipc_dxstate_info dx;struct skl_sst *skl = ctx->thread_context;
@@ -262,7 +263,7 @@ static int bxt_set_dsp_D3(struct sst_dsp *ctx)return ret; } - ret =skl_dsp_disable_core (ctx); + ret =skl_dsp_disable_core (ctx,SKL_DSP_CORE0_MASK );if (ret <0 ) {dev_err (ctx->dev,"disbale dsp core failed: %d\n" , ret); ret = -EIO ;
@@ -330,6 +331,7 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,if (ret)return ret; + skl->cores.count =2 ; skl->boot_complete = false;init_waitqueue_head (&skl->boot_wait);
@@ -339,6 +341,8 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,return ret; } +skl_dsp_init_core_state (sst); +if (dsp) *dsp = skl;
sound/soc/intel/skylake/skl-sst-dsp.c +182 -70
419 lines not on this page · raw message
sound/soc/intel/skylake/skl-sst-dsp.h +62 -34
126 lines not on this page · raw message
sound/soc/intel/skylake/skl-sst-ipc.h +11 -0
@@ -45,6 +45,14 @@ struct skl_ipc_header {u32 extension; }; +#define SKL_DSP_CORES_MAX 2 + +struct skl_dsp_cores { +unsigned int count; +enum skl_dsp_states state[SKL_DSP_CORES_MAX ]; +int usage_count[SKL_DSP_CORES_MAX ]; +}; +struct skl_sst {struct device *dev;struct sst_dsp *dsp;
@@ -66,6 +74,9 @@ struct skl_sst {/* Is firmware loaded */ bool fw_loaded; + +/* multi-core */ +struct skl_dsp_cores cores; };struct skl_ipc_init_instance_msg {
sound/soc/intel/skylake/skl-sst.c +9 -7
@@ -84,10 +84,8 @@ static int skl_load_base_firmware(struct sst_dsp *ctx) ret =request_firmware (&ctx->fw, ctx->fw_name, ctx->dev);if (ret <0 ) {dev_err (ctx->dev,"Request firmware failed %d\n" , ret); -skl_dsp_disable_core (ctx);return -EIO ; } - } ret =snd_skl_parse_uuids (ctx,SKL_ADSP_FW_BIN_HDR_OFFSET );
@@ -95,7 +93,7 @@ static int skl_load_base_firmware(struct sst_dsp *ctx)dev_err (ctx->dev,"UUID parsing err: %d\n" , ret);release_firmware (ctx->fw); -skl_dsp_disable_core (ctx); +skl_dsp_disable_core (ctx,SKL_DSP_CORE0_MASK );return ret; }
@@ -159,13 +157,13 @@ static int skl_load_base_firmware(struct sst_dsp *ctx) transfer_firmware_failed: ctx->cl_dev.ops.cl_cleanup_controller (ctx); skl_load_base_firmware_failed: -skl_dsp_disable_core (ctx); +skl_dsp_disable_core (ctx,SKL_DSP_CORE0_MASK );release_firmware (ctx->fw); ctx->fw =NULL ;return ret; } -static int skl_set_dsp_D0 (struct sst_dsp *ctx) +static int skl_set_dsp_D0 (struct sst_dsp *ctx,unsigned int core_id) {int ret;
@@ -180,7 +178,7 @@ static int skl_set_dsp_D0(struct sst_dsp *ctx)return ret; } -static int skl_set_dsp_D3 (struct sst_dsp *ctx) +static int skl_set_dsp_D3 (struct sst_dsp *ctx,unsigned int core_id) {int ret;struct skl_ipc_dxstate_info dx;
@@ -207,7 +205,7 @@ static int skl_set_dsp_D3(struct sst_dsp *ctx)skl_ipc_op_int_disable (ctx);skl_ipc_int_disable (ctx); - ret =skl_dsp_disable_core (ctx); + ret =skl_dsp_disable_core (ctx, core_id);if (ret <0 ) {dev_err (ctx->dev,"disable dsp core failed ret: %d\n" , ret); ret = -EIO ;
@@ -466,12 +464,16 @@ int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,if (ret)return ret; + skl->cores.count =2 ; + ret = sst->fw_ops.load_fw (sst);if (ret <0 ) {dev_err (dev,"Load base fw failed : %d" , ret); goto cleanup; } +skl_dsp_init_core_state (sst); +if (dsp) *dsp = skl;
Signature · 1 line
1.9.1
PATCH 2/3 ASoC: Intel: Skylake: Support multi-core in Skylake
In reply to Vinod KoulFrom: Jayachandran B <[email protected]>
Add multicore DSP support in Skylake DSP operations.
--- sound/soc/intel/skylake/skl-sst.c | 77 ++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 29 deletions(-)
sound/soc/intel/skylake/skl-sst.c +48 -29
@@ -150,7 +150,6 @@ static int skl_load_base_firmware(struct sst_dsp *ctx) }dev_dbg (ctx->dev,"Download firmware successful%d\n" , ret); -skl_dsp_set_state_locked (ctx,SKL_DSP_RUNNING ); skl->fw_loaded = true; }return 0 ;
@@ -166,14 +165,41 @@ skl_load_base_firmware_failed:static int skl_set_dsp_D0 (struct sst_dsp *ctx,unsigned int core_id) {int ret; +struct skl_ipc_dxstate_info dx; +struct skl_sst *skl = ctx->thread_context; +unsigned int core_mask =SKL_DSP_CORE_MASK (core_id); - ret =skl_load_base_firmware (ctx); -if (ret <0 ) { -dev_err (ctx->dev,"unable to load firmware\n" ); -return ret; +/* If core0 is being turned on, we need to load the FW */ +if (core_id ==SKL_DSP_CORE0_ID ) { + ret =skl_load_base_firmware (ctx); +if (ret <0 ) { +dev_err (ctx->dev,"unable to load firmware\n" ); +return ret; + } + } + +/* +* If any core other than core 0 is being moved to D0, enable the +* core and send the set dx IPC for the core. +*/ +if (core_id !=SKL_DSP_CORE0_ID ) { + ret =skl_dsp_enable_core (ctx, core_mask); +if (ret <0 ) +return ret; + + dx.core_mask = core_mask; + dx.dx_mask = core_mask; + + ret =skl_ipc_set_dx (&skl->ipc,SKL_INSTANCE_ID , +SKL_BASE_FW_MODULE_ID , &dx); +if (ret <0 ) { +dev_err (ctx->dev,"Failed to set dsp to D0:core id= %d\n" , + core_id); +skl_dsp_disable_core (ctx, core_mask); + } } -skl_dsp_set_state_locked (ctx,SKL_DSP_RUNNING ); + skl->cores.state[core_id] =SKL_DSP_RUNNING ;return ret; }
@@ -183,35 +209,28 @@ static int skl_set_dsp_D3(struct sst_dsp *ctx, unsigned int core_id)int ret;struct skl_ipc_dxstate_info dx;struct skl_sst *skl = ctx->thread_context; +unsigned int core_mask =SKL_DSP_CORE_MASK (core_id); -dev_dbg (ctx->dev,"In %s:\n" , __func__); -mutex_lock (&ctx->mutex); -if (!is_skl_dsp_running (ctx)) { -mutex_unlock (&ctx->mutex); -return 0 ; - } -mutex_unlock (&ctx->mutex); - - dx.core_mask =SKL_DSP_CORE0_MASK ; + dx.core_mask = core_mask; dx.dx_mask =SKL_IPC_D3_MASK ; + ret =skl_ipc_set_dx (&skl->ipc,SKL_INSTANCE_ID ,SKL_BASE_FW_MODULE_ID , &dx);if (ret <0 ) -dev_err (ctx->dev, -"D3 request to FW failed, continuing reset: %d" , ret); - -/* disable Interrupt */ - ctx->cl_dev.ops.cl_cleanup_controller (ctx); -skl_cldma_int_disable (ctx); -skl_ipc_op_int_disable (ctx); -skl_ipc_int_disable (ctx); - - ret =skl_dsp_disable_core (ctx, core_id); -if (ret <0 ) { -dev_err (ctx->dev,"disable dsp core failed ret: %d\n" , ret); - ret = -EIO ; +dev_err (ctx->dev,"set Dx core %d fail: %d\n" , core_id, ret); + +if (core_id ==SKL_DSP_CORE0_ID ) { +/* disable Interrupt */ + ctx->cl_dev.ops.cl_cleanup_controller (ctx); +skl_cldma_int_disable (ctx); +skl_ipc_op_int_disable (ctx); +skl_ipc_int_disable (ctx); } -skl_dsp_set_state_locked (ctx,SKL_DSP_RESET ); + ret =skl_dsp_disable_core (ctx, core_mask); +if (ret <0 ) +return ret; + + skl->cores.state[core_id] =SKL_DSP_RESET ;return ret; }
Signature · 1 line
1.9.1
Mark Brown
maintainerApplied "ASoC: Intel: Skylake: Support multi-core in Skylake" to the asoc tree
The patch
ASoC: Intel: Skylake: Support multi-core in Skylake
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
40a166039a84da15a6d01a7a997398eb4a0d3c1eMon Sep 17 00:00:00 2001
From: Jayachandran B <[email protected]>
Date: Tue, 21 Jun 2016 10:17:42 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Support multi-core in Skylake
Add multicore DSP support in Skylake DSP operations.
--- sound/soc/intel/skylake/skl-sst.c | 77 ++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 29 deletions(-)
sound/soc/intel/skylake/skl-sst.c +48 -29
@@ -150,7 +150,6 @@ static int skl_load_base_firmware(struct sst_dsp *ctx) }dev_dbg (ctx->dev,"Download firmware successful%d\n" , ret); -skl_dsp_set_state_locked (ctx,SKL_DSP_RUNNING ); skl->fw_loaded = true; }return 0 ;
@@ -166,14 +165,41 @@ skl_load_base_firmware_failed:static int skl_set_dsp_D0 (struct sst_dsp *ctx,unsigned int core_id) {int ret; +struct skl_ipc_dxstate_info dx; +struct skl_sst *skl = ctx->thread_context; +unsigned int core_mask =SKL_DSP_CORE_MASK (core_id); - ret =skl_load_base_firmware (ctx); -if (ret <0 ) { -dev_err (ctx->dev,"unable to load firmware\n" ); -return ret; +/* If core0 is being turned on, we need to load the FW */ +if (core_id ==SKL_DSP_CORE0_ID ) { + ret =skl_load_base_firmware (ctx); +if (ret <0 ) { +dev_err (ctx->dev,"unable to load firmware\n" ); +return ret; + } + } + +/* +* If any core other than core 0 is being moved to D0, enable the +* core and send the set dx IPC for the core. +*/ +if (core_id !=SKL_DSP_CORE0_ID ) { + ret =skl_dsp_enable_core (ctx, core_mask); +if (ret <0 ) +return ret; + + dx.core_mask = core_mask; + dx.dx_mask = core_mask; + + ret =skl_ipc_set_dx (&skl->ipc,SKL_INSTANCE_ID , +SKL_BASE_FW_MODULE_ID , &dx); +if (ret <0 ) { +dev_err (ctx->dev,"Failed to set dsp to D0:core id= %d\n" , + core_id); +skl_dsp_disable_core (ctx, core_mask); + } } -skl_dsp_set_state_locked (ctx,SKL_DSP_RUNNING ); + skl->cores.state[core_id] =SKL_DSP_RUNNING ;return ret; }
@@ -183,35 +209,28 @@ static int skl_set_dsp_D3(struct sst_dsp *ctx, unsigned int core_id)int ret;struct skl_ipc_dxstate_info dx;struct skl_sst *skl = ctx->thread_context; +unsigned int core_mask =SKL_DSP_CORE_MASK (core_id); -dev_dbg (ctx->dev,"In %s:\n" , __func__); -mutex_lock (&ctx->mutex); -if (!is_skl_dsp_running (ctx)) { -mutex_unlock (&ctx->mutex); -return 0 ; - } -mutex_unlock (&ctx->mutex); - - dx.core_mask =SKL_DSP_CORE0_MASK ; + dx.core_mask = core_mask; dx.dx_mask =SKL_IPC_D3_MASK ; + ret =skl_ipc_set_dx (&skl->ipc,SKL_INSTANCE_ID ,SKL_BASE_FW_MODULE_ID , &dx);if (ret <0 ) -dev_err (ctx->dev, -"D3 request to FW failed, continuing reset: %d" , ret); - -/* disable Interrupt */ - ctx->cl_dev.ops.cl_cleanup_controller (ctx); -skl_cldma_int_disable (ctx); -skl_ipc_op_int_disable (ctx); -skl_ipc_int_disable (ctx); - - ret =skl_dsp_disable_core (ctx, core_id); -if (ret <0 ) { -dev_err (ctx->dev,"disable dsp core failed ret: %d\n" , ret); - ret = -EIO ; +dev_err (ctx->dev,"set Dx core %d fail: %d\n" , core_id, ret); + +if (core_id ==SKL_DSP_CORE0_ID ) { +/* disable Interrupt */ + ctx->cl_dev.ops.cl_cleanup_controller (ctx); +skl_cldma_int_disable (ctx); +skl_ipc_op_int_disable (ctx); +skl_ipc_int_disable (ctx); } -skl_dsp_set_state_locked (ctx,SKL_DSP_RESET ); + ret =skl_dsp_disable_core (ctx, core_mask); +if (ret <0 ) +return ret; + + skl->cores.state[core_id] =SKL_DSP_RESET ;return ret; }
Signature · 1 line
2.8.1
PATCH 3/3 ASoC: Intel: Skylake: Support multi-core in Broxton
In reply to Vinod KoulFrom: Jayachandran B <[email protected]>
Add multicore DSP support in Broxton DSP operations.
--- sound/soc/intel/skylake/bxt-sst.c | 144 +++++++++++++++++++++++++++----------- 1 file changed, 103 insertions(+), 41 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +103 -41
@@ -37,11 +37,19 @@#define BXT_ADSP_SRAM1_BASE 0xA0000 +#define BXT_INSTANCE_ID 0 +#define BXT_BASE_FW_MODULE_ID 0 +static unsigned int bxt_get_errorcode (struct sst_dsp *ctx) {return sst_dsp_shim_read (ctx,BXT_ADSP_ERROR_CODE ); } +/* +* First boot sequence has some extra steps. Core 0 waits for power +* status on core 1, so power up core 1 also momentarily, keep it in +* reset/stall and then turn it off +*/ static int sst_bxt_prepare_fw (struct sst_dsp *ctx,const void *fwdata,u32 fwsize) {
@@ -49,7 +57,7 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx,u32 reg; stream_tag = ctx->dsp_ops.prepare (ctx->dev,0x40 , fwsize, &ctx->dmab); -if (stream_tag <0 ) { +if (stream_tag <=0 ) {dev_err (ctx->dev,"Failed to prepare DMA FW loading err: %x\n" , stream_tag);return stream_tag;
@@ -58,16 +66,19 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx, ctx->dsp_ops.stream_tag = stream_tag;memcpy (ctx->dmab.area, fwdata, fwsize); - ret =skl_dsp_core_power_up (ctx,SKL_DSP_CORE0_MASK ); +/* Step 1: Power up core 0 and core1 */ + ret =skl_dsp_core_power_up (ctx,SKL_DSP_CORE0_MASK | +SKL_DSP_CORE_MASK (1 ));if (ret <0 ) { -dev_err (ctx->dev,"Boot dsp core failed ret: %d\n" , ret); +dev_err (ctx->dev,"dsp core0/1 power up failed\n" ); goto base_fw_load_failed; } -/* Purge FW request */ +/* Step 2: Purge FW request */ sst_dsp_shim_write (ctx,SKL_ADSP_REG_HIPCI ,SKL_ADSP_REG_HIPCI_BUSY | (BXT_IPC_PURGE_FW | ((stream_tag -1 ) <<9 ))); +/* Step 3: Unset core0 reset state & unstall/run core0 */ ret =skl_dsp_start_core (ctx,SKL_DSP_CORE0_MASK );if (ret <0 ) {dev_err (ctx->dev,"Start dsp core failed ret: %d\n" , ret);
@@ -75,6 +86,7 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx, goto base_fw_load_failed; } +/* Step 4: Wait for DONE Bit */ for (i =BXT_INIT_TIMEOUT ; i >0 ; --i) { reg =sst_dsp_shim_read (ctx,SKL_ADSP_REG_HIPCIE );
@@ -94,10 +106,18 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx, SKL_ADSP_REG_HIPCIE_DONE); } -/* enable Interrupt */ +/* Step 5: power down core1 */ + ret =skl_dsp_core_power_down (ctx,SKL_DSP_CORE_MASK (1 )); +if (ret <0 ) { +dev_err (ctx->dev,"dsp core1 power down failed\n" ); + goto base_fw_load_failed; + } + +/* Step 6: Enable Interrupt */ skl_ipc_int_enable (ctx);skl_ipc_op_int_enable (ctx); +/* Step 7: Wait for ROM init */ for (i =BXT_INIT_TIMEOUT ; i >0 ; --i) { if (SKL_FW_INIT == (sst_dsp_shim_read(ctx, BXT_ADSP_FW_STATUS) &
@@ -194,7 +214,6 @@ static int bxt_load_base_firmware(struct sst_dsp *ctx)skl_dsp_disable_core (ctx,SKL_DSP_CORE0_MASK ); ret = -EIO ; }else { -skl_dsp_set_state_locked (ctx,SKL_DSP_RUNNING ); ret =0 ; skl->fw_loaded = true; }
@@ -209,67 +228,110 @@ static int bxt_set_dsp_D0(struct sst_dsp *ctx, unsigned int core_id) {struct skl_sst *skl = ctx->thread_context;int ret; - - skl->boot_complete = false; +struct skl_ipc_dxstate_info dx; +unsigned int core_mask =SKL_DSP_CORE_MASK (core_id);if (skl->fw_loaded == false) { -dev_dbg (ctx->dev,"Re-loading fw\n" ); ret =bxt_load_base_firmware (ctx);if (ret <0 )dev_err (ctx->dev,"reload fw failed: %d\n" , ret);return ret; } - ret =skl_dsp_enable_core (ctx,SKL_DSP_CORE0_MASK ); -if (ret <0 ) { -dev_err (ctx->dev,"enable dsp core failed ret: %d\n" , ret); -return ret; +/* If core 0 is being turned on, turn on core 1 as well */ +if (core_id ==SKL_DSP_CORE0_ID ) + ret =skl_dsp_core_power_up (ctx, core_mask | +SKL_DSP_CORE_MASK (1 )); +else + ret =skl_dsp_core_power_up (ctx, core_mask); + +if (ret <0 ) + goto err; + +if (core_id ==SKL_DSP_CORE0_ID ) { + +/* +* Enable interrupt after SPA is set and before +* DSP is unstalled +*/ +skl_ipc_int_enable (ctx); +skl_ipc_op_int_enable (ctx); + skl->boot_complete = false; } -/* enable interrupt */ -skl_ipc_int_enable (ctx); -skl_ipc_op_int_enable (ctx); + ret =skl_dsp_start_core (ctx, core_mask); +if (ret <0 ) + goto err; - ret =wait_event_timeout (skl->boot_wait, skl->boot_complete, -msecs_to_jiffies (SKL_IPC_BOOT_MSECS )); -if (ret ==0 ) { -dev_err (ctx->dev,"ipc: error DSP boot timeout\n" ); -dev_err (ctx->dev,"Error code=0x%x: FW status=0x%x\n" , -sst_dsp_shim_read (ctx,BXT_ADSP_ERROR_CODE ), -sst_dsp_shim_read (ctx,BXT_ADSP_FW_STATUS )); -return -EIO ; +if (core_id ==SKL_DSP_CORE0_ID ) { + ret =wait_event_timeout (skl->boot_wait, + skl->boot_complete, +msecs_to_jiffies (SKL_IPC_BOOT_MSECS )); + +/* If core 1 was turned on for booting core 0, turn it off */ +skl_dsp_core_power_down (ctx,SKL_DSP_CORE_MASK (1 )); +if (ret ==0 ) { +dev_err (ctx->dev,"%s: DSP boot timeout\n" , __func__); +dev_err (ctx->dev,"Error code=0x%x: FW status=0x%x\n" , +sst_dsp_shim_read (ctx,BXT_ADSP_ERROR_CODE ), +sst_dsp_shim_read (ctx,BXT_ADSP_FW_STATUS )); +dev_err (ctx->dev,"Failed to set core0 to D0 state\n" ); + ret = -EIO ; + goto err; + } + } + +/* Tell FW if additional core in now On */ + +if (core_id !=SKL_DSP_CORE0_ID ) { + dx.core_mask = core_mask; + dx.dx_mask = core_mask; + + ret =skl_ipc_set_dx (&skl->ipc,BXT_INSTANCE_ID , +BXT_BASE_FW_MODULE_ID , &dx); +if (ret <0 ) { +dev_err (ctx->dev,"IPC set_dx for core %d fail: %d\n" , + core_id, ret); + goto err; + } } -skl_dsp_set_state_locked (ctx,SKL_DSP_RUNNING ); + skl->cores.state[core_id] =SKL_DSP_RUNNING ;return 0 ; +err: +if (core_id ==SKL_DSP_CORE0_ID ) + core_mask |=SKL_DSP_CORE_MASK (1 ); +skl_dsp_disable_core (ctx, core_mask); + +return ret; }static int bxt_set_dsp_D3 (struct sst_dsp *ctx,unsigned int core_id) { +int ret;struct skl_ipc_dxstate_info dx;struct skl_sst *skl = ctx->thread_context; -int ret =0 ; - -if (!is_skl_dsp_running (ctx)) -return ret; +unsigned int core_mask =SKL_DSP_CORE_MASK (core_id); - dx.core_mask =SKL_DSP_CORE0_MASK ; + dx.core_mask = core_mask; dx.dx_mask =SKL_IPC_D3_MASK ; - ret =skl_ipc_set_dx (&skl->ipc,SKL_INSTANCE_ID , -SKL_BASE_FW_MODULE_ID , &dx); -if (ret <0 ) { -dev_err (ctx->dev,"Failed to set DSP to D3 state: %d\n" , ret); -return ret; - } +dev_dbg (ctx->dev,"core mask=%x dx_mask=%x\n" , + dx.core_mask, dx.dx_mask); - ret =skl_dsp_disable_core (ctx,SKL_DSP_CORE0_MASK ); + ret =skl_ipc_set_dx (&skl->ipc,BXT_INSTANCE_ID , +BXT_BASE_FW_MODULE_ID , &dx); +if (ret <0 ) +dev_err (ctx->dev, +"Failed to set DSP to D3:core id = %d;Continue reset\n" , + core_id); + + ret =skl_dsp_disable_core (ctx, core_mask);if (ret <0 ) { -dev_err (ctx->dev,"disbale dsp core failed: %d\n" , ret); - ret = -EIO ; +dev_err (ctx->dev,"Failed to disable core %d" , ret); +return ret; } - -skl_dsp_set_state_locked (ctx,SKL_DSP_RESET ); + skl->cores.state[core_id] =SKL_DSP_RESET ;return 0 ; }
Signature · 1 line
1.9.1
Mark Brown
maintainerApplied "ASoC: Intel: Skylake: Support multi-core in Broxton" to the asoc tree
The patch
ASoC: Intel: Skylake: Support multi-core in Broxton
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
e68aca08d77e75c43850187a1cf8203fc53179deMon Sep 17 00:00:00 2001
From: Jayachandran B <[email protected]>
Date: Tue, 21 Jun 2016 10:17:43 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Support multi-core in Broxton
Add multicore DSP support in Broxton DSP operations.
--- sound/soc/intel/skylake/bxt-sst.c | 144 +++++++++++++++++++++++++++----------- 1 file changed, 103 insertions(+), 41 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +103 -41
@@ -37,11 +37,19 @@#define BXT_ADSP_SRAM1_BASE 0xA0000 +#define BXT_INSTANCE_ID 0 +#define BXT_BASE_FW_MODULE_ID 0 +static unsigned int bxt_get_errorcode (struct sst_dsp *ctx) {return sst_dsp_shim_read (ctx,BXT_ADSP_ERROR_CODE ); } +/* +* First boot sequence has some extra steps. Core 0 waits for power +* status on core 1, so power up core 1 also momentarily, keep it in +* reset/stall and then turn it off +*/ static int sst_bxt_prepare_fw (struct sst_dsp *ctx,const void *fwdata,u32 fwsize) {
@@ -49,7 +57,7 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx,u32 reg; stream_tag = ctx->dsp_ops.prepare (ctx->dev,0x40 , fwsize, &ctx->dmab); -if (stream_tag <0 ) { +if (stream_tag <=0 ) {dev_err (ctx->dev,"Failed to prepare DMA FW loading err: %x\n" , stream_tag);return stream_tag;
@@ -58,16 +66,19 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx, ctx->dsp_ops.stream_tag = stream_tag;memcpy (ctx->dmab.area, fwdata, fwsize); - ret =skl_dsp_core_power_up (ctx,SKL_DSP_CORE0_MASK ); +/* Step 1: Power up core 0 and core1 */ + ret =skl_dsp_core_power_up (ctx,SKL_DSP_CORE0_MASK | +SKL_DSP_CORE_MASK (1 ));if (ret <0 ) { -dev_err (ctx->dev,"Boot dsp core failed ret: %d\n" , ret); +dev_err (ctx->dev,"dsp core0/1 power up failed\n" ); goto base_fw_load_failed; } -/* Purge FW request */ +/* Step 2: Purge FW request */ sst_dsp_shim_write (ctx,SKL_ADSP_REG_HIPCI ,SKL_ADSP_REG_HIPCI_BUSY | (BXT_IPC_PURGE_FW | ((stream_tag -1 ) <<9 ))); +/* Step 3: Unset core0 reset state & unstall/run core0 */ ret =skl_dsp_start_core (ctx,SKL_DSP_CORE0_MASK );if (ret <0 ) {dev_err (ctx->dev,"Start dsp core failed ret: %d\n" , ret);
@@ -75,6 +86,7 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx, goto base_fw_load_failed; } +/* Step 4: Wait for DONE Bit */ for (i =BXT_INIT_TIMEOUT ; i >0 ; --i) { reg =sst_dsp_shim_read (ctx,SKL_ADSP_REG_HIPCIE );
@@ -94,10 +106,18 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx, SKL_ADSP_REG_HIPCIE_DONE); } -/* enable Interrupt */ +/* Step 5: power down core1 */ + ret =skl_dsp_core_power_down (ctx,SKL_DSP_CORE_MASK (1 )); +if (ret <0 ) { +dev_err (ctx->dev,"dsp core1 power down failed\n" ); + goto base_fw_load_failed; + } + +/* Step 6: Enable Interrupt */ skl_ipc_int_enable (ctx);skl_ipc_op_int_enable (ctx); +/* Step 7: Wait for ROM init */ for (i =BXT_INIT_TIMEOUT ; i >0 ; --i) { if (SKL_FW_INIT == (sst_dsp_shim_read(ctx, BXT_ADSP_FW_STATUS) &
@@ -194,7 +214,6 @@ static int bxt_load_base_firmware(struct sst_dsp *ctx)skl_dsp_disable_core (ctx,SKL_DSP_CORE0_MASK ); ret = -EIO ; }else { -skl_dsp_set_state_locked (ctx,SKL_DSP_RUNNING ); ret =0 ; skl->fw_loaded = true; }
@@ -209,67 +228,110 @@ static int bxt_set_dsp_D0(struct sst_dsp *ctx, unsigned int core_id) {struct skl_sst *skl = ctx->thread_context;int ret; - - skl->boot_complete = false; +struct skl_ipc_dxstate_info dx; +unsigned int core_mask =SKL_DSP_CORE_MASK (core_id);if (skl->fw_loaded == false) { -dev_dbg (ctx->dev,"Re-loading fw\n" ); ret =bxt_load_base_firmware (ctx);if (ret <0 )dev_err (ctx->dev,"reload fw failed: %d\n" , ret);return ret; } - ret =skl_dsp_enable_core (ctx,SKL_DSP_CORE0_MASK ); -if (ret <0 ) { -dev_err (ctx->dev,"enable dsp core failed ret: %d\n" , ret); -return ret; +/* If core 0 is being turned on, turn on core 1 as well */ +if (core_id ==SKL_DSP_CORE0_ID ) + ret =skl_dsp_core_power_up (ctx, core_mask | +SKL_DSP_CORE_MASK (1 )); +else + ret =skl_dsp_core_power_up (ctx, core_mask); + +if (ret <0 ) + goto err; + +if (core_id ==SKL_DSP_CORE0_ID ) { + +/* +* Enable interrupt after SPA is set and before +* DSP is unstalled +*/ +skl_ipc_int_enable (ctx); +skl_ipc_op_int_enable (ctx); + skl->boot_complete = false; } -/* enable interrupt */ -skl_ipc_int_enable (ctx); -skl_ipc_op_int_enable (ctx); + ret =skl_dsp_start_core (ctx, core_mask); +if (ret <0 ) + goto err; - ret =wait_event_timeout (skl->boot_wait, skl->boot_complete, -msecs_to_jiffies (SKL_IPC_BOOT_MSECS )); -if (ret ==0 ) { -dev_err (ctx->dev,"ipc: error DSP boot timeout\n" ); -dev_err (ctx->dev,"Error code=0x%x: FW status=0x%x\n" , -sst_dsp_shim_read (ctx,BXT_ADSP_ERROR_CODE ), -sst_dsp_shim_read (ctx,BXT_ADSP_FW_STATUS )); -return -EIO ; +if (core_id ==SKL_DSP_CORE0_ID ) { + ret =wait_event_timeout (skl->boot_wait, + skl->boot_complete, +msecs_to_jiffies (SKL_IPC_BOOT_MSECS )); + +/* If core 1 was turned on for booting core 0, turn it off */ +skl_dsp_core_power_down (ctx,SKL_DSP_CORE_MASK (1 )); +if (ret ==0 ) { +dev_err (ctx->dev,"%s: DSP boot timeout\n" , __func__); +dev_err (ctx->dev,"Error code=0x%x: FW status=0x%x\n" , +sst_dsp_shim_read (ctx,BXT_ADSP_ERROR_CODE ), +sst_dsp_shim_read (ctx,BXT_ADSP_FW_STATUS )); +dev_err (ctx->dev,"Failed to set core0 to D0 state\n" ); + ret = -EIO ; + goto err; + } + } + +/* Tell FW if additional core in now On */ + +if (core_id !=SKL_DSP_CORE0_ID ) { + dx.core_mask = core_mask; + dx.dx_mask = core_mask; + + ret =skl_ipc_set_dx (&skl->ipc,BXT_INSTANCE_ID , +BXT_BASE_FW_MODULE_ID , &dx); +if (ret <0 ) { +dev_err (ctx->dev,"IPC set_dx for core %d fail: %d\n" , + core_id, ret); + goto err; + } } -skl_dsp_set_state_locked (ctx,SKL_DSP_RUNNING ); + skl->cores.state[core_id] =SKL_DSP_RUNNING ;return 0 ; +err: +if (core_id ==SKL_DSP_CORE0_ID ) + core_mask |=SKL_DSP_CORE_MASK (1 ); +skl_dsp_disable_core (ctx, core_mask); + +return ret; }static int bxt_set_dsp_D3 (struct sst_dsp *ctx,unsigned int core_id) { +int ret;struct skl_ipc_dxstate_info dx;struct skl_sst *skl = ctx->thread_context; -int ret =0 ; - -if (!is_skl_dsp_running (ctx)) -return ret; +unsigned int core_mask =SKL_DSP_CORE_MASK (core_id); - dx.core_mask =SKL_DSP_CORE0_MASK ; + dx.core_mask = core_mask; dx.dx_mask =SKL_IPC_D3_MASK ; - ret =skl_ipc_set_dx (&skl->ipc,SKL_INSTANCE_ID , -SKL_BASE_FW_MODULE_ID , &dx); -if (ret <0 ) { -dev_err (ctx->dev,"Failed to set DSP to D3 state: %d\n" , ret); -return ret; - } +dev_dbg (ctx->dev,"core mask=%x dx_mask=%x\n" , + dx.core_mask, dx.dx_mask); - ret =skl_dsp_disable_core (ctx,SKL_DSP_CORE0_MASK ); + ret =skl_ipc_set_dx (&skl->ipc,BXT_INSTANCE_ID , +BXT_BASE_FW_MODULE_ID , &dx); +if (ret <0 ) +dev_err (ctx->dev, +"Failed to set DSP to D3:core id = %d;Continue reset\n" , + core_id); + + ret =skl_dsp_disable_core (ctx, core_mask);if (ret <0 ) { -dev_err (ctx->dev,"disbale dsp core failed: %d\n" , ret); - ret = -EIO ; +dev_err (ctx->dev,"Failed to disable core %d" , ret); +return ret; } - -skl_dsp_set_state_locked (ctx,SKL_DSP_RESET ); + skl->cores.state[core_id] =SKL_DSP_RESET ;return 0 ; }
Signature · 1 line
2.8.1