[GIT PULL] Please pull IOMMUFD subsystem changes

From: Jason Gunthorpe
Date: Tue Apr 25 2023 - 10:46:31 EST


Hi Linus,

We did not manage to get the VFIO parts ready for this cycle, but it
looks really close now. Here is the stuff still in progress:

- VFIO PCI hot reset support for iommufd:
https://lore.kernel.org/kvm/20230401144429.88673-1-yi.l.liu@xxxxxxxxx/

- VFIO device cdev support to allow exposing all the iommufd features:
https://lore.kernel.org/kvm/20230401151833.124749-1-yi.l.liu@xxxxxxxxx/

- iommufd page table replace operation:
https://lore.kernel.org/kvm/0-v6-fdb604df649a+369-iommufd_alloc_jgg@xxxxxxxxxx/

- IOMMU driver information query:
https://lore.kernel.org/kvm/20230309075358.571567-1-yi.l.liu@xxxxxxxxx/

- Intel VT-d nested translation:
https://lore.kernel.org/kvm/20230309082207.612346-1-yi.l.liu@xxxxxxxxx/

- ARM SMMUv3 nested translation:
https://lore.kernel.org/linux-iommu/cover.1678348754.git.nicolinc@xxxxxxxxxx/

Along with qemu patches implementing iommufd:
https://lore.kernel.org/qemu-devel/20230131205305.2726330-1-eric.auger@xxxxxxxxxx/

And draft patches for the qemu side support for nested translation.

This PR is some small fixes and two preperatory reworks for the above
series.

Thanks,
Jason

The following changes since commit 13a0d1ae7ee6b438f5537711a8c60cba00554943:

iommufd: Do not corrupt the pfn list when doing batch carry (2023-04-04 09:10:55 -0300)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git tags/for-linus-iommufd

for you to fetch changes up to 62e37c86bf0718e1ec0156c7a88a43ced6cdf201:

iommufd/selftest: Cover domain unmap with huge pages and access (2023-04-04 13:11:24 -0300)

----------------------------------------------------------------
iommufd for 6.4

Two series:

- Reorganize how the hardware page table objects are managed,
particularly their destruction flow. Increase the selftest
test coverage in this area by creating a more complete mock
iommu driver.

This is preparation to add a replace operation for HWPT binding,
which is done but waiting for the VFIO parts to complete so there
is a user.

- Split the iommufd support for "access" to make it two step - allocate
an access then link it to an IOAS. Update VFIO and have VFIO always
create an access even for the VFIO mdevs that never do DMA.

This is also preperation for the replace VFIO series that will allow
replace to work on access types as well.

Three minor fixes:

- Sykzaller found the selftest code didn't check for overflow when
processing user VAs

- smatch noted a .data item should have been static

- Add a selftest that reproduces a syzkaller bug for batch carry already
fixed in rc

----------------------------------------------------------------
Jason Gunthorpe (16):
iommufd: Assert devices_lock for iommufd_hw_pagetable_has_group()
iommufd: Add iommufd_lock_obj() around the auto-domains hwpts
iommufd: Consistently manage hwpt_item
iommufd: Move ioas related HWPT destruction into iommufd_hw_pagetable_destroy()
iommufd: Move iommufd_device to iommufd_private.h
iommufd: Make iommufd_hw_pagetable_alloc() do iopt_table_add_domain()
iommufd/selftest: Rename the sefltest 'device_id' to 'stdev_id'
iommufd/selftest: Rename domain_id to stdev_id for FIXTURE iommufd_ioas
iommufd/selftest: Rename domain_id to hwpt_id for FIXTURE iommufd_mock_domain
iommufd/selftest: Rename the remaining mock device_id's to stdev_id
iommufd/selftest: Make selftest create a more complete mock device
iommufd/selftest: Add a selftest for iommufd_device_attach() with a hwpt argument
iommufd/selftest: Catch overflow of uptr and length
Merge branch 'vfio_mdev_ops' into iommufd.git for-next
Merge branch 'iommufd/for-rc' into for-next
iommufd/selftest: Cover domain unmap with huge pages and access

Nicolin Chen (1):
iommufd: Create access in vfio_iommufd_emulated_bind()

Tom Rix (1):
iommufd/selftest: Set varaiable mock_iommu_device storage-class-specifier to static

Yi Liu (5):
iommu/iommufd: Pass iommufd_ctx pointer in iommufd_get_ioas()
vfio-iommufd: No need to record iommufd_ctx in vfio_device
vfio-iommufd: Make vfio_iommufd_emulated_bind() return iommufd_access ID
vfio/mdev: Uses the vfio emulated iommufd ops set in the mdev sample drivers
vfio: Check the presence for iommufd callbacks in __vfio_register_dev()

drivers/iommu/iommufd/device.c | 205 +++++++++------------
drivers/iommu/iommufd/hw_pagetable.c | 70 ++++++--
drivers/iommu/iommufd/ioas.c | 14 +-
drivers/iommu/iommufd/iommufd_private.h | 39 +++-
drivers/iommu/iommufd/iommufd_test.h | 2 +-
drivers/iommu/iommufd/selftest.c | 219 +++++++++++++++++++----
drivers/iommu/iommufd/vfio_compat.c | 2 +-
drivers/vfio/iommufd.c | 37 ++--
drivers/vfio/vfio_main.c | 5 +-
include/linux/iommufd.h | 5 +-
include/linux/vfio.h | 1 -
samples/vfio-mdev/mbochs.c | 3 +
samples/vfio-mdev/mdpy.c | 3 +
samples/vfio-mdev/mtty.c | 3 +
tools/testing/selftests/iommu/iommufd.c | 104 +++++++----
tools/testing/selftests/iommu/iommufd_fail_nth.c | 38 ++--
tools/testing/selftests/iommu/iommufd_utils.h | 16 +-
17 files changed, 494 insertions(+), 272 deletions(-)

Attachment: signature.asc
Description: PGP signature