[PATCH 3/9] iommu/generic_pt: implement iova_to_phys_length
guanghuifeng at linux.alibaba.com
guanghuifeng at linux.alibaba.com
Tue Jun 2 00:20:05 PDT 2026
在 2026/6/1 7:54, Jason Gunthorpe 写道:
> On Sun, May 31, 2026 at 05:36:31PM +0800, Guanghui Feng wrote:
>> @@ -159,45 +164,51 @@ static __always_inline int __do_iova_to_phys(struct pt_range *range, void *arg,
>> case PT_ENTRY_TABLE:
>> return pt_descend(&pts, arg, descend_fn);
>> case PT_ENTRY_OA:
>> - *res = pt_entry_oa_exact(&pts);
>> + data->phys = pt_entry_oa_exact(&pts);
>> + data->length = BIT(pt_entry_oa_lg2sz(&pts));
> BIT is the wrong function, it uses the wrong type. log2_to_int() is
> type'd properly
>
> This also needs to keep walking and accumulating length for
> consecutive PTEs until it reaches a non-contiguity.
>
> The other drivers don't need to have that complexity.
>
> Jason
pt_entry_oa_lg2sz has already considered continuous PTEs.
Does this mean that multiple PTEs need to be traversed additionally for
consecutive PA address mappings?
More information about the linux-arm-kernel
mailing list