[PATCH v2 0/3] IOMMU user API enhancement

From: Jacob Pan
Date: Wed Mar 25 2020 - 19:11:27 EST


IOMMU user API header was introduced to support nested DMA translation and
related fault handling. The current UAPI data structures consist of three
areas that cover the interactions between host kernel and guest:
- fault handling
- cache invalidation
- bind guest page tables, i.e. guest PASID

With future extensions in mind, the UAPI structures passed from user to kernel
always starts with a mandatory version field (u32). While this is flexible
for extensions of individual structures, it is difficult to maintain support
of combinations of version numbers.

This patchset introduces a unified UAPI version number that governs all the
UAPI data structure versions. When userspace query UAPI version for check on
compatibility, a single match would be sufficient.

After UAPI version check, users such as VFIO can also retrieve the matching
data structure size based on version and type. Kernel IOMMU UAPI support is
always backward compatible. Data structures are also only open to extension
and closed to modifications.

The introduction of UAPI version does not change the existing UAPI but rather
simplify the data structure version and size matching.

Changelog:
- v2 Rewrite the extension rules that disallows adding new members at the end
of each UAPI data structures. Only padding bytes and union can be extended.
Clarified size look up array extension rules with examples.

Thanks,

Jacob


Jacob Pan (3):
iommu/uapi: Define uapi version and capabilities
iommu/uapi: Use unified UAPI version
iommu/uapi: Add helper function for size lookup

drivers/iommu/intel-iommu.c | 3 +-
drivers/iommu/intel-svm.c | 2 +-
drivers/iommu/iommu.c | 75 ++++++++++++++++++++++++++++++++++++++++++++-
include/linux/iommu.h | 6 ++++
include/uapi/linux/iommu.h | 62 +++++++++++++++++++++++++++++++++----
5 files changed, 139 insertions(+), 9 deletions(-)

--
2.7.4