[PATCH v2 00/12] iommu: Prepare to deliver page faults to user space

From: Lu Baolu
Date: Thu Jul 27 2023 - 01:51:35 EST


When a user-managed page table is attached to an IOMMU, it is necessary
to deliver IO page faults to user space so that they can be handled
appropriately. One use case for this is nested translation, which is
currently being discussed in the mailing list.

I have posted a RFC series [1] that describes the implementation of
delivering page faults to user space through IOMMUFD. This series has
received several comments on the IOMMU refactoring, which I have
addressed in this series.

The major refactoring includes:

- [PATCH 01 ~ 03] Move include/uapi/linux/iommu.h to
include/linux/iommu.h. Remove the unrecoverable fault data definition.
- [PATCH 04 ~ 07] Remove iommu_[un]register_device_fault_handler().
- [PATCH 08 ~ 12] Separate SVA and IOPF. Make IOPF a generic page fault
handling framework.

This is also available at github [2]. I would appreciate your feedback
on this series.

[1] https://lore.kernel.org/linux-iommu/20230530053724.232765-1-baolu.lu@xxxxxxxxxxxxxxx/
[2] https://github.com/LuBaolu/intel-iommu/commits/preparatory-io-pgfault-delivery-v2

Change log:
v2:
- Remove unrecoverable fault data definition as suggested by Kevin.
- Drop the per-device fault cookie code considering that doesn't make
much sense for SVA.
- Make the IOMMU page fault handling framework generic. So that it can
avaible for use cases other than SVA.

v1: https://lore.kernel.org/linux-iommu/20230711010642.19707-1-baolu.lu@xxxxxxxxxxxxxxx/

Lu Baolu (12):
iommu: Move iommu fault data to linux/iommu.h
iommu/arm-smmu-v3: Remove unrecoverable faults reporting
iommu: Remove unrecoverable fault data
iommu: Replace device fault handler with iommu_queue_iopf()
iommu: Change the return value of dev_iommu_get()
iommu: Make dev->fault_param static
iommu: Remove iommu_[un]register_device_fault_handler()
iommu: Prepare for separating SVA and IOPF
iommu: Move iopf_handler() to iommu-sva.c
iommu: Make iommu_queue_iopf() more generic
iommu: Separate SVA and IOPF in Makefile and Kconfig
iommu: Add helper to set iopf handler for domain

include/linux/iommu.h | 196 +++++++++++++++---
drivers/iommu/iommu-sva.h | 71 -------
include/uapi/linux/iommu.h | 161 --------------
.../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 14 +-
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 47 ++---
drivers/iommu/intel/iommu.c | 19 +-
drivers/iommu/intel/svm.c | 1 -
drivers/iommu/io-pgfault.c | 90 +++-----
drivers/iommu/iommu-sva.c | 47 ++++-
drivers/iommu/iommu.c | 153 ++++----------
MAINTAINERS | 1 -
drivers/iommu/Kconfig | 4 +
drivers/iommu/Makefile | 3 +-
drivers/iommu/intel/Kconfig | 1 +
14 files changed, 314 insertions(+), 494 deletions(-)
delete mode 100644 drivers/iommu/iommu-sva.h
delete mode 100644 include/uapi/linux/iommu.h

--
2.34.1