cpuidle: lpm-workarounds: Skip L2 spm programming in HLOS

Due to a hardware bug on 8939 and 8909, secure world needs
to disable and enable L2 SPM to get the proper context in
secure watchdog bite cases. With this workaround there is
a race in programming L2 SPM between HLOS and secure world.
This leads to stability issues. To avoid this program L2 SPM
only in secure world based on the L2 mode flag passed.

Change-Id: I426289e1fc66664ed9c4ecf81c4106ce2c7c1145
Signed-off-by: Anil Kumar Mamidala <amami@codeaurora.org>
This commit is contained in:
Anil Kumar Mamidala 2015-03-17 17:06:05 +05:30
parent 646b269a5c
commit 08d2ce4c82
4 changed files with 26 additions and 4 deletions

View file

@ -13,6 +13,14 @@ The optional properties are:
- lpm-cx-supply: will hold handle for CX regulator supply which is used
to unvote.
- qcom,lpm-wa-skip-l2-spm: Due to a hardware bug on 8939 and 8909, secure
world needs to disable and enable L2 SPM to get the proper context
in secure watchdog bite cases. With this workaround there is a race
in programming L2 SPM between HLOS and secure world. This leads to
stability issues. To avoid this program L2 SPM only in secure world
based on the L2 mode flag passed. Set lpm-wa-skip-l2-spm node if this
is required.
Example:
qcom,lpm-workarounds {
@ -20,4 +28,5 @@ qcom,lpm-workarounds {
lpm-cx-supply = <&pm8916_s2_corner>;
qcom,lpm-wa-cx-turbo-unvote;
qcom,lpm-wa-skip-l2-spm;
}

View file

@ -232,8 +232,11 @@ int set_l2_mode(struct low_power_ops *ops, int mode, bool notify_rpm)
lpm = MSM_SPM_MODE_DISABLED;
break;
}
rc = msm_spm_config_low_power_mode(ops->spm, lpm, notify_rpm);
/* Do not program L2 SPM. This will be set by TZ */
if (lpm_wa_get_skip_l2_spm())
return 0;
rc = msm_spm_config_low_power_mode(ops->spm, lpm, notify_rpm);
if (rc)
pr_err("%s: Failed to set L2 low power mode %d, ERR %d",
__func__, lpm, rc);

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -24,6 +24,7 @@ static struct regulator *lpm_cx_reg;
static struct work_struct dummy_vote_work;
static struct workqueue_struct *lpm_wa_wq;
static bool lpm_wa_cx_turbo_unvote;
static bool skip_l2_spm;
/* While exiting from RPM assisted power collapse on some targets like MSM8939
* the CX is bumped to turbo mode by RPM. To reduce the power impact, APSS
@ -52,6 +53,13 @@ void lpm_wa_cx_unvote_send(void)
}
EXPORT_SYMBOL(lpm_wa_cx_unvote_send);
bool lpm_wa_get_skip_l2_spm(void)
{
return skip_l2_spm;
}
EXPORT_SYMBOL(lpm_wa_get_skip_l2_spm);
static int lpm_wa_cx_unvote_init(struct platform_device *pdev)
{
int ret = 0;
@ -95,6 +103,8 @@ static int lpm_wa_probe(struct platform_device *pdev)
}
}
skip_l2_spm = of_property_read_bool(pdev->dev.of_node,
"qcom,lpm-wa-skip-l2-spm");
return ret;
}

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -15,5 +15,5 @@
#define __LPM_WA_H
void lpm_wa_cx_unvote_send(void);
bool lpm_wa_get_skip_l2_spm(void);
#endif /* __LPM_WA_H */