linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/21] DT cpu node iterator
@ 2018-09-05 19:37 Rob Herring
  2018-09-05 19:37 ` [PATCH 03/21] ARM: use for_each_of_cpu_node iterator Rob Herring
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Rob Herring @ 2018-09-05 19:37 UTC (permalink / raw)
  To: linux-arm-kernel

This series adds an iterator for cpu nodes and converts users over to use
it or of_get_cpu_node in some cases. This allows us to remove the
dependency on device_type property for cpu nodes though removing that
from DTS files will have to wait for some time. In some cases, this makes
the DT search more strict by only looking in /cpus child nodes rather
than any node with the device_type == cpu. The iterator also honors the
status property which is often forgotten.

I've only tested on ARM under QEMU and compiled powerpc.

Rob

Rob Herring (21):
  of: Add cpu node iterator for_each_of_cpu_node()
  of: Support matching cpu nodes with no 'reg' property
  ARM: use for_each_of_cpu_node iterator
  ARM: topology: remove unneeded check for /cpus node
  ARM: shmobile: use for_each_of_cpu_node iterator
  arm64: use for_each_of_cpu_node iterator
  c6x: use for_each_of_cpu_node iterator
  microblaze: get cpu node with of_get_cpu_node
  nios2: get cpu node with of_get_cpu_node
  openrisc: use for_each_of_cpu_node iterator
  powerpc: use for_each_of_cpu_node iterator
  powerpc: 4xx: get cpu node with of_get_cpu_node
  powerpc: 8xx: get cpu node with of_get_cpu_node
  riscv: use for_each_of_cpu_node iterator
  SH: use for_each_of_cpu_node iterator
  x86: DT: use for_each_of_cpu_node iterator
  clk: mvebu: use for_each_of_cpu_node iterator
  edac: cpc925: use for_each_of_cpu_node iterator
  iommu: fsl_pamu: use for_each_of_cpu_node iterator
  of: use for_each_of_cpu_node iterator
  fbdev: fsl-diu: get cpu node with of_get_cpu_node

 arch/arm/kernel/devtree.c                 |  5 +--
 arch/arm/kernel/topology.c                |  6 ---
 arch/arm/mach-shmobile/pm-rcar-gen2.c     |  8 +---
 arch/arm/mach-shmobile/pm-rmobile.c       |  2 +-
 arch/arm/mach-shmobile/timer.c            | 10 +----
 arch/arm64/kernel/smp.c                   |  2 +-
 arch/c6x/kernel/setup.c                   | 11 ++---
 arch/microblaze/kernel/cpu/cpuinfo.c      |  4 +-
 arch/nios2/kernel/cpuinfo.c               |  4 +-
 arch/openrisc/kernel/setup.c              |  3 +-
 arch/powerpc/platforms/4xx/soc.c          |  2 +-
 arch/powerpc/platforms/8xx/m8xx_setup.c   |  5 ++-
 arch/powerpc/platforms/powermac/feature.c | 51 ++++++++---------------
 arch/powerpc/platforms/powermac/setup.c   | 15 +++----
 arch/riscv/kernel/smpboot.c               |  2 +-
 arch/sh/boards/of-generic.c               |  2 +-
 arch/x86/kernel/devicetree.c              |  2 +-
 drivers/clk/mvebu/clk-cpu.c               |  4 +-
 drivers/edac/cpc925_edac.c                | 20 +--------
 drivers/iommu/fsl_pamu.c                  |  2 +-
 drivers/of/base.c                         | 43 ++++++++++++++++++-
 drivers/of/of_numa.c                      | 15 +------
 drivers/video/fbdev/fsl-diu-fb.c          |  2 +-
 include/linux/of.h                        | 11 +++++
 24 files changed, 111 insertions(+), 120 deletions(-)

--
2.17.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 03/21] ARM: use for_each_of_cpu_node iterator
  2018-09-05 19:37 [PATCH 00/21] DT cpu node iterator Rob Herring
@ 2018-09-05 19:37 ` Rob Herring
  2018-09-05 19:37 ` [PATCH 04/21] ARM: topology: remove unneeded check for /cpus node Rob Herring
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Rob Herring @ 2018-09-05 19:37 UTC (permalink / raw)
  To: linux-arm-kernel

Use the for_each_of_cpu_node iterator to iterate over cpu nodes. This
has the side effect of defaulting to iterating using "cpu" node names in
preference to the deprecated (for FDT) device_type == "cpu".

Cc: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel at lists.infradead.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
Please ack and I will take via the DT tree. This is dependent on the
first 2 patches.

 arch/arm/kernel/devtree.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index ecaa68dd1af5..13bcd3b867cb 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -87,14 +87,11 @@ void __init arm_dt_init_cpu_maps(void)
 	if (!cpus)
 		return;

-	for_each_child_of_node(cpus, cpu) {
+	for_each_of_cpu_node(cpu) {
 		const __be32 *cell;
 		int prop_bytes;
 		u32 hwid;

-		if (of_node_cmp(cpu->type, "cpu"))
-			continue;
-
 		pr_debug(" * %pOF...\n", cpu);
 		/*
 		 * A device tree containing CPU nodes with missing "reg"
--
2.17.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 04/21] ARM: topology: remove unneeded check for /cpus node
  2018-09-05 19:37 [PATCH 00/21] DT cpu node iterator Rob Herring
  2018-09-05 19:37 ` [PATCH 03/21] ARM: use for_each_of_cpu_node iterator Rob Herring
