iommufd/selftest: Refactor mock_domain_read_and_clear_dirty()
authorJoao Martins <joao.m.martins@oracle.com>
Fri, 2 Feb 2024 13:34:12 +0000 (13:34 +0000)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 6 Feb 2024 15:31:45 +0000 (11:31 -0400)
commit02a8c61a8b06a4a082b58c3e643b28036c6be60f
tree030721d05f6ef59c436cd2e6961d0af4f1b0fe1a
parent407fc184f0e0bfde61026d6ce3fb1e70a15159a3
iommufd/selftest: Refactor mock_domain_read_and_clear_dirty()

Move the clearing of the dirty bit of the mock domain into
mock_domain_test_and_clear_dirty() helper, simplifying the caller
function.

Additionally, rework the mock_domain_read_and_clear_dirty() loop to
iterate over a potentially variable IO page size. No functional change
intended with the loop refactor.

This is in preparation for dirty tracking support for IOMMU hugepage mock
domains.

Link: https://lore.kernel.org/r/20240202133415.23819-7-joao.m.martins@oracle.com
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/iommu/iommufd/selftest.c