Message ID | IA1PR20MB49538F11DE1AF4A52B0F9F9ABBE2A@IA1PR20MB4953.namprd20.prod.outlook.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v2] riscv: dts: allwinner: d1: Add PMU event node | expand |
Context | Check | Description |
---|---|---|
conchuod/cover_letter | success | Single patches do not need cover letters |
conchuod/tree_selection | success | Guessed tree name to be for-next at HEAD 9f944d2e0ab3 |
conchuod/fixes_present | success | Fixes tag not required for -next series |
conchuod/maintainers_pattern | success | MAINTAINERS pattern errors before the patch: 4 and now 4 |
conchuod/verify_signedoff | success | Signed-off-by tag matches author and committer |
conchuod/kdoc | success | Errors and warnings before: 0 this patch: 0 |
conchuod/build_rv64_clang_allmodconfig | success | Errors and warnings before: 9 this patch: 9 |
conchuod/module_param | success | Was 0 now: 0 |
conchuod/build_rv64_gcc_allmodconfig | success | Errors and warnings before: 9 this patch: 9 |
conchuod/build_rv32_defconfig | success | Build OK |
conchuod/dtb_warn_rv64 | fail | Errors and warnings before: 12 this patch: 36 |
conchuod/header_inline | success | No static functions without inline keyword in header files |
conchuod/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 45 lines checked |
conchuod/build_rv64_nommu_k210_defconfig | success | Build OK |
conchuod/verify_fixes | success | No Fixes tag |
conchuod/build_rv64_nommu_virt_defconfig | success | Build OK |
On Sat, Aug 26, 2023 at 08:25:04PM +0800, Inochi Amaoto wrote: > D1 has several pmu events supported by opensbi. > These events can be used by perf for profiling. > > The event value and mapping can be found in the R1S0 version of C906 > documentation: > https://dl.linux-sunxi.org/D1/Xuantie_C906_R1S0_User_Manual.pdf Link: https://dl.linux-sunxi.org/D1/Xuantie_C906_R1S0_User_Manual.pdf > Signed-off-by: Inochi Amaoto <inochiama@outlook.com> > --- > The meaning of T-HEAD events can be found in this pending patch: > https://lore.kernel.org/linux-perf-users/IA1PR20MB4953DD82D0116EC291C21777BBE2A@IA1PR20MB4953.namprd20.prod.outlook.com > > The patch above also provides a detailed example that shows how to setup > environment and use perf with T-HEAD events. > --- Firstly, you need to move the PMU node out of the soc bus: arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi:76.7-114.5: Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi:76.7-114.5: Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi:76.7-114.5: Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi:76.7-114.5: Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi:76.7-114.5: Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi:76.7-114.5: Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi:76.7-114.5: Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi:76.7-114.5: Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property And secondly, and I dunno WTF the fix for this is, but what you've got here is completely invalid as per the binding... The fix for this might well be moving it out of the soc bus (I think I fixed the same errors in QEMU's pmu node), but it shows that you didn't actually test this :/ Please do so: /tmp/tmp.SOQ8Wz6Pug/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv.dtb: soc: pmu: {'compatible': ['riscv,pmu'], 'riscv,event-to-mhpmcounters': [[3, 3, 8], [4, 4, 16], [5, 5, 512], [6, 6, 256], [65536, 65536, 16384], [65537, 65537, 32768], [65538, 65538, 65536], [65539, 65539, 131072], [65561, 65561, 64], [65569, 65569, 32]], 'riscv,event-to-mhpmevent': [[3, 0, 1], [4, 0, 2], [5, 0, 7], [6, 0, 6], [10, 0, 11], [65536, 0, 12], [65537, 0, 13], [65538, 0, 14], [65539, 0, 15], [65561, 0, 4], [65569, 0, 3]], 'riscv,raw-event-to-mhpmcounters': [[0, 1, 4294967295, 4294967295, 8], [0, 2, 4294967295, 4294967295, 16], [0, 3, 4294967295, 4294967295, 32], [0, 4, 4294967295, 4294967295, 64], [0, 5, 4294967295, 4294967295, 128], [0, 6, 4294967295, 4294967295, 256], [0, 7, 4294967295, 4294967295, 512], [0, 11, 4294967295, 4294967295, 8192], [0, 12, 4294967295, 4294967295, 16384], [0, 13, 4294967295, 4294967295, 32768], [0, 14, 4294967295, 4294967295, 65536], [0, 15, 4294967295, 4294967295, 131072]]} should not be valid under {'type': 'object'} from schema $id: http://devicetree.org/schemas/simple-bus.yaml# /tmp/tmp.SOQ8Wz6Pug/arch/riscv/boot/dts/allwinner/sun20i-d1-dongshan-nezha-stu.dtb: soc: pmu: {'compatible': ['riscv,pmu'], 'riscv,event-to-mhpmcounters': [[3, 3, 8], [4, 4, 16], [5, 5, 512], [6, 6, 256], [65536, 65536, 16384], [65537, 65537, 32768], [65538, 65538, 65536], [65539, 65539, 131072], [65561, 65561, 64], [65569, 65569, 32]], 'riscv,event-to-mhpmevent': [[3, 0, 1], [4, 0, 2], [5, 0, 7], [6, 0, 6], [10, 0, 11], [65536, 0, 12], [65537, 0, 13], [65538, 0, 14], [65539, 0, 15], [65561, 0, 4], [65569, 0, 3]], 'riscv,raw-event-to-mhpmcounters': [[0, 1, 4294967295, 4294967295, 8], [0, 2, 4294967295, 4294967295, 16], [0, 3, 4294967295, 4294967295, 32], [0, 4, 4294967295, 4294967295, 64], [0, 5, 4294967295, 4294967295, 128], [0, 6, 4294967295, 4294967295, 256], [0, 7, 4294967295, 4294967295, 512], [0, 11, 4294967295, 4294967295, 8192], [0, 12, 4294967295, 4294967295, 16384], [0, 13, 4294967295, 4294967295, 32768], [0, 14, 4294967295, 4294967295, 65536], [0, 15, 4294967295, 4294967295, 131072]]} should not be valid under {'type': 'object'} from schema $id: http://devicetree.org/schemas/simple-bus.yaml# /tmp/tmp.SOQ8Wz6Pug/arch/riscv/boot/dts/allwinner/sun20i-d1-mangopi-mq-pro.dtb: soc: pmu: {'compatible': ['riscv,pmu'], 'riscv,event-to-mhpmcounters': [[3, 3, 8], [4, 4, 16], [5, 5, 512], [6, 6, 256], [65536, 65536, 16384], [65537, 65537, 32768], [65538, 65538, 65536], [65539, 65539, 131072], [65561, 65561, 64], [65569, 65569, 32]], 'riscv,event-to-mhpmevent': [[3, 0, 1], [4, 0, 2], [5, 0, 7], [6, 0, 6], [10, 0, 11], [65536, 0, 12], [65537, 0, 13], [65538, 0, 14], [65539, 0, 15], [65561, 0, 4], [65569, 0, 3]], 'riscv,raw-event-to-mhpmcounters': [[0, 1, 4294967295, 4294967295, 8], [0, 2, 4294967295, 4294967295, 16], [0, 3, 4294967295, 4294967295, 32], [0, 4, 4294967295, 4294967295, 64], [0, 5, 4294967295, 4294967295, 128], [0, 6, 4294967295, 4294967295, 256], [0, 7, 4294967295, 4294967295, 512], [0, 11, 4294967295, 4294967295, 8192], [0, 12, 4294967295, 4294967295, 16384], [0, 13, 4294967295, 4294967295, 32768], [0, 14, 4294967295, 4294967295, 65536], [0, 15, 4294967295, 4294967295, 131072]]} should not be valid under {'type': 'object'} from schema $id: http://devicetree.org/schemas/simple-bus.yaml# /tmp/tmp.SOQ8Wz6Pug/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-dock.dtb: soc: pmu: {'compatible': ['riscv,pmu'], 'riscv,event-to-mhpmcounters': [[3, 3, 8], [4, 4, 16], [5, 5, 512], [6, 6, 256], [65536, 65536, 16384], [65537, 65537, 32768], [65538, 65538, 65536], [65539, 65539, 131072], [65561, 65561, 64], [65569, 65569, 32]], 'riscv,event-to-mhpmevent': [[3, 0, 1], [4, 0, 2], [5, 0, 7], [6, 0, 6], [10, 0, 11], [65536, 0, 12], [65537, 0, 13], [65538, 0, 14], [65539, 0, 15], [65561, 0, 4], [65569, 0, 3]], 'riscv,raw-event-to-mhpmcounters': [[0, 1, 4294967295, 4294967295, 8], [0, 2, 4294967295, 4294967295, 16], [0, 3, 4294967295, 4294967295, 32], [0, 4, 4294967295, 4294967295, 64], [0, 5, 4294967295, 4294967295, 128], [0, 6, 4294967295, 4294967295, 256], [0, 7, 4294967295, 4294967295, 512], [0, 11, 4294967295, 4294967295, 8192], [0, 12, 4294967295, 4294967295, 16384], [0, 13, 4294967295, 4294967295, 32768], [0, 14, 4294967295, 4294967295, 65536], [0, 15, 4294967295, 4294967295, 131072]]} should not be valid under {'type': 'object'} from schema $id: http://devicetree.org/schemas/simple-bus.yaml# /tmp/tmp.SOQ8Wz6Pug/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel-720p.dtb: soc: pmu: {'compatible': ['riscv,pmu'], 'riscv,event-to-mhpmcounters': [[3, 3, 8], [4, 4, 16], [5, 5, 512], [6, 6, 256], [65536, 65536, 16384], [65537, 65537, 32768], [65538, 65538, 65536], [65539, 65539, 131072], [65561, 65561, 64], [65569, 65569, 32]], 'riscv,event-to-mhpmevent': [[3, 0, 1], [4, 0, 2], [5, 0, 7], [6, 0, 6], [10, 0, 11], [65536, 0, 12], [65537, 0, 13], [65538, 0, 14], [65539, 0, 15], [65561, 0, 4], [65569, 0, 3]], 'riscv,raw-event-to-mhpmcounters': [[0, 1, 4294967295, 4294967295, 8], [0, 2, 4294967295, 4294967295, 16], [0, 3, 4294967295, 4294967295, 32], [0, 4, 4294967295, 4294967295, 64], [0, 5, 4294967295, 4294967295, 128], [0, 6, 4294967295, 4294967295, 256], [0, 7, 4294967295, 4294967295, 512], [0, 11, 4294967295, 4294967295, 8192], [0, 12, 4294967295, 4294967295, 16384], [0, 13, 4294967295, 4294967295, 32768], [0, 14, 4294967295, 4294967295, 65536], [0, 15, 4294967295, 4294967295, 131072]]} should not be valid under {'type': 'object'} from schema $id: http://devicetree.org/schemas/simple-bus.yaml# /tmp/tmp.SOQ8Wz6Pug/arch/riscv/boot/dts/allwinner/sun20i-d1s-mangopi-mq.dtb: soc: pmu: {'compatible': ['riscv,pmu'], 'riscv,event-to-mhpmcounters': [[3, 3, 8], [4, 4, 16], [5, 5, 512], [6, 6, 256], [65536, 65536, 16384], [65537, 65537, 32768], [65538, 65538, 65536], [65539, 65539, 131072], [65561, 65561, 64], [65569, 65569, 32]], 'riscv,event-to-mhpmevent': [[3, 0, 1], [4, 0, 2], [5, 0, 7], [6, 0, 6], [10, 0, 11], [65536, 0, 12], [65537, 0, 13], [65538, 0, 14], [65539, 0, 15], [65561, 0, 4], [65569, 0, 3]], 'riscv,raw-event-to-mhpmcounters': [[0, 1, 4294967295, 4294967295, 8], [0, 2, 4294967295, 4294967295, 16], [0, 3, 4294967295, 4294967295, 32], [0, 4, 4294967295, 4294967295, 64], [0, 5, 4294967295, 4294967295, 128], [0, 6, 4294967295, 4294967295, 256], [0, 7, 4294967295, 4294967295, 512], [0, 11, 4294967295, 4294967295, 8192], [0, 12, 4294967295, 4294967295, 16384], [0, 13, 4294967295, 4294967295, 32768], [0, 14, 4294967295, 4294967295, 65536], [0, 15, 4294967295, 4294967295, 131072]]} should not be valid under {'type': 'object'} from schema $id: http://devicetree.org/schemas/simple-bus.yaml# /tmp/tmp.SOQ8Wz6Pug/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dtb: soc: pmu: {'compatible': ['riscv,pmu'], 'riscv,event-to-mhpmcounters': [[3, 3, 8], [4, 4, 16], [5, 5, 512], [6, 6, 256], [65536, 65536, 16384], [65537, 65537, 32768], [65538, 65538, 65536], [65539, 65539, 131072], [65561, 65561, 64], [65569, 65569, 32]], 'riscv,event-to-mhpmevent': [[3, 0, 1], [4, 0, 2], [5, 0, 7], [6, 0, 6], [10, 0, 11], [65536, 0, 12], [65537, 0, 13], [65538, 0, 14], [65539, 0, 15], [65561, 0, 4], [65569, 0, 3]], 'riscv,raw-event-to-mhpmcounters': [[0, 1, 4294967295, 4294967295, 8], [0, 2, 4294967295, 4294967295, 16], [0, 3, 4294967295, 4294967295, 32], [0, 4, 4294967295, 4294967295, 64], [0, 5, 4294967295, 4294967295, 128], [0, 6, 4294967295, 4294967295, 256], [0, 7, 4294967295, 4294967295, 512], [0, 11, 4294967295, 4294967295, 8192], [0, 12, 4294967295, 4294967295, 16384], [0, 13, 4294967295, 4294967295, 32768], [0, 14, 4294967295, 4294967295, 65536], [0, 15, 4294967295, 4294967295, 131072]]} should not be valid under {'type': 'object'} from schema $id: http://devicetree.org/schemas/simple-bus.yaml# /tmp/tmp.SOQ8Wz6Pug/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel-480p.dtb: soc: pmu: {'compatible': ['riscv,pmu'], 'riscv,event-to-mhpmcounters': [[3, 3, 8], [4, 4, 16], [5, 5, 512], [6, 6, 256], [65536, 65536, 16384], [65537, 65537, 32768], [65538, 65538, 65536], [65539, 65539, 131072], [65561, 65561, 64], [65569, 65569, 32]], 'riscv,event-to-mhpmevent': [[3, 0, 1], [4, 0, 2], [5, 0, 7], [6, 0, 6], [10, 0, 11], [65536, 0, 12], [65537, 0, 13], [65538, 0, 14], [65539, 0, 15], [65561, 0, 4], [65569, 0, 3]], 'riscv,raw-event-to-mhpmcounters': [[0, 1, 4294967295, 4294967295, 8], [0, 2, 4294967295, 4294967295, 16], [0, 3, 4294967295, 4294967295, 32], [0, 4, 4294967295, 4294967295, 64], [0, 5, 4294967295, 4294967295, 128], [0, 6, 4294967295, 4294967295, 256], [0, 7, 4294967295, 4294967295, 512], [0, 11, 4294967295, 4294967295, 8192], [0, 12, 4294967295, 4294967295, 16384], [0, 13, 4294967295, 4294967295, 32768], [0, 14, 4294967295, 4294967295, 65536], [0, 15, 4294967295, 4294967295, 131072]]} should not be valid under {'type': 'object'} from schema $id: http://devicetree.org/schemas/simple-bus.yaml# Thanks, Conor. > arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi | 40 +++++++++++++++++++ > 1 file changed, 40 insertions(+) > > diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi b/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi > index 8275630af977..d9031ccdec89 100644 > --- a/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi > +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi > @@ -72,5 +72,45 @@ plic: interrupt-controller@10000000 { > #address-cells = <0>; > #interrupt-cells = <2>; > }; > + > + pmu { > + compatible = "riscv,pmu"; > + riscv,event-to-mhpmcounters = > + <0x00003 0x00003 0x00000008>, > + <0x00004 0x00004 0x00000010>, > + <0x00005 0x00005 0x00000200>, > + <0x00006 0x00006 0x00000100>, > + <0x10000 0x10000 0x00004000>, > + <0x10001 0x10001 0x00008000>, > + <0x10002 0x10002 0x00010000>, > + <0x10003 0x10003 0x00020000>, > + <0x10019 0x10019 0x00000040>, > + <0x10021 0x10021 0x00000020>; > + riscv,event-to-mhpmevent = > + <0x00003 0x00000000 0x00000001>, > + <0x00004 0x00000000 0x00000002>, > + <0x00005 0x00000000 0x00000007>, > + <0x00006 0x00000000 0x00000006>, > + <0x0000a 0x00000000 0x0000000b>, > + <0x10000 0x00000000 0x0000000c>, > + <0x10001 0x00000000 0x0000000d>, > + <0x10002 0x00000000 0x0000000e>, > + <0x10003 0x00000000 0x0000000f>, > + <0x10019 0x00000000 0x00000004>, > + <0x10021 0x00000000 0x00000003>; > + riscv,raw-event-to-mhpmcounters = > + <0x00000000 0x00000001 0xffffffff 0xffffffff 0x00000008>, > + <0x00000000 0x00000002 0xffffffff 0xffffffff 0x00000010>, > + <0x00000000 0x00000003 0xffffffff 0xffffffff 0x00000020>, > + <0x00000000 0x00000004 0xffffffff 0xffffffff 0x00000040>, > + <0x00000000 0x00000005 0xffffffff 0xffffffff 0x00000080>, > + <0x00000000 0x00000006 0xffffffff 0xffffffff 0x00000100>, > + <0x00000000 0x00000007 0xffffffff 0xffffffff 0x00000200>, > + <0x00000000 0x0000000b 0xffffffff 0xffffffff 0x00002000>, > + <0x00000000 0x0000000c 0xffffffff 0xffffffff 0x00004000>, > + <0x00000000 0x0000000d 0xffffffff 0xffffffff 0x00008000>, > + <0x00000000 0x0000000e 0xffffffff 0xffffffff 0x00010000>, > + <0x00000000 0x0000000f 0xffffffff 0xffffffff 0x00020000>; > + }; > }; > }; > -- > 2.41.0 >
>On Sat, Aug 26, 2023 at 08:25:04PM +0800, Inochi Amaoto wrote: >> D1 has several pmu events supported by opensbi. >> These events can be used by perf for profiling. >> >> The event value and mapping can be found in the R1S0 version of C906 >> documentation: >> https://dl.linux-sunxi.org/D1/Xuantie_C906_R1S0_User_Manual.pdf > >Link: https://dl.linux-sunxi.org/D1/Xuantie_C906_R1S0_User_Manual.pdf Thanks. >> Signed-off-by: Inochi Amaoto <inochiama@outlook.com> >> --- >> The meaning of T-HEAD events can be found in this pending patch: >> https://lore.kernel.org/linux-perf-users/IA1PR20MB4953DD82D0116EC291C21777BBE2A@IA1PR20MB4953.namprd20.prod.outlook.com >> >> The patch above also provides a detailed example that shows how to setup >> environment and use perf with T-HEAD events. >> --- > >Firstly, you need to move the PMU node out of the soc bus: > >arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi:76.7-114.5: Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property >arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi:76.7-114.5: Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property >arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi:76.7-114.5: Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property >arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi:76.7-114.5: Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property >arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi:76.7-114.5: Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property >arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi:76.7-114.5: Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property >arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi:76.7-114.5: Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property >arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi:76.7-114.5: Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property > >And secondly, and I dunno WTF the fix for this is, but what you've got >here is completely invalid as per the binding... >The fix for this might well be moving it out of the soc bus (I think I >fixed the same errors in QEMU's pmu node), but it shows that you didn't >actually test this :/ Please do so: > >/tmp/tmp.SOQ8Wz6Pug/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv.dtb: soc: pmu: {'compatible': ['riscv,pmu'], 'riscv,event-to-mhpmcounters': [[3, 3, 8], [4, 4, 16], [5, 5, 512], [6, 6, 256], [65536, 65536, 16384], [65537, 65537, 32768], [65538, 65538, 65536], [65539, 65539, 131072], [65561, 65561, 64], [65569, 65569, 32]], 'riscv,event-to-mhpmevent': [[3, 0, 1], [4, 0, 2], [5, 0, 7], [6, 0, 6], [10, 0, 11], [65536, 0, 12], [65537, 0, 13], [65538, 0, 14], [65539, 0, 15], [65561, 0, 4], [65569, 0, 3]], 'riscv,raw-event-to-mhpmcounters': [[0, 1, 4294967295, 4294967295, 8], [0, 2, 4294967295, 4294967295, 16], [0, 3, 4294967295, 4294967295, 32], [0, 4, 4294967295, 4294967295, 64], [0, 5, 4294967295, 4294967295, 128], [0, 6, 4294967295, 4294967295, 256], [0, 7, 4294967295, 4294967295, 512], [0, 11, 4294967295, 4294967295, 8192], [0, 12, 4294967295, 4294967295, 16384], [0, 13, 4294967295, 4294967295, 32768], [0, 14, 4294967295, 4294967295, 65536], [0, 15, 4294967295, 4294967295, 131072]]} should not be valid under {'type': 'object'} > from schema $id: http://devicetree.org/schemas/simple-bus.yaml# >/tmp/tmp.SOQ8Wz6Pug/arch/riscv/boot/dts/allwinner/sun20i-d1-dongshan-nezha-stu.dtb: soc: pmu: {'compatible': ['riscv,pmu'], 'riscv,event-to-mhpmcounters': [[3, 3, 8], [4, 4, 16], [5, 5, 512], [6, 6, 256], [65536, 65536, 16384], [65537, 65537, 32768], [65538, 65538, 65536], [65539, 65539, 131072], [65561, 65561, 64], [65569, 65569, 32]], 'riscv,event-to-mhpmevent': [[3, 0, 1], [4, 0, 2], [5, 0, 7], [6, 0, 6], [10, 0, 11], [65536, 0, 12], [65537, 0, 13], [65538, 0, 14], [65539, 0, 15], [65561, 0, 4], [65569, 0, 3]], 'riscv,raw-event-to-mhpmcounters': [[0, 1, 4294967295, 4294967295, 8], [0, 2, 4294967295, 4294967295, 16], [0, 3, 4294967295, 4294967295, 32], [0, 4, 4294967295, 4294967295, 64], [0, 5, 4294967295, 4294967295, 128], [0, 6, 4294967295, 4294967295, 256], [0, 7, 4294967295, 4294967295, 512], [0, 11, 4294967295, 4294967295, 8192], [0, 12, 4294967295, 4294967295, 16384], [0, 13, 4294967295, 4294967295, 32768], [0, 14, 4294967295, 4294967295, 65536], [0, 15, 4294967295, 4294967295, 131072]]} should not be valid under {'type': 'object'} > from schema $id: http://devicetree.org/schemas/simple-bus.yaml# >/tmp/tmp.SOQ8Wz6Pug/arch/riscv/boot/dts/allwinner/sun20i-d1-mangopi-mq-pro.dtb: soc: pmu: {'compatible': ['riscv,pmu'], 'riscv,event-to-mhpmcounters': [[3, 3, 8], [4, 4, 16], [5, 5, 512], [6, 6, 256], [65536, 65536, 16384], [65537, 65537, 32768], [65538, 65538, 65536], [65539, 65539, 131072], [65561, 65561, 64], [65569, 65569, 32]], 'riscv,event-to-mhpmevent': [[3, 0, 1], [4, 0, 2], [5, 0, 7], [6, 0, 6], [10, 0, 11], [65536, 0, 12], [65537, 0, 13], [65538, 0, 14], [65539, 0, 15], [65561, 0, 4], [65569, 0, 3]], 'riscv,raw-event-to-mhpmcounters': [[0, 1, 4294967295, 4294967295, 8], [0, 2, 4294967295, 4294967295, 16], [0, 3, 4294967295, 4294967295, 32], [0, 4, 4294967295, 4294967295, 64], [0, 5, 4294967295, 4294967295, 128], [0, 6, 4294967295, 4294967295, 256], [0, 7, 4294967295, 4294967295, 512], [0, 11, 4294967295, 4294967295, 8192], [0, 12, 4294967295, 4294967295, 16384], [0, 13, 4294967295, 4294967295, 32768], [0, 14, 4294967295, 4294967295, 65536], [0, 15, 4294967295, 4294967295, 131072]]} should not be valid under {'type': 'object'} > from schema $id: http://devicetree.org/schemas/simple-bus.yaml# >/tmp/tmp.SOQ8Wz6Pug/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-dock.dtb: soc: pmu: {'compatible': ['riscv,pmu'], 'riscv,event-to-mhpmcounters': [[3, 3, 8], [4, 4, 16], [5, 5, 512], [6, 6, 256], [65536, 65536, 16384], [65537, 65537, 32768], [65538, 65538, 65536], [65539, 65539, 131072], [65561, 65561, 64], [65569, 65569, 32]], 'riscv,event-to-mhpmevent': [[3, 0, 1], [4, 0, 2], [5, 0, 7], [6, 0, 6], [10, 0, 11], [65536, 0, 12], [65537, 0, 13], [65538, 0, 14], [65539, 0, 15], [65561, 0, 4], [65569, 0, 3]], 'riscv,raw-event-to-mhpmcounters': [[0, 1, 4294967295, 4294967295, 8], [0, 2, 4294967295, 4294967295, 16], [0, 3, 4294967295, 4294967295, 32], [0, 4, 4294967295, 4294967295, 64], [0, 5, 4294967295, 4294967295, 128], [0, 6, 4294967295, 4294967295, 256], [0, 7, 4294967295, 4294967295, 512], [0, 11, 4294967295, 4294967295, 8192], [0, 12, 4294967295, 4294967295, 16384], [0, 13, 4294967295, 4294967295, 32768], [0, 14, 4294967295, 4294967295, 65536], [0, 15, 4294967295, 4294967295, 131072]]} should not be valid under {'type': 'object'} > from schema $id: http://devicetree.org/schemas/simple-bus.yaml# >/tmp/tmp.SOQ8Wz6Pug/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel-720p.dtb: soc: pmu: {'compatible': ['riscv,pmu'], 'riscv,event-to-mhpmcounters': [[3, 3, 8], [4, 4, 16], [5, 5, 512], [6, 6, 256], [65536, 65536, 16384], [65537, 65537, 32768], [65538, 65538, 65536], [65539, 65539, 131072], [65561, 65561, 64], [65569, 65569, 32]], 'riscv,event-to-mhpmevent': [[3, 0, 1], [4, 0, 2], [5, 0, 7], [6, 0, 6], [10, 0, 11], [65536, 0, 12], [65537, 0, 13], [65538, 0, 14], [65539, 0, 15], [65561, 0, 4], [65569, 0, 3]], 'riscv,raw-event-to-mhpmcounters': [[0, 1, 4294967295, 4294967295, 8], [0, 2, 4294967295, 4294967295, 16], [0, 3, 4294967295, 4294967295, 32], [0, 4, 4294967295, 4294967295, 64], [0, 5, 4294967295, 4294967295, 128], [0, 6, 4294967295, 4294967295, 256], [0, 7, 4294967295, 4294967295, 512], [0, 11, 4294967295, 4294967295, 8192], [0, 12, 4294967295, 4294967295, 16384], [0, 13, 4294967295, 4294967295, 32768], [0, 14, 4294967295, 4294967295, 65536], [0, 15, 4294967295, 4294967295, 131072]]} should not be valid under {'type': 'object'} > from schema $id: http://devicetree.org/schemas/simple-bus.yaml# >/tmp/tmp.SOQ8Wz6Pug/arch/riscv/boot/dts/allwinner/sun20i-d1s-mangopi-mq.dtb: soc: pmu: {'compatible': ['riscv,pmu'], 'riscv,event-to-mhpmcounters': [[3, 3, 8], [4, 4, 16], [5, 5, 512], [6, 6, 256], [65536, 65536, 16384], [65537, 65537, 32768], [65538, 65538, 65536], [65539, 65539, 131072], [65561, 65561, 64], [65569, 65569, 32]], 'riscv,event-to-mhpmevent': [[3, 0, 1], [4, 0, 2], [5, 0, 7], [6, 0, 6], [10, 0, 11], [65536, 0, 12], [65537, 0, 13], [65538, 0, 14], [65539, 0, 15], [65561, 0, 4], [65569, 0, 3]], 'riscv,raw-event-to-mhpmcounters': [[0, 1, 4294967295, 4294967295, 8], [0, 2, 4294967295, 4294967295, 16], [0, 3, 4294967295, 4294967295, 32], [0, 4, 4294967295, 4294967295, 64], [0, 5, 4294967295, 4294967295, 128], [0, 6, 4294967295, 4294967295, 256], [0, 7, 4294967295, 4294967295, 512], [0, 11, 4294967295, 4294967295, 8192], [0, 12, 4294967295, 4294967295, 16384], [0, 13, 4294967295, 4294967295, 32768], [0, 14, 4294967295, 4294967295, 65536], [0, 15, 4294967295, 4294967295, 131072]]} should not be valid under {'type': 'object'} > from schema $id: http://devicetree.org/schemas/simple-bus.yaml# >/tmp/tmp.SOQ8Wz6Pug/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dtb: soc: pmu: {'compatible': ['riscv,pmu'], 'riscv,event-to-mhpmcounters': [[3, 3, 8], [4, 4, 16], [5, 5, 512], [6, 6, 256], [65536, 65536, 16384], [65537, 65537, 32768], [65538, 65538, 65536], [65539, 65539, 131072], [65561, 65561, 64], [65569, 65569, 32]], 'riscv,event-to-mhpmevent': [[3, 0, 1], [4, 0, 2], [5, 0, 7], [6, 0, 6], [10, 0, 11], [65536, 0, 12], [65537, 0, 13], [65538, 0, 14], [65539, 0, 15], [65561, 0, 4], [65569, 0, 3]], 'riscv,raw-event-to-mhpmcounters': [[0, 1, 4294967295, 4294967295, 8], [0, 2, 4294967295, 4294967295, 16], [0, 3, 4294967295, 4294967295, 32], [0, 4, 4294967295, 4294967295, 64], [0, 5, 4294967295, 4294967295, 128], [0, 6, 4294967295, 4294967295, 256], [0, 7, 4294967295, 4294967295, 512], [0, 11, 4294967295, 4294967295, 8192], [0, 12, 4294967295, 4294967295, 16384], [0, 13, 4294967295, 4294967295, 32768], [0, 14, 4294967295, 4294967295, 65536], [0, 15, 4294967295, 4294967295, 131072]]} should not be valid under {'type': 'object'} > from schema $id: http://devicetree.org/schemas/simple-bus.yaml# >/tmp/tmp.SOQ8Wz6Pug/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel-480p.dtb: soc: pmu: {'compatible': ['riscv,pmu'], 'riscv,event-to-mhpmcounters': [[3, 3, 8], [4, 4, 16], [5, 5, 512], [6, 6, 256], [65536, 65536, 16384], [65537, 65537, 32768], [65538, 65538, 65536], [65539, 65539, 131072], [65561, 65561, 64], [65569, 65569, 32]], 'riscv,event-to-mhpmevent': [[3, 0, 1], [4, 0, 2], [5, 0, 7], [6, 0, 6], [10, 0, 11], [65536, 0, 12], [65537, 0, 13], [65538, 0, 14], [65539, 0, 15], [65561, 0, 4], [65569, 0, 3]], 'riscv,raw-event-to-mhpmcounters': [[0, 1, 4294967295, 4294967295, 8], [0, 2, 4294967295, 4294967295, 16], [0, 3, 4294967295, 4294967295, 32], [0, 4, 4294967295, 4294967295, 64], [0, 5, 4294967295, 4294967295, 128], [0, 6, 4294967295, 4294967295, 256], [0, 7, 4294967295, 4294967295, 512], [0, 11, 4294967295, 4294967295, 8192], [0, 12, 4294967295, 4294967295, 16384], [0, 13, 4294967295, 4294967295, 32768], [0, 14, 4294967295, 4294967295, 65536], [0, 15, 4294967295, 4294967295, 131072]]} should not be valid under {'type': 'object'} > from schema $id: http://devicetree.org/schemas/simple-bus.yaml# > >Thanks, >Conor. > Sorry for this as I only test the compilation. I will run the check and fix this. Thanks, Inochi >> arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi | 40 +++++++++++++++++++ >> 1 file changed, 40 insertions(+) >> >> diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi b/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi >> index 8275630af977..d9031ccdec89 100644 >> --- a/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi >> +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi >> @@ -72,5 +72,45 @@ plic: interrupt-controller@10000000 { >> #address-cells = <0>; >> #interrupt-cells = <2>; >> }; >> + >> + pmu { >> + compatible = "riscv,pmu"; >> + riscv,event-to-mhpmcounters = >> + <0x00003 0x00003 0x00000008>, >> + <0x00004 0x00004 0x00000010>, >> + <0x00005 0x00005 0x00000200>, >> + <0x00006 0x00006 0x00000100>, >> + <0x10000 0x10000 0x00004000>, >> + <0x10001 0x10001 0x00008000>, >> + <0x10002 0x10002 0x00010000>, >> + <0x10003 0x10003 0x00020000>, >> + <0x10019 0x10019 0x00000040>, >> + <0x10021 0x10021 0x00000020>; >> + riscv,event-to-mhpmevent = >> + <0x00003 0x00000000 0x00000001>, >> + <0x00004 0x00000000 0x00000002>, >> + <0x00005 0x00000000 0x00000007>, >> + <0x00006 0x00000000 0x00000006>, >> + <0x0000a 0x00000000 0x0000000b>, >> + <0x10000 0x00000000 0x0000000c>, >> + <0x10001 0x00000000 0x0000000d>, >> + <0x10002 0x00000000 0x0000000e>, >> + <0x10003 0x00000000 0x0000000f>, >> + <0x10019 0x00000000 0x00000004>, >> + <0x10021 0x00000000 0x00000003>; >> + riscv,raw-event-to-mhpmcounters = >> + <0x00000000 0x00000001 0xffffffff 0xffffffff 0x00000008>, >> + <0x00000000 0x00000002 0xffffffff 0xffffffff 0x00000010>, >> + <0x00000000 0x00000003 0xffffffff 0xffffffff 0x00000020>, >> + <0x00000000 0x00000004 0xffffffff 0xffffffff 0x00000040>, >> + <0x00000000 0x00000005 0xffffffff 0xffffffff 0x00000080>, >> + <0x00000000 0x00000006 0xffffffff 0xffffffff 0x00000100>, >> + <0x00000000 0x00000007 0xffffffff 0xffffffff 0x00000200>, >> + <0x00000000 0x0000000b 0xffffffff 0xffffffff 0x00002000>, >> + <0x00000000 0x0000000c 0xffffffff 0xffffffff 0x00004000>, >> + <0x00000000 0x0000000d 0xffffffff 0xffffffff 0x00008000>, >> + <0x00000000 0x0000000e 0xffffffff 0xffffffff 0x00010000>, >> + <0x00000000 0x0000000f 0xffffffff 0xffffffff 0x00020000>; >> + }; >> }; >> }; >> -- >> 2.41.0 >> >
diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi b/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi index 8275630af977..d9031ccdec89 100644 --- a/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi @@ -72,5 +72,45 @@ plic: interrupt-controller@10000000 { #address-cells = <0>; #interrupt-cells = <2>; }; + + pmu { + compatible = "riscv,pmu"; + riscv,event-to-mhpmcounters = + <0x00003 0x00003 0x00000008>, + <0x00004 0x00004 0x00000010>, + <0x00005 0x00005 0x00000200>, + <0x00006 0x00006 0x00000100>, + <0x10000 0x10000 0x00004000>, + <0x10001 0x10001 0x00008000>, + <0x10002 0x10002 0x00010000>, + <0x10003 0x10003 0x00020000>, + <0x10019 0x10019 0x00000040>, + <0x10021 0x10021 0x00000020>; + riscv,event-to-mhpmevent = + <0x00003 0x00000000 0x00000001>, + <0x00004 0x00000000 0x00000002>, + <0x00005 0x00000000 0x00000007>, + <0x00006 0x00000000 0x00000006>, + <0x0000a 0x00000000 0x0000000b>, + <0x10000 0x00000000 0x0000000c>, + <0x10001 0x00000000 0x0000000d>, + <0x10002 0x00000000 0x0000000e>, + <0x10003 0x00000000 0x0000000f>, + <0x10019 0x00000000 0x00000004>, + <0x10021 0x00000000 0x00000003>; + riscv,raw-event-to-mhpmcounters = + <0x00000000 0x00000001 0xffffffff 0xffffffff 0x00000008>, + <0x00000000 0x00000002 0xffffffff 0xffffffff 0x00000010>, + <0x00000000 0x00000003 0xffffffff 0xffffffff 0x00000020>, + <0x00000000 0x00000004 0xffffffff 0xffffffff 0x00000040>, + <0x00000000 0x00000005 0xffffffff 0xffffffff 0x00000080>, + <0x00000000 0x00000006 0xffffffff 0xffffffff 0x00000100>, + <0x00000000 0x00000007 0xffffffff 0xffffffff 0x00000200>, + <0x00000000 0x0000000b 0xffffffff 0xffffffff 0x00002000>, + <0x00000000 0x0000000c 0xffffffff 0xffffffff 0x00004000>, + <0x00000000 0x0000000d 0xffffffff 0xffffffff 0x00008000>, + <0x00000000 0x0000000e 0xffffffff 0xffffffff 0x00010000>, + <0x00000000 0x0000000f 0xffffffff 0xffffffff 0x00020000>; + }; }; };
D1 has several pmu events supported by opensbi. These events can be used by perf for profiling. The event value and mapping can be found in the R1S0 version of C906 documentation: https://dl.linux-sunxi.org/D1/Xuantie_C906_R1S0_User_Manual.pdf Signed-off-by: Inochi Amaoto <inochiama@outlook.com> --- The meaning of T-HEAD events can be found in this pending patch: https://lore.kernel.org/linux-perf-users/IA1PR20MB4953DD82D0116EC291C21777BBE2A@IA1PR20MB4953.namprd20.prod.outlook.com The patch above also provides a detailed example that shows how to setup environment and use perf with T-HEAD events. --- arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) -- 2.41.0