Re: [RFC PATCH 0/2] iommu: Avoid unnecessary PRI queue flushes

2020-10-19 Thread Jacob Pan
Hi Jean-Philippe, On Mon, 19 Oct 2020 16:08:24 +0200, Jean-Philippe Brucker wrote: > On Sat, Oct 17, 2020 at 04:25:25AM -0700, Raj, Ashok wrote: > > > For devices that *don't* use a stop marker, the PCIe spec says > > > (10.4.1.2): > > > > > > To stop [using a PASID] without using a Stop

Re: [PATCH v3 00/14] IOASID extensions for guest SVA

2020-10-19 Thread Jacob Pan
Hi, Any comments on this? I know we have some opens w.r.t. PASID management UAPI, but I think having this common kernel API features should be justified. Thanks! Jacob On Mon, 28 Sep 2020 14:38:27 -0700, Jacob Pan wrote: > IOASID was introduced in v5.5 as a generic kernel allocator serv

[PATCH v3 11/14] iommu/ioasid: Support mm type ioasid_set notifications

2020-09-28 Thread Jacob Pan
-by: Liu Yi L Signed-off-by: Wu Hao Signed-off-by: Jacob Pan --- drivers/iommu/ioasid.c | 117 + include/linux/ioasid.h | 15 +++ 2 files changed, 132 insertions(+) diff --git a/drivers/iommu/ioasid.c b/drivers/iommu/ioasid.c index

[PATCH v3 01/14] docs: Document IO Address Space ID (IOASID) APIs

2020-09-28 Thread Jacob Pan
Signed-off-by: Jacob Pan --- Documentation/driver-api/ioasid.rst | 648 1 file changed, 648 insertions(+) create mode 100644 Documentation/driver-api/ioasid.rst diff --git a/Documentation/driver-api/ioasid.rst b/Documentation/driver-api/ioasid.rst new file

[PATCH v3 12/14] iommu/vt-d: Remove mm reference for guest SVA

2020-09-28 Thread Jacob Pan
Now that IOASID core keeps track of the IOASID to mm_struct ownership in the forms of ioasid_set with IOASID_SET_TYPE_MM token type, there is no need to keep the same mapping in VT-d driver specific data. Native SVM usage is not affected by the change. Signed-off-by: Jacob Pan --- drivers/iommu

[PATCH v3 02/14] iommu/ioasid: Rename ioasid_set_data()

2020-09-28 Thread Jacob Pan
Rename ioasid_set_data() to ioasid_attach_data() to avoid confusion with struct ioasid_set. ioasid_set is a group of IOASIDs that share a common token. Reviewed-by: Jean-Philippe Brucker Signed-off-by: Jacob Pan --- drivers/iommu/intel/svm.c | 6 +++--- drivers/iommu/ioasid.c| 6

[PATCH v3 03/14] iommu/ioasid: Add a separate function for detach data

2020-09-28 Thread Jacob Pan
-by: Jacob Pan --- drivers/iommu/intel/svm.c | 4 ++-- drivers/iommu/ioasid.c| 54 ++- include/linux/ioasid.h| 5 - 3 files changed, 50 insertions(+), 13 deletions(-) diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c index

[PATCH v3 10/14] iommu/ioasid: Introduce notification APIs

2020-09-28 Thread Jacob Pan
/ioasid.rst. Signed-off-by: Liu Yi L Signed-off-by: Wu Hao Signed-off-by: Jacob Pan --- drivers/iommu/ioasid.c | 141 + include/linux/ioasid.h | 57 +++- 2 files changed, 197 insertions(+), 1 deletion(-) diff --git a/drivers/iommu

[PATCH v3 06/14] iommu/ioasid: Introduce API to adjust the quota of an ioasid_set

2020-09-28 Thread Jacob Pan
-wide IOASID pool if the new quota is smaller than the existing one. Signed-off-by: Jacob Pan --- drivers/iommu/ioasid.c | 47 +++ include/linux/ioasid.h | 6 ++ 2 files changed, 53 insertions(+) diff --git a/drivers/iommu/ioasid.c b/drivers/iommu

[PATCH v3 09/14] iommu/ioasid: Introduce ioasid_set private ID

2020-09-28 Thread Jacob Pan
is usually established when a guest page table is bound to a host PASID. Signed-off-by: Jacob Pan --- drivers/iommu/ioasid.c | 102 + include/linux/ioasid.h | 19 + 2 files changed, 121 insertions(+) diff --git a/drivers/iommu/ioasid.c b

[PATCH v3 13/14] iommu/vt-d: Listen to IOASID notifications

2020-09-28 Thread Jacob Pan
registers IOASID notification handler such that IOMMU driver can perform PASID teardown upon receiving an unexpected IOASID free event. Signed-off-by: Jacob Pan --- drivers/iommu/intel/svm.c | 94 - include/linux/intel-iommu.h | 2 + 2 files changed, 94

[PATCH v3 00/14] IOASID extensions for guest SVA

2020-09-28 Thread Jacob Pan
notifications. - Added async work in VT-d driver to perform teardown outside atomic context Jacob Pan (14): docs: Document IO Address Space ID (IOASID) APIs iommu/ioasid: Rename ioasid_set_data() iommu/ioasid: Add a separate function for detach data iommu/ioasid: Support setting system-wide capacity

