As per FW Interface Modules Configuration, init instance IPC request
requires base initial module configuration. This configuration structure
is made of:
- cpc (chunks per cycle)
- ibs (input buffer size)
- obs (output buffer size)
- is_pages (memory pages required)
- audio_fmt (self explanatory)
Skylake topology accepts following tokens: MCPS, CPS and CPC. All of
these are directly connected. Moreover, assigning one of these allows
to calculate the remaining two. In simplest scenario and assuming 1ms
scheduling, following is true:
CPS = CPC times 1000
MCPS = CPS times 1000 000
Note: these calculations vary depending on scenario and scheduling
requirements.
Given the current implementation, userspace is allowed to provide
different values for all three causing informational chaos. On top of
that, struct skl_base_cfg which represents base module configuration,
incorrectly takes CPS param instead of CPC.
This ambiguity may lead to user unintentionally providing improper
values to DSP firmware and thus impacting module scheduling in
unexpected fashion. Fix by making MCPS and CPS topology params obsolete
and relying solely on CPC value.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20190723145854.8527-7-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
size_t count, loff_t *ppos)
{
struct skl_module_cfg *mconfig = file->private_data;
+ struct skl_module *module = mconfig->module;
+ struct skl_module_res *res = &module->resources[mconfig->res_idx];
char *buf;
ssize_t ret;
mconfig->id.pvt_id);
ret += snprintf(buf + ret, MOD_BUF - ret,
- "Resources:\n\tMCPS %#x\n\tIBS %#x\n\tOBS %#x\t\n",
- mconfig->mcps, mconfig->ibs, mconfig->obs);
+ "Resources:\n\tCPC %#x\n\tIBS %#x\n\tOBS %#x\t\n",
+ res->cpc, res->ibs, res->obs);
ret += snprintf(buf + ret, MOD_BUF - ret,
"Module data:\n\tCore %d\n\tIn queue %d\n\t"
base_cfg->audio_fmt.interleaving = format->interleaving_style;
- base_cfg->cps = res->cps;
+ base_cfg->cpc = res->cpc;
base_cfg->ibs = res->ibs;
base_cfg->obs = res->obs;
base_cfg->is_pages = res->is_pages;
return -EINVAL;
switch (tkn_elem->token) {
- case SKL_TKN_MM_U32_CPS:
- res->cps = tkn_elem->value;
- break;
-
case SKL_TKN_MM_U32_DMA_SIZE:
res->dma_buffer_size = tkn_elem->value;
break;
res->ibs = tkn_elem->value;
break;
- case SKL_TKN_U32_MAX_MCPS:
- res->cps = tkn_elem->value;
- break;
-
case SKL_TKN_MM_U32_RES_PIN_ID:
case SKL_TKN_MM_U32_PIN_BUF:
ret = skl_tplg_manifest_pin_res_tkn(dev, tkn_elem, res,
return ret;
break;
+ case SKL_TKN_MM_U32_CPS:
+ case SKL_TKN_U32_MAX_MCPS:
+ /* ignore unused tokens */
+ break;
+
default:
dev_err(dev, "Not a res type token: %d", tkn_elem->token);
return -EINVAL;
return ret;
mconfig->id.module_id = -1;
mconfig->id.instance_id = dfw->instance_id;
- mconfig->module->resources[0].cps = dfw->max_mcps;
+ mconfig->module->resources[0].cpc = dfw->max_mcps / 1000;
mconfig->module->resources[0].ibs = dfw->ibs;
mconfig->module->resources[0].obs = dfw->obs;
mconfig->core_id = dfw->core_id;
} __packed;
struct skl_base_cfg {
- u32 cps;
+ u32 cpc;
u32 ibs;
u32 obs;
u32 is_pages;
struct skl_module_res {
u8 id;
u32 is_pages;
- u32 cps;
u32 ibs;
u32 obs;
u32 dma_buffer_size;
u8 out_queue_mask;
u8 in_queue;
u8 out_queue;
- u32 mcps;
u32 ibs;
u32 obs;
u8 is_loadable;