[PATCH v3 4/7] iommu/riscv: Enable IOMMU registration and device probe.
Baolu Lu
baolu.lu at linux.intel.com
Wed May 1 02:53:48 PDT 2024
On 2024/5/1 4:01, Tomasz Jeznach wrote:
> Advertise IOMMU device and its core API.
> Only minimal implementation for single identity domain type, without
> per-group domain protection.
>
> Signed-off-by: Tomasz Jeznach <tjeznach at rivosinc.com>
Reviewed-by: Lu Baolu <baolu.lu at linux.intel.com>
with some nits below.
> ---
> drivers/iommu/riscv/iommu.c | 64 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 64 insertions(+)
[..]
> static int riscv_iommu_init_check(struct riscv_iommu_device *iommu)
> {
> u64 ddtp;
> @@ -71,6 +126,7 @@ static int riscv_iommu_init_check(struct riscv_iommu_device *iommu)
>
> void riscv_iommu_remove(struct riscv_iommu_device *iommu)
> {
> + iommu_device_unregister(&iommu->iommu);
> iommu_device_sysfs_remove(&iommu->iommu);
> }
>
> @@ -96,8 +152,16 @@ int riscv_iommu_init(struct riscv_iommu_device *iommu)
> goto err_sysfs;
> }
>
> + rc = iommu_device_register(&iommu->iommu, &riscv_iommu_ops, iommu->dev);
> + if (rc) {
> + dev_err_probe(iommu->dev, rc, "cannot register iommu interface\n");
> + goto err_iommu;
> + }
> +
> return 0;
>
> +err_iommu:
> + iommu_device_sysfs_remove(&iommu->iommu);
> err_sysfs:
> return rc;
> }
It's better to make the goto label indicate what is going to be handled.
So it's more readable to make it like this:
err_remove_sysfs:
iommu_device_sysfs_remove(&iommu->iommu);
Best regards,
baolu
More information about the linux-riscv
mailing list