[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1594925117-64892-1-git-send-email-jacob.jun.pan@linux.intel.com>
Date: Thu, 16 Jul 2020 11:45:12 -0700
From: Jacob Pan <jacob.jun.pan@...ux.intel.com>
To: iommu@...ts.linux-foundation.org,
LKML <linux-kernel@...r.kernel.org>,
Joerg Roedel <joro@...tes.org>,
Alex Williamson <alex.williamson@...hat.com>
Cc: "Lu Baolu" <baolu.lu@...ux.intel.com>,
David Woodhouse <dwmw2@...radead.org>,
Yi Liu <yi.l.liu@...el.com>,
"Tian, Kevin" <kevin.tian@...el.com>,
Raj Ashok <ashok.raj@...el.com>,
"Christoph Hellwig" <hch@...radead.org>,
Jean-Philippe Brucker <jean-philippe@...aro.com>,
Eric Auger <eric.auger@...hat.com>,
Jonathan Corbet <corbet@....net>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>
Subject: [PATCH v5 0/5] IOMMU user API enhancement
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
Future extensions are likely to support more architectures and vIOMMU features.
In the previous discussion, using user-filled data size and feature flags is
made a preferred approach over a unified version number.
https://lkml.org/lkml/2020/1/29/45
In addition to introduce argsz field to data structures, this patchset is also
trying to document the UAPI design, usage, and extension rules. VT-d driver
changes to utilize the new argsz field is included, VFIO usage is to follow.
Thanks,
Jacob
Changeog:
v5
- Addjusted paddings in UAPI data to be 8 byte aligned
- Do not clobber argsz in IOMMU core before passing on to vendor driver
- Removed pr_warn_ for invalid UAPI data check, just return -EINVAL
- Clarified VFIO responsibility in UAPI data handling
- Use iommu_uapi prefix to differentiate APIs has in-kernel caller
- Added comment for unchecked flags of invalidation granularity
- Added example in doc to show vendor data checking
v4
- Added checks of UAPI data for reserved fields, version, and flags.
- Removed version check from vendor driver (vt-d)
- Relaxed argsz check to match the UAPI struct size instead of variable
union size
- Updated documentation
v3:
- Rewrote backward compatibility rule to support existing code
re-compiled with newer kernel UAPI header that runs on older
kernel. Based on review comment from Alex W.
https://lore.kernel.org/linux-iommu/20200611094741.6d118fa8@w520.home/
- Take user pointer directly in UAPI functions. Perform argsz check
and copy_from_user() in IOMMU driver. Eliminate the need for
VFIO or other upper layer to parse IOMMU data.
- Create wrapper function for in-kernel users of UAPI functions
v2:
- Removed unified API version and helper
- Introduced argsz for each UAPI data
- Introduced UAPI doc
Jacob Pan (5):
docs: IOMMU user API
iommu/uapi: Add argsz for user filled data
iommu/uapi: Use named union for user data
iommu/uapi: Handle data and argsz filled by users
iommu/vt-d: Check UAPI data processed by IOMMU core
Documentation/userspace-api/iommu.rst | 338 ++++++++++++++++++++++++++++++++++
drivers/iommu/intel/iommu.c | 27 ++-
drivers/iommu/intel/svm.c | 9 +-
drivers/iommu/iommu.c | 192 ++++++++++++++++++-
include/linux/iommu.h | 20 +-
include/uapi/linux/iommu.h | 16 +-
6 files changed, 568 insertions(+), 34 deletions(-)
create mode 100644 Documentation/userspace-api/iommu.rst
--
2.7.4
Powered by blists - more mailing lists