RE: [PATCH v5 03/15] iommupt: Add the basic structure of the iommu implementation

Tian, Kevin
2025-09-18T06:58:08Z

> From: Jason Gunthorpe <jgg@nvidia.com>
> Sent: Thursday, September 4, 2025 1:47 AM
>
> +
> +struct pt_iommu_collect_args {
> + struct iommu_pages_list free_list;
> + u8 ignore_mapped : 1;
> +};
> +
> +static int __collect_tables(struct pt_range *range, void *arg,
> + unsigned int level, struct pt_table_p *table)
> +{
> + struct pt_state pts = pt_init(range, level, table);
> + struct pt_iommu_collect_args *collect = arg;
> + int ret;
> +
> + if (collect->ignore_mapped && !pt_can_have_table(&pts))
> + return 0;
> +
> + for_each_pt_level_entry(&pts) {
> + if (pts.type == PT_ENTRY_TABLE) {
> + iommu_pages_list_add(&collect->free_list,
> pts.table_lower);
> + ret = pt_descend(&pts, arg, __collect_tables);
> + if (ret)
> + return ret;
> + continue;
> + }
> + if (pts.type == PT_ENTRY_OA && !collect->ignore_mapped)
> + return -EADDRINUSE;
> + }
> + return 0;
> +}

I don't quite understand the purpose of ignore_mapped here. Could you
mind elaborating it? the only caller always sets it now...