Skip to contentSkip to conversation

arm64: tegra: add topology data for Tegra194 cpu

PATCH Superseded Bo Yan 2 participants 9 messages Jan 31, 2019 – Feb 22, 2019

Subsystems (2)
lore
Share & tools
lore

Bo Yan

author
#0 lore raw

PATCH 1/1 arm64: tegra: add topology data for Tegra194 cpu

The xavier CPU architecture includes 8 CPU cores organized in 4 clusters. Add cpu-map data for topology initialization, add cache data for cache node creation in sysfs.

---
 arch/arm64/boot/dts/nvidia/tegra194.dtsi | 148 +++++++++++++++++++++++++++++--
 1 file changed, 140 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +140 -8
index 6dfa1ca..7c2a1fb 100644
@@ -870,63 +870,195 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		cpu@0 {
+		cpu-map {
+			cluster0 {
+				core0 {
+					cpu = <&cl0_0>;
+				};
+
+				core1 {
+					cpu = <&cl0_1>;
+				};
+			};
+
+			cluster1 {
+				core0 {
+					cpu = <&cl1_0>;
+				};
+
+				core1 {
+					cpu = <&cl1_1>;
+				};
+			};
+
+			cluster2 {
+				core0 {
+					cpu = <&cl2_0>;
+				};
+
+				core1 {
+					cpu = <&cl2_1>;
+				};
+			};
+
+			cluster3 {
+				core0 {
+					cpu = <&cl3_0>;
+				};
+
+				core1 {
+					cpu = <&cl3_1>;
+				};
+			};
+		};
+
+		cl0_0: cpu@0 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x10000>;
 			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_0>;
 		};
 
-		cpu@1 {
+		cl0_1: cpu@1 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x10001>;
 			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_0>;
 		};
 
-		cpu@2 {
+		cl1_0: cpu@2 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x100>;
 			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_1>;
 		};
 
-		cpu@3 {
+		cl1_1: cpu@3 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x101>;
 			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_1>;
 		};
 
-		cpu@4 {
+		cl2_0: cpu@4 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x200>;
 			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_2>;
 		};
 
-		cpu@5 {
+		cl2_1: cpu@5 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x201>;
 			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_2>;
 		};
 
-		cpu@6 {
+		cl3_0: cpu@6 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x10300>;
 			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_3>;
 		};
 
-		cpu@7 {
+		cl3_1: cpu@7 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x10301>;
 			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_3>;
 		};
 	};
 
