Tegra194 cpufreq driver misc changes
Subsystems (2)
cover Tegra194 cpufreq driver misc changes
This patch set has below two changes:
1) get consistent cpuinfo_cur_freq value from freq_table.
2) Fix unlisted boot freq warning by setting closest ndiv value from freq_table if the boot frequency gets filtered while creating freq_table in kernel.
Sumit Gupta (2):
cpufreq: tegra194: get consistent cpuinfo_cur_freq
cpufreq: tegra194: Fix unlisted boot freq warning
drivers/cpufreq/tegra194-cpufreq.c | 182 ++++++++++++++++++++++++++++++++++--- 1 file changed, 167 insertions(+), 15 deletions(-)
Signature · 7 lines
2.7.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/2 cpufreq: tegra194: get consistent cpuinfo_cur_freq
Frequency returned by 'cpuinfo_cur_freq' using counters is not fixed and keeps changing slightly. This change returns a consistent value from freq_table. If the reconstructed frequency has acceptable delta from the last written value, then return the frequency corresponding to the last written ndiv value from freq_table. Otherwise, print a warning and return the reconstructed freq.
--- drivers/cpufreq/tegra194-cpufreq.c | 66 ++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 9 deletions(-)
drivers/cpufreq/tegra194-cpufreq.c +57 -9
@@ -180,9 +180,65 @@ static unsigned int tegra194_get_speed_common(u32 cpu, u32 delay)return (rate_mhz *KHZ );/* in KHz */ } +static void get_cpu_ndiv (void *ndiv) +{ +u64 ndiv_val; + + asmvolatile ("mrs %0, s3_0_c15_c0_4" :"=r" (ndiv_val) : ); + + *(u64 *)ndiv = ndiv_val; +} + +static void set_cpu_ndiv (void *data) +{ +struct cpufreq_frequency_table *tbl = data; +u64 ndiv_val = (u64 )tbl->driver_data; + + asmvolatile ("msr s3_0_c15_c0_4, %0" : :"r" (ndiv_val)); +} +static unsigned int tegra194_get_speed (u32 cpu) { -return tegra194_get_speed_common (cpu,US_DELAY ); +struct cpufreq_frequency_table *table, *pos; +struct cpufreq_policy policy; +unsigned int rate; +u64 ndiv; +int err; + +cpufreq_get_policy (&policy, cpu); + table = policy.freq_table; + +/* reconstruct actual cpu freq using counters*/ + rate =tegra194_get_speed_common (cpu,US_DELAY ); + +/* get last written ndiv value*/ + err =smp_call_function_single (cpu, get_cpu_ndiv, &ndiv, true); +if (err) { +pr_err ("cpufreq: Failed to get ndiv for CPU%d, ret:%d\n" , + cpu, err); +return rate; + } + +/* if the reconstructed frequency has acceptable delta from +* the last written value, then return freq corresponding +* to the last written ndiv value from freq_table. This is +* done to return consistent value. +*/ +cpufreq_for_each_valid_entry (pos, table) { +if (pos->driver_data != ndiv) +continue ; + +if (abs (pos->frequency - rate) >115200 ) { +pr_warn ("cpufreq: high delta (%d) on CPU%d\n" , +abs (pos->frequency - rate), cpu); +pr_warn ("cpufreq: cur:%u, set:%u, set ndiv:%llu\n" , + rate, pos->frequency, ndiv); + }else { + rate = pos->frequency; + } +break ; + } +return rate; }static int tegra194_cpufreq_init (struct cpufreq_policy *policy)
@@ -209,14 +265,6 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy)return 0 ; } -static void set_cpu_ndiv (void *data) -{ -struct cpufreq_frequency_table *tbl = data; -u64 ndiv_val = (u64 )tbl->driver_data; - - asmvolatile ("msr s3_0_c15_c0_4, %0" : :"r" (ndiv_val)); -} -static int tegra194_cpufreq_set_target (struct cpufreq_policy *policy,unsigned int index) {
Signature · 7 lines
2.7.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [Patch 1/2] cpufreq: tegra194: get consistent cpuinfo_cur_freq
Quoted 6 lines · Sumit Gupta
Frequency returned by '
cpuinfo_cur_freq' using counters is not fixed and keeps changing slightly. This change returns a consistent value fromfreq_table. If the reconstructed frequency has acceptable delta from the last written value, then return the frequency corresponding to the last written ndiv value fromfreq_table. Otherwise, print a warning and return the reconstructed freq.
We should include the Fixes tag here ...
Quoted 2 lines
Signed-off-by Sumit Gupta <[email protected]>
Otherwise ...
Viresh, ideally we need to include this fix for v5.9. Do you need Sumit to resend with the Fixes tag or are you happy to add?
Thanks
Jon
Signature · 1 line
nvpublic
Jon Hunter
maintainerRe: [Patch 1/2] cpufreq: tegra194: get consistent cpuinfo_cur_freq
Adding Sudeep ...
Quoted 17 lines · Jon Hunter
Quoted 6 lines · Sumit Gupta
Frequency returned by '
cpuinfo_cur_freq' using counters is not fixed and keeps changing slightly. This change returns a consistent value fromfreq_table. If the reconstructed frequency has acceptable delta from the last written value, then return the frequency corresponding to the last written ndiv value fromfreq_table. Otherwise, print a warning and return the reconstructed freq.We should include the Fixes tag here ...
Fixes df320f89359c ("cpufreq: Add Tegra194 cpufreq driver")Quoted 2 lines
Signed-off-by Sumit Gupta <[email protected]>
Quoted 7 lines
Otherwise ...
Reviewed-by Jon Hunter <[email protected]>Tested-by Jon Hunter <[email protected]>Viresh, ideally we need to include this fix for v5.9. Do you need Sumit to resend with the Fixes tag or are you happy to add?
Sudeep, Rafael, looks like Viresh is out of office until next month. Please let me know if we can pick up both this patch and following patch for v5.9.
Thanks!
Jon
Signature · 1 line
nvpublic
Jon Hunter
maintainerRe: [Patch 1/2] cpufreq: tegra194: get consistent cpuinfo_cur_freq
Hi Rafael, Sudeep,
Quoted 25 lines · Jon Hunter
Adding Sudeep ...
Quoted 22 lines · Jon Hunter
Quoted 6 lines · Sumit Gupta
Frequency returned by '
cpuinfo_cur_freq' using counters is not fixed and keeps changing slightly. This change returns a consistent value fromfreq_table. If the reconstructed frequency has acceptable delta from the last written value, then return the frequency corresponding to the last written ndiv value fromfreq_table. Otherwise, print a warning and return the reconstructed freq.We should include the Fixes tag here ...
Fixes df320f89359c ("cpufreq: Add Tegra194 cpufreq driver")Quoted 2 lines
Signed-off-by Sumit Gupta <[email protected]>Otherwise ...
Reviewed-by Jon Hunter <[email protected]>Tested-by Jon Hunter <[email protected]>
Quoted 7 lines
Quoted 2 lines
Viresh, ideally we need to include this fix for v5.9. Do you need Sumit to resend with the Fixes tag or are you happy to add?
Sudeep, Rafael, looks like Viresh is out of office until next month. Please let me know if we can pick up both this patch and following patch for v5.9.
Any chance we can get these patches into v5.9?
Thanks!
Jon
Signature · 1 line
nvpublic
Viresh Kumar
maintainerRe: [Patch 1/2] cpufreq: tegra194: get consistent cpuinfo_cur_freq
In reply to Jon HunterQuoted 2 lines · Jon Hunter
Viresh, ideally we need to include this fix for v5.9. Do you need Sumit to resend with the Fixes tag or are you happy to add?
I understand that this fixes a patch which got merged recently, but I am not sure if anything is broken badly right now, i.e. will make the hardware work incorrectly.
Do we really need to get these in 5.9 ? As these are significant changes and may cause more bugs. Won't getting them in 5.9-stable and 5.10-rc1 be enough ?
Signature · 1 line
viresh
Jon Hunter
maintainerRe: [Patch 1/2] cpufreq: tegra194: get consistent cpuinfo_cur_freq
Quoted 10 lines · Viresh Kumar
Quoted 2 lines · Jon Hunter
Viresh, ideally we need to include this fix for v5.9. Do you need Sumit to resend with the Fixes tag or are you happy to add?
I understand that this fixes a patch which got merged recently, but I am not sure if anything is broken badly right now, i.e. will make the hardware work incorrectly.
Do we really need to get these in 5.9 ? As these are significant changes and may cause more bugs. Won't getting them in 5.9-stable and 5.10-rc1 be enough ?
Yes we want these in v5.9 ideally but yes we could merge to 5.9-stable once accepted into the mainline.
Jon
Signature · 1 line
nvpublic
Re: [Patch 1/2] cpufreq: tegra194: get consistent cpuinfo_cur_freq
In reply to Sumit GuptaQuoted 11 lines · Sumit Gupta
Frequency returned by '
cpuinfo_cur_freq' using counters is not fixed and keeps changing slightly. This change returns a consistent value fromfreq_table. If the reconstructed frequency has acceptable delta from the last written value, then return the frequency corresponding to the last written ndiv value fromfreq_table. Otherwise, print a warning and return the reconstructed freq.Signed-off-by Sumit Gupta <[email protected]>--- drivers/cpufreq/tegra194-cpufreq.c | 66 ++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 9 deletions(-)
Viresh Kumar
maintainerRe: [Patch 1/2] cpufreq: tegra194: get consistent cpuinfo_cur_freq
In reply to Sumit GuptaQuoted 38 lines · Sumit Gupta
Frequency returned by '
cpuinfo_cur_freq' using counters is not fixed and keeps changing slightly. This change returns a consistent value fromfreq_table. If the reconstructed frequency has acceptable delta from the last written value, then return the frequency corresponding to the last written ndiv value fromfreq_table. Otherwise, print a warning and return the reconstructed freq.Signed-off-by Sumit Gupta <[email protected]>--- drivers/cpufreq/tegra194-cpufreq.c | 66 ++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 9 deletions(-)drivers/cpufreq/tegra194-cpufreq.c +17
-0@@ -180,9 +180,65 @@ static unsigned int tegra194_get_speed_common(u32 cpu, u32 delay)return (rate_mhz *KHZ );/* in KHz */ } +static void get_cpu_ndiv (void *ndiv) +{ +u64 ndiv_val; + + asmvolatile ("mrs %0, s3_0_c15_c0_4" :"=r" (ndiv_val) : ); + + *(u64 *)ndiv = ndiv_val; +} + +static void set_cpu_ndiv (void *data) +{ +struct cpufreq_frequency_table *tbl = data; +u64 ndiv_val = (u64 )tbl->driver_data; + + asmvolatile ("msr s3_0_c15_c0_4, %0" : :"r" (ndiv_val)); +} +static unsigned int tegra194_get_speed (u32 cpu)
drivers/cpufreq/tegra194-cpufreq.c static unsigned int tegra194_get_speed_common(u32 cpu, u32 delay) · line 209
Quoted 10 lines
drivers/cpufreq/tegra194-cpufreq.c +8
-1{ -return tegra194_get_speed_common (cpu,US_DELAY ); +struct cpufreq_frequency_table *table, *pos; +struct cpufreq_policy policy; +unsigned int rate; +u64 ndiv; +int err; + +cpufreq_get_policy (&policy, cpu); + table = policy.freq_table;
Maybe getting freq-table from cluster specific data would be better/faster.
drivers/cpufreq/tegra194-cpufreq.c static unsigned int tegra194_get_speed_common(u32 cpu, u32 delay) · line 222
Quoted 13 lines
drivers/cpufreq/tegra194-cpufreq.c +13
-0+ +/* reconstruct actual cpu freq using counters*/ + rate =tegra194_get_speed_common (cpu,US_DELAY ); + +/* get last written ndiv value*/ + err =smp_call_function_single (cpu, get_cpu_ndiv, &ndiv, true); +if (err) { +pr_err ("cpufreq: Failed to get ndiv for CPU%d, ret:%d\n" , + cpu, err); +return rate; + } + +/* if the reconstructed frequency has acceptable delta from
Both have got the multi-line comments wrong. Format is wrong and every sentence needs to start with a capital letter.
drivers/cpufreq/tegra194-cpufreq.c static unsigned int tegra194_get_speed_common(u32 cpu, u32 delay) · line 235
Quoted 13 lines
drivers/cpufreq/tegra194-cpufreq.c +13
-0+* the last written value, then return freq corresponding +* to the last written ndiv value from freq_table. This is +* done to return consistent value. +*/ +cpufreq_for_each_valid_entry (pos, table) { +if (pos->driver_data != ndiv) +continue ; + +if (abs (pos->frequency - rate) >115200 ) { +pr_warn ("cpufreq: high delta (%d) on CPU%d\n" , +abs (pos->frequency - rate), cpu); +pr_warn ("cpufreq: cur:%u, set:%u, set ndiv:%llu\n" , + rate, pos->frequency, ndiv);
Both of these can be merged in a single line I think. There is no need to print delta as you already print both the frequencies.
Quoted 26 lines
drivers/cpufreq/tegra194-cpufreq.c +6
-8+ }else { + rate = pos->frequency; + } +break ; + } +return rate; }static int tegra194_cpufreq_init (struct cpufreq_policy *policy)@@ -209,14 +265,6 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy)return 0 ; } -static void set_cpu_ndiv (void *data) -{ -struct cpufreq_frequency_table *tbl = data; -u64 ndiv_val = (u64 )tbl->driver_data; - - asmvolatile ("msr s3_0_c15_c0_4, %0" : :"r" (ndiv_val)); -} -static int tegra194_cpufreq_set_target (struct cpufreq_policy *policy,unsigned int index) {Signature · 1 line
2.7.4
Signature · 1 line
viresh
Re: [Patch 1/2] cpufreq: tegra194: get consistent cpuinfo_cur_freq
Quoted 43 lines
Quoted 43 lines
Frequency returned by '
cpuinfo_cur_freq' using counters is not fixed and keeps changing slightly. This change returns a consistent value fromfreq_table. If the reconstructed frequency has acceptable delta from the last written value, then return the frequency corresponding to the last written ndiv value fromfreq_table. Otherwise, print a warning and return the reconstructed freq.Signed-off-by Sumit Gupta <[email protected]>--- drivers/cpufreq/tegra194-cpufreq.c | 66 ++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 9 deletions(-)drivers/cpufreq/tegra194-cpufreq.c +19
-1@@ -180,9 +180,65 @@ static unsigned int tegra194_get_speed_common(u32 cpu, u32 delay)return (rate_mhz *KHZ );/* in KHz */ } +static void get_cpu_ndiv (void *ndiv) +{ +u64 ndiv_val; + + asmvolatile ("mrs %0, s3_0_c15_c0_4" :"=r" (ndiv_val) : ); + + *(u64 *)ndiv = ndiv_val; +} + +static void set_cpu_ndiv (void *data) +{ +struct cpufreq_frequency_table *tbl = data; +u64 ndiv_val = (u64 )tbl->driver_data; + + asmvolatile ("msr s3_0_c15_c0_4, %0" : :"r" (ndiv_val)); +} +static unsigned int tegra194_get_speed (u32 cpu) { -return tegra194_get_speed_common (cpu,US_DELAY ); +struct cpufreq_frequency_table *table, *pos; +struct cpufreq_policy policy;
Quoted 9 lines
drivers/cpufreq/tegra194-cpufreq.c static unsigned int tegra194_get_speed_common(u32 cpu, u32 delay) · line 209
Quoted 6 lines
drivers/cpufreq/tegra194-cpufreq.c +6
-0+unsigned int rate; +u64 ndiv; +int err; + +cpufreq_get_policy (&policy, cpu); + table = policy.freq_table;Maybe getting freq-table from cluster specific data would be better/faster.
will do the change in next patch version.
Quoted 8 lines
Quoted 8 lines
drivers/cpufreq/tegra194-cpufreq.c +8
-0+ +/* reconstruct actual cpu freq using counters*/ + rate =tegra194_get_speed_common (cpu,US_DELAY ); + +/* get last written ndiv value*/ + err =smp_call_function_single (cpu, get_cpu_ndiv, &ndiv, true); +if (err) { + pr_err("cpufreq: Failed to get ndiv for CPU%d, ret:%d\n",
Quoted 9 lines
drivers/cpufreq/tegra194-cpufreq.c static unsigned int tegra194_get_speed_common(u32 cpu, u32 delay) · line 222
Quoted 5 lines
drivers/cpufreq/tegra194-cpufreq.c +5
-0+ cpu, err); +return rate; + } + +/* if the reconstructed frequency has acceptable delta from Both have got the multi-line comments wrong. Format is wrong and every sentence needs to start with a capital letter.
will correct.
Quoted 14 lines
drivers/cpufreq/tegra194-cpufreq.c static unsigned int tegra194_get_speed_common(u32 cpu, u32 delay) · line 235
Quoted 13 lines
drivers/cpufreq/tegra194-cpufreq.c +13
-0+* the last written value, then return freq corresponding +* to the last written ndiv value from freq_table. This is +* done to return consistent value. +*/ +cpufreq_for_each_valid_entry (pos, table) { +if (pos->driver_data != ndiv) +continue ; + +if (abs (pos->frequency - rate) >115200 ) { +pr_warn ("cpufreq: high delta (%d) on CPU%d\n" , +abs (pos->frequency - rate), cpu); +pr_warn ("cpufreq: cur:%u, set:%u, set ndiv:%llu\n" , + rate, pos->frequency, ndiv);
Quoted 3 lines
Both of these can be merged in a single line I think. There is no need to print delta as you already print both the frequencies.
Will do this also in next patch version.
Quoted 30 lines
Quoted 25 lines
drivers/cpufreq/tegra194-cpufreq.c +6
-9+ }else { + rate = pos->frequency; + } +break ; + } +return rate; }static int tegra194_cpufreq_init (struct cpufreq_policy *policy)@@ -209,14 +265,6 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy)return 0 ; } -static void set_cpu_ndiv (void *data) -{ -struct cpufreq_frequency_table *tbl = data; -u64 ndiv_val = (u64 )tbl->driver_data; - - asmvolatile ("msr s3_0_c15_c0_4, %0" : :"r" (ndiv_val)); -} -static int tegra194_cpufreq_set_target (struct cpufreq_policy *policy,unsigned int index) { --Quoted 1 line
2.7.4
--
viresh
PATCH 2/2 cpufreq: tegra194: Fix unlisted boot freq warning
In reply to Sumit GuptaWarning coming during boot because the boot freq set by bootloader gets filtered out due to big freq steps while creating freq_table. Fixing this by setting closest ndiv value from freq_table. Warning:
cpufreq: cpufreq_online: CPU0: Running at unlisted freq
cpufreq: cpufreq_online: CPU0: Unlisted initial frequency changed
Also, added change in init to wait till current frequency becomes equal or near to the previously requested frequency. This is done because it takes some time to restore the previous frequency while turning-on non-boot cores during exit from SC7(Suspend-to-RAM).
--- drivers/cpufreq/tegra194-cpufreq.c | 118 ++++++++++++++++++++++++++++++++++--- 1 file changed, 111 insertions(+), 7 deletions(-)
drivers/cpufreq/tegra194-cpufreq.c +111 -7
@@ -7,6 +7,7 @@#include <linux/cpufreq.h> #include <linux/delay.h> #include <linux/dma-mapping.h> +#include <linux/iopoll.h> #include <linux/module.h> #include <linux/of.h> #include <linux/of_platform.h>
@@ -21,7 +22,6 @@#define KHZ 1000#define REF_CLK_MHZ 408/* 408 MHz */ #define US_DELAY 500 -#define US_DELAY_MIN 2#define CPUFREQ_TBL_STEP_HZ (50 * KHZ * KHZ)#define MAX_CNT ~0U
@@ -241,26 +241,130 @@ static unsigned int tegra194_get_speed(u32 cpu)return rate; } +static int +freqtable_find_index_closest_ndiv (struct cpufreq_frequency_table *table, +unsigned int target_ndiv) +{ +struct cpufreq_frequency_table *pos; +unsigned int ndiv; +int idx, best =-1 ; + +cpufreq_for_each_valid_entry_idx (pos, table, idx) { + ndiv = pos->driver_data; + +if (ndiv == target_ndiv) +return idx; + +if (ndiv < target_ndiv) { + best = idx; +continue ; + } + +/* No ndiv found below target_ndiv */ +if (best ==-1 ) +return idx; + +/* Choose the closest ndiv */ +if (target_ndiv - table[best].driver_data > ndiv - target_ndiv) +return idx; + +return best; + } + +return best; +} + +static int +freqtable_set_closest_ndiv (struct cpufreq_frequency_table *freq_table, +int cpu) +{ +u64 ndiv; +int idx, ret; + +if (!cpu_online (cpu)) +return -EINVAL ; + +/* get ndiv for the last frequency request from software */ + ret =smp_call_function_single (cpu, get_cpu_ndiv, &ndiv, true); +if (ret) { +pr_err ("cpufreq: Failed to get ndiv for CPU%d\n" , cpu); +return ret; + } + +/* while creating freq_table during boot, if the ndiv value got +* filtered out due to large freq steps, then find closest ndiv +* from freq_table and set that. +*/ + idx =freqtable_find_index_closest_ndiv (freq_table, ndiv); + +if (ndiv != freq_table[idx].driver_data) { +pr_debug ("cpufreq: new freq:%d ndiv:%d, old ndiv:%llu\n" , + freq_table[idx].frequency, + freq_table[idx].driver_data, ndiv); + + ret =smp_call_function_single (cpu, set_cpu_ndiv, + freq_table + idx, true); +if (ret) { +pr_err ("cpufreq: setting ndiv for CPU%d failed\n" , + cpu); +return ret; + } + } + +return freq_table[idx].frequency; +} +static int tegra194_cpufreq_init (struct cpufreq_policy *policy) {struct tegra194_cpufreq_data *data =cpufreq_get_driver_data (); -u32 cpu; +u32 cpu = policy->cpu; +int new_freq, ret;u32 cl; -smp_call_function_single (policy->cpu, get_cpu_cluster, &cl, true); +if (!cpu_online (cpu)) +return -EINVAL ; + + ret =smp_call_function_single (cpu, get_cpu_cluster, &cl, true); +if (ret) { +pr_err ("cpufreq: Failed to get cluster for CPU%d\n" , cpu); +return ret; + }if (cl >= data->num_clusters)return -EINVAL ; -/* boot freq */ - policy->cur =tegra194_get_speed_common (policy->cpu,US_DELAY_MIN ); -/* set same policy for all cpus in a cluster */ for (cpu = (cl *2 ); cpu < ((cl +1 ) *2 ); cpu++)cpumask_set_cpu (cpu, policy->cpus); policy->freq_table = data->tables[cl]; - policy->cpuinfo.transition_latency =TEGRA_CPUFREQ_TRANSITION_LATENCY ; + policy->cpuinfo.transition_latency = +TEGRA_CPUFREQ_TRANSITION_LATENCY ; + +/* Find and set the closest ndiv from freq_table if the boot freq +* already set is filtered out from freq_table or not present. +*/ + new_freq =freqtable_set_closest_ndiv (policy->freq_table, policy->cpu); +if (new_freq <0 ) { +pr_err ("cpufreq: set closest ndiv for CPU%d failed(%d)\n" , + policy->cpu, new_freq); +return new_freq; + } + +/* It takes some time to restore the previous frequency while +* turning-on non-boot cores during exit from SC7(Suspend-to-RAM). +* So, wait till it reaches the previous value and timeout if the +* time taken to reach requested freq is >100ms +*/ + ret =read_poll_timeout (tegra194_get_speed_common, policy->cur, +abs (policy->cur - new_freq) <=115200 ,0 , +100 *USEC_PER_MSEC , false, policy->cpu, +US_DELAY ); +if (ret) +pr_warn ("cpufreq: time taken to restore freq >100ms\n" ); + +pr_debug ("cpufreq: cpu%d, curfreq:%d, setfreq:%d\n" , policy->cpu, + policy->cur, new_freq);return 0 ; }
Signature · 7 lines
2.7.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [Patch 2/2] cpufreq: tegra194: Fix unlisted boot freq warning
Quoted 11 lines · Sumit Gupta
Warning coming during boot because the boot freq set by bootloader gets filtered out due to big freq steps while creating
freq_table. Fixing this by setting closest ndiv value fromfreq_table. Warning:
cpufreq:cpufreq_online: CPU0: Running at unlisted freq
cpufreq:cpufreq_online: CPU0: Unlisted initial frequency changedAlso, added change in init to wait till current frequency becomes equal or near to the previously requested frequency. This is done because it takes some time to restore the previous frequency while turning-on non-boot cores during exit from SC7(Suspend-to-RAM).
Same here ...
Quoted 2 lines
Signed-off-by Sumit Gupta <[email protected]>
Viresh, this is also needed for v5.9.
Thanks
Jon
Signature · 1 line
nvpublic
Jon Hunter
maintainerRe: [Patch 2/2] cpufreq: tegra194: Fix unlisted boot freq warning
Quoted 16 lines · Jon Hunter
Quoted 11 lines · Sumit Gupta
Warning coming during boot because the boot freq set by bootloader gets filtered out due to big freq steps while creating
freq_table. Fixing this by setting closest ndiv value fromfreq_table. Warning:
cpufreq:cpufreq_online: CPU0: Running at unlisted freq
cpufreq:cpufreq_online: CPU0: Unlisted initial frequency changedAlso, added change in init to wait till current frequency becomes equal or near to the previously requested frequency. This is done because it takes some time to restore the previous frequency while turning-on non-boot cores during exit from SC7(Suspend-to-RAM).
Same here ...
Quoted 8 lines
Fixes df320f89359c ("cpufreq: Add Tegra194 cpufreq driver")Quoted 2 lines
Signed-off-by Sumit Gupta <[email protected]>Reviewed-by Jon Hunter <[email protected]>Tested-by Jon Hunter <[email protected]>Viresh, this is also needed for v5.9.
Adding Sudeep.
Jon
Signature · 1 line
nvpublic
Re: [Patch 2/2] cpufreq: tegra194: Fix unlisted boot freq warning
In reply to Sumit GuptaQuoted 12 lines · Sumit Gupta
Warning coming during boot because the boot freq set by bootloader gets filtered out due to big freq steps while creating
freq_table. Fixing this by setting closest ndiv value fromfreq_table. Warning:
cpufreq:cpufreq_online: CPU0: Running at unlisted freq
cpufreq:cpufreq_online: CPU0: Unlisted initial frequency changedAlso, added change in init to wait till current frequency becomes equal or near to the previously requested frequency. This is done because it takes some time to restore the previous frequency while turning-on non-boot cores during exit from SC7(Suspend-to-RAM).
Quoted 4 lines
Signed-off-by Sumit Gupta <[email protected]>--- drivers/cpufreq/tegra194-cpufreq.c | 118 ++++++++++++++++++++++++++++++++++--- 1 file changed, 111 insertions(+), 7 deletions(-)
Viresh Kumar
maintainerRe: [Patch 2/2] cpufreq: tegra194: Fix unlisted boot freq warning
In reply to Sumit GuptaQuoted 11 lines · Sumit Gupta
Warning coming during boot because the boot freq set by bootloader gets filtered out due to big freq steps while creating
freq_table. Fixing this by setting closest ndiv value fromfreq_table. Warning:
cpufreq:cpufreq_online: CPU0: Running at unlisted freq
cpufreq:cpufreq_online: CPU0: Unlisted initial frequency changedAlso, added change in init to wait till current frequency becomes equal or near to the previously requested frequency. This is done because it takes some time to restore the previous frequency while turning-on non-boot cores during exit from SC7(Suspend-to-RAM).
So you are trying to figure if the frequency is listed in freq-table or not, otherwise setting the frequency to a value you think is appropriate. Right ?
This is what the cpufreq core already does when it printed these boot time messages. Do we really need to add this much code in here ?
If you really don't want to see the warning, how about fixing it the way cpufreq core does ? i.e. with this call:
ret = __cpufreq_driver_target(policy, policy->cur - 1, CPUFREQ_RELATION_L);
Signature · 1 line
viresh
Re: [Patch 2/2] cpufreq: tegra194: Fix unlisted boot freq warning
Quoted 8 lines
Quoted 8 lines
Warning coming during boot because the boot freq set by bootloader gets filtered out due to big freq steps while creating
freq_table. Fixing this by setting closest ndiv value fromfreq_table. Warning:
cpufreq:cpufreq_online: CPU0: Running at unlisted freq
cpufreq:cpufreq_online: CPU0: Unlisted initial frequency changed
Quoted 7 lines
Quoted 4 lines
Also, added change in init to wait till current frequency becomes equal or near to the previously requested frequency. This is done because it takes some time to restore the previous frequency while turning-on non-boot cores during exit from SC7(Suspend-to-RAM).
So you are trying to figure if the frequency is listed in freq-table or not, otherwise setting the frequency to a value you think is appropriate. Right ?
During boot, want to set the frequency from freq_table which is closest to the one set by bootloader.
During resume from suspend-to-idle, want to restore the frequency which was set on non-boot cores before they were hotplug powered off.
Quoted 3 lines
This is what the cpufreq core already does when it printed these boot time messages. Do we really need to add this much code in here ?
We want to avoid the warning messages.
Quoted 6 lines
If you really don't want to see the warning, how about fixing it the way cpufreq core does ? i.e. with this call:
ret =
__cpufreq_driver_target(policy, policy->cur - 1, CPUFREQ_RELATION_L);
The cpufreq core change will help in bootup case but not during the case of resume.
In this change, reading the previously stored value and restoring it will also fix the warning message during resume.
Quoted 3 lines
--
viresh
Viresh Kumar
maintainerRe: [Patch 2/2] cpufreq: tegra194: Fix unlisted boot freq warning
Quoted 13 lines · Sumit Gupta
Quoted 13 lines
Quoted 12 lines
Warning coming during boot because the boot freq set by bootloader gets filtered out due to big freq steps while creating
freq_table. Fixing this by setting closest ndiv value fromfreq_table. Warning:
cpufreq:cpufreq_online: CPU0: Running at unlisted freq
cpufreq:cpufreq_online: CPU0: Unlisted initial frequency changedAlso, added change in init to wait till current frequency becomes equal or near to the previously requested frequency. This is done because it takes some time to restore the previous frequency while turning-on non-boot cores during exit from SC7(Suspend-to-RAM).
Quoted 4 lines
Quoted 2 lines
So you are trying to figure if the frequency is listed in freq-table or not, otherwise setting the frequency to a value you think is appropriate. Right ?
During boot, want to set the frequency from
freq_tablewhich is closest to the one set by bootloader.
Right.
Quoted 2 lines
During resume from suspend-to-idle, want to restore the frequency which was set on non-boot cores before they were hotplug powered off.
Why exactly do you want to do that ? Rather you should provide online/offline hooks for the cpufreq driver and do light-weight suspend/resume as is done by cpufreq-dt.c as well.
Quoted 4 lines
Quoted 3 lines
This is what the cpufreq core already does when it printed these boot time messages. Do we really need to add this much code in here ?
We want to avoid the warning messages.
Hmm, okay.
Quoted 10 lines
Quoted 6 lines
If you really don't want to see the warning, how about fixing it the way cpufreq core does ? i.e. with this call:
ret =
__cpufreq_driver_target(policy, policy->cur - 1, CPUFREQ_RELATION_L);The cpufreq core change will help in bootup case but not during the case of resume.
In this change, reading the previously stored value and restoring it will also fix the warning message during resume.
You were getting the message during resume as well ? Why ? The firmware is updating the frequency to a previous value ? If that is so, you should just set the frequency again to some other value during resume to fix it.
Signature · 1 line
viresh
Re: [Patch 2/2] cpufreq: tegra194: Fix unlisted boot freq warning
Quoted 18 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Warning coming during boot because the boot freq set by bootloader gets filtered out due to big freq steps while creating
freq_table. Fixing this by setting closest ndiv value fromfreq_table. Warning:
cpufreq:cpufreq_online: CPU0: Running at unlisted freq
cpufreq:cpufreq_online: CPU0: Unlisted initial frequency changedAlso, added change in init to wait till current frequency becomes equal or near to the previously requested frequency. This is done because it takes some time to restore the previous frequency while turning-on non-boot cores during exit from SC7(Suspend-to-RAM).
Quoted 4 lines
Quoted 2 lines
So you are trying to figure if the frequency is listed in freq-table or not, otherwise setting the frequency to a value you think is appropriate. Right ?
During boot, want to set the frequency from
freq_tablewhich is closest to the one set by bootloader.
Quoted 9 lines
Right.
Quoted 2 lines
During resume from suspend-to-idle, want to restore the frequency which was set on non-boot cores before they were hotplug powered off.
Why exactly do you want to do that ? Rather you should provide online/offline hooks for the cpufreq driver and do light-weight suspend/resume as is done by
cpufreq-dt.cas well.
Thank you for pointer. Added online hook to avoid warning during hot-plug-on for the non-boot CPU's while exiting from Suspend-to-RAM. Will send new version with the changes.
Quoted 18 lines
Quoted 4 lines
Quoted 3 lines
This is what the cpufreq core already does when it printed these boot time messages. Do we really need to add this much code in here ?
We want to avoid the warning messages.
Hmm, okay.
Quoted 10 lines
Quoted 6 lines
If you really don't want to see the warning, how about fixing it the way cpufreq core does ? i.e. with this call:
ret =
__cpufreq_driver_target(policy, policy->cur - 1, CPUFREQ_RELATION_L);The cpufreq core change will help in bootup case but not during the case of resume.
In this change, reading the previously stored value and restoring it will also fix the warning message during resume.
Quoted 4 lines
You were getting the message during resume as well ? Why ? The firmware is updating the frequency to a previous value ? If that is so, you should just set the frequency again to some other value during resume to fix it.
Yes, it boots at a predefined frequency and then some time is taken to restore the last frequency which software requested before entering Suspend-to-RAM. We don't need to re-write the register again.
Quoted 4 lines
--
viresh