[PATCH v3 3/8] iommu/riscv: Add HPM support for performance monitoring
Zong Li
zong.li at sifive.com
Wed Feb 4 18:11:26 PST 2026
On Thu, Feb 5, 2026 at 2:39 AM Andrew Jones
<andrew.jones at oss.qualcomm.com> wrote:
>
> How does this relate to
>
> https://lore.kernel.org/all/20250115030306.29735-1-zong.li@sifive.com/
>
> From a quick skim it looks like there's plenty of overlap.
>
> Thanks,
> drew
>
Hi all,
Thanks Andrew for bringing me here, and sorry for the long delay on
the IOMMU PMU driver series.
I’m currently working on the next version to incorporate the feedback
from my earlier series. The main goals are to decouple the IOMMU perf
driver from the IOMMU driver itself, and to make it easier to add
custom events.
The implementation is almost done, but I’m still working on binding a
name between the PMU driver with the IOMMU driver on PCIe and ACPI
cases. This part is related to how custom events should be added.
That said, I’m thinking that I could submit the current implementation
first, and then send a separate patch series later to handle the
custom event support.
Also, I’d like to mention that Yaxing has a similar implementation. We
had some discussion about this last month.
https://lore.kernel.org/linux-iommu/2ce9d8be-10b3-48dd-b99e-7358347fc171@bosc.ac.cn/
I think I should be able to submit this next week.
Thanks,
>
> On Wed, Feb 04, 2026 at 05:09:01PM +0800, Lv Zheng wrote:
> > From: Jingyu Li <joey.li at spacemit.com>
> >
> > Introduces perf-based HPM driver for RISC-V IOMMU, enabling performance
> > monitoring capabilities.
> >
> > Note that the RISC-V IOMMU HPM module uses COUNTER_MAX-1 as a static
> > counter index of HPMCYCLES, and 0~COUNTER_MAX-2 as the dynamic counter
> > indexes of other HPMEVENTS in order to correctly index into IOHPMEVT and
> > IOHPMCTR registers that have already been defined in the iommu-bits.h.
> > However the users treat 0 as the index of HPMCYCLES and 1~COUNTER_MAX-1 as
> > the indexes of other HPMEVENTS, thus care should be taken in dealing with
> > counter indexes between userspace and kernel space.
> >
> > Signed-off-by: Jingyu Li <joey.li at spacemit.com>
> > Signed-off-by: Lv Zheng <lv.zheng at linux.spacemit.com>
> > Link: https://github.com/riscv-non-isa/riscv-iommu
> > ---
> > drivers/iommu/riscv/Kconfig | 9 +
> > drivers/iommu/riscv/Makefile | 1 +
> > drivers/iommu/riscv/iommu-bits.h | 6 +
> > drivers/iommu/riscv/iommu-hpm.c | 843 +++++++++++++++++++++++++++
> > drivers/iommu/riscv/iommu-pci.c | 13 +-
> > drivers/iommu/riscv/iommu-platform.c | 8 +-
> > drivers/iommu/riscv/iommu.h | 42 ++
> > 7 files changed, 919 insertions(+), 3 deletions(-)
> > create mode 100644 drivers/iommu/riscv/iommu-hpm.c
> >
More information about the linux-riscv
mailing list