@ 2018-09-05 19:37 ` Rob Herring
  2018-09-05 19:37 ` [PATCH 05/21] ARM: shmobile: use for_each_of_cpu_node iterator Rob Herring
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Rob Herring @ 2018-09-05 19:37 UTC (permalink / raw)
  To: linux-arm-kernel

Checking for "/cpus" node is not necessary as of_get_cpu_node() will fail
later on anyways. The call to of_find_node_by_path() also leaks a
reference. So just remove the check.

Cc: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel at lists.infradead.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
Please ack and I will take via the DT tree. This is dependent on the
first 2 patches.

 arch/arm/kernel/topology.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index 24ac3cab411d..60e375ce1ab2 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -94,12 +94,6 @@ static void __init parse_dt_topology(void)
 	__cpu_capacity = kcalloc(nr_cpu_ids, sizeof(*__cpu_capacity),
 				 GFP_NOWAIT);

-	cn = of_find_node_by_path("/cpus");
-	if (!cn) {
-		pr_err("No CPU information found in DT\n");
-		return;
-	}
-
 	for_each_possible_cpu(cpu) {
 		const u32 *rate;
 		int len;
--
2.17.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 05/21] ARM: shmobile: use for_each_of_cpu_node iterator
  2018-09-05 19:37 [PATCH 00/21] DT cpu node iterator Rob Herring
  2018-09-05 19:37 ` [PATCH 03/21] ARM: use for_each_of_cpu_node iterator Rob Herring
  2018-09-05 19:37 ` [PATCH 04/21] ARM: topology: remove unneeded check for /cpus node Rob Herring
