Skip to content

Commit d4ec229

Browse files
Dragan Simicwens
authored andcommitted
arm64: dts: allwinner: Add cache information to the SoC dtsi for H616
Add missing cache information to the Allwinner H616 SoC dtsi, to allow the userspace, which includes lscpu(1) that uses the virtual files provided by the kernel under the /sys/devices/system/cpu directory, to display the proper H616 cache information. Adding the cache information to the H616 SoC dtsi also makes the following warning message in the kernel log go away: cacheinfo: Unable to detect cache hierarchy for CPU 0 Rather conspicuously, almost no cache-related information is available in the publicly available Allwinner H616 datasheet (version 1.0) and H616 user manual (version 1.0). Thus, the cache parameters for the H616 SoC dtsi were obtained and derived by hand from the cache size and layout specifications found in the following technical reference manual, and from the cache size and die revision hints available from the following community-provided data and memory subsystem benchmarks: - ARM Cortex-A53 revision r0p4 TRM, version J - Summary of the two available H616 die revisions and their differences in cache sizes observed from the CSSIDR_EL1 register readouts, provided by Andre Przywara [1][2] - Tinymembench benchmark results of the H616-based OrangePi Zero 2 SBC, provided by Thomas Kaiser [3] For future reference, here's a brief summary of the available documentation and the community-provided data and memory subsystem benchmarks: - All caches employ the 64-byte cache line length - Each Cortex-A53 core has 32 KB of L1 2-way, set-associative instruction cache and 32 KB of L1 4-way, set-associative data cache - The size of the L2 cache depends on the actual H616 die revision (there are two die revisions), so the entire SoC can have either 256 KB or 1 MB of unified L2 16-way, set-associative cache [1] Also for future reference, here's the relevant excerpt from the community- provided H616 memory subsystem benchmark, [3] which confirms that 32 KB and 256 KB are the L1 data and L2 cache sizes, respectively: block size : single random read / dual random read 1024 : 0.0 ns / 0.0 ns 2048 : 0.0 ns / 0.0 ns 4096 : 0.0 ns / 0.0 ns 8192 : 0.0 ns / 0.0 ns 16384 : 0.0 ns / 0.0 ns 32768 : 0.0 ns / 0.0 ns 65536 : 4.3 ns / 7.3 ns 131072 : 6.6 ns / 10.5 ns 262144 : 9.8 ns / 15.2 ns 524288 : 91.8 ns / 142.9 ns 1048576 : 138.6 ns / 188.3 ns 2097152 : 163.0 ns / 204.8 ns 4194304 : 178.8 ns / 213.5 ns 8388608 : 187.1 ns / 217.9 ns 16777216 : 192.2 ns / 220.9 ns 33554432 : 196.5 ns / 224.0 ns 67108864 : 215.7 ns / 259.5 ns The changes introduced to the H616 SoC dtsi by this patch specify 256 KB as the L2 cache size. As outlined by Andre Przywara, [2] a follow-up TF-A patch will perform runtime adjustment of the device tree data, making the correct L2 cache size of 1 MB present in the device tree for the boards based on the revision of H616 that actually provides 1 MB of L2 cache. [1] https://lore.kernel.org/linux-sunxi/[email protected]/ [2] https://lore.kernel.org/linux-sunxi/[email protected]/ [3] https://raw.githubusercontent.com/ThomasKaiser/sbc-bench/master/results/4knM.txt Suggested-by: Andre Przywara <[email protected]> Helped-by: Andre Przywara <[email protected]> Reviewed-by: Andre Przywara <[email protected]> Signed-off-by: Dragan Simic <[email protected]> Link: https://lore.kernel.org/r/e4b9cc3e3d366a571e552c31dafa5de847bc1c12.1716914537.git.dsimic@manjaro.org Signed-off-by: Chen-Yu Tsai <[email protected]>
1 parent 7360e75 commit d4ec229

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@
2727
enable-method = "psci";
2828
clocks = <&ccu CLK_CPUX>;
2929
#cooling-cells = <2>;
30+
i-cache-size = <0x8000>;
31+
i-cache-line-size = <64>;
32+
i-cache-sets = <256>;
33+
d-cache-size = <0x8000>;
34+
d-cache-line-size = <64>;
35+
d-cache-sets = <128>;
36+
next-level-cache = <&l2_cache>;
3037
};
3138

3239
cpu1: cpu@1 {
@@ -36,6 +43,13 @@
3643
enable-method = "psci";
3744
clocks = <&ccu CLK_CPUX>;
3845
#cooling-cells = <2>;
46+
i-cache-size = <0x8000>;
47+
i-cache-line-size = <64>;
48+
i-cache-sets = <256>;
49+
d-cache-size = <0x8000>;
50+
d-cache-line-size = <64>;
51+
d-cache-sets = <128>;
52+
next-level-cache = <&l2_cache>;
3953
};
4054

4155
cpu2: cpu@2 {
@@ -45,6 +59,13 @@
4559
enable-method = "psci";
4660
clocks = <&ccu CLK_CPUX>;
4761
#cooling-cells = <2>;
62+
i-cache-size = <0x8000>;
63+
i-cache-line-size = <64>;
64+
i-cache-sets = <256>;
65+
d-cache-size = <0x8000>;
66+
d-cache-line-size = <64>;
67+
d-cache-sets = <128>;
68+
next-level-cache = <&l2_cache>;
4869
};
4970

5071
cpu3: cpu@3 {
@@ -54,6 +75,22 @@
5475
enable-method = "psci";
5576
clocks = <&ccu CLK_CPUX>;
5677
#cooling-cells = <2>;
78+
i-cache-size = <0x8000>;
79+
i-cache-line-size = <64>;
80+
i-cache-sets = <256>;
81+
d-cache-size = <0x8000>;
82+
d-cache-line-size = <64>;
83+
d-cache-sets = <128>;
84+
next-level-cache = <&l2_cache>;
85+
};
86+
87+
l2_cache: l2-cache {
88+
compatible = "cache";
89+
cache-level = <2>;
90+
cache-unified;
91+
cache-size = <0x40000>;
92+
cache-line-size = <64>;
93+
cache-sets = <256>;
5794
};
5895
};
5996

0 commit comments

Comments
 (0)