* [PATCH] cpufreq: qcom-cpufreq-hw: Add cpufreq qos for LMh
@ 2022-09-15 9:05 Xuewen Yan
2022-09-21 7:24 ` Viresh Kumar
2022-09-26 5:51 ` Viresh Kumar
0 siblings, 2 replies; 5+ messages in thread
From: Xuewen Yan @ 2022-09-15 9:05 UTC (permalink / raw)
To: agross, bjorn.andersson, viresh.kumar, konrad.dybcio, rafael
Cc: linux-arm-msm, linux-pm, linux-kernel, di.shen
Before update thermal pressure, the max cpufreq should be limited.
Add QOS control for Lmh throttle cpufreq.
Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
---
drivers/cpufreq/qcom-cpufreq-hw.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
index d5ef3c66c762..deb1219435a5 100644
--- a/drivers/cpufreq/qcom-cpufreq-hw.c
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -13,6 +13,7 @@
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/pm_opp.h>
+#include <linux/pm_qos.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/units.h>
@@ -56,6 +57,8 @@ struct qcom_cpufreq_data {
struct cpufreq_policy *policy;
bool per_core_dcvs;
+
+ struct freq_qos_request throttle_freq_req;
};
static unsigned long cpu_hw_rate, xo_rate;
@@ -318,6 +321,8 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data)
} else {
throttled_freq = freq_hz / HZ_PER_KHZ;
+ freq_qos_update_request(&data->throttle_freq_req, throttled_freq);
+
/* Update thermal pressure (the boost frequencies are accepted) */
arch_update_thermal_pressure(policy->related_cpus, throttled_freq);
@@ -413,6 +418,14 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index)
if (data->throttle_irq < 0)
return data->throttle_irq;
+ ret = freq_qos_add_request(&policy->constraints,
+ &data->throttle_freq_req, FREQ_QOS_MAX,
+ FREQ_QOS_MAX_DEFAULT_VALUE);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "Failed to add freq constraint (%d)\n", ret);
+ return ret;
+ }
+
data->cancel_throttle = false;
data->policy = policy;
@@ -479,6 +492,7 @@ static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
if (data->throttle_irq <= 0)
return;
+ freq_qos_remove_request(&data->throttle_freq_req);
free_irq(data->throttle_irq, data);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] cpufreq: qcom-cpufreq-hw: Add cpufreq qos for LMh
2022-09-15 9:05 [PATCH] cpufreq: qcom-cpufreq-hw: Add cpufreq qos for LMh Xuewen Yan
@ 2022-09-21 7:24 ` Viresh Kumar
2022-09-26 5:51 ` Viresh Kumar
1 sibling, 0 replies; 5+ messages in thread
From: Viresh Kumar @ 2022-09-21 7:24 UTC (permalink / raw)
To: Xuewen Yan, mani, Bjorn Andersson, Neil Armstrong
Cc: agross, konrad.dybcio, rafael, linux-arm-msm, linux-pm,
linux-kernel, di.shen
Can someone familiar with the code please review this ?
On 15-09-22, 17:05, Xuewen Yan wrote:
> Before update thermal pressure, the max cpufreq should be limited.
> Add QOS control for Lmh throttle cpufreq.
>
> Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
> ---
> drivers/cpufreq/qcom-cpufreq-hw.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
> index d5ef3c66c762..deb1219435a5 100644
> --- a/drivers/cpufreq/qcom-cpufreq-hw.c
> +++ b/drivers/cpufreq/qcom-cpufreq-hw.c
> @@ -13,6 +13,7 @@
> #include <linux/of_address.h>
> #include <linux/of_platform.h>
> #include <linux/pm_opp.h>
> +#include <linux/pm_qos.h>
> #include <linux/slab.h>
> #include <linux/spinlock.h>
> #include <linux/units.h>
> @@ -56,6 +57,8 @@ struct qcom_cpufreq_data {
> struct cpufreq_policy *policy;
>
> bool per_core_dcvs;
> +
> + struct freq_qos_request throttle_freq_req;
> };
>
> static unsigned long cpu_hw_rate, xo_rate;
> @@ -318,6 +321,8 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data)
> } else {
> throttled_freq = freq_hz / HZ_PER_KHZ;
>
> + freq_qos_update_request(&data->throttle_freq_req, throttled_freq);
> +
> /* Update thermal pressure (the boost frequencies are accepted) */
> arch_update_thermal_pressure(policy->related_cpus, throttled_freq);
>
> @@ -413,6 +418,14 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index)
> if (data->throttle_irq < 0)
> return data->throttle_irq;
>
> + ret = freq_qos_add_request(&policy->constraints,
> + &data->throttle_freq_req, FREQ_QOS_MAX,
> + FREQ_QOS_MAX_DEFAULT_VALUE);
> + if (ret < 0) {
> + dev_err(&pdev->dev, "Failed to add freq constraint (%d)\n", ret);
> + return ret;
> + }
> +
> data->cancel_throttle = false;
> data->policy = policy;
>
> @@ -479,6 +492,7 @@ static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
> if (data->throttle_irq <= 0)
> return;
>
> + freq_qos_remove_request(&data->throttle_freq_req);
> free_irq(data->throttle_irq, data);
> }
--
viresh
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cpufreq: qcom-cpufreq-hw: Add cpufreq qos for LMh
2022-09-15 9:05 [PATCH] cpufreq: qcom-cpufreq-hw: Add cpufreq qos for LMh Xuewen Yan
2022-09-21 7:24 ` Viresh Kumar
@ 2022-09-26 5:51 ` Viresh Kumar
2022-09-26 8:34 ` [PATCH v2] " Xuewen Yan
1 sibling, 1 reply; 5+ messages in thread
From: Viresh Kumar @ 2022-09-26 5:51 UTC (permalink / raw)
To: Xuewen Yan
Cc: agross, bjorn.andersson, konrad.dybcio, rafael, linux-arm-msm,
linux-pm, linux-kernel, di.shen
On 15-09-22, 17:05, Xuewen Yan wrote:
> Before update thermal pressure, the max cpufreq should be limited.
> Add QOS control for Lmh throttle cpufreq.
>
> Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
> ---
> drivers/cpufreq/qcom-cpufreq-hw.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
This doesn't apply cleanly over my tree anymore, can you please rebase and
resend ?
git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git cpufreq/arm/linux-next
--
viresh
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] cpufreq: qcom-cpufreq-hw: Add cpufreq qos for LMh
2022-09-26 5:51 ` Viresh Kumar
@ 2022-09-26 8:34 ` Xuewen Yan
2022-09-26 8:36 ` Viresh Kumar
0 siblings, 1 reply; 5+ messages in thread
From: Xuewen Yan @ 2022-09-26 8:34 UTC (permalink / raw)
To: viresh.kumar
Cc: agross, bjorn.andersson, konrad.dybcio, linux-arm-msm,
linux-kernel, linux-pm, rafael, di.shen
Before update thermal pressure, the max cpufreq should be limited.
Add QOS control for Lmh throttle cpufreq.
Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
---
v1->v2:
reabse to cpufreq/arm/linux-next;
---
drivers/cpufreq/qcom-cpufreq-hw.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
index bb32659820ce..833589bc95e4 100644
--- a/drivers/cpufreq/qcom-cpufreq-hw.c
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -13,6 +13,7 @@
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/pm_opp.h>
+#include <linux/pm_qos.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/units.h>
@@ -56,6 +57,8 @@ struct qcom_cpufreq_data {
struct cpufreq_policy *policy;
bool per_core_dcvs;
+
+ struct freq_qos_request throttle_freq_req;
};
static unsigned long cpu_hw_rate, xo_rate;
@@ -321,6 +324,8 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data)
throttled_freq = freq_hz / HZ_PER_KHZ;
+ freq_qos_update_request(&data->throttle_freq_req, throttled_freq);
+
/* Update thermal pressure (the boost frequencies are accepted) */
arch_update_thermal_pressure(policy->related_cpus, throttled_freq);
@@ -413,6 +418,14 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index)
if (data->throttle_irq < 0)
return data->throttle_irq;
+ ret = freq_qos_add_request(&policy->constraints,
+ &data->throttle_freq_req, FREQ_QOS_MAX,
+ FREQ_QOS_MAX_DEFAULT_VALUE);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "Failed to add freq constraint (%d)\n", ret);
+ return ret;
+ }
+
data->cancel_throttle = false;
data->policy = policy;
@@ -479,6 +492,7 @@ static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
if (data->throttle_irq <= 0)
return;
+ freq_qos_remove_request(&data->throttle_freq_req);
free_irq(data->throttle_irq, data);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] cpufreq: qcom-cpufreq-hw: Add cpufreq qos for LMh
2022-09-26 8:34 ` [PATCH v2] " Xuewen Yan
@ 2022-09-26 8:36 ` Viresh Kumar
0 siblings, 0 replies; 5+ messages in thread
From: Viresh Kumar @ 2022-09-26 8:36 UTC (permalink / raw)
To: Xuewen Yan
Cc: agross, bjorn.andersson, konrad.dybcio, linux-arm-msm,
linux-kernel, linux-pm, rafael, di.shen
On 26-09-22, 16:34, Xuewen Yan wrote:
> Before update thermal pressure, the max cpufreq should be limited.
> Add QOS control for Lmh throttle cpufreq.
>
> Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
> ---
> v1->v2:
> reabse to cpufreq/arm/linux-next;
> ---
> drivers/cpufreq/qcom-cpufreq-hw.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
> index bb32659820ce..833589bc95e4 100644
> --- a/drivers/cpufreq/qcom-cpufreq-hw.c
> +++ b/drivers/cpufreq/qcom-cpufreq-hw.c
> @@ -13,6 +13,7 @@
> #include <linux/of_address.h>
> #include <linux/of_platform.h>
> #include <linux/pm_opp.h>
> +#include <linux/pm_qos.h>
> #include <linux/slab.h>
> #include <linux/spinlock.h>
> #include <linux/units.h>
> @@ -56,6 +57,8 @@ struct qcom_cpufreq_data {
> struct cpufreq_policy *policy;
>
> bool per_core_dcvs;
> +
> + struct freq_qos_request throttle_freq_req;
> };
>
> static unsigned long cpu_hw_rate, xo_rate;
> @@ -321,6 +324,8 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data)
>
> throttled_freq = freq_hz / HZ_PER_KHZ;
>
> + freq_qos_update_request(&data->throttle_freq_req, throttled_freq);
> +
> /* Update thermal pressure (the boost frequencies are accepted) */
> arch_update_thermal_pressure(policy->related_cpus, throttled_freq);
>
> @@ -413,6 +418,14 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index)
> if (data->throttle_irq < 0)
> return data->throttle_irq;
>
> + ret = freq_qos_add_request(&policy->constraints,
> + &data->throttle_freq_req, FREQ_QOS_MAX,
> + FREQ_QOS_MAX_DEFAULT_VALUE);
> + if (ret < 0) {
> + dev_err(&pdev->dev, "Failed to add freq constraint (%d)\n", ret);
> + return ret;
> + }
> +
> data->cancel_throttle = false;
> data->policy = policy;
>
> @@ -479,6 +492,7 @@ static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
> if (data->throttle_irq <= 0)
> return;
>
> + freq_qos_remove_request(&data->throttle_freq_req);
> free_irq(data->throttle_irq, data);
> }
>
Applied. Thanks.
--
viresh
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-09-26 8:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-15 9:05 [PATCH] cpufreq: qcom-cpufreq-hw: Add cpufreq qos for LMh Xuewen Yan
2022-09-21 7:24 ` Viresh Kumar
2022-09-26 5:51 ` Viresh Kumar
2022-09-26 8:34 ` [PATCH v2] " Xuewen Yan
2022-09-26 8:36 ` Viresh Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).