Re: [PATCH v2 1/3] iommu/uapi: Define uapi version and capabilities

2020-04-14 Thread Jacob Pan
On Tue, 14 Apr 2020 10:13:04 -0700 Jacob Pan wrote: > > > > In any of the proposed solutions, the > > > > IOMMU driver is ultimately responsible for validating the user > > > > data, so do we want vfio performing the copy_from_user() to an > > &g

Re: [PATCH v11 01/13] iommu: Introduce attach/detach_pasid_table API

2020-04-14 Thread Jacob Pan
ta. If argsz <= minsz, kernel can support the attach_table but must process the data based on flags or config. Does it make sense to you? On Tue, 14 Apr 2020 17:05:55 +0200 Eric Auger wrote: > From: Jacob Pan > > In virtualization use case, when a guest is assigned > a PCI host dev

Re: [PATCH v2 1/3] iommu/uapi: Define uapi version and capabilities

2020-04-14 Thread Jacob Pan
On Tue, 14 Apr 2020 10:13:58 -0600 Alex Williamson wrote: > On Mon, 13 Apr 2020 22:05:15 -0700 > Jacob Pan wrote: > > > Hi Alex, > > Thanks a lot for the feedback, my comments inline. > > > > On Mon, 13 Apr 2020 16:21:29 -0600 > > Alex Williamson wrote:

Re: [PATCH v2 1/3] iommu/uapi: Define uapi version and capabilities

2020-04-14 Thread Jacob Pan
On Tue, 14 Apr 2020 01:11:07 -0700 Christoph Hellwig wrote: > On Mon, Apr 13, 2020 at 01:41:57PM -0700, Jacob Pan wrote: > > Hi All, > > > > Just a gentle reminder, any feedback on the options I listed below? > > New ideas will be even better. > > > > Chr

Re: [PATCH v2 1/3] iommu/uapi: Define uapi version and capabilities

2020-04-13 Thread Jacob Pan
Hi Alex, Thanks a lot for the feedback, my comments inline. On Mon, 13 Apr 2020 16:21:29 -0600 Alex Williamson wrote: > On Mon, 13 Apr 2020 13:41:57 -0700 > Jacob Pan wrote: > > > Hi All, > > > > Just a gentle reminder, any feedback on the options I listed below?

Re: [PATCH 05/10] iommu/ioasid: Create an IOASID set for host SVA use

2020-04-13 Thread Jacob Pan
Hi Jean, Sorry for the delay, I have to do some research based on your feedback. I also plan to document this in the next version. On Tue, 7 Apr 2020 13:01:46 +0200 Jean-Philippe Brucker wrote: > On Mon, Apr 06, 2020 at 08:33:53AM -0700, Jacob Pan wrote: > > Hi Jean, > > &g

Re: [PATCH v2 1/3] iommu/uapi: Define uapi version and capabilities

2020-04-13 Thread Jacob Pan
another use of the version, it makes checking easy when a vIOMMU is launched. Thanks, Jacob On Thu, 2 Apr 2020 11:36:04 -0700 Jacob Pan wrote: > On Wed, 1 Apr 2020 05:32:21 + > "Tian, Kevin" wrote: > > > > From: Jacob Pan > > > Sent: Tuesday, March

Re: [PATCH v11 07/10] iommu/vt-d: Add svm/sva invalidate function

2020-04-10 Thread Jacob Pan
On Thu, 9 Apr 2020 10:50:34 +0200 Auger Eric wrote: > Hi Jacob, > > On 4/3/20 8:42 PM, Jacob Pan wrote: > > When Shared Virtual Address (SVA) is enabled for a guest OS via > > vIOMMU, we need to provide invalidation support at IOMMU API and > > driver level. This pat

Re: [PATCH v11 05/10] iommu/vt-d: Add bind guest PASID support

2020-04-10 Thread Jacob Pan
Hi Eric, Missed a few things in the last reply. On Thu, 9 Apr 2020 09:41:32 +0200 Auger Eric wrote: > > + intel_pasid_tear_down_entry(iommu, dev, > > svm->pasid); > intel_svm_unbind_mm() calls intel_flush_svm_range_dev(svm, sdev, 0, > -1, 0); Don't we need to flush the (DEV-

Re: [PATCH v11 05/10] iommu/vt-d: Add bind guest PASID support

2020-04-10 Thread Jacob Pan
Hi Eric, On Thu, 9 Apr 2020 09:41:32 +0200 Auger Eric wrote: > Hi Jacob, > > On 4/3/20 8:42 PM, Jacob Pan wrote: > > When supporting guest SVA with emulated IOMMU, the guest PASID > > table is shadowed in VMM. Updates to guest vIOMMU PASID table > > will result in P

Re: [PATCH 0/2] iommu: Remove iommu_sva_ops::mm_exit()

2020-04-10 Thread Jacob Pan
On Thu, 9 Apr 2020 16:50:58 +0200 Jean-Philippe Brucker wrote: > > So unbind is coming anyway, the difference in handling in mmu > > release notifier is whether we silently drop DMA fault vs. > > reporting fault? > > What I meant is, between mmu release notifier and unbind(), we can't > print

Re: [PATCH 08/10] iommu/ioasid: Introduce notifier APIs

