[RFC PATCH v5 03/10] iommu/riscv: report iommu capabilities
Gong Shuai
gong.shuai at sanechips.com.cn
Thu Oct 29 19:31:04 PDT 2026
Hi Fangyu,
> From: Tomasz Jeznach <tjeznach at rivosinc.com>
>
> Report RISC-V IOMMU capabilities required by VFIO subsystem
> to enable PCIe device assignment.
>
> Signed-off-by: Tomasz Jeznach <tjeznach at rivosinc.com>
> Signed-off-by: Fangyu Yu <fangyu.yu at linux.alibaba.com>
> Reviewed-by: Nutty Liu <nutty.liu at hotmail.com>
This patch has already been merged
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3069e8f3e1e9bdf007316eadae4d1777065e7b78
Thanks,
Shuai
> ---
> drivers/iommu/riscv/iommu.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/iommu/riscv/iommu.c b/drivers/iommu/riscv/iommu.c
> index fe8e6d0f8a23..40beccedd39f 100644
> --- a/drivers/iommu/riscv/iommu.c
> +++ b/drivers/iommu/riscv/iommu.c
> @@ -1444,6 +1444,16 @@ static struct iommu_group *riscv_iommu_device_group(struct device *dev)
> return generic_device_group(dev);
> }
>
> +static bool riscv_iommu_capable(struct device *dev, enum iommu_cap cap)
> +{
> + switch (cap) {
> + case IOMMU_CAP_CACHE_COHERENCY:
> + return true;
> + default:
> + return false;
> + }
> +}
> +
> static int riscv_iommu_of_xlate(struct device *dev, const struct of_phandle_args *args)
> {
> return iommu_fwspec_add_ids(dev, args->args, 1);
> @@ -1505,6 +1515,7 @@ static void riscv_iommu_release_device(struct device *dev)
>
> static const struct iommu_ops riscv_iommu_ops = {
> .of_xlate = riscv_iommu_of_xlate,
> + .capable = riscv_iommu_capable,
> .identity_domain = &riscv_iommu_identity_domain,
> .blocked_domain = &riscv_iommu_blocking_domain,
> .release_domain = &riscv_iommu_blocking_domain,
> --
> 2.50.1
More information about the kvm-riscv
mailing list