lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250829053911.pzrkfvzes3bsrvtm@vireshk-i7>
Date: Fri, 29 Aug 2025 11:09:11 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: webgeek1234@...il.com
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
	Thierry Reding <thierry.reding@...il.com>,
	Jonathan Hunter <jonathanh@...dia.com>,
	Aaron Kling <luceoscutum@...il.com>,
	Sumit Gupta <sumitg@...dia.com>,
	Thierry Reding <treding@...dia.com>, linux-pm@...r.kernel.org,
	linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org,
	Mikko Perttunen <mperttunen@...dia.com>
Subject: Re: [PATCH v3 2/2] cpufreq: tegra186: Initialize all cores to max
 frequencies

On 28-08-25, 21:48, Aaron Kling via B4 Relay wrote:
> From: Aaron Kling <webgeek1234@...il.com>
> 
> During initialization, the EDVD_COREx_VOLT_FREQ registers for some cores
> are still at reset values and not reflecting the actual frequency. This
> causes get calls to fail. Set all cores to their respective max
> frequency during probe to initialize the registers to working values.
> 
> Suggested-by: Mikko Perttunen <mperttunen@...dia.com>
> Signed-off-by: Aaron Kling <webgeek1234@...il.com>
> ---
>  drivers/cpufreq/tegra186-cpufreq.c | 27 +++++++++++++++++++++------
>  1 file changed, 21 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/cpufreq/tegra186-cpufreq.c b/drivers/cpufreq/tegra186-cpufreq.c
> index 6c394b429b6182faffabf222e5af501393dbbba9..bd94beebc4cc2fe6870e13ca55343cedb9729e99 100644
> --- a/drivers/cpufreq/tegra186-cpufreq.c
> +++ b/drivers/cpufreq/tegra186-cpufreq.c
> @@ -138,13 +138,14 @@ static struct cpufreq_driver tegra186_cpufreq_driver = {
>  
>  static struct cpufreq_frequency_table *init_vhint_table(
>  	struct platform_device *pdev, struct tegra_bpmp *bpmp,
> -	struct tegra186_cpufreq_cluster *cluster, unsigned int cluster_id)
> +	struct tegra186_cpufreq_cluster *cluster, unsigned int cluster_id,
> +	int *num_rates)
>  {
>  	struct cpufreq_frequency_table *table;
>  	struct mrq_cpu_vhint_request req;
>  	struct tegra_bpmp_message msg;
>  	struct cpu_vhint_data *data;
> -	int err, i, j, num_rates = 0;
> +	int err, i, j;
>  	dma_addr_t phys;
>  	void *virt;
>  
> @@ -174,6 +175,7 @@ static struct cpufreq_frequency_table *init_vhint_table(
>  		goto free;
>  	}
>  
> +	*num_rates = 0;
>  	for (i = data->vfloor; i <= data->vceil; i++) {
>  		u16 ndiv = data->ndiv[i];
>  
> @@ -184,10 +186,10 @@ static struct cpufreq_frequency_table *init_vhint_table(
>  		if (i > 0 && ndiv == data->ndiv[i - 1])
>  			continue;
>  
> -		num_rates++;
> +		(*num_rates)++;
>  	}
>  
> -	table = devm_kcalloc(&pdev->dev, num_rates + 1, sizeof(*table),
> +	table = devm_kcalloc(&pdev->dev, *num_rates + 1, sizeof(*table),
>  			     GFP_KERNEL);
>  	if (!table) {
>  		table = ERR_PTR(-ENOMEM);
> @@ -229,7 +231,9 @@ static int tegra186_cpufreq_probe(struct platform_device *pdev)
>  {
>  	struct tegra186_cpufreq_data *data;
>  	struct tegra_bpmp *bpmp;
> -	unsigned int i = 0, err;
> +	unsigned int i = 0, err, edvd_offset;
> +	int num_rates = 0;

You don't need to initialize this AFAICT.

> +	u32 edvd_val, cpu;
>  
>  	data = devm_kzalloc(&pdev->dev,
>  			    struct_size(data, clusters, TEGRA186_NUM_CLUSTERS),
> @@ -252,10 +256,21 @@ static int tegra186_cpufreq_probe(struct platform_device *pdev)
>  	for (i = 0; i < TEGRA186_NUM_CLUSTERS; i++) {
>  		struct tegra186_cpufreq_cluster *cluster = &data->clusters[i];
>  
> -		cluster->table = init_vhint_table(pdev, bpmp, cluster, i);
> +		cluster->table = init_vhint_table(pdev, bpmp, cluster, i, &num_rates);
>  		if (IS_ERR(cluster->table)) {
>  			err = PTR_ERR(cluster->table);
>  			goto put_bpmp;
> +		} else if (!num_rates) {
> +			err = -EINVAL;
> +			goto put_bpmp;
> +		}
> +
> +		for (cpu = 0; cpu < ARRAY_SIZE(tegra186_cpus); cpu++) {
> +			if (data->cpus[cpu].bpmp_cluster_id == i) {
> +				edvd_val = cluster->table[num_rates - 1].driver_data;
> +				edvd_offset = data->cpus[cpu].edvd_offset;
> +				writel(edvd_val, data->regs + edvd_offset);
> +			}
>  		}
>  	}
>  
> 
> -- 
> 2.50.1
> 

-- 
viresh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