On Fri, Jul 18, 2025 at 11:50:30AM -0700, Nicolin Chen wrote:
0xfffffffffff80001 and 0x50000 could repro with 64K pages, exactly what your math works :)
Okay, I was also worried we'd get into trouble with how iova_alignment might be working but if it's fine lets do this then:
@@ -975,18 +975,24 @@ TEST_F(iommufd_ioas, reserved_overflow) .size = sizeof(test_cmd), .op = IOMMU_TEST_OP_ADD_RESERVED, .id = self->ioas_id, - .add_reserved = { .start = 6, - .length = 0xffffffffffff8001 }, + .add_reserved.start = 6, }; + unsigned int map_len; __u64 iova;
- if (PAGE_SIZE != 4096) - SKIP(return, "Test requires 4k PAGE_SIZE"); + if (PAGE_SIZE == 4096) { + test_cmd.add_reserved.length = 0xffffffffffff8001; + map_len = 0x5000; + } else { + test_cmd.add_reserved.length = + 0xffffffffffffffff - MOCK_PAGE_SIZE * 16; + map_len = MOCK_PAGE_SIZE * 10; + }
ASSERT_EQ(0, ioctl(self->fd, _IOMMU_TEST_CMD(IOMMU_TEST_OP_ADD_RESERVED), &test_cmd)); - test_err_ioctl_ioas_map(ENOSPC, buffer, 0x5000, &iova); + test_err_ioctl_ioas_map(ENOSPC, buffer, map_len, &iova); }
TEST_F(iommufd_ioas, area_allowed)
Thanks, Jason