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] [thread-next>] [day] [month] [year] [list]
Message-ID: <51FA3064.9080502@arm.com>
Date:	Thu, 01 Aug 2013 10:54:44 +0100
From:	Sudeep KarkadaNagesha <Sudeep.KarkadaNagesha@....com>
To:	Sudeep KarkadaNagesha <Sudeep.KarkadaNagesha@....com>,
	Gregory Clement <gregory.clement@...e-electrons.com>,
	Andrew Lunn <andrew@...n.ch>,
	Jason Cooper <jason@...edaemon.net>
CC:	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"cpufreq@...r.kernel.org" <cpufreq@...r.kernel.org>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	Russell King <linux@....linux.org.uk>,
	Shawn Guo <shawn.guo@...aro.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Viresh Kumar <viresh.kumar@...aro.org>,
	"Rafael J. Wysocki" <rjw@...k.pl>,
	"grant.likely@...aro.org" <grant.likely@...aro.org>,
	"rob.herring@...xeda.com" <rob.herring@...xeda.com>,
	Lorenzo Pieralisi <Lorenzo.Pieralisi@....com>,
	Olof Johansson <olof@...om.net>, Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH v3 05/16] ARM: mvebu: remove device tree parsing for cpu
 nodes

On 22/07/13 12:32, Sudeep KarkadaNagesha wrote:
> From: Sudeep KarkadaNagesha <sudeep.karkadanagesha@....com>
> 
> Currently set_secondary_cpus_clock assume the CPU logical ordering
> and the MPDIR in DT are same, which is incorrect.
> 
> Since the CPU device nodes can be retrieved in the logical ordering
> using the DT helper, we can remove the devices tree parsing.
> 
> This patch removes DT parsing by making use of of_get_cpu_node.
> 
> Cc: Gregory Clement <gregory.clement@...e-electrons.com>
> Cc: Andrew Lunn <andrew@...n.ch>
> Cc: Jason Cooper <jason@...edaemon.net>
> Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@....com>

Hi Gregory/Andrew/Jason,

Does this change look fine for mvebu?
If yes, can I have your ACKs ?

Regards,
Sudeep
> ---
>  arch/arm/mach-mvebu/platsmp.c | 52 ++++++++++++++++++++-----------------------
>  1 file changed, 24 insertions(+), 28 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
> index ce81d30..001dd42 100644
> --- a/arch/arm/mach-mvebu/platsmp.c
> +++ b/arch/arm/mach-mvebu/platsmp.c
> @@ -23,51 +23,47 @@
>  #include <linux/of.h>
>  #include <linux/mbus.h>
>  #include <asm/cacheflush.h>
> +#include <asm/prom.h>
>  #include <asm/smp_plat.h>
>  #include "common.h"
>  #include "armada-370-xp.h"
>  #include "pmsu.h"
>  #include "coherency.h"
>  
> +static struct clk *__init get_cpu_clk(int cpu)
> +{
> +	struct clk *cpu_clk;
> +	struct device_node *np = of_get_cpu_node(cpu);
> +
> +	if (WARN(!np, "missing cpu node\n"))
> +		return NULL;
> +	cpu_clk = of_clk_get(np, 0);
> +	if (WARN_ON(IS_ERR(cpu_clk)))
> +		return NULL;
> +	return cpu_clk;
> +}
> +
>  void __init set_secondary_cpus_clock(void)
>  {
> -	int thiscpu;
> +	int thiscpu, cpu;
>  	unsigned long rate;
> -	struct clk *cpu_clk = NULL;
> -	struct device_node *np = NULL;
> +	struct clk *cpu_clk;
>  
>  	thiscpu = smp_processor_id();
> -	for_each_node_by_type(np, "cpu") {
> -		int err;
> -		int cpu;
> -
> -		err = of_property_read_u32(np, "reg", &cpu);
> -		if (WARN_ON(err))
> -			return;
> -
> -		if (cpu == thiscpu) {
> -			cpu_clk = of_clk_get(np, 0);
> -			break;
> -		}
> -	}
> -	if (WARN_ON(IS_ERR(cpu_clk)))
> +	cpu_clk = get_cpu_clk(thiscpu);
> +	if (!cpu_clk)
>  		return;
>  	clk_prepare_enable(cpu_clk);
>  	rate = clk_get_rate(cpu_clk);
>  
>  	/* set all the other CPU clk to the same rate than the boot CPU */
> -	for_each_node_by_type(np, "cpu") {
> -		int err;
> -		int cpu;
> -
> -		err = of_property_read_u32(np, "reg", &cpu);
> -		if (WARN_ON(err))
> +	for_each_possible_cpu(cpu) {
> +		if (cpu == thiscpu)
> +			continue;
> +		cpu_clk = get_cpu_clk(cpu);
> +		if (!cpu_clk)
>  			return;
> -
> -		if (cpu != thiscpu) {
> -			cpu_clk = of_clk_get(np, 0);
> -			clk_set_rate(cpu_clk, rate);
> -		}
> +		clk_set_rate(cpu_clk, rate);
>  	}
>  }
>  
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