[PATCH v3 08/14] iommu/ioasid: Add reference couting functions

2020-09-28 Thread Jacob Pan
is cleared. Signed-off-by: Jacob Pan --- drivers/iommu/ioasid.c | 117 + include/linux/ioasid.h | 24 ++ 2 files changed, 141 insertions(+) diff --git a/drivers/iommu/ioasid.c b/drivers/iommu/ioasid.c index 9628e78b2ab4..828cc44b1b1c 100644

[PATCH v3 14/14] iommu/vt-d: Store guest PASID during bind

2020-09-28 Thread Jacob Pan
IOASID core maintains the guest-host mapping in the form of SPID and IOASID. This patch assigns the guest PASID (if valid) as SPID while binding guest page table with a host PASID. This mapping will be used for lookup and notifications. Signed-off-by: Jacob Pan --- drivers/iommu/intel/svm.c | 2

[PATCH v3 04/14] iommu/ioasid: Support setting system-wide capacity

2020-09-28 Thread Jacob Pan
-off-by: Jacob Pan --- drivers/iommu/intel/iommu.c | 5 + drivers/iommu/ioasid.c | 20 include/linux/ioasid.h | 11 +++ 3 files changed, 36 insertions(+) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 18ed3b3c70d7

[PATCH v3 05/14] iommu/ioasid: Redefine IOASID set and allocation APIs

2020-09-28 Thread Jacob Pan
APIs are introduced that wire up these new data. Existing users of IOASID APIs are converted where a host IOASID set is allocated for bare-metal usage. Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- drivers/iommu/intel/iommu.c | 26 +++-- drivers/iommu/intel/pasid.h | 1 + drivers/iommu

[PATCH v3 07/14] iommu/ioasid: Add an iterator API for ioasid_set

2020-09-28 Thread Jacob Pan
on each IOASID. This patch adds an API to iterate all the IOASIDs within the set. Signed-off-by: Jacob Pan --- drivers/iommu/ioasid.c | 17 + include/linux/ioasid.h | 9 + 2 files changed, 26 insertions(+) diff --git a/drivers/iommu/ioasid.c b/drivers/iommu/ioasid.c index

Re: [PATCH v12 0/6] IOMMU user API enhancement

2020-09-28 Thread Jacob Pan
Hi Joerg, Just wondering if you will be able to take this for v5.10? There hasn't been any material changes since we last discussed in LPC. We have VFIO and other vSVA patches depending on it. Thanks! Jacob On Fri, 25 Sep 2020 09:32:41 -0700, Jacob Pan wrote: > IOMMU user API hea

[PATCH v12 1/6] docs: IOMMU user API

2020-09-25 Thread Jacob Pan
extensions should be achieved are also covered in this documentation. Cc: linux-...@vger.kernel.org Cc: Jonathan Corbet Cc: linux-...@vger.kernel.org Reviewed-by: Eric Auger Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- Documentation/userspace-api/iommu.rst | 209

[PATCH v12 0/6] IOMMU user API enhancement

2020-09-25 Thread Jacob Pan
Introduced UAPI doc Jacob Pan (6): docs: IOMMU user API iommu/uapi: Add argsz for user filled data iommu/uapi: Use named union for user data iommu/uapi: Rename uapi functions iommu/uapi: Handle data and argsz filled by users iommu/vt-d: Check UAPI data processed by IOMMU core Doc

[PATCH v12 4/6] iommu/uapi: Rename uapi functions

2020-09-25 Thread Jacob Pan
functions, one called through ioctls, carrying a user pointer and one called directly with valid IOMMU UAPI structs. To differentiate both, let's rename existing functions with an iommu_uapi_ prefix. Suggested-by: Alex Williamson Reviewed-by: Eric Auger Signed-off-by: Jacob Pan --- drivers

[PATCH v12 3/6] iommu/uapi: Use named union for user data

2020-09-25 Thread Jacob Pan
, the minimum size is the offset of the union. To use offsetof() on the union, we must make it named. Link: https://lore.kernel.org/linux-iommu/20200611145518.0c281...@x1.home/ Signed-off-by: Jacob Pan Reviewed-by: Lu Baolu Reviewed-by: Eric Auger --- drivers/iommu/intel/iommu.c | 22

[PATCH v12 6/6] iommu/vt-d: Check UAPI data processed by IOMMU core

2020-09-25 Thread Jacob Pan
- adds check for the use of reserved/undefined flags Signed-off-by: Jacob Pan --- drivers/iommu/intel/iommu.c | 3 +-- drivers/iommu/intel/svm.c | 11 +-- include/uapi/linux/iommu.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b

[PATCH v12 5/6] iommu/uapi: Handle data and argsz filled by users

2020-09-25 Thread Jacob Pan
-Philippe Brucker Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- drivers/iommu/iommu.c | 194 +++-- include/linux/iommu.h | 28 --- include/uapi/linux/iommu.h | 1 + 3 files changed, 207 insertions(+), 16 deletions(-) diff --git a/drivers

[PATCH v12 2/6] iommu/uapi: Add argsz for user filled data

2020-09-25 Thread Jacob Pan
scenarios for user data handling are documented in: Documentation/userspace-api/iommu.rst As there is no current users of the API, struct version is not incremented. Reviewed-by: Eric Auger Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- include/uapi/linux/iommu.h | 12 +--- 1

