[PATCH v2 0/2] RISC-V IOMMU HPM support

Zong Li posted 2 patches 4 hours ago
drivers/iommu/riscv/iommu-bits.h |  61 ---
drivers/iommu/riscv/iommu.c      |  20 +
drivers/perf/Kconfig             |  12 +
drivers/perf/Makefile            |   1 +
drivers/perf/riscv_iommu_pmu.c   | 661 +++++++++++++++++++++++++++++++
5 files changed, 694 insertions(+), 61 deletions(-)
create mode 100644 drivers/perf/riscv_iommu_pmu.c
[PATCH v2 0/2] RISC-V IOMMU HPM support
Posted by Zong Li 4 hours ago
This series implements support for the RISC-V IOMMU hardware performance
monitor.

The RISC-V IOMMU PMU driver is implemented as an auxiliary device driver
created by the parent RISC-V IOMMU driver. The child driver can obtain
resources and information from the parent device, such as the MMIO base
address and IRQ number.

Custom event support is not included in this series and will be submitted
as a separate series. The idea is that custom events will be defined
through the driver data of the auxiliary driver. When the parent IOMMU
driver creates the auxiliary device, it should pass a vendor-specific
name as the device name in order to match the corresponding auxiliary
device ID.

After my initial RFC and the v1 patch series were posted, similar patch
series also appeared on the mailing list.

One was from Yaxing Guo:
https://lore.kernel.org/all/20250915020911.1313-1-guoyaxing@bosc.ac.cn/

and another from Lv Zheng:
https://lore.kernel.org/all/30C7AD351DB55276+a8b03dac-c5af-4034-8631-ac1c352a469f@linux.spacemit.com/

Yaxing has agreed to pause his series, as discussed here:
https://lore.kernel.org/linux-iommu/2ce9d8be-10b3-48dd-b99e-7358347fc171@bosc.ac.cn/

The motivation for sending this v2 version is not only to address the
feedback and suggestions from the previous round, but also to introduce
a major structural change: the PMU driver has been moved under
drivers/perf/, which has been mentioned repeatedly by several people.
This results in a different driver structure compared to my earlier
version and the other two series, and I'd like to gather feedback and
suggestions from the community on this approach. If the community would
prefer to go with Lv Zheng’s version instead, I am perfectly fine with
that as well.

Since I did not follow up closely on the patches from Lv Zheng, Jingyu
Li, or Yaxing, it is possible that this v2 series may miss some important
features or fixes from their work. Therefore, I would really appreciate
it if everyone could help review this v2 series and point out any
additional fixes or feature support that I may have missed.

Changed in v1:
- Rebased onto v6.19-rc8
- Pick all suggestions and feedbacks from v1 series
- Add cpu hotplug implementation to avoid race enablement
- Move PMU-related definition from header to c file
- Change PMU driver to auxiliary device driver

Changed in RFC:
- Rebase onto v6.13-rc7
- Clear interrupt pending before handling interrupt
- Fix the counter value issue caused by OF bit in the cycle counter.
- Invoke riscv_iommu_hpm_disable() instead of riscv_iommu_pmu_uninit()
  in riscv_iommu_remove()

Zong Li (2):
  drivers/perf: riscv-iommu: add risc-v iommu pmu driver
  iommu/riscv: create a auxiliary device for HPM

 drivers/iommu/riscv/iommu-bits.h |  61 ---
 drivers/iommu/riscv/iommu.c      |  20 +
 drivers/perf/Kconfig             |  12 +
 drivers/perf/Makefile            |   1 +
 drivers/perf/riscv_iommu_pmu.c   | 661 +++++++++++++++++++++++++++++++
 5 files changed, 694 insertions(+), 61 deletions(-)
 create mode 100644 drivers/perf/riscv_iommu_pmu.c

-- 
2.43.7