在 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

Intel, AMD, and SMMU implement continuous PTEs differently. Furthermore,

if the range covered by returning all adjacent continuous PTEs exceeds the

scope of the query operation, more safety checks and judgments are needed

(e.g., distinguishing between partial unmapped PTEs and multiple consecutive

continuous PTEs that can be safely partially unmapped). More modifications

and judgments are required.

Therefore, currently only the PTE mapping size of the iova is returned.

The current commit has a large number of changes; this issue will be fixed

in a subsequent series patch.

Reply via email to