Re: [PATCH v11 5/6] iommu/uapi: Handle data and argsz filled by users

2020-09-25 Thread Jacob Pan
Hi Jean-Philippe, On Fri, 25 Sep 2020 11:46:36 +0200, Jean-Philippe Brucker wrote: > On Thu, Sep 24, 2020 at 12:24:19PM -0700, Jacob Pan wrote: > > IOMMU user APIs are responsible for processing user data. This patch > > changes the interface such that user pointers can be pa

[PATCH v11 6/6] iommu/vt-d: Check UAPI data processed by IOMMU core

2020-09-24 Thread Jacob Pan
- adds check for the use of reserved/undefined flags Signed-off-by: Jacob Pan --- drivers/iommu/intel/iommu.c | 3 +-- drivers/iommu/intel/svm.c | 11 +-- include/uapi/linux/iommu.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b

[PATCH v11 5/6] iommu/uapi: Handle data and argsz filled by users

2020-09-24 Thread Jacob Pan
Signed-off-by: Jacob Pan --- drivers/iommu/iommu.c | 199 +++-- include/linux/iommu.h | 28 +-- include/uapi/linux/iommu.h | 1 + 3 files changed, 212 insertions(+), 16 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c

[PATCH v11 0/6] IOMMU user API enhancement

2020-09-24 Thread Jacob Pan
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 (6): docs: IOMMU user API iommu

[PATCH v11 4/6] iommu/uapi: Rename uapi functions

2020-09-24 Thread Jacob Pan
functions, one called through ioctls, carrying a user pointer and one called directly with valid IOMMU UAPI structs. To differentiate both, let's rename existing functions with an iommu_uapi_ prefix. Suggested-by: Alex Williamson Reviewed-by: Eric Auger Signed-off-by: Jacob Pan --- drivers

[PATCH v11 1/6] docs: IOMMU user API

2020-09-24 Thread Jacob Pan
extensions should be achieved are also covered in this documentation. Cc: linux-...@vger.kernel.org Cc: Jonathan Corbet Cc: linux-...@vger.kernel.org Reviewed-by: Eric Auger Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- Documentation/userspace-api/iommu.rst | 209

[PATCH v11 2/6] iommu/uapi: Add argsz for user filled data

2020-09-24 Thread Jacob Pan
scenarios for user data handling are documented in: Documentation/userspace-api/iommu.rst As there is no current users of the API, struct version is not incremented. Reviewed-by: Eric Auger Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- include/uapi/linux/iommu.h | 12 +--- 1

[PATCH v11 3/6] iommu/uapi: Use named union for user data

2020-09-24 Thread Jacob Pan
, the minimum size is the offset of the union. To use offsetof() on the union, we must make it named. Link: https://lore.kernel.org/linux-iommu/20200611145518.0c281...@x1.home/ Signed-off-by: Jacob Pan Reviewed-by: Lu Baolu Reviewed-by: Eric Auger --- drivers/iommu/intel/iommu.c | 22

Re: [PATCH v9 3/7] iommu/uapi: Introduce enum type for PASID data format

2020-09-24 Thread Jacob Pan
Hi Joerg, On Thu, 24 Sep 2020 10:40:16 +0200, Joerg Roedel wrote: > > On Fri, 18 Sep 2020 11:44:50 +0200, Joerg Roedel > > wrote: > > > On Fri, Sep 11, 2020 at 02:57:52PM -0700, Jacob Pan wrote: > > > > There can be multiple vendor-specific PASID data format

Re: [PATCH v9 3/7] iommu/uapi: Introduce enum type for PASID data format

2020-09-22 Thread Jacob Pan
Hi Joerg, I sent out v10 with Randy's comments addressed but I didn't change this patch. Does my explanation below make sense? I am hoping to make it in v5.10 since many other pieces depend on it, your guidance is much appreciated. Jacob On Fri, 18 Sep 2020 10:11:08 -0700, Jacob Pan wrote

[PATCH v10 1/7] docs: IOMMU user API

2020-09-22 Thread Jacob Pan
extensions should be achieved are also covered in this documentation. Cc: linux-...@vger.kernel.org Cc: Jonathan Corbet Cc: linux-...@vger.kernel.org Reviewed-by: Eric Auger Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- Documentation/userspace-api/iommu.rst | 210

[PATCH v10 7/7] iommu/vt-d: Check UAPI data processed by IOMMU core

2020-09-22 Thread Jacob Pan
- adds check for the use of reserved/undefined flags Signed-off-by: Jacob Pan --- drivers/iommu/intel/iommu.c | 3 +-- drivers/iommu/intel/svm.c | 11 +-- include/uapi/linux/iommu.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b

[PATCH v10 2/7] iommu/uapi: Add argsz for user filled data

2020-09-22 Thread Jacob Pan
scenarios for user data handling are documented in: Documentation/userspace-api/iommu.rst As there is no current users of the API, struct version is not incremented. Reviewed-by: Eric Auger Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- include/uapi/linux/iommu.h | 12 +--- 1

[PATCH v10 3/7] iommu/uapi: Introduce enum type for PASID data format