+	l2_0: l2-cache0 {
+		cache-size = <2097152>;
+		cache-line-size = <64>;
+		cache-sets = <2048>;
+		next-level-cache = <&l3>;
+	};
+
+	l2_1: l2-cache1 {
+		cache-size = <2097152>;
+		cache-line-size = <64>;
+		cache-sets = <2048>;
+		next-level-cache = <&l3>;
+	};
+
+	l2_2: l2-cache2 {
+		cache-size = <2097152>;
+		cache-line-size = <64>;
+		cache-sets = <2048>;
+		next-level-cache = <&l3>;
+	};
+
+	l2_3: l2-cache3 {
+		cache-size = <2097152>;
+		cache-line-size = <64>;
+		cache-sets = <2048>;
+		next-level-cache = <&l3>;
+	};
+
+	l3: l3-cache {
+		cache-size = <4194304>;
+		cache-line-size = <64>;
+		cache-sets = <4096>;
+	};
+
 	psci {
 		compatible = "arm,psci-1.0";
 		status = "okay";
Signature · 1 line
2.7.4
#1 lore raw
Quoted 61 lines · Bo Yan

The xavier CPU architecture includes 8 CPU cores organized in 4 clusters. Add cpu-map data for topology initialization, add cache data for cache node creation in sysfs.

---
 arch/arm64/boot/dts/nvidia/tegra194.dtsi | 148 +++++++++++++++++++++++++++++--
 1 file changed, 140 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +43 -1
index 6dfa1ca..7c2a1fb 100644
@@ -870,63 +870,195 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		cpu@0 {
+		cpu-map {
+			cluster0 {
+				core0 {
+					cpu = <&cl0_0>;
+				};
+
+				core1 {
+					cpu = <&cl0_1>;
+				};
+			};
+
+			cluster1 {
+				core0 {
+					cpu = <&cl1_0>;
+				};
+
+				core1 {
+					cpu = <&cl1_1>;
+				};
+			};
+
+			cluster2 {
+				core0 {
+					cpu = <&cl2_0>;
+				};
+
+				core1 {
+					cpu = <&cl2_1>;
+				};
+			};
+
+			cluster3 {
+				core0 {
+					cpu = <&cl3_0>;
+				};
+
+				core1 {
+					cpu = <&cl3_1>;
+				};
+			};
+		};
+
+		cl0_0: cpu@0 {

arch/arm64/boot/dts/nvidia/tegra194.dtsi line 925

Quoted 10 lines
arch/arm64/boot/dts/nvidia/tegra194.dtsi +6 -0
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x10000>;
 			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;

These don't seem to be well-defined. They are mentioned in a very weird locations (Documentation/devicetree/booting-without-of.txt) but there seem to be examples and other device tree files that use them so maybe those are all valid. It might be worth mentioning these in other places where people can more easily find them.

According to the above document, {i,d}-cache-line-size are deprecated in favour of {i,d}-cache-block-size.

I also don't see any mention of {i,d}-cache_sets in the device tree bindings, though riscv/cpus.txt mentions {i,d}-cache-sets (note the hyphen instead of underscore) in the examples. arm/l2c2x0.txt and arm/uniphier/cache-unifier.txt describe cache-sets, though that's slightly different.

Might make sense to document all these in more standard places. Maybe adding them to arm/cpus.txt. For consistency with other properties, I think there should be called {i,d}-cache-sets like for RISC-V.

arch/arm64/boot/dts/nvidia/tegra194.dtsi line 926

Quoted 1 line
arch/arm64/boot/dts/nvidia/tegra194.dtsi +1 -0
+			l2-cache = <&l2_0>;

This seems to be called next-level-cache everywhere else, though it's only formally described in arm/uniphier/cache-uniphier.txt. So might also make sense to add this to arm/cpus.txt.

Quoted 104 lines
arch/arm64/boot/dts/nvidia/tegra194.dtsi +55 -7
 		};
 
-		cpu@1 {
+		cl0_1: cpu@1 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x10001>;
 			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_0>;
 		};
 
-		cpu@2 {
+		cl1_0: cpu@2 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x100>;
 			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_1>;
 		};
 
-		cpu@3 {
+		cl1_1: cpu@3 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x101>;
 			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_1>;
 		};
 
-		cpu@4 {
+		cl2_0: cpu@4 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x200>;
 			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_2>;
 		};
 
-		cpu@5 {
+		cl2_1: cpu@5 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x201>;
 			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_2>;
 		};
 
-		cpu@6 {
+		cl3_0: cpu@6 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x10300>;
 			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_3>;
 		};
 
-		cpu@7 {
+		cl3_1: cpu@7 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x10301>;
 			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;

arch/arm64/boot/dts/nvidia/tegra194.dtsi line 1033

Quoted 10 lines
arch/arm64/boot/dts/nvidia/tegra194.dtsi +7 -0
+			l2-cache = <&l2_3>;
 		};
 	};
 
+	l2_0: l2-cache0 {
+		cache-size = <2097152>;
+		cache-line-size = <64>;
+		cache-sets = <2048>;
+		next-level-cache = <&l3>;
+	};

Does this need a compatible string? Also, are there controllers behind these caches? I'm just wondering if these also need reg properties and unit-addresses.

arm/l2c2x0.txt and arm/uniphier/cache-uniphier.txt describe an additional property that you don't specify here: cache-level. This sounds useful to have so that we don't have to guess the cache level from the name, which may or may not work depending on what people name the nodes.

Also, similar to the L1 cache, cache-block-size is preferred over cache-line-size.

arch/arm64/boot/dts/nvidia/tegra194.dtsi line 1060

Quoted 5 lines
arch/arm64/boot/dts/nvidia/tegra194.dtsi +5 -0
+	l3: l3-cache {
+		cache-size = <4194304>;
+		cache-line-size = <64>;
+		cache-sets = <4096>;
+	};

The same comments apply as for the L2 caches.

Thierry

author
#2 lore raw
Quoted 10 lines · Thierry Reding
Quoted 9 lines · Bo Yan

The xavier CPU architecture includes 8 CPU cores organized in 4 clusters. Add cpu-map data for topology initialization, add cache data for cache node creation in sysfs.

---
  arch/arm64/boot/dts/nvidia/tegra194.dtsi | 148 +++++++++++++++++++++++++++++--
  1 file changed, 140 insertions(+), 8 deletions(-)
Quoted 13 lines

arch/arm64/boot/dts/nvidia/tegra194.dtsi line 871

Quoted 7 lines
arch/arm64/boot/dts/nvidia/tegra194.dtsi +0 -0
index 6dfa1ca..7c2a1fb 100644
@@ -870,63 +870,195 @@
  		#address-cells = <1>;
  		#size-cells = <0>;

These don't seem to be well-defined. They are mentioned in a very weird locations (Documentation/devicetree/booting-without-of.txt) but there seem to be examples and other device tree files that use them so maybe those are all valid. It might be worth mentioning these in other places where people can more easily find them.

It might be logical to place a reference to this document (booting-without-of.txt) in architecture specific documents, for example, arm/cpus.txt. I see the need for improved documentation, but this probably should be best done in a separate change.

Quoted 3 lines

According to the above document, {i,d}-cache-line-size are deprecated in favour of {i,d}-cache-block-size.

Mostly, this seems to be derived from the oddity of PowerPC, which might have different cache-line-size and cache-block-size. I don't know if there are other examples? It looks like the {i,d}-cache-line-size are being used in dts files for almost all architectures, the only exception is arch/sh/boot/dts/j2_mimas_v2.dts. On ARM and ARM64, cache-line-size is the same as cache-block-size. So I am wondering whether the booting-without-of.txt should be fixed instead? just to keep it consistent among dts files, especially in arm64.

Quoted 11 lines

I also don't see any mention of {i,d}-cache_sets in the device tree bindings, though riscv/cpus.txt mentions {i,d}-cache-sets (note the hyphen instead of underscore) in the examples. arm/l2c2x0.txt and arm/uniphier/cache-unifier.txt describe cache-sets, though that's slightly different.

Might make sense to document all these in more standard places. Maybe adding them to arm/cpus.txt. For consistency with other properties, I think there should be called {i,d}-cache-sets like for RISC-V.

Quoted 5 lines

arch/arm64/boot/dts/nvidia/tegra194.dtsi line 872

Quoted 1 line
arch/arm64/boot/dts/nvidia/tegra194.dtsi +1 -0
+			l2-cache = <&l2_0>;

This seems to be called next-level-cache everywhere else, though it's only formally described in arm/uniphier/cache-uniphier.txt. So might also make sense to add this to arm/cpus.txt.

the improved documentation is certainly desired, I agree.

Quoted 109 lines
Quoted 109 lines
arch/arm64/boot/dts/nvidia/tegra194.dtsi +56 -7
  		};
 