@ 2018-09-05 19:37 ` Rob Herring
  2018-09-06  8:52   ` Geert Uytterhoeven
  2018-09-06  8:56   ` Simon Horman
  2018-09-05 19:37 ` [PATCH 06/21] arm64: " Rob Herring
       [not found] ` <CAHTX3d+BFKM-jFo8Ww_dXwAzsDVoWqE==erfwVTeijHfh8kkOw@mail.gmail.com>
  4 siblings, 2 replies; 9+ messages in thread
From: Rob Herring @ 2018-09-05 19:37 UTC (permalink / raw)
  To: linux-arm-kernel

Use the for_each_of_cpu_node iterator to iterate over cpu nodes. This
has the side effect of defaulting to iterating using "cpu" node names in
preference to the deprecated (for FDT) device_type == "cpu".

Cc: Simon Horman <horms@verge.net.au>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-renesas-soc at vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
Please ack and I will take via the DT tree. This is dependent on the
first 2 patches.

 arch/arm/mach-shmobile/pm-rcar-gen2.c |  8 ++------
 arch/arm/mach-shmobile/pm-rmobile.c   |  2 +-
 arch/arm/mach-shmobile/timer.c        | 10 ++--------
 3 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-shmobile/pm-rcar-gen2.c b/arch/arm/mach-shmobile/pm-rcar-gen2.c
index 345af3ebcc3a..7efe95bd584f 100644
--- a/arch/arm/mach-shmobile/pm-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/pm-rcar-gen2.c
@@ -50,7 +50,7 @@ void __init rcar_gen2_pm_init(void)
 	void __iomem *p;
 	u32 bar;
 	static int once;
-	struct device_node *np, *cpus;
+	struct device_node *np;
 	bool has_a7 = false;
 	bool has_a15 = false;
 	struct resource res;
@@ -59,11 +59,7 @@ void __init rcar_gen2_pm_init(void)
 	if (once++)
 		return;

-	cpus = of_find_node_by_path("/cpus");
-	if (!cpus)
-		return;
-
-	for_each_child_of_node(cpus, np) {
+	for_each_of_cpu_node(np) {
 		if (of_device_is_compatible(np, "arm,cortex-a15"))
 			has_a15 = true;
 		else if (of_device_is_compatible(np, "arm,cortex-a7"))
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index e348bcfe389d..94fdeef11b81 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -202,7 +202,7 @@ static void __init get_special_pds(void)
 	const struct of_device_id *id;

 	/* PM domains containing CPUs */
-	for_each_node_by_type(np, "cpu")
+	for_each_of_cpu_node(np)
 		add_special_pd(np, PD_CPU);

 	/* PM domain containing console */
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
index 828e8aea037e..e48b0939693f 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -22,22 +22,16 @@

 void __init shmobile_init_delay(void)
 {
-	struct device_node *np, *cpus;
+	struct device_node *np;
 	u32 max_freq = 0;

-	cpus = of_find_node_by_path("/cpus");
-	if (!cpus)
-		return;
-
-	for_each_child_of_node(cpus, np) {
+	for_each_of_cpu_node(np) {
 		u32 freq;

 		if (!of_property_read_u32(np, "clock-frequency", &freq))
 			max_freq = max(max_freq, freq);
 	}

-	of_node_put(cpus);
-
 	if (!max_freq)
 		return;

--
2.17.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 06/21] arm64: use for_each_of_cpu_node iterator
  2018-09-05 19:37 [PATCH 00/21] DT cpu node iterator Rob Herring
                   ` (2 preceding siblings ...)
  2018-09-05 19:37 ` [PATCH 05/21] ARM: shmobile: use for_each_of_cpu_node iterator Rob Herring
@ 2018-09-05 19:37 ` Rob Herring
  2018-09-06 10:04   ` Will Deacon
       [not found] ` <CAHTX3d+BFKM-jFo8Ww_dXwAzsDVoWqE==erfwVTeijHfh8kkOw@mail.gmail.com>
  4 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2018-09-05 19:37 UTC (permalink / raw)
  To: linux-arm-kernel

