DSPBRIDGE: trivial opp constraint
A message that is not in the archive (sent off-list or not yet received): [PATCH 1/2] DSPBRIDGE: remove dependency of mpu freq
cover DSPBRIDGE: trivial opp constraint
in continuation of the discussion in:
http://marc.info/?t=126395196000002&r=1&w=2
patch #2 in this series depends on:
http://marc.info/?l=linux-omap&m=126402596424801&w=2
Nishanth Menon (2):
DSPBRIDGE: improve constraint_value handling
DSPBRIDGE: sanitize opp_idx before passing to PM
drivers/dsp/bridge/wmd/tiomap3430_pwr.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-)
Regards,
Nishanth Menon
PATCH 1/2 DSPBRIDGE: improve constraint_value handling
currently pConstraint value is a pointer which is dereferenced twice(when debug is enabled) to get to the opp index. instead dereference it correctly once. since the meaning of the variable changes, rename it as opp_idx
--- drivers/dsp/bridge/wmd/tiomap3430_pwr.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
drivers/dsp/bridge/wmd/tiomap3430_pwr.c +6 -4
@@ -66,18 +66,20 @@ DSP_STATUS handle_constraints_set(struct WMD_DEV_CONTEXT *pDevContext, IN void *pArgs) {#ifdef CONFIG_BRIDGE_DVFS -u32 *pConstraintVal; +u32 opp_idx;struct dspbridge_platform_data *pdata = omap_dspbridge_dev->dev.platform_data; - pConstraintVal = (u32 *)(pArgs); +/* pick up the opp index */ + opp_idx = *(((u32 *)(pArgs)) +1 ); +/* Read the target value requested by DSP */ DBG_Trace (DBG_LEVEL7 ,"handle_constraints_set:" -"opp requested = 0x%x\n" , (u32)*(pConstraintVal+1 )); +"opp requested = 0x%x\n" , opp_idx);/* Set the new opp value */ if (pdata->dsp_set_min_opp) - (*pdata->dsp_set_min_opp)((u32)*(pConstraintVal+1 )); + (*pdata->dsp_set_min_opp)(opp_idx);#endif /* #ifdef CONFIG_BRIDGE_DVFS */ return DSP_SOK ; }
Signature · 1 line
1.6.3.3
PATCH 2/2 DSPBRIDGE: sanitize opp_idx before passing to PM
DSP is not supposed to return bad opp_indices which are not part of the opp table we created for it. If it does, throw an error, and refuse to switch the OPP.
Ref: discussion: http://marc.info/?t=126395196000002&r=1&w=2
Depends on: http://marc.info/?l=linux-omap&m=126402596424801&w=2
--- drivers/dsp/bridge/wmd/tiomap3430_pwr.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/dsp/bridge/wmd/tiomap3430_pwr.c +6 -0
@@ -73,6 +73,12 @@ DSP_STATUS handle_constraints_set(struct WMD_DEV_CONTEXT *pDevContext,/* pick up the opp index */ opp_idx = *(((u32 *)(pArgs)) +1 ); +/* Sanity check to ensure things are fine */ +if (!opp_idx || (opp_idx > pdata->dsp_num_speeds)) { +pr_err ("%s: DSP requested for an invalid OPP %d Vs %d->%d!\n" , + __func__, opp_idx,1 , pdata->dsp_num_speeds); +return DSP_EINVALIDARG ; + }/* Read the target value requested by DSP */ DBG_Trace (DBG_LEVEL7 ,"handle_constraints_set:" "opp requested = 0x%x\n" , opp_idx);
Signature · 1 line
1.6.3.3