-		cpu@1 {
+		cl0_1: cpu@1 {
  			compatible = "nvidia,tegra194-carmel", "arm,armv8";
  			device_type = "cpu";
  			reg = <0x10001>;
  			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_0>;
  		};
 
-		cpu@2 {
+		cl1_0: cpu@2 {
  			compatible = "nvidia,tegra194-carmel", "arm,armv8";
  			device_type = "cpu";
  			reg = <0x100>;
  			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_1>;
  		};
 
-		cpu@3 {
+		cl1_1: cpu@3 {
  			compatible = "nvidia,tegra194-carmel", "arm,armv8";
  			device_type = "cpu";
  			reg = <0x101>;
  			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_1>;
  		};
 
-		cpu@4 {
+		cl2_0: cpu@4 {
  			compatible = "nvidia,tegra194-carmel", "arm,armv8";
  			device_type = "cpu";
  			reg = <0x200>;
  			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_2>;
  		};
 
-		cpu@5 {
+		cl2_1: cpu@5 {
  			compatible = "nvidia,tegra194-carmel", "arm,armv8";
  			device_type = "cpu";
  			reg = <0x201>;
  			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_2>;
  		};
 
-		cpu@6 {
+		cl3_0: cpu@6 {
  			compatible = "nvidia,tegra194-carmel", "arm,armv8";
  			device_type = "cpu";
  			reg = <0x10300>;
  			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_3>;
  		};
 
-		cpu@7 {
+		cl3_1: cpu@7 {
  			compatible = "nvidia,tegra194-carmel", "arm,armv8";
  			device_type = "cpu";
  			reg = <0x10301>;
  			enable-method = "psci";
+			i-cache-size = <131072>;
+			i-cache-line-size = <64>;
+			i-cache-sets = <512>;
+			d-cache-size = <65536>;
+			d-cache-line-size = <64>;
+			d-cache_sets = <256>;
+			l2-cache = <&l2_3>;
  		};
  	};
 
Quoted 10 lines

arch/arm64/boot/dts/nvidia/tegra194.dtsi line 1033

Quoted 6 lines
arch/arm64/boot/dts/nvidia/tegra194.dtsi +6 -0
+	l2_0: l2-cache0 {
+		cache-size = <2097152>;
+		cache-line-size = <64>;
+		cache-sets = <2048>;
+		next-level-cache = <&l3>;
+	};

Does this need a compatible string? Also, are there controllers behind these caches? I'm just wondering if these also need reg properties and unit-addresses.

No need for compatible string. No reg properties and addresses. These will be parsed by drivers/of/base.c and drivers/base/cacheinfo.c, they are generic.

Quoted 6 lines

arm/l2c2x0.txt and arm/uniphier/cache-uniphier.txt describe an additional property that you don't specify here: cache-level. This sounds useful to have so that we don't have to guess the cache level from the name, which may or may not work depending on what people name the nodes.

the cache level property is implied in device tree hierarchy, so after system boots up, I can find cache level in related sysfs nodes:

    [root@alarm cache]# cat index*/level
    1
    1
    2
    3
Quoted 14 lines

Also, similar to the L1 cache, cache-block-size is preferred over cache-line-size.

arch/arm64/boot/dts/nvidia/tegra194.dtsi line 1060

Quoted 5 lines
arch/arm64/boot/dts/nvidia/tegra194.dtsi +5 -0
+	l3: l3-cache {
+		cache-size = <4194304>;
+		cache-line-size = <64>;
+		cache-sets = <4096>;
+	};

The same comments apply as for the L2 caches.

Thierry

author
#3 lore raw

To make this simpler, I think it's best to isolate the cache information in its own patch. So I will amend this patch to include topology information only.

Quoted 195 lines · Bo Yan
Quoted 11 lines · Thierry Reding
Quoted 10 lines · Bo Yan

The xavier CPU architecture includes 8 CPU cores organized in 4 clusters. Add cpu-map data for topology initialization, add cache data for cache node creation in sysfs.

---
  arch/arm64/boot/dts/nvidia/tegra194.dtsi | 148
+++++++++++++++++++++++++++++--

  1 file changed, 140 insertions(+), 8 deletions(-)
Quoted 13 lines

arch/arm64/boot/dts/nvidia/tegra194.dtsi line 871

Quoted 7 lines
arch/arm64/boot/dts/nvidia/tegra194.dtsi +0 -0
index 6dfa1ca..7c2a1fb 100644
@@ -870,63 +870,195 @@
           #address-cells = <1>;
           #size-cells = <0>;

These don't seem to be well-defined. They are mentioned in a very weird locations (Documentation/devicetree/booting-without-of.txt) but there seem to be examples and other device tree files that use them so maybe those are all valid. It might be worth mentioning these in other places where people can more easily find them.

It might be logical to place a reference to this document (booting-without-of.txt) in architecture specific documents, for example, arm/cpus.txt. I see the need for improved documentation, but this probably should be best done in a separate change.

Quoted 3 lines

According to the above document, {i,d}-cache-line-size are deprecated in favour of {i,d}-cache-block-size.

Mostly, this seems to be derived from the oddity of PowerPC, which might have different cache-line-size and cache-block-size. I don't know if there are other examples? It looks like the {i,d}-cache-line-size are being used in dts files for almost all architectures, the only exception is arch/sh/boot/dts/j2_mimas_v2.dts. On ARM and ARM64, cache-line-size is the same as cache-block-size. So I am wondering whether the booting-without-of.txt should be fixed instead? just to keep it consistent among dts files, especially in arm64.

Quoted 11 lines

I also don't see any mention of {i,d}-cache_sets in the device tree bindings, though riscv/cpus.txt mentions {i,d}-cache-sets (note the hyphen instead of underscore) in the examples. arm/l2c2x0.txt and arm/uniphier/cache-unifier.txt describe cache-sets, though that's slightly different.

Might make sense to document all these in more standard places. Maybe adding them to arm/cpus.txt. For consistency with other properties, I think there should be called {i,d}-cache-sets like for RISC-V.

Quoted 5 lines

arch/arm64/boot/dts/nvidia/tegra194.dtsi line 872

Quoted 1 line
arch/arm64/boot/dts/nvidia/tegra194.dtsi +1 -0
+            l2-cache = <&l2_0>;

This seems to be called next-level-cache everywhere else, though it's only formally described in arm/uniphier/cache-uniphier.txt. So might also make sense to add this to arm/cpus.txt.

the improved documentation is certainly desired, I agree.

Quoted 108 lines
Quoted 97 lines
arch/arm64/boot/dts/nvidia/tegra194.dtsi +54 -7
           };
-        cpu@1 {
+        cl0_1: cpu@1 {
               compatible = "nvidia,tegra194-carmel", "arm,armv8";
               device_type = "cpu";
               reg = <0x10001>;
               enable-method = "psci";
+            i-cache-size = <131072>;
+            i-cache-line-size = <64>;
+            i-cache-sets = <512>;
+            d-cache-size = <65536>;
+            d-cache-line-size = <64>;
+            d-cache_sets = <256>;
+            l2-cache = <&l2_0>;
           };
-        cpu@2 {
+        cl1_0: cpu@2 {
               compatible = "nvidia,tegra194-carmel", "arm,armv8";
               device_type = "cpu";
               reg = <0x100>;
               enable-method = "psci";
+            i-cache-size = <131072>;
+            i-cache-line-size = <64>;
+            i-cache-sets = <512>;
+            d-cache-size = <65536>;
+            d-cache-line-size = <64>;
+            d-cache_sets = <256>;
+            l2-cache = <&l2_1>;
           };
-        cpu@3 {
+        cl1_1: cpu@3 {
               compatible = "nvidia,tegra194-carmel", "arm,armv8";
               device_type = "cpu";
               reg = <0x101>;
               enable-method = "psci";
+            i-cache-size = <131072>;
+            i-cache-line-size = <64>;
+            i-cache-sets = <512>;
+            d-cache-size = <65536>;
+            d-cache-line-size = <64>;
+            d-cache_sets = <256>;
+            l2-cache = <&l2_1>;
           };
-        cpu@4 {
+        cl2_0: cpu@4 {
               compatible = "nvidia,tegra194-carmel", "arm,armv8";
               device_type = "cpu";
               reg = <0x200>;
               enable-method = "psci";
+            i-cache-size = <131072>;
+            i-cache-line-size = <64>;
+            i-cache-sets = <512>;
+            d-cache-size = <65536>;
+            d-cache-line-size = <64>;
+            d-cache_sets = <256>;
+            l2-cache = <&l2_2>;
           };
-        cpu@5 {
+        cl2_1: cpu@5 {
               compatible = "nvidia,tegra194-carmel", "arm,armv8";
               device_type = "cpu";
               reg = <0x201>;
               enable-method = "psci";
+            i-cache-size = <131072>;
+            i-cache-line-size = <64>;
+            i-cache-sets = <512>;
+            d-cache-size = <65536>;
+            d-cache-line-size = <64>;
+            d-cache_sets = <256>;
+            l2-cache = <&l2_2>;
           };
-        cpu@6 {
+        cl3_0: cpu@6 {
               compatible = "nvidia,tegra194-carmel", "arm,armv8";
               device_type = "cpu";
               reg = <0x10300>;
               enable-method = "psci";
+            i-cache-size = <131072>;
+            i-cache-line-size = <64>;
+            i-cache-sets = <512>;
+            d-cache-size = <65536>;
+            d-cache-line-size = <64>;
+            d-cache_sets = <256>;
+            l2-cache = <&l2_3>;
           };
-        cpu@7 {
+        cl3_1: cpu@7 {
               compatible = "nvidia,tegra194-carmel", "arm,armv8";
               device_type = "cpu";
               reg = <0x10301>;
               enable-method = "psci";
+            i-cache-size = <131072>;
+            i-cache-line-size = <64>;
+            i-cache-sets = <512>;
+            d-cache-size = <65536>;
+            d-cache-line-size = <64>;

arch/arm64/boot/dts/nvidia/tegra194.dtsi line 1033

Quoted 10 lines
arch/arm64/boot/dts/nvidia/tegra194.dtsi +8 -0
+            d-cache_sets = <256>;
+            l2-cache = <&l2_3>;
           };
       };
+    l2_0: l2-cache0 {
+        cache-size = <2097152>;
+        cache-line-size = <64>;
+        cache-sets = <2048>;
+        next-level-cache = <&l3>;
+    };
Quoted 3 lines

Does this need a compatible string? Also, are there controllers behind these caches? I'm just wondering if these also need reg properties and unit-addresses.

No need for compatible string. No reg properties and addresses. These will be parsed by drivers/of/base.c and drivers/base/cacheinfo.c, they are generic.

Quoted 6 lines

arm/l2c2x0.txt and arm/uniphier/cache-uniphier.txt describe an additional property that you don't specify here: cache-level. This sounds useful to have so that we don't have to guess the cache level from the name, which may or may not work depending on what people name the nodes.

the cache level property is implied in device tree hierarchy, so after system boots up, I can find cache level in related sysfs nodes:

    [root@alarm cache]# cat index*/level
    1
    1
    2
    3

Quoted 14 lines

Also, similar to the L1 cache, cache-block-size is preferred over cache-line-size.

arch/arm64/boot/dts/nvidia/tegra194.dtsi line 1060

Quoted 5 lines
arch/arm64/boot/dts/nvidia/tegra194.dtsi +5 -0
+    l3: l3-cache {
+        cache-size = <4194304>;
+        cache-line-size = <64>;
+        cache-sets = <4096>;
+    };

The same comments apply as for the L2 caches.

Thierry

author
#4 lore raw

PATCH v2 1/1 arm64: tegra: add topology data for Tegra194 cpu

In reply to Thierry Reding

The xavier CPU architecture includes 8 CPU cores organized in 4 clusters. Add cpu-map data for topology initialization, this fixes the topology information in /sys/devices/system/cpu/cpu[n]/topology

---
V2: remove cache nodes, add topology data only

 arch/arm64/boot/dts/nvidia/tegra194.dtsi | 58 +++++++++++++++++++++++++++-----
 1 file changed, 50 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +50 -8
index 6dfa1ca..35e6e76 100644
@@ -870,56 +870,98 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		cpu@0 {
+		cpu-map {
+			cluster0 {
+				core0 {
+					cpu = <&cl0_0>;
+				};
+
+				core1 {
+					cpu = <&cl0_1>;
+				};
+			};
+
+			cluster1 {
+				core0 {
+					cpu = <&cl1_0>;
+				};
+
+				core1 {
+					cpu = <&cl1_1>;
+				};
+			};
+
+			cluster2 {
+				core0 {
+					cpu = <&cl2_0>;
+				};
+
+				core1 {
+					cpu = <&cl2_1>;
+				};
+			};
+
+			cluster3 {
+				core0 {
+					cpu = <&cl3_0>;
+				};
+
+				core1 {
+					cpu = <&cl3_1>;
+				};
+			};
+		};
+
+		cl0_0: cpu@0 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x10000>;
 			enable-method = "psci";
 		};
 
-		cpu@1 {
+		cl0_1: cpu@1 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x10001>;
 			enable-method = "psci";
 		};
 
-		cpu@2 {
+		cl1_0: cpu@2 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x100>;
 			enable-method = "psci";
 		};
 
-		cpu@3 {
+		cl1_1: cpu@3 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x101>;
 			enable-method = "psci";
 		};
 
-		cpu@4 {
+		cl2_0: cpu@4 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x200>;
 			enable-method = "psci";
 		};
 
-		cpu@5 {
+		cl2_1: cpu@5 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x201>;
 			enable-method = "psci";
 		};
 
-		cpu@6 {
+		cl3_0: cpu@6 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x10300>;
 			enable-method = "psci";
 		};
 
-		cpu@7 {
+		cl3_1: cpu@7 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
 			reg = <0x10301>;
Signature · 1 line
2.7.4
#5 lore raw
Quoted 11 lines · Bo Yan

The xavier CPU architecture includes 8 CPU cores organized in 4 clusters. Add cpu-map data for topology initialization, this fixes the topology information in /sys/devices/system/cpu/cpu[n]/topology

---
V2: remove cache nodes, add topology data only

 arch/arm64/boot/dts/nvidia/tegra194.dtsi | 58 +++++++++++++++++++++++++++-----
 1 file changed, 50 insertions(+), 8 deletions(-)

This mostly looks good to me. One minor comment below.

Quoted 6 lines
arch/arm64/boot/dts/nvidia/tegra194.dtsi +0 -0
index 6dfa1ca..35e6e76 100644

arch/arm64/boot/dts/nvidia/tegra194.dtsi line 876

Quoted 8 lines
arch/arm64/boot/dts/nvidia/tegra194.dtsi +4 -1
@@ -870,56 +870,98 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		cpu@0 {
+		cpu-map {
+			cluster0 {
+				core0 {
+					cpu = <&cl0_0>;

I wonder if perhaps in this case it would be better to use the full path to refer to the phandle here. That way we can avoid the labels, which are somewhat cumbersome to write and the hierarchy, in my opinion, is a much more natural way to reference these.

What I'm suggesting would look roughly like this:

		cpu-map {
			cluster0 {
				core0 {
					cpu = <&{/cpus/cpu@0}>;
				};

				core1 {
					cpu = <&{/cpus/cpu@1}>;
				};
			};

			cluster1 {
				core0 {
					cpu = <&{/cpus/cpu@2}>;
				};

				core1 {
					cpu = <&{/cpus/cpu@3}>;
				};
			};

			...
		};

That's slightly more characters, but I think it's much easier to read than the labels.

I don't feel very strongly about it, though, so feel free to keep this as-is if you prefer.

Thierry

author
#6 lore raw

I agree, will update this patch with full paths replacing phandles.

Quoted 69 lines · Thierry Reding
Quoted 11 lines · Bo Yan

The xavier CPU architecture includes 8 CPU cores organized in 4 clusters. Add cpu-map data for topology initialization, this fixes the topology information in /sys/devices/system/cpu/cpu[n]/topology

---
V2: remove cache nodes, add topology data only

  arch/arm64/boot/dts/nvidia/tegra194.dtsi | 58 +++++++++++++++++++++++++++-----
  1 file changed, 50 insertions(+), 8 deletions(-)

This mostly looks good to me. One minor comment below.

Quoted 6 lines
arch/arm64/boot/dts/nvidia/tegra194.dtsi +0 -0
index 6dfa1ca..35e6e76 100644

arch/arm64/boot/dts/nvidia/tegra194.dtsi line 876

Quoted 8 lines
arch/arm64/boot/dts/nvidia/tegra194.dtsi +4 -1
@@ -870,56 +870,98 @@
  		#address-cells = <1>;
  		#size-cells = <0>;
 
-		cpu@0 {
+		cpu-map {
+			cluster0 {
+				core0 {
+					cpu = <&cl0_0>;

I wonder if perhaps in this case it would be better to use the full path to refer to the phandle here. That way we can avoid the labels, which are somewhat cumbersome to write and the hierarchy, in my opinion, is a much more natural way to reference these.

What I'm suggesting would look roughly like this:

		cpu-map {
			cluster0 {
				core0 {
					cpu = <&{/cpus/cpu@0}>;
				};

				core1 {
					cpu = <&{/cpus/cpu@1}>;
				};
			};

			cluster1 {
				core0 {
					cpu = <&{/cpus/cpu@2}>;
				};

				core1 {
					cpu = <&{/cpus/cpu@3}>;
				};
			};

			...
		};

That's slightly more characters, but I think it's much easier to read than the labels.

I don't feel very strongly about it, though, so feel free to keep this as-is if you prefer.

Thierry

author
#7 lore raw

PATCH v3 1/1 arm64: tegra: add topology data for Tegra194 cpu

In reply to Thierry Reding

The xavier CPU architecture includes 8 CPU cores organized in 4 clusters. Add cpu-map data for topology initialization, this fixes the topology information in /sys/devices/system/cpu/cpu[n]/topology

---
V3: Replaced phandles with full path to CPU node
V2: remove cache nodes, add topology data only

 arch/arm64/boot/dts/nvidia/tegra194.dtsi | 42 ++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +42 -0
index 6dfa1ca..708d20c 100644
@@ -870,6 +870,48 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 
+		cpu-map {
+			cluster0 {
+				core0 {
+					cpu = <&{/cpus/cpu@0}>;
+				};
+
+				core1 {
+					cpu = <&{/cpus/cpu@1}>;
+				};
+			};
+
+			cluster1 {
+				core0 {
+					cpu = <&{/cpus/cpu@2}>;
+				};
+
+				core1 {
+					cpu = <&{/cpus/cpu@3}>;
+				};
+			};
+
+			cluster2 {
+				core0 {
+					cpu = <&{/cpus/cpu@4}>;
+				};
+
+				core1 {
+					cpu = <&{/cpus/cpu@5}>;
+				};
+			};
+
+			cluster3 {
+				core0 {
+					cpu = <&{/cpus/cpu@6}>;
+				};
+
+				core1 {
+					cpu = <&{/cpus/cpu@7}>;
+				};
+			};
+		};
+
 		cpu@0 {
 			compatible = "nvidia,tegra194-carmel", "arm,armv8";
 			device_type = "cpu";
Signature · 1 line
2.7.4
author
#8 lore raw

The patch V3 adopted changes suggested by Thierry.

Quoted 67 lines · Bo Yan

The xavier CPU architecture includes 8 CPU cores organized in 4 clusters. Add cpu-map data for topology initialization, this fixes the topology information in /sys/devices/system/cpu/cpu[n]/topology

---
V3: Replaced phandles with full path to CPU node
V2: remove cache nodes, add topology data only

  arch/arm64/boot/dts/nvidia/tegra194.dtsi | 42 ++++++++++++++++++++++++++++++++
  1 file changed, 42 insertions(+)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +42 -0
index 6dfa1ca..708d20c 100644
@@ -870,6 +870,48 @@
  		#address-cells = <1>;
  		#size-cells = <0>;
 
+		cpu-map {
+			cluster0 {
+				core0 {
+					cpu = <&{/cpus/cpu@0}>;
+				};
+
+				core1 {
+					cpu = <&{/cpus/cpu@1}>;
+				};
+			};
+
+			cluster1 {
+				core0 {
+					cpu = <&{/cpus/cpu@2}>;
+				};
+
+				core1 {
+					cpu = <&{/cpus/cpu@3}>;
+				};
+			};
+
+			cluster2 {
+				core0 {
+					cpu = <&{/cpus/cpu@4}>;
+				};
+
+				core1 {
+					cpu = <&{/cpus/cpu@5}>;
+				};
+			};
+
+			cluster3 {
+				core0 {
+					cpu = <&{/cpus/cpu@6}>;
+				};
+
+				core1 {
+					cpu = <&{/cpus/cpu@7}>;
+				};
+			};
+		};
+
  		cpu@0 {
  			compatible = "nvidia,tegra194-carmel", "arm,armv8";
  			device_type = "cpu";