Use the for_each_of_cpu_node iterator to iterate over cpu nodes. This
has the side effect of defaulting to iterating using "cpu" node names in
preference to the deprecated (for FDT) device_type == "cpu".

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel at lists.infradead.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
Please ack and I will take via the DT tree. This is dependent on the
first 2 patches.

 arch/arm64/kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 25fcd22a4bb2..96b8f2f51ab2 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -602,7 +602,7 @@ static void __init of_parse_and_init_cpus(void)
 {
 	struct device_node *dn;

-	for_each_node_by_type(dn, "cpu") {
+	for_each_of_cpu_node(dn) {
 		u64 hwid = of_get_cpu_mpidr(dn);

 		if (hwid == INVALID_HWID)
--
2.17.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 05/21] ARM: shmobile: use for_each_of_cpu_node iterator
  2018-09-05 19:37 ` [PATCH 05/21] ARM: shmobile: use for_each_of_cpu_node iterator Rob Herring
@ 2018-09-06  8:52   ` Geert Uytterhoeven
  2018-09-06  8:56   ` Simon Horman
  1 sibling, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2018-09-06  8:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 5, 2018 at 9:38 PM Rob Herring <robh@kernel.org> wrote:
> Use the for_each_of_cpu_node iterator to iterate over cpu nodes. This
> has the side effect of defaulting to iterating using "cpu" node names in
> preference to the deprecated (for FDT) device_type == "cpu".
>
> Cc: Simon Horman <horms@verge.net.au>
> Cc: Magnus Damm <magnus.damm@gmail.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-renesas-soc at vger.kernel.org
> Signed-off-by: Rob Herring <robh@kernel.org>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 05/21] ARM: shmobile: use for_each_of_cpu_node iterator
  2018-09-05 19:37 ` [PATCH 05/21] ARM: shmobile: use for_each_of_cpu_node iterator Rob Herring
  2018-09-06  8:52   ` Geert Uytterhoeven
@ 2018-09-06  8:56   ` Simon Horman
  1 sibling, 0 replies; 9+ messages in thread
From: Simon Horman @ 2018-09-06  8:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 05, 2018 at 02:37:22PM -0500, Rob Herring wrote:
> Use the for_each_of_cpu_node iterator to iterate over cpu nodes. This
> has the side effect of defaulting to iterating using "cpu" node names in
> preference to the deprecated (for FDT) device_type == "cpu".
> 
> Cc: Simon Horman <horms@verge.net.au>
> Cc: Magnus Damm <magnus.damm@gmail.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-renesas-soc at vger.kernel.org
> Signed-off-by: Rob Herring <robh@kernel.org>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 06/21] arm64: use for_each_of_cpu_node iterator
  2018-09-05 19:37 ` [PATCH 06/21] arm64: " Rob Herring
@ 2018-09-06 10:04   ` Will Deacon
  0 siblings, 0 replies; 9+ messages in thread
From: Will Deacon @ 2018-09-06 10:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 05, 2018 at 02:37:23PM -0500, Rob Herring wrote:
> Use the for_each_of_cpu_node iterator to iterate over cpu nodes. This
> has the side effect of defaulting to iterating using "cpu" node names in
> preference to the deprecated (for FDT) device_type == "cpu".
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: linux-arm-kernel at lists.infradead.org
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> Please ack and I will take via the DT tree. This is dependent on the
> first 2 patches.

Acked-by: Will Deacon <will.deacon@arm.com>

Will

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 00/21] DT cpu node iterator
       [not found] ` <CAHTX3d+BFKM-jFo8Ww_dXwAzsDVoWqE==erfwVTeijHfh8kkOw@mail.gmail.com>
@ 2018-09-07 13:58   ` Rob Herring
  0 siblings, 0 replies; 9+ messages in thread
From: Rob Herring @ 2018-09-07 13:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Sep 7, 2018 at 7:54 AM Michal Simek <monstr@monstr.eu> wrote:
>
> Hi Rob,
>
> 2018-09-05 21:37 GMT+02:00 Rob Herring <robh@kernel.org>:
>>
>> This series adds an iterator for cpu nodes and converts users over to use
>> it or of_get_cpu_node in some cases. This allows us to remove the
>> dependency on device_type property for cpu nodes though removing that
>> from DTS files will have to wait for some time. In some cases, this makes
>> the DT search more strict by only looking in /cpus child nodes rather
>> than any node with the device_type == cpu. The iterator also honors the
>> status property which is often forgotten.
>>
>> I've only tested on ARM under QEMU and compiled powerpc.
>
>
>
> Do you have this somewhere in your tree not to apply 21 patches by hand?

Yes, dt/cpu-type branch on my kernel.org tree.

Rob

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-09-07 13:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-05 19:37 [PATCH 00/21] DT cpu node iterator Rob Herring
2018-09-05 19:37 ` [PATCH 03/21] ARM: use for_each_of_cpu_node iterator Rob Herring
2018-09-05 19:37 ` [PATCH 04/21] ARM: topology: remove unneeded check for /cpus node Rob Herring
2018-09-05 19:37 ` [PATCH 05/21] ARM: shmobile: use for_each_of_cpu_node iterator Rob Herring
2018-09-06  8:52   ` Geert Uytterhoeven
2018-09-06  8:56   ` Simon Horman
2018-09-05 19:37 ` [PATCH 06/21] arm64: " Rob Herring
2018-09-06 10:04   ` Will Deacon
     [not found] ` <CAHTX3d+BFKM-jFo8Ww_dXwAzsDVoWqE==erfwVTeijHfh8kkOw@mail.gmail.com>
2018-09-07 13:58   ` [PATCH 00/21] DT cpu node iterator Rob Herring

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).