2020-04-10 Thread Jacob Pan
On Wed, 1 Apr 2020 16:00:06 +0200 Jean-Philippe Brucker wrote: > On Wed, Mar 25, 2020 at 10:55:29AM -0700, Jacob Pan wrote: > > IOASID users fit into the publisher-subscriber pattern, a system > > wide blocking notifier chain can be used to inform subscribers of > > st

Re: [PATCH 0/2] iommu: Remove iommu_sva_ops::mm_exit()

2020-04-09 Thread Jacob Pan
On Thu, 9 Apr 2020 09:08:21 -0300 Jason Gunthorpe wrote: > On Wed, Apr 08, 2020 at 04:48:02PM -0700, Jacob Pan wrote: > > > Yes, this is the proper way, when the DMA is stopped and no use > > > of the PASID remains then you can drop the mmu notifier and > > > relea

Re: [PATCH 0/2] iommu: Remove iommu_sva_ops::mm_exit()

2020-04-09 Thread Jacob Pan
On Thu, 9 Apr 2020 16:50:58 +0200 Jean-Philippe Brucker wrote: > On Thu, Apr 09, 2020 at 07:14:24AM -0700, Jacob Pan wrote: > > On Thu, 9 Apr 2020 08:39:05 +0200 > > Jean-Philippe Brucker wrote: > > > > > On Wed, Apr 08, 2020 at 04:48:02PM -0700, Jacob Pan wrote

Re: [PATCH 0/2] iommu: Remove iommu_sva_ops::mm_exit()

2020-04-09 Thread Jacob Pan
On Thu, 9 Apr 2020 11:25:19 -0300 Jason Gunthorpe wrote: > On Thu, Apr 09, 2020 at 07:14:24AM -0700, Jacob Pan wrote: > > > When the process is killed, mm release can happen before fds are > > > released. If you look at do_exit() in kernel/exit.c: > > > >

Re: [PATCH 0/2] iommu: Remove iommu_sva_ops::mm_exit()

2020-04-09 Thread Jacob Pan
On Thu, 9 Apr 2020 08:39:05 +0200 Jean-Philippe Brucker wrote: > On Wed, Apr 08, 2020 at 04:48:02PM -0700, Jacob Pan wrote: > > On Wed, 8 Apr 2020 19:32:18 -0300 > > Jason Gunthorpe wrote: > > > > > On Wed, Apr 08, 2020 at 02:35:52PM -0700, Jacob Pan wrote:

Re: [PATCH 0/2] iommu: Remove iommu_sva_ops::mm_exit()

2020-04-08 Thread Jacob Pan
On Wed, 8 Apr 2020 19:32:18 -0300 Jason Gunthorpe wrote: > On Wed, Apr 08, 2020 at 02:35:52PM -0700, Jacob Pan wrote: > > > On Wed, Apr 08, 2020 at 11:35:52AM -0700, Jacob Pan wrote: > > > > Hi Jean, > > > > > > > > On Wed, 8 Apr 2020 16:

Re: [PATCH 0/2] iommu: Remove iommu_sva_ops::mm_exit()

2020-04-08 Thread Jacob Pan
Hi Jason, Thanks for the explanation, more comments/questions inline. On Wed, 8 Apr 2020 16:02:26 -0300 Jason Gunthorpe wrote: > On Wed, Apr 08, 2020 at 11:35:52AM -0700, Jacob Pan wrote: > > Hi Jean, > > > > On Wed, 8 Apr 2020 16:04:25 +0200 > > J

Re: [PATCH 0/2] iommu: Remove iommu_sva_ops::mm_exit()

2020-04-08 Thread Jacob Pan
iommu: Remove iommu_sva_ops::mm_exit() > > include/linux/iommu.h | 30 --- > include/linux/uacce.h | 34 ++-- > drivers/iommu/iommu.c | 11 --- > drivers/misc/uacce/uacce.c | 171 > +------

Re: [PATCH v11 02/10] iommu/uapi: Define a mask for bind data

2020-04-08 Thread Jacob Pan
On Wed, 8 Apr 2020 15:07:22 +0200 Joerg Roedel wrote: > On Fri, Apr 03, 2020 at 11:42:06AM -0700, Jacob Pan wrote: > > Memory type related flags can be grouped together for one simple > > check. > > > > --- > > v9 renamed from EMT to MTS since these

Re: [PATCH 06/10] iommu/ioasid: Convert to set aware allocations

2020-04-06 Thread Jacob Pan
On Sat, 28 Mar 2020 06:40:58 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Saturday, March 28, 2020 1:42 AM > > > > On Fri, 27 Mar 2020 09:54:11 + > > "Tian, Kevin" wrote: > > > > > > From: Jacob Pan > &

Re: [PATCH 03/10] iommu/ioasid: Introduce per set allocation APIs

2020-04-06 Thread Jacob Pan
On Wed, 1 Apr 2020 15:47:45 +0200 Jean-Philippe Brucker wrote: > On Wed, Mar 25, 2020 at 10:55:24AM -0700, Jacob Pan wrote: > > IOASID set defines a group of IDs that share the same token. The > > ioasid_set concept helps to do permission checking among users as > >

Re: [PATCH 05/10] iommu/ioasid: Create an IOASID set for host SVA use

