iommufd/iova_bitmap: Switch iova_bitmap::bitmap to an u8 array
authorJoao Martins <joao.m.martins@oracle.com>
Fri, 2 Feb 2024 13:34:08 +0000 (13:34 +0000)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 6 Feb 2024 15:31:45 +0000 (11:31 -0400)
commitd18411ec305728c6371806c4fb09be07016aad0b
tree22496564af0a18b7c7d3d48e7721b7a9fb0729eb
parenta4ab7dedaee0e39b15653c5fd0367e420739f7ef
iommufd/iova_bitmap: Switch iova_bitmap::bitmap to an u8 array

iova_bitmap_mapped_length() don't deal correctly with the small bitmaps
(< 2M bitmaps) when the starting address isn't u64 aligned, leading to
skipping a tiny part of the IOVA range. This is materialized as not
marking data dirty that should otherwise have been.

Fix that by using a u8 * in the internal state of IOVA bitmap. Most of the
data structures use the type of the bitmap to adjust its indexes, thus
changing the type of the bitmap decreases the granularity of the bitmap
indexes.

Fixes: b058ea3ab5af ("vfio/iova_bitmap: refactor iova_bitmap_set() to better handle page boundaries")
Link: https://lore.kernel.org/r/20240202133415.23819-3-joao.m.martins@oracle.com
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Tested-by: Avihai Horon <avihaih@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/iommu/iommufd/iova_bitmap.c