Re: [RFC PATCH v5 03/10] iommu/riscv: report iommu capabilities

From: fangyu . yu

Date: Thu Oct 29 2026 - 22:49:56 EST


>Hi Fangyu,
>
>> From: Tomasz Jeznach <tjeznach@xxxxxxxxxxxx>
>>
>> Report RISC-V IOMMU capabilities required by VFIO subsystem
>> to enable PCIe device assignment.
>>
>> Signed-off-by: Tomasz Jeznach <tjeznach@xxxxxxxxxxxx>
>> Signed-off-by: Fangyu Yu <fangyu.yu@xxxxxxxxxxxxxxxxx>
>> Reviewed-by: Nutty Liu <nutty.liu@xxxxxxxxxxx>
>
>This patch has already been merged
>https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3069e8f3e1e9bdf007316eadae4d1777065e7b78
>

Thanks for pointing that out. I'll drop this patch in the next version.

Thanks,
Fangyu

>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