[PATCH v1 3/3] iommu/riscv: Register RISC-V IOMMU PMU at init time
Yaxing Guo
guoyaxing at bosc.ac.cn
Sun Sep 14 19:09:11 PDT 2025
Register the RISC-V IOMMU driver during IOMMU driver
initialization.
Signed-off-by: Yaxing Guo <guoyaxing at bosc.ac.cn>
---
drivers/iommu/riscv/iommu.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/iommu/riscv/iommu.c b/drivers/iommu/riscv/iommu.c
index 0eae2f4bdc5e..453d04b03c6c 100644
--- a/drivers/iommu/riscv/iommu.c
+++ b/drivers/iommu/riscv/iommu.c
@@ -23,6 +23,7 @@
#include "../iommu-pages.h"
#include "iommu-bits.h"
#include "iommu.h"
+#include "iommu-perf.h"
/* Timeouts in [us] */
#define RISCV_IOMMU_QCSR_TIMEOUT 150000
@@ -1604,6 +1605,7 @@ void riscv_iommu_remove(struct riscv_iommu_device *iommu)
riscv_iommu_iodir_set_mode(iommu, RISCV_IOMMU_DDTP_IOMMU_MODE_OFF);
riscv_iommu_queue_disable(&iommu->cmdq);
riscv_iommu_queue_disable(&iommu->fltq);
+ riscv_iommu_pmu_unregister(iommu);
}
int riscv_iommu_init(struct riscv_iommu_device *iommu)
@@ -1656,6 +1658,14 @@ int riscv_iommu_init(struct riscv_iommu_device *iommu)
goto err_remove_sysfs;
}
+ rc = riscv_iommu_pmu_alloc(iommu);
+ if (rc) {
+ dev_err(iommu->dev, "cannot alloc iommu pmu (%d)\n", rc);
+ iommu_device_sysfs_remove(&iommu->iommu);
+ goto err_remove_sysfs;
+ }
+ riscv_iommu_pmu_register(iommu);
+
return 0;
err_remove_sysfs:
--
2.34.1
More information about the linux-riscv
mailing list