On Wed, Mar 01, 2023 at 03:30:17PM -0400, Jason Gunthorpe wrote:
As discussed here is a small series to address the confusing lifetime scheme for the hwpt. This was some leftover from prior rework that was never fully cleaned up.
Make it clear that the ioas and ioas->hwpt_list are associated with the hwpt during creation and never changed until it is destroyed. A hwpt with a positive reference count is always valid for device attachment.
This also improves the selftest handling of the mock domains so that we can implement more testing for the hwpt model.
This is a step toward the nesting and replace series.
I have this on github:
https://github.com/jgunthorpe/linux/commits/iommufd_hwpt
v3:
- Split patch to just make the hwpt_item handling consistent
- Remove two confusing comments
- Four new patches to clean up the confusing 'domain_id' in the selftest
v2: https://lore.kernel.org/r/0-v2-406f7ac07936+6a-iommufd_hwpt_jgg@nvidia.com
- Basically completely different
- Add a test for HWPT cases by enhancing the mock iommu driver to be more complete
- Move the device attachment as well into iommufd_hw_pagetable_alloc() so destroy is more symmetric
v1: https://lore.kernel.org/r/0-v1-4336b5cb2fe4+1d7-iommufd_hwpt_jgg@nvidia.com
Applied to iommufd for-next with the noted comment update
Thanks, Jason