[PATCH v4 0/7] iommu/riscv: Add HPM support for RISC-V IOMMU
Lv Zheng
lv.zheng at linux.spacemit.com
Thu Feb 5 01:09:59 PST 2026
Includes HPM support for RISC-V IOMMU. The HPM hardware mechanism can be
found in the recent announced SpacemiT SoCs (K3, V100), where T100
(SpacemiT distributed IOMMU) is shipped.
Revisions:
v1
Initial release.
v2 (sent as v1.1)
Split and cleanup DT-bindings.
v3
1. Refactor using vendor specific compatible.
2. Implement vendor events with a userspace identifier.
v4
1. Drop ICVEC check which is not that usful as WSI device tree can use
only 1 vector for IOATS CIV/FIV/PIV/PMIV.
2. Solve DT binding check of "interrupts/maxItems" attribute.
3. Address Robin's comments for an old revision sent by "Zong Li":
https://lore.kernel.org/all/20250115030306.29735-1-zong.li@sifive.com/
4. Limit IOATC enumeration by referencing spacemit,riscv-iommu.
The tested result can be found as follows:
root at sdfirm:~# perf stat --timeout 5000 -a -e spacemit_ioats_hpm_00/dd_walk,config1=0x20c0010000000000/ dmatest; sleep 1
[ 145.630224] dmatest: Started 1 threads using dma0chan0
[ 145.644896] dmatest: dma0chan0-copy0: summary 1 tests, 0 failures 123.60 iops 123 KB/s (0)
Performance counter stats for 'system wide':
3 spacemit_ioats_hpm_00/dd_walk,config1=0x20c0010000000000/
0.193108000 seconds time elapsed
root at sdfirm:~# echo dma0chan1 > /sys/module/dmatest/parameters/channel
[ 327.001820] dmatest: Added 1 threads using dma0chan1
root at sdfirm:~# perf stat --timeout 5000 -a -e spacemit_ioats_hpm_00/s_walk,config1=0x20c0011000000000/ dmatest; sleep 1
[ 484.037180] dmatest: Started 1 threads using dma0chan1
[ 484.048832] dmatest: dma0chan1-copy0: summary 1 tests, 0 failures 172.11 iops 172 KB/s (0)
Performance counter stats for 'system wide':
6 spacemit_ioats_hpm_00/s_walk,config1=0x20c0011000000000/
0.191970000 seconds time elapsed
root at sdfirm:~# perf stat --timeout 5000 -a -e spacemit_ioatc_hpm_0003/tlb_mis,config1=0x20c0011000000000/ dmatest; sleep 1
[ 546.332494] dmatest: No channels configured, continue with any
[ 546.363062] dmatest: Added 1 threads using dma0chan1
[ 546.377994] dmatest: Started 1 threads using dma0chan1
[ 546.388376] dmatest: dma0chan1-copy0: summary 1 tests, 0 failures 213.94 iops 213 KB/s (0)
Performance counter stats for 'system wide':
3 spacemit_ioatc_hpm_0003/tlb_mis,config1=0x20c0011000000000/
0.225062000 seconds time elapsed
Jingyu Li (2):
iommu/riscv: Enable IOMMU DMA mapping support
iommu/riscv: Add HPM support for performance monitoring
Lv Zheng (5):
dt-bindings: iommu: Add spacemit/t100 features
iommu/riscv: Add vendor event support for RISC-V IOMMU HPM
spacemit/t100: Add global filter awareness for RISC-V IOMMU HPM
spacemit/t100: Add SpacemiT T100 IOATC HPM support
perf vendor events riscv:: Add support for spacemit,riscv-iommu HPM
aliasing
.../bindings/iommu/riscv,iommu.yaml | 53 +-
MAINTAINERS | 3 +
drivers/iommu/Kconfig | 2 +-
drivers/iommu/riscv/Kconfig | 9 +
drivers/iommu/riscv/Makefile | 1 +
drivers/iommu/riscv/iommu-bits.h | 18 +
drivers/iommu/riscv/iommu-hpm.c | 1123 +++++++++++++++++
drivers/iommu/riscv/iommu-pci.c | 13 +-
drivers/iommu/riscv/iommu-platform.c | 12 +-
drivers/iommu/riscv/iommu.h | 46 +-
.../arch/riscv/spacemit/iommu/sys/ioatc.json | 30 +
.../arch/riscv/spacemit/iommu/sys/ioats.json | 163 +++
12 files changed, 1464 insertions(+), 9 deletions(-)
create mode 100644 drivers/iommu/riscv/iommu-hpm.c
create mode 100644 tools/perf/pmu-events/arch/riscv/spacemit/iommu/sys/ioatc.json
create mode 100644 tools/perf/pmu-events/arch/riscv/spacemit/iommu/sys/ioats.json
--
2.43.0
More information about the linux-riscv
mailing list