2020-09-22 Thread Jacob Pan
There can be multiple vendor-specific PASID data formats used in UAPI structures. This patch adds enum type with a last entry which makes range checking much easier. Suggested-by: Alex Williamson Reviewed-by: Eric Auger Signed-off-by: Jacob Pan --- include/uapi/linux/iommu.h | 8 ++-- 1

[PATCH v10 5/7] iommu/uapi: Rename uapi functions

2020-09-22 Thread Jacob Pan
functions, one called through ioctls, carrying a user pointer and one called directly with valid IOMMU UAPI structs. To differentiate both, let's rename existing functions with an iommu_uapi_ prefix. Suggested-by: Alex Williamson Reviewed-by: Eric Auger Signed-off-by: Jacob Pan --- drivers

[PATCH v10 6/7] iommu/uapi: Handle data and argsz filled by users

2020-09-22 Thread Jacob Pan
Signed-off-by: Jacob Pan --- drivers/iommu/iommu.c | 199 -- include/linux/iommu.h | 28 --- 2 files changed, 211 insertions(+), 16 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 4ae02291ccc2..5c1b7ae48aae 100644

[PATCH v10 4/7] iommu/uapi: Use named union for user data

2020-09-22 Thread Jacob Pan
, the minimum size is the offset of the union. To use offsetof() on the union, we must make it named. Link: https://lore.kernel.org/linux-iommu/20200611145518.0c281...@x1.home/ Signed-off-by: Jacob Pan Reviewed-by: Lu Baolu Reviewed-by: Eric Auger --- drivers/iommu/intel/iommu.c | 22

[PATCH v10 0/7] IOMMU user API enhancement

2020-09-22 Thread Jacob Pan
. 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 (7): docs

Re: [PATCH v9 1/7] docs: IOMMU user API

2020-09-18 Thread Jacob Pan
Hi Randy, Thanks for the review. On Wed, 16 Sep 2020 11:26:00 -0700, Randy Dunlap wrote: > On 9/11/20 2:57 PM, Jacob Pan wrote: > > IOMMU UAPI is newly introduced to support communications between guest > > virtual IOMMU and host IOMMU. There has been lots of discussions on ho

Re: [PATCH v9 0/7] IOMMU user API enhancement

2020-09-18 Thread Jacob Pan
Hi Joerg, On Fri, 18 Sep 2020 12:02:36 +0200, Joerg Roedel wrote: > Hi Jacob, > > On Fri, Sep 11, 2020 at 02:57:49PM -0700, Jacob Pan wrote: > > IOMMU user API header was introduced to support nested DMA translation > > and related fault handling. The current UAPI da

Re: [PATCH v9 3/7] iommu/uapi: Introduce enum type for PASID data format

2020-09-18 Thread Jacob Pan
Hi Joerg, On Fri, 18 Sep 2020 11:44:50 +0200, Joerg Roedel wrote: > On Fri, Sep 11, 2020 at 02:57:52PM -0700, Jacob Pan wrote: > > There can be multiple vendor-specific PASID data formats used in UAPI > > structures. This patch adds enum type with a last entry which makes >

Re: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-09-17 Thread Jacob Pan (Jun)
Hi Jason, On Thu, 17 Sep 2020 11:53:49 +0800, Jason Wang wrote: > On 2020/9/17 上午7:09, Jacob Pan (Jun) wrote: > > Hi Jason, > > On Wed, 16 Sep 2020 15:38:41 -0300, Jason Gunthorpe > > wrote: > > > >> On Wed, Sep 16, 2020 at 11:21:10AM -0700, Jac

Re: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-09-16 Thread Jacob Pan (Jun)
Hi Jason, On Wed, 16 Sep 2020 15:38:41 -0300, Jason Gunthorpe wrote: > On Wed, Sep 16, 2020 at 11:21:10AM -0700, Jacob Pan (Jun) wrote: > > Hi Jason, > > On Wed, 16 Sep 2020 14:01:13 -0300, Jason Gunthorpe > > wrote: > > > > > On Wed, Sep 16, 2020 a

Re: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-09-16 Thread Jacob Pan (Jun)
Hi Jason, On Wed, 16 Sep 2020 14:01:13 -0300, Jason Gunthorpe wrote: > On Wed, Sep 16, 2020 at 09:33:43AM -0700, Raj, Ashok wrote: > > On Wed, Sep 16, 2020 at 12:07:54PM -0300, Jason Gunthorpe wrote: > > > On Tue, Sep 15, 2020 at 05:22:26PM -0700, Jacob Pan (Jun) wrote:

Re: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-09-15 Thread Jacob Pan (Jun)
Hi Jason, On Tue, 15 Sep 2020 20:51:26 -0300, Jason Gunthorpe wrote: > On Tue, Sep 15, 2020 at 03:08:51PM -0700, Jacob Pan wrote: > > > A PASID vIOMMU solution sharable with VDPA and VFIO, based on a > > > PASID control char dev (eg /dev/sva, or maybe /dev/iommu) seems &g

Re: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-09-15 Thread Jacob Pan
Hi Jason, On Tue, 15 Sep 2020 15:45:10 -0300, Jason Gunthorpe wrote: > On Tue, Sep 15, 2020 at 11:11:54AM -0700, Raj, Ashok wrote: > > > PASID applies widely to many device and needs to be introduced with a > > > wide community agreement so all scenarios will be supportable. > > > > True,

