iommufd/selftest: Test u64 unaligned bitmaps
Exercise the dirty tracking bitmaps with byte unaligned addresses in addition to the PAGE_SIZE unaligned bitmaps, using a address towards the end of the page boundary. In doing so, increase the tailroom we allocate for the bitmap from MOCK_PAGE_SIZE(2K) into PAGE_SIZE(4K), such that we can test end of bitmap boundary. Link: https://lore.kernel.org/r/20240202133415.23819-4-joao.m.martins@oracle.com Signed-off-by: Joao Martins <joao.m.martins@oracle.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
parent
d18411ec30
commit
42af951145
@ -1741,9 +1741,9 @@ FIXTURE_SETUP(iommufd_dirty_tracking)
|
|||||||
self->bitmap_size =
|
self->bitmap_size =
|
||||||
variant->buffer_size / self->page_size / BITS_PER_BYTE;
|
variant->buffer_size / self->page_size / BITS_PER_BYTE;
|
||||||
|
|
||||||
/* Provision with an extra (MOCK_PAGE_SIZE) for the unaligned case */
|
/* Provision with an extra (PAGE_SIZE) for the unaligned case */
|
||||||
rc = posix_memalign(&self->bitmap, PAGE_SIZE,
|
rc = posix_memalign(&self->bitmap, PAGE_SIZE,
|
||||||
self->bitmap_size + MOCK_PAGE_SIZE);
|
self->bitmap_size + PAGE_SIZE);
|
||||||
assert(!rc);
|
assert(!rc);
|
||||||
assert(self->bitmap);
|
assert(self->bitmap);
|
||||||
assert((uintptr_t)self->bitmap % PAGE_SIZE == 0);
|
assert((uintptr_t)self->bitmap % PAGE_SIZE == 0);
|
||||||
@ -1873,6 +1873,13 @@ TEST_F(iommufd_dirty_tracking, get_dirty_bitmap)
|
|||||||
self->bitmap + MOCK_PAGE_SIZE,
|
self->bitmap + MOCK_PAGE_SIZE,
|
||||||
self->bitmap_size, 0, _metadata);
|
self->bitmap_size, 0, _metadata);
|
||||||
|
|
||||||
|
/* u64 unaligned bitmap */
|
||||||
|
test_mock_dirty_bitmaps(hwpt_id, variant->buffer_size,
|
||||||
|
MOCK_APERTURE_START, self->page_size,
|
||||||
|
self->bitmap + 0xff1,
|
||||||
|
self->bitmap_size, 0, _metadata);
|
||||||
|
|
||||||
|
|
||||||
test_ioctl_destroy(stddev_id);
|
test_ioctl_destroy(stddev_id);
|
||||||
test_ioctl_destroy(hwpt_id);
|
test_ioctl_destroy(hwpt_id);
|
||||||
}
|
}
|
||||||
@ -1907,6 +1914,14 @@ TEST_F(iommufd_dirty_tracking, get_dirty_bitmap_no_clear)
|
|||||||
IOMMU_HWPT_GET_DIRTY_BITMAP_NO_CLEAR,
|
IOMMU_HWPT_GET_DIRTY_BITMAP_NO_CLEAR,
|
||||||
_metadata);
|
_metadata);
|
||||||
|
|
||||||
|
/* u64 unaligned bitmap */
|
||||||
|
test_mock_dirty_bitmaps(hwpt_id, variant->buffer_size,
|
||||||
|
MOCK_APERTURE_START, self->page_size,
|
||||||
|
self->bitmap + 0xff1,
|
||||||
|
self->bitmap_size,
|
||||||
|
IOMMU_HWPT_GET_DIRTY_BITMAP_NO_CLEAR,
|
||||||
|
_metadata);
|
||||||
|
|
||||||
test_ioctl_destroy(stddev_id);
|
test_ioctl_destroy(stddev_id);
|
||||||
test_ioctl_destroy(hwpt_id);
|
test_ioctl_destroy(hwpt_id);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user