2020-04-06 Thread Jacob Pan
Hi Jean, On Wed, 1 Apr 2020 15:53:16 +0200 Jean-Philippe Brucker wrote: > On Wed, Mar 25, 2020 at 10:55:26AM -0700, Jacob Pan wrote: > > Bare metal SVA allocates IOASIDs for native process addresses. This > > should be separated from VM allocated IOASIDs thus under

[PATCH v11 04/10] iommu/vt-d: Add nested translation helper function

2020-04-03 Thread Jacob Pan
file. Improved flow in MTS handling suggested by Eric. --- Signed-off-by: Jacob Pan Signed-off-by: Liu, Yi L --- drivers/iommu/intel-iommu.c | 25 - drivers/iommu/intel-pasid.c | 246 +++- drivers/iommu/intel-pasid.h | 12 +++ include/linux/intel

[PATCH v11 06/10] iommu/vt-d: Support flushing more translation cache types

2020-04-03 Thread Jacob Pan
When Shared Virtual Memory is exposed to a guest via vIOMMU, scalable IOTLB invalidation may be passed down from outside IOMMU subsystems. This patch adds invalidation functions that can be used for additional translation cache types. Signed-off-by: Jacob Pan --- v9 -> v10: Fix off by 1

[PATCH v11 03/10] iommu/vt-d: Use a helper function to skip agaw for SL

2020-04-03 Thread Jacob Pan
4 & 5 from v10. --- Signed-off-by: Jacob Pan Signed-off-by: Lu Baolu --- drivers/iommu/intel-pasid.c | 34 -- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/intel-pasid.c b/drivers/iommu/intel-pasid.c index 22b30f10b396..66c

[PATCH v11 00/10] Nested Shared Virtual Address (SVA) VT-d support

2020-04-03 Thread Jacob Pan
- Integrated with Eric Auger's new v7 series for common APIs (https://github.com/eauger/linux/tree/v5.1-rc3-2stage-v7) - Addressed review comments from Andy Shevchenko and Alex Williamson on IOASID custom allocator. - Support multiple custom IOASID allocators (vIOMMUs)

[PATCH v11 08/10] iommu/vt-d: Cache virtual command capability register

2020-04-03 Thread Jacob Pan
Virtual command registers are used in the guest only, to prevent vmexit cost, we cache the capability and store it during initialization. Signed-off-by: Jacob Pan Reviewed-by: Eric Auger Reviewed-by: Lu Baolu --- v7 Reviewed by Eric & Baolu --- Signed-off-by: Jacob Pan --- drivers/i

[PATCH v11 01/10] iommu/vt-d: Move domain helper to header

2020-04-03 Thread Jacob Pan
Move domain helper to header to be used by SVA code. Signed-off-by: Jacob Pan Reviewed-by: Eric Auger Reviewed-by: Kevin Tian --- drivers/iommu/intel-iommu.c | 6 -- include/linux/intel-iommu.h | 6 ++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/intel

[PATCH v11 07/10] iommu/vt-d: Add svm/sva invalidate function

2020-04-03 Thread Jacob Pan
review fixed in v10 --- Signed-off-by: Jacob Pan Signed-off-by: Ashok Raj Signed-off-by: Liu, Yi L --- drivers/iommu/intel-iommu.c | 158 1 file changed, 158 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index

[PATCH v11 09/10] iommu/vt-d: Enlightened PASID allocation

2020-04-03 Thread Jacob Pan
s the enlightened PASID allocation/free interfaces via the virtual command interface. Cc: Ashok Raj Cc: Jacob Pan Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu Signed-off-by: Jacob Pan Reviewed-by: Eric Auger Reviewed-by: Kevin Tian --- drivers/iommu/intel-pasid.c

[PATCH v11 02/10] iommu/uapi: Define a mask for bind data

2020-04-03 Thread Jacob Pan
Memory type related flags can be grouped together for one simple check. --- v9 renamed from EMT to MTS since these are memory type support flags. --- Reviewed-by: Eric Auger Signed-off-by: Jacob Pan --- include/uapi/linux/iommu.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff

[PATCH v11 10/10] iommu/vt-d: Add custom allocator for IOASID

2020-04-03 Thread Jacob Pan
PASID namespace is system- wide. Signed-off-by: Lu Baolu Signed-off-by: Liu, Yi L Signed-off-by: Jacob Pan --- drivers/iommu/intel-iommu.c | 84 + include/linux/intel-iommu.h | 2 ++ 2 files changed, 86 insertions(+) diff --git a/drivers/iommu/intel

[PATCH v11 05/10] iommu/vt-d: Add bind guest PASID support

2020-04-03 Thread Jacob Pan
empty. Use rate limited error message since the bind gpasid call comes from user space. --- Signed-off-by: Jacob Pan Signed-off-by: Liu, Yi L --- drivers/iommu/intel-iommu.c | 4 + drivers/iommu/intel-svm.c | 206 include/linux/intel-iommu.h

Re: [PATCH v1 7/8] vfio/type1: Add VFIO_IOMMU_CACHE_INVALIDATE

2020-04-03 Thread Jacob Pan
gt; IOMMU > > cache > > > correctness. > > > > > > With this patch, vSVA (Virtual Shared Virtual Addressing) can be > > > used safely as the host IOMMU iotlb correctness are ensured. > > > > > > Cc: Kevin Tian > > >

Re: [PATCH V10 11/11] iommu/vt-d: Add custom allocator for IOASID