[PATCH v9 7/7] iommu/vt-d: Check UAPI data processed by IOMMU core

2020-09-11 Thread Jacob Pan
- adds check for the use of reserved/undefined flags Signed-off-by: Jacob Pan --- drivers/iommu/intel/iommu.c | 3 +-- drivers/iommu/intel/svm.c | 11 +-- include/uapi/linux/iommu.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b

[PATCH v9 6/7] iommu/uapi: Handle data and argsz filled by users

2020-09-11 Thread Jacob Pan
Signed-off-by: Jacob Pan --- drivers/iommu/iommu.c | 199 -- include/linux/iommu.h | 28 --- 2 files changed, 211 insertions(+), 16 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 4ae02291ccc2..5c1b7ae48aae 100644

[PATCH v9 0/7] IOMMU user API enhancement

2020-09-11 Thread Jacob Pan
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 (7): docs: IOMMU user API iommu/uapi: Add argsz for user filled data iommu

[PATCH v9 2/7] iommu/uapi: Add argsz for user filled data

2020-09-11 Thread Jacob Pan
scenarios for user data handling are documented in: Documentation/userspace-api/iommu.rst As there is no current users of the API, struct version is not incremented. Reviewed-by: Eric Auger Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- include/uapi/linux/iommu.h | 12 +--- 1

[PATCH v9 1/7] docs: IOMMU user API

2020-09-11 Thread Jacob Pan
extensions should be achieved are also covered in this documentation. Reviewed-by: Eric Auger Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- Documentation/userspace-api/iommu.rst | 211 ++ MAINTAINERS | 1 + 2 files changed, 212

[PATCH v9 5/7] iommu/uapi: Rename uapi functions

2020-09-11 Thread Jacob Pan
functions, one called through ioctls, carrying a user pointer and one called directly with valid IOMMU UAPI structs. To differentiate both, let's rename existing functions with an iommu_uapi_ prefix. Suggested-by: Alex Williamson Reviewed-by: Eric Auger Signed-off-by: Jacob Pan --- drivers

[PATCH v9 3/7] iommu/uapi: Introduce enum type for PASID data format

2020-09-11 Thread Jacob Pan
There can be multiple vendor-specific PASID data formats used in UAPI structures. This patch adds enum type with a last entry which makes range checking much easier. Suggested-by: Alex Williamson Reviewed-by: Eric Auger Signed-off-by: Jacob Pan --- include/uapi/linux/iommu.h | 8 ++-- 1

[PATCH v9 4/7] iommu/uapi: Use named union for user data

2020-09-11 Thread Jacob Pan
, the minimum size is the offset of the union. To use offsetof() on the union, we must make it named. Link: https://lore.kernel.org/linux-iommu/20200611145518.0c281...@x1.home/ Signed-off-by: Jacob Pan Reviewed-by: Lu Baolu Reviewed-by: Eric Auger --- drivers/iommu/intel/iommu.c | 22

Re: [PATCH v2 9/9] iommu/vt-d: Store guest PASID during bind

2020-09-10 Thread Jacob Pan
On Tue, 1 Sep 2020 19:08:44 +0200 Auger Eric wrote: > Hi Jacob, > On 8/22/20 6:35 AM, Jacob Pan wrote: > > IOASID core maintains the guest-host mapping in the form of SPID and > > IOASID. This patch assigns the guest PASID (if valid) as SPID while > > binding guest page

Re: [PATCH v2 7/9] iommu/vt-d: Listen to IOASID notifications

2020-09-09 Thread Jacob Pan
On Tue, 1 Sep 2020 19:03:23 +0200 Auger Eric wrote: > Hi Jacob, > > On 8/22/20 6:35 AM, Jacob Pan wrote: > > On Intel Scalable I/O Virtualization (SIOV) enabled platforms, IOMMU > > driver is one of the users of IOASIDs. In normal flow, callers will > > perform IOAS

Re: [PATCH v2 6/9] iommu/ioasid: Introduce notification APIs

2020-09-09 Thread Jacob Pan
On Tue, 1 Sep 2020 18:49:38 +0200 Auger Eric wrote: > Hi Jacob, > > On 8/22/20 6:35 AM, Jacob Pan wrote: > > Relations among IOASID users largely follow a publisher-subscriber > > pattern. E.g. to support guest SVA on Intel Scalable I/O > > Virtualization (SIOV) ena

Re: [PATCH v2 6/9] iommu/ioasid: Introduce notification APIs

2020-09-09 Thread Jacob Pan
On Tue, 25 Aug 2020 12:26:17 +0200 Jean-Philippe Brucker wrote: > On Fri, Aug 21, 2020 at 09:35:15PM -0700, Jacob Pan wrote: > > Relations among IOASID users largely follow a publisher-subscriber > > pattern. E.g. to support guest SVA on Intel Scalable I/O > > Virtuali

Re: [PATCH v2 5/9] iommu/ioasid: Introduce ioasid_set private ID

2020-09-08 Thread Jacob Pan
On Tue, 1 Sep 2020 17:38:44 +0200 Auger Eric wrote: > Hi Jacob, > On 8/22/20 6:35 AM, Jacob Pan wrote: > > When an IOASID set is used for guest SVA, each VM will acquire its > > ioasid_set for IOASID allocations. IOASIDs within the VM must have a > > host/physical IOASID

Re: [PATCH v2 5/9] iommu/ioasid: Introduce ioasid_set private ID

2020-09-08 Thread Jacob Pan
On Tue, 25 Aug 2020 12:22:09 +0200 Jean-Philippe Brucker wrote: > On Fri, Aug 21, 2020 at 09:35:14PM -0700, Jacob Pan wrote: > > When an IOASID set is used for guest SVA, each VM will acquire its > > ioasid_set for IOASID allocations. IOASIDs within the VM must have a > >

Re: [PATCH v2 4/9] iommu/ioasid: Add reference couting functions

2020-09-08 Thread Jacob Pan
On Tue, 1 Sep 2020 14:13:00 +0200 Auger Eric wrote: > Hi Jacob, > > On 8/22/20 6:35 AM, Jacob Pan wrote: > > There can be multiple users of an IOASID, each user could have > > hardware contexts associated with the IOASID. In order to align > > lifecycles, refer

Re: [PATCH v2 4/9] iommu/ioasid: Add reference couting functions

2020-09-08 Thread Jacob Pan
On Tue, 25 Aug 2020 12:19:37 +0200 Jean-Philippe Brucker wrote: > On Fri, Aug 21, 2020 at 09:35:13PM -0700, Jacob Pan wrote: > > There can be multiple users of an IOASID, each user could have > > hardware contexts associated with the IOASID. In order to align > > lifecycle

Re: [PATCH v8 0/7] IOMMU user API enhancement

2020-09-08 Thread Jacob Pan
Hi Joerg, Alex, and all. Just wondering if there are any more comments? We have discussed this at LPC, there are other patches depending on this set. Thanks, Jacob On Mon, 31 Aug 2020 11:24:53 -0700 Jacob Pan wrote: > IOMMU user API header was introduced to support nested DMA > trans

Re: [PATCH v2 1/9] docs: Document IO Address Space ID (IOASID) APIs

2020-09-08 Thread Jacob Pan
On Mon, 7 Sep 2020 10:03:39 +0200 Auger Eric wrote: > Hi Jacob, > > On 9/1/20 6:56 PM, Jacob Pan wrote: > > Hi Eric, > > > > On Thu, 27 Aug 2020 18:21:07 +0200 > > Auger Eric wrote: > > > >> Hi Jacob, > >> On 8/24/20 12:32 PM, Jean-P

Re: [PATCH v2 3/9] iommu/ioasid: Introduce ioasid_set APIs

2020-09-03 Thread Jacob Pan
On Tue, 1 Sep 2020 13:51:26 +0200 Auger Eric wrote: > Hi Jacob, > > On 8/22/20 6:35 AM, Jacob Pan wrote: > > ioasid_set was introduced as an arbitrary token that are shared by > > a > that is got it > > group of IOASIDs. For example, if IOASID #1 and #2

Re: [PATCH v2 3/9] iommu/ioasid: Introduce ioasid_set APIs