2020-04-02 Thread Jacob Pan
On Thu, 2 Apr 2020 02:18:45 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Wednesday, April 1, 2020 11:48 PM > > > > On Sat, 28 Mar 2020 10:22:41 + > > "Tian, Kevin" wrote: > > > > > > From: Jacob Pan >

Re: [PATCH v2 1/3] iommu/uapi: Define uapi version and capabilities

2020-04-02 Thread Jacob Pan
On Wed, 1 Apr 2020 05:32:21 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Tuesday, March 31, 2020 11:55 PM > > > > On Tue, 31 Mar 2020 06:06:38 + > > "Tian, Kevin" wrote: > > > > > > From: Jacob Pan >

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

2020-04-02 Thread Jacob Pan
On Thu, 2 Apr 2020 14:26:33 +0200 Jean-Philippe Brucker wrote: > On Wed, Apr 01, 2020 at 04:38:42PM -0700, Jacob Pan wrote: > > On Wed, 1 Apr 2020 16:03:01 +0200 > > Jean-Philippe Brucker wrote: > > > > > Hi Jacob, > > > > > > On Wed, M

Re: [PATCH V10 08/11] iommu/vt-d: Add svm/sva invalidate function

2020-04-02 Thread Jacob Pan
On Wed, 1 Apr 2020 09:32:37 +0200 Auger Eric wrote: > > I didn’t read through all comments. Here is a concern with this 2-D > > table, the iommu cache type is defined as below. I suppose there is > > a problem here. If I'm using IOMMU_CACHE_INV_TYPE_PASID, it will > > beyond the 2-D table. > > >

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

2020-04-01 Thread Jacob Pan
On Wed, 1 Apr 2020 16:03:01 +0200 Jean-Philippe Brucker wrote: > Hi Jacob, > > On Wed, Mar 25, 2020 at 10:55:21AM -0700, Jacob Pan wrote: > > IOASID was introduced in v5.5 as a generic kernel allocator service > > for both PCIe Process Address Space ID (PASID) and ARM SMM

Re: [PATCH 01/10] iommu/ioasid: Introduce system-wide capacity

2020-04-01 Thread Jacob Pan
Hi Jean, On Wed, 1 Apr 2020 15:45:52 +0200 Jean-Philippe Brucker wrote: > On Wed, Mar 25, 2020 at 10:55:22AM -0700, Jacob Pan wrote: > > IOASID is a limited system-wide resource that can be allocated at > > runtime. This limitation can be enumerated during boot. For >

Re: [PATCH 06/10] iommu/ioasid: Convert to set aware allocations

2020-04-01 Thread Jacob Pan
On Wed, 1 Apr 2020 15:55:25 +0200 Jean-Philippe Brucker wrote: > On Wed, Mar 25, 2020 at 10:55:27AM -0700, Jacob Pan wrote: > > The current ioasid_alloc function takes a token/ioasid_set then > > record it on the IOASID being allocated. There is no alloc/free on > > the ioas

Re: [PATCH V10 05/11] iommu/vt-d: Add nested translation helper function

2020-04-01 Thread Jacob Pan
On Sun, 29 Mar 2020 13:35:15 +0200 Auger Eric wrote: > Hi Jacob, > > On 3/21/20 12:27 AM, Jacob Pan wrote: > > Nested translation mode is supported in VT-d 3.0 Spec.CH 3.8. > > With PASID granular translation type set to 0x11b, translation > > result from the first

Re: [PATCH V10 06/11] iommu/vt-d: Add bind guest PASID support