2020-09-02 Thread Jacob Pan
>> + * @ref: Reference count of the users > >> + */ > >> struct ioasid_set { > >> - int dummy; > >> + void *token; > >> + struct xarray xa; > >> + int type; > >> + int quota; > >> + int nr_ioasids; > >&

Re: [PATCH v2 3/9] iommu/ioasid: Introduce ioasid_set APIs

2020-09-02 Thread Jacob Pan
On Mon, 24 Aug 2020 11:30:47 -0700 Randy Dunlap wrote: > On 8/24/20 11:28 AM, Jean-Philippe Brucker wrote: > >> +/** > >> + * struct ioasid_data - Meta data about ioasid > >> + * > >> + * @id: Unique ID > >> + * @users Number of active users > >> + * @state Track state of the IOASID >

Re: [PATCH v2 3/9] iommu/ioasid: Introduce ioasid_set APIs

2020-09-02 Thread Jacob Pan
On Mon, 24 Aug 2020 20:28:48 +0200 Jean-Philippe Brucker wrote: > On Fri, Aug 21, 2020 at 09:35:12PM -0700, Jacob Pan wrote: > > ioasid_set was introduced as an arbitrary token that are shared by a > > group of IOASIDs. For example, if IOASID #1 and #2 are allocated > > vi

Re: [PATCH v2 3/9] iommu/ioasid: Introduce ioasid_set APIs

2020-09-01 Thread Jacob Pan
On Mon, 24 Aug 2020 10:24:11 +0800 Lu Baolu wrote: > Hi Jacob, > > On 8/22/20 12:35 PM, Jacob Pan wrote: > > ioasid_set was introduced as an arbitrary token that are shared by a > > group of IOASIDs. For example, if IOASID #1 and #2 are allocated > > via the same i

Re: [PATCH v2 1/9] docs: Document IO Address Space ID (IOASID) APIs

2020-09-01 Thread Jacob Pan
Hi Eric, On Thu, 27 Aug 2020 18:21:07 +0200 Auger Eric wrote: > Hi Jacob, > On 8/24/20 12:32 PM, Jean-Philippe Brucker wrote: > > On Fri, Aug 21, 2020 at 09:35:10PM -0700, Jacob Pan wrote: > >> IOASID is used to identify address spaces that can be targeted by > >&

[PATCH v8 6/7] iommu/uapi: Handle data and argsz filled by users

2020-08-31 Thread Jacob Pan
Signed-off-by: Jacob Pan --- drivers/iommu/iommu.c | 201 -- include/linux/iommu.h | 28 --- 2 files changed, 212 insertions(+), 17 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 4ae02291ccc2..3bc263ae31ed 100644

[PATCH v8 3/7] iommu/uapi: Introduce enum type for PASID data format

2020-08-31 Thread Jacob Pan
There can be multiple vendor-specific PASID data formats used in UAPI structures. This patch adds enum type with a last entry which makes range checking much easier. Suggested-by: Alex Williamson Reviewed-by: Eric Auger Signed-off-by: Jacob Pan --- include/uapi/linux/iommu.h | 8 ++-- 1

[PATCH v8 2/7] iommu/uapi: Add argsz for user filled data

2020-08-31 Thread Jacob Pan
scenarios for user data handling are documented in: Documentation/userspace-api/iommu.rst As there is no current users of the API, struct version is not incremented. Reviewed-by: Eric Auger Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- include/uapi/linux/iommu.h | 12 +--- 1

[PATCH v8 4/7] iommu/uapi: Use named union for user data

2020-08-31 Thread Jacob Pan
, the minimum size is the offset of the union. To use offsetof() on the union, we must make it named. Link: https://lore.kernel.org/linux-iommu/20200611145518.0c281...@x1.home/ Signed-off-by: Jacob Pan Reviewed-by: Lu Baolu Reviewed-by: Eric Auger --- drivers/iommu/intel/iommu.c | 22

[PATCH v8 7/7] iommu/vt-d: Check UAPI data processed by IOMMU core

2020-08-31 Thread Jacob Pan
- adds check for the use of reserved/undefined flags Signed-off-by: Jacob Pan --- drivers/iommu/intel/iommu.c | 3 +-- drivers/iommu/intel/svm.c | 11 +-- include/uapi/linux/iommu.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b

[PATCH v8 1/7] docs: IOMMU user API

2020-08-31 Thread Jacob Pan
extensions should be achieved are also covered in this documentation. Reviewed-by: Eric Auger Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- Documentation/userspace-api/iommu.rst | 211 ++ MAINTAINERS | 1 + 2 files changed, 212

[PATCH v8 5/7] iommu/uapi: Rename uapi functions

2020-08-31 Thread Jacob Pan
functions, one called through ioctls, carrying a user pointer and one called directly with valid IOMMU UAPI structs. To differentiate both, let's rename existing functions with an iommu_uapi_ prefix. Suggested-by: Alex Williamson Reviewed-by: Eric Auger Signed-off-by: Jacob Pan --- drivers

[PATCH v8 0/7] IOMMU user API enhancement

2020-08-31 Thread Jacob Pan
- Introduced argsz for each UAPI data - Introduced UAPI doc Jacob Pan (7): docs: IOMMU user API iommu/uapi: Add argsz for user filled data iommu/uapi: Introduce enum type for PASID data format iommu/uapi: Use named union for user data iommu/uapi: Rename uapi functions iommu/uapi

Re: [PATCH v7 7/7] iommu/vt-d: Check UAPI data processed by IOMMU core

2020-08-31 Thread Jacob Pan
On Thu, 13 Aug 2020 11:19:46 +0200 Auger Eric wrote: > Hi Jacob, > > On 7/30/20 2:21 AM, Jacob Pan wrote: > > IOMMU generic layer already does sanity checks UAPI data for version > > match and argsz range under generic information. > > Remove the redundant ver

Re: [PATCH v2 1/9] docs: Document IO Address Space ID (IOASID) APIs

2020-08-28 Thread Jacob Pan
Hi Jean, Thanks for the review! On Mon, 24 Aug 2020 12:32:39 +0200 Jean-Philippe Brucker wrote: > On Fri, Aug 21, 2020 at 09:35:10PM -0700, Jacob Pan wrote: > > IOASID is used to identify address spaces that can be targeted by > > device DMA. It is a system-wide resource th

Re: [PATCH v2 1/9] docs: Document IO Address Space ID (IOASID) APIs

2020-08-28 Thread Jacob Pan
Hi Baolu, Thanks for the review! On Sun, 23 Aug 2020 15:05:08 +0800 Lu Baolu wrote: > Hi Jacob, > > On 2020/8/22 12:35, Jacob Pan wrote: > > IOASID is used to identify address spaces that can be targeted by > > device DMA. It is a system-wide resource that is essential

[PATCH v2 8/9] iommu/vt-d: Send IOASID bind/unbind notifications

2020-08-22 Thread Jacob Pan
time. This patch adds a notification event to the IOMMU driver such that KVM can be notified when a new guest-host PASID mapping is established or demolished. Signed-off-by: Jacob Pan --- drivers/iommu/intel/svm.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/iommu/intel

[PATCH v2 2/9] iommu/ioasid: Rename ioasid_set_data()

2020-08-22 Thread Jacob Pan
Rename ioasid_set_data() to ioasid_attach_data() to avoid confusion with struct ioasid_set. ioasid_set is a group of IOASIDs that share a common token. Signed-off-by: Jacob Pan --- drivers/iommu/intel/svm.c | 6 +++--- drivers/iommu/ioasid.c| 6 +++--- include/linux/ioasid.h| 4 ++-- 3

[PATCH v2 0/9] IOASID extensions for guest SVA

2020-08-22 Thread Jacob Pan
- Added set private ID (SPID) for guest PASID usage. - Add per ioasid_set notification and priority support. - Back to use spinlocks and atomic notifications. - Added async work in VT-d driver to perform teardown outside atomic context Jacob Pan (9): docs: Document IO Address Space ID (IOASID) APIs

[PATCH v2 1/9] docs: Document IO Address Space ID (IOASID) APIs

2020-08-22 Thread Jacob Pan
) enabled platforms are the primary users of IOASID. Examples of how SIOV components interact with IOASID APIs are provided in that many APIs are driven by the requirements from SIOV. Signed-off-by: Liu Yi L Signed-off-by: Wu Hao Signed-off-by: Jacob Pan --- Documentation/ioasid.rst | 618

[PATCH v2 4/9] iommu/ioasid: Add reference couting functions

2020-08-22 Thread Jacob Pan
is cleared. Signed-off-by: Jacob Pan --- drivers/iommu/ioasid.c | 113 + include/linux/ioasid.h | 4 ++ 2 files changed, 117 insertions(+) diff --git a/drivers/iommu/ioasid.c b/drivers/iommu/ioasid.c index f73b3dbfc37a..5f31d63c75b1 100644

[PATCH v2 3/9] iommu/ioasid: Introduce ioasid_set APIs

2020-08-22 Thread Jacob Pan
but with optional types ioasid_set level APIs are introduced that wires up these new data. Existing users of IOASID APIs are converted where a host IOASID set is allocated for bare-metal usage. Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- drivers/iommu/intel/iommu.c | 27 ++- drivers/iommu/intel

[PATCH v2 9/9] iommu/vt-d: Store guest PASID during bind

2020-08-22 Thread Jacob Pan
IOASID core maintains the guest-host mapping in the form of SPID and IOASID. This patch assigns the guest PASID (if valid) as SPID while binding guest page table with a host PASID. This mapping will be used for lookup and notifications. Signed-off-by: Jacob Pan --- drivers/iommu/intel/svm.c | 2

[PATCH v2 7/9] iommu/vt-d: Listen to IOASID notifications

2020-08-22 Thread Jacob Pan
registers IOASID notification handler such that IOMMU driver can perform PASID teardown upon receiving an unexpected IOASID free event. Signed-off-by: Jacob Pan --- drivers/iommu/intel/svm.c | 74 - include/linux/intel-iommu.h | 2 ++ 2 files changed, 75

[PATCH v2 5/9] iommu/ioasid: Introduce ioasid_set private ID

2020-08-22 Thread Jacob Pan
is usually established when a guest page table is bound to a host PASID. Signed-off-by: Jacob Pan --- drivers/iommu/ioasid.c | 54 ++ include/linux/ioasid.h | 12 +++ 2 files changed, 66 insertions(+) diff --git a/drivers/iommu/ioasid.c b

[PATCH v2 6/9] iommu/ioasid: Introduce notification APIs

2020-08-22 Thread Jacob Pan
/ioasid.rst. Signed-off-by: Liu Yi L Signed-off-by: Wu Hao Signed-off-by: Jacob Pan --- drivers/iommu/ioasid.c | 280 - include/linux/ioasid.h | 70 + 2 files changed, 348 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/ioasid.c b

Re: [PATCH v6 02/15] iommu: Report domain nesting info

2020-08-17 Thread Jacob Pan
FIO_TYPE1_NESTING_IOMMU. > >> This is not what this patch does ;-) It introduces a new IOMMU UAPI > >> struct that gives information about the nesting capabilities and > >> features. This struct is supposed to be returned by > >> iommu_domain_get_attr() with DOMAIN_A

Re: [PATCH v7 5/7] iommu/uapi: Rename uapi functions

2020-08-17 Thread Jacob Pan
On Thu, 13 Aug 2020 10:58:53 +0200 Auger Eric wrote: > Hi Jacob, > > On 7/30/20 2:21 AM, Jacob Pan wrote: > > User APIs such as iommu_sva_unbind_gpasid() may also be used by the > > kernel. Since we introduced user pointer to the UAPI functions, > Practically this i

Re: [PATCH v7 2/7] iommu/uapi: Add argsz for user filled data

2020-08-17 Thread Jacob Pan
On Wed, 12 Aug 2020 18:59:14 +0200 Auger Eric wrote: > Hi, > > On 7/30/20 2:21 AM, Jacob Pan wrote: > > As IOMMU UAPI gets extended, user data size may increase. To support > > backward compatibiliy, this patch introduces a size field to each > > UAPI > s/compa

Re: [PATCH v7 1/7] docs: IOMMU user API

2020-08-17 Thread Jacob Pan
On Wed, 12 Aug 2020 18:38:50 +0200 Auger Eric wrote: > Hi Jacob, > > On 7/30/20 2:21 AM, Jacob Pan wrote: > > IOMMU UAPI is newly introduced to support communications between > > guest virtual IOMMU and host IOMMU. There has been lots of > > discussions on how it

  1   2   3   4   5   6   7   8   9   10   >