2020-04-01 Thread Jacob Pan
On Tue, 31 Mar 2020 03:43:39 + "Tian, Kevin" wrote: > > > > struct intel_svm_dev { > > > > @@ -698,9 +700,13 @@ struct intel_svm_dev { > > > > struct intel_svm { > > > > struct mmu_notifier notifier; > > > > struct mm_struct *mm; > > > > + > > > > struct intel_iommu

Re: [PATCH V10 08/11] iommu/vt-d: Add svm/sva invalidate function

2020-04-01 Thread Jacob Pan
On Wed, 1 Apr 2020 09:32:37 +0200 Auger Eric wrote: > >> devtlb > >> descriptor, that is why Eric suggests {0, 0, 1}. > > > > I think it should be {0, 0, 1} :-) addr field and S field are must, > > pasid field depends on G bit. > > On my side, I understood from the spec that addr/S are alwa

Re: [PATCH V10 08/11] iommu/vt-d: Add svm/sva invalidate function

2020-04-01 Thread Jacob Pan
On Wed, 1 Apr 2020 06:57:42 + "Liu, Yi L" wrote: > > From: Tian, Kevin > > Sent: Wednesday, April 1, 2020 2:24 PM > > To: Jacob Pan > > Subject: RE: [PATCH V10 08/11] iommu/vt-d: Add svm/sva invalidate > > function > > > From: Jacob

Re: [PATCH V10 11/11] iommu/vt-d: Add custom allocator for IOASID

2020-04-01 Thread Jacob Pan
On Sat, 28 Mar 2020 10:22:41 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Saturday, March 21, 2020 7:28 AM > > > > When VT-d driver runs in the guest, PASID allocation must be > > performed via virtual command interface. This patch regis

Re: [PATCH V10 10/11] iommu/vt-d: Enlightened PASID allocation

2020-03-31 Thread Jacob Pan
On Sat, 28 Mar 2020 10:08:52 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Saturday, March 21, 2020 7:28 AM > > > > From: Lu Baolu > > > > Enabling IOMMU in a guest requires communication with the host > > driver for certa

Re: [PATCH V10 09/11] iommu/vt-d: Cache virtual command capability register

2020-03-31 Thread Jacob Pan
On Sat, 28 Mar 2020 10:04:38 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Saturday, March 21, 2020 7:28 AM > > > > Virtual command registers are used in the guest only, to prevent > > vmexit cost, we cache the capability and store it during

Re: [PATCH V10 08/11] iommu/vt-d: Add svm/sva invalidate function

2020-03-31 Thread Jacob Pan
On Sun, 29 Mar 2020 18:05:47 +0200 Auger Eric wrote: > Hi Jacob, > > On 3/21/20 12:27 AM, Jacob Pan wrote: > > When Shared Virtual Address (SVA) is enabled for a guest OS via > > vIOMMU, we need to provide invalidation support at IOMMU API and > > driver level.

Re: [PATCH V10 08/11] iommu/vt-d: Add svm/sva invalidate function

2020-03-31 Thread Jacob Pan
On Tue, 31 Mar 2020 03:34:22 + "Tian, Kevin" wrote: > > From: Auger Eric > > Sent: Monday, March 30, 2020 12:05 AM > > > > On 3/28/20 11:01 AM, Tian, Kevin wrote: > > >> From: Jacob Pan > > >> Sent: Saturday, March 21, 2020

Re: [PATCH V10 08/11] iommu/vt-d: Add svm/sva invalidate function

2020-03-31 Thread Jacob Pan
On Tue, 31 Mar 2020 02:49:21 + "Tian, Kevin" wrote: > > From: Auger Eric > > Sent: Sunday, March 29, 2020 11:34 PM > > > > Hi, > > > > On 3/28/20 11:01 AM, Tian, Kevin wrote: > > >> From: Jacob Pan > > >> Sent: Satu

Re: [PATCH V10 08/11] iommu/vt-d: Add svm/sva invalidate function

2020-03-31 Thread Jacob Pan
On Sat, 28 Mar 2020 10:01:42 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Saturday, March 21, 2020 7:28 AM > > > > When Shared Virtual Address (SVA) is enabled for a guest OS via > > vIOMMU, we need to provide invalidation support at IOMMU A

Re: [PATCH V10 07/11] iommu/vt-d: Support flushing more translation cache types

2020-03-31 Thread Jacob Pan
On Mon, 30 Mar 2020 16:28:34 -0700 Jacob Pan wrote: > On Fri, 27 Mar 2020 15:46:23 +0100 > Auger Eric wrote: > > > Hi Jacob, > > > > On 3/21/20 12:27 AM, Jacob Pan wrote: > > > When Shared Virtual Memory is exposed to a guest via vIOMMU, > > > s

Re: [PATCH] iommu/vt-d: Fix PASID cache flush

2020-03-31 Thread Jacob Pan
ignore this, sorry about the confusion. On Tue, 31 Mar 2020 11:28:17 +0200 Auger Eric wrote: > Hi Jacob, > > On 3/31/20 1:25 AM, Jacob Pan wrote: > > PASID cache type and shift of granularity bits are missing in > > the current code. > > > > Fixes: 6f7db75e1c46 (&

Re: [PATCH v2 1/3] iommu/uapi: Define uapi version and capabilities

2020-03-31 Thread Jacob Pan
On Tue, 31 Mar 2020 06:06:38 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Tuesday, March 31, 2020 12:08 AM > > > > On Mon, 30 Mar 2020 05:40:40 + > > "Tian, Kevin" wrote: > > > > > > From: Jacob Pan >

Re: [PATCH 08/10] iommu/ioasid: Introduce notifier APIs

2020-03-31 Thread Jacob Pan
On Sat, 28 Mar 2020 06:43:37 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Saturday, March 28, 2020 2:37 AM > > > > On Fri, 27 Mar 2020 10:03:26 + > > "Tian, Kevin" wrote: > > > > > > From: Jacob Pan &

Re: [PATCH V10 07/11] iommu/vt-d: Support flushing more translation cache types

2020-03-30 Thread Jacob Pan
On Fri, 27 Mar 2020 15:46:23 +0100 Auger Eric wrote: > Hi Jacob, > > On 3/21/20 12:27 AM, Jacob Pan wrote: > > When Shared Virtual Memory is exposed to a guest via vIOMMU, > > scalable IOTLB invalidation may be passed down from outside IOMMU > > subsystems. T

[PATCH] iommu/vt-d: Fix PASID cache flush

2020-03-30 Thread Jacob Pan
PASID cache type and shift of granularity bits are missing in the current code. Fixes: 6f7db75e1c46 ("iommu/vt-d: Add second level page table interface") Cc: Eric Auger Signed-off-by: Jacob Pan --- drivers/iommu/intel-pasid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)

Re: [PATCH V10 06/11] iommu/vt-d: Add bind guest PASID support

2020-03-30 Thread Jacob Pan
On Sun, 29 Mar 2020 15:40:22 +0200 Auger Eric wrote: > Hi, > > On 3/21/20 12:27 AM, Jacob Pan wrote: > > When supporting guest SVA with emulated IOMMU, the guest PASID > > table is shadowed in VMM. Updates to guest vIOMMU PASID table > > will result in PASID cache

Re: [PATCH V10 06/11] iommu/vt-d: Add bind guest PASID support

2020-03-30 Thread Jacob Pan
On Sat, 28 Mar 2020 08:02:01 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Saturday, March 21, 2020 7:28 AM > > > > When supporting guest SVA with emulated IOMMU, the guest PASID > > table is shadowed in VMM. Updates to guest vIOMMU PASID ta

Re: [PATCH V10 05/11] iommu/vt-d: Add nested translation helper function

2020-03-30 Thread Jacob Pan
On Sun, 29 Mar 2020 16:03:36 +0800 Lu Baolu wrote: > On 2020/3/27 20:21, Tian, Kevin wrote: > >> From: Jacob Pan > >> Sent: Saturday, March 21, 2020 7:28 AM > >> > >> Nested translation mode is supported in VT-d 3.0 Spec.CH 3.8. > > > >

Re: [PATCH V10 03/11] iommu/vt-d: Add a helper function to skip agaw

2020-03-30 Thread Jacob Pan
On Sun, 29 Mar 2020 15:20:55 +0800 Lu Baolu wrote: > On 2020/3/27 19:53, Tian, Kevin wrote: > >> From: Jacob Pan > >> Sent: Saturday, March 21, 2020 7:28 AM > >> > >> Signed-off-by: Jacob Pan > > > > could you elaborate in which scenario t

Re: [PATCH v2 1/3] iommu/uapi: Define uapi version and capabilities

2020-03-30 Thread Jacob Pan
On Mon, 30 Mar 2020 05:40:40 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Saturday, March 28, 2020 7:54 AM > > > > On Fri, 27 Mar 2020 00:47:02 -0700 > > Christoph Hellwig wrote: > > > > > On Fri, Mar 27, 2020 at 02:49:55AM

Re: [PATCH v2 1/3] iommu/uapi: Define uapi version and capabilities

2020-03-27 Thread Jacob Pan
On Fri, 27 Mar 2020 00:47:02 -0700 Christoph Hellwig wrote: > On Fri, Mar 27, 2020 at 02:49:55AM +, Tian, Kevin wrote: > > If those API calls are inter-dependent for composing a feature > > (e.g. SVA), shouldn't we need a way to check them together before > > exposing the feature to the guest

Re: [PATCH 10/10] iommu/vt-d: Register PASID notifier for status change

2020-03-27 Thread Jacob Pan
On Fri, 27 Mar 2020 10:22:57 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Thursday, March 26, 2020 1:56 AM > > > > In bare metal SVA, IOMMU driver ensures that IOASID free call > > always comes after IOASID unbind operation. > > >

Re: [PATCH 09/10] iommu/ioasid: Support ioasid_set quota adjustment

2020-03-27 Thread Jacob Pan
On Fri, 27 Mar 2020 10:09:04 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Thursday, March 26, 2020 1:56 AM > > > > IOASID set is allocated with an initial quota, at runtime there may > > be needs to balance IOASID resources among differ

Re: [PATCH 08/10] iommu/ioasid: Introduce notifier APIs

2020-03-27 Thread Jacob Pan
On Fri, 27 Mar 2020 10:03:26 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Thursday, March 26, 2020 1:55 AM > > > > IOASID users fit into the publisher-subscriber pattern, a system > > wide blocking notifier chain can be used to inform su

Re: [PATCH 06/10] iommu/ioasid: Convert to set aware allocations

2020-03-27 Thread Jacob Pan
On Fri, 27 Mar 2020 09:54:11 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Thursday, March 26, 2020 1:55 AM > > > > The current ioasid_alloc function takes a token/ioasid_set then > > record it on the IOASID being allocated. Ther

Re: [PATCH 05/10] iommu/ioasid: Create an IOASID set for host SVA use

2020-03-27 Thread Jacob Pan
On Fri, 27 Mar 2020 09:41:55 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Thursday, March 26, 2020 1:55 AM > > > > Bare metal SVA allocates IOASIDs for native process addresses. This > > should be separated from VM allocated IOASIDs thus

Re: [PATCH 03/10] iommu/ioasid: Introduce per set allocation APIs

2020-03-27 Thread Jacob Pan
On Fri, 27 Mar 2020 08:38:44 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Thursday, March 26, 2020 1:55 AM > > > > IOASID set defines a group of IDs that share the same token. The > > ioasid_set concept helps to do permission checkin

Re: [PATCH 01/10] iommu/ioasid: Introduce system-wide capacity

2020-03-27 Thread Jacob Pan
On Fri, 27 Mar 2020 08:07:20 + "Tian, Kevin" wrote: > > From: Jacob Pan > > Sent: Thursday, March 26, 2020 1:55 AM > > > > IOASID is a limited system-wide resource that can be allocated at > > runtime. This limitation can be enumerated during boot

Re: [PATCH 03/10] iommu/ioasid: Introduce per set allocation APIs

2020-03-26 Thread Jacob Pan
Hi Baolu, On Thu, 26 Mar 2020 10:12:36 +0800 Lu Baolu wrote: > On 2020/3/26 1:55, Jacob Pan wrote: > > IOASID set defines a group of IDs that share the same token. The > > ioasid_set concept helps to do permission checking among users as > > in the current code. > >

Re: [PATCH v2 1/3] iommu/uapi: Define uapi version and capabilities

2020-03-26 Thread Jacob Pan
Hi Christoph, Thanks for the review. Please see my comments inline. On Thu, 26 Mar 2020 02:23:16 -0700 Christoph Hellwig wrote: > On Wed, Mar 25, 2020 at 04:17:05PM -0700, Jacob Pan wrote: > > Having a single UAPI version to govern the user-kernel data > > structures makes comp

[PATCH v2 0/3] IOMMU user API enhancement

2020-03-25 Thread Jacob Pan
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

[PATCH v2 3/3] iommu/uapi: Add helper function for size lookup

2020-03-25 Thread Jacob Pan
lookup with version and type as input arguments. --- v2: Clarify size lookup array extension rules, backfill -EINVAL if new version introduce new union members. --- Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- drivers/iommu/iommu.c | 72

[PATCH v2 2/3] iommu/uapi: Use unified UAPI version

2020-03-25 Thread Jacob Pan
Reuse UAPI version for each UAPI data structure. This is to avoid supporting multiple version combinations, simplify support model as we bump up the versions. Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- drivers/iommu/intel-iommu.c | 3 ++- drivers/iommu/intel-svm.c | 2 +- drivers

[PATCH v2 1/3] iommu/uapi: Define uapi version and capabilities

2020-03-25 Thread Jacob Pan
between user and kernel. --- v2: Rewrite extension rules to disallow adding new members. Use padding and union extensions only. --- Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan Link: https://lkml.org/lkml/2020/2/3/1126 --- include/uapi/linux/iommu.h | 53

[PATCH 05/10] iommu/ioasid: Create an IOASID set for host SVA use

2020-03-25 Thread Jacob Pan
processes. Signed-off-by: Jacob Pan --- drivers/iommu/intel-iommu.c | 8 +++- drivers/iommu/ioasid.c | 9 + include/linux/ioasid.h | 9 + 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index

[PATCH 08/10] iommu/ioasid: Introduce notifier APIs

2020-03-25 Thread Jacob Pan
driver gets notified when IOASID is freed by VFIO or core mm code such that PASID context can be cleaned up. Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- drivers/iommu/ioasid.c | 61 ++ include/linux/ioasid.h | 40

[PATCH 04/10] iommu/ioasid: Rename ioasid_set_data to avoid confusion with ioasid_set

2020-03-25 Thread Jacob Pan
IOASID set refers to a group of IOASIDs that shares the same token. ioasid_set_data() function is used to attach a private data to an IOASID, rename it to ioasid_attach_data() avoid being confused with the group/set concept. Signed-off-by: Jacob Pan --- drivers/iommu/intel-svm.c | 11

[PATCH 01/10] iommu/ioasid: Introduce system-wide capacity

2020-03-25 Thread Jacob Pan
register as defined in the VT-d spec. This patch adds a helper to set the system capacity, it expected to be set during boot prior to any allocation request. Signed-off-by: Jacob Pan --- drivers/iommu/ioasid.c | 15 +++ include/linux/ioasid.h | 5 - 2 files changed, 19 insertions

[PATCH 09/10] iommu/ioasid: Support ioasid_set quota adjustment

2020-03-25 Thread Jacob Pan
IOASID set is allocated with an initial quota, at runtime there may be needs to balance IOASID resources among different VMs/sets. This patch adds a new API to adjust per set quota. Signed-off-by: Jacob Pan --- drivers/iommu/ioasid.c | 44 include

[PATCH 07/10] iommu/ioasid: Use mutex instead of spinlock

2020-03-25 Thread Jacob Pan
operations. This patch converts allocator lock from spinlock to mutex in preparation for IOASID notifier. Signed-off-by: Jacob Pan --- drivers/iommu/ioasid.c | 45 +++-- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/drivers/iommu/ioasid.c b

[PATCH 02/10] iommu/vt-d: Set IOASID capacity when SVM is enabled

2020-03-25 Thread Jacob Pan
Assign system-wide PASID capacity with enumerated max value. Currently, all Intel SVM capable devices should support full 20 bits of PASID value. Signed-off-by: Jacob Pan --- drivers/iommu/intel-iommu.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b

[PATCH 06/10] iommu/ioasid: Convert to set aware allocations

2020-03-25 Thread Jacob Pan
then be enforced. This patch converts existing API to the new ioasid_set model. Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- drivers/iommu/intel-iommu.c | 10 +++--- drivers/iommu/intel-svm.c | 10 +++--- drivers/iommu/ioasid.c | 78

[PATCH 00/10] IOASID extensions for guest SVA

2020-03-25 Thread Jacob Pan
send notification on an IOASID with one of the commands (FREE, BIND/UNBIND, etc.), use: - int ioasid_notify(ioasid_t id, enum ioasid_notify_val cmd); This work is a result of collaboration with many people: Liu, Yi L Wu Hao Ashok Raj Kevin Tian Thanks, Jacob Jacob Pan (10): iommu/i

[PATCH 03/10] iommu/ioasid: Introduce per set allocation APIs

2020-03-25 Thread Jacob Pan
. Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- drivers/iommu/ioasid.c | 147 + include/linux/ioasid.h | 13 + 2 files changed, 160 insertions(+) diff --git a/drivers/iommu/ioasid.c b/drivers/iommu/ioasid.c index 4026e52855b9..27ee57f7079b

[PATCH 10/10] iommu/vt-d: Register PASID notifier for status change

2020-03-25 Thread Jacob Pan
such that VT-d driver can take action to clean up PASID context and data. Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- drivers/iommu/intel-svm.c | 68 - include/linux/intel-iommu.h | 1 + 2 files changed, 68 insertions(+), 1 deletion(-) diff

Re: [PATCH 2/2] iommu/vt-d: Replace intel SVM APIs with generic SVA APIs

2020-03-24 Thread Jacob Pan
On Fri, 20 Mar 2020 10:29:55 +0100 Jean-Philippe Brucker wrote: > Hi Jacob, > > I think this step is really useful and the patch looks good overall, > thanks for doing this. Some commments inline > > On Mon, Feb 24, 2020 at 03:26:37PM -0800, Jacob Pan wrote: > > This

Re: [PATCH 1/3] iommu/vt-d: Remove redundant IOTLB flush

2020-03-24 Thread Jacob Pan
On Sat, 21 Mar 2020 09:32:45 +0800 Lu Baolu wrote: > On 2020/3/21 0:20, Jacob Pan wrote: > > On Fri, 20 Mar 2020 21:45:26 +0800 > > Lu Baolu wrote: > > > >> On 2020/3/20 12:32, Jacob Pan wrote: > >>> IOTLB flush already included in the PASID te

Re: [PATCH V10 02/11] iommu/uapi: Define a mask for bind data

2020-03-23 Thread Jacob Pan
On Sun, 22 Mar 2020 09:29:32 +0800 Lu Baolu wrote: > On 2020/3/21 7:27, Jacob Pan wrote: > > Memory type related flags can be grouped together for one simple > > check. > > > > --- > > v9 renamed from EMT to MTS since these are memory type support > > f

[PATCH V10 00/11] Nested Shared Virtual Address (SVA) VT-d support

2020-03-20 Thread Jacob Pan
ments from Andy Shevchenko and Alex Williamson on IOASID custom allocator. - Support multiple custom IOASID allocators (vIOMMUs) and dynamic registration. Jacob Pan (10): iommu/vt-d: Move domain helper to header iommu/uapi: Define a mask for bind data iommu/v

[PATCH V10 05/11] iommu/vt-d: Add nested translation helper function

2020-03-20 Thread Jacob Pan
physical translation and SL performs guest physical to host physical translation. This patch adds a helper function for setting up nested translation where second level comes from a domain and first level comes from a guest PGD. Signed-off-by: Jacob Pan Signed-off-by: Liu, Yi L --- drivers

[PATCH V10 06/11] iommu/vt-d: Add bind guest PASID support

2020-03-20 Thread Jacob Pan
| | |SL for GPA-HPA, default domain| | | '--' '-' Where: - FL = First level/stage one page tables - SL = Second level/stage two page tables Signed-off-by: Jacob Pan Signed-off-by: Liu, Yi L ---

[PATCH V10 07/11] iommu/vt-d: Support flushing more translation cache types

2020-03-20 Thread Jacob Pan
When Shared Virtual Memory is exposed to a guest via vIOMMU, scalable IOTLB invalidation may be passed down from outside IOMMU subsystems. This patch adds invalidation functions that can be used for additional translation cache types. Signed-off-by: Jacob Pan --- v9 -> v10: Fix off by 1

[PATCH V10 10/11] iommu/vt-d: Enlightened PASID allocation

2020-03-20 Thread Jacob Pan
s the enlightened PASID allocation/free interfaces via the virtual command interface. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu Signed-off-by: Jacob Pan Reviewed-by: Eric Auger --- drivers/iommu/intel-pasid.c

[PATCH V10 08/11] iommu/vt-d: Add svm/sva invalidate function

2020-03-20 Thread Jacob Pan
device handle, host IOMMU driver can replace certain fields before submit to the invalidation queue. --- v7 review fixed in v10 --- Signed-off-by: Jacob Pan Signed-off-by: Ashok Raj Signed-off-by: Liu, Yi L --- drivers/iommu/intel-iommu.c | 182 1

[PATCH V10 11/11] iommu/vt-d: Add custom allocator for IOASID

2020-03-20 Thread Jacob Pan
PASID namespace is system- wide. Signed-off-by: Lu Baolu Signed-off-by: Liu, Yi L Signed-off-by: Jacob Pan --- drivers/iommu/intel-iommu.c | 84 + include/linux/intel-iommu.h | 2 ++ 2 files changed, 86 insertions(+) diff --git a/drivers/iommu/intel

[PATCH V10 03/11] iommu/vt-d: Add a helper function to skip agaw

2020-03-20 Thread Jacob Pan
Signed-off-by: Jacob Pan --- drivers/iommu/intel-pasid.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/drivers/iommu/intel-pasid.c b/drivers/iommu/intel-pasid.c index 22b30f10b396..191508c7c03e 100644 --- a/drivers/iommu/intel-pasid.c +++ b/drivers/iommu/intel

<    1   2   3   4   5   6   7   8   9   10   >