Re: [PATCH v2 00/33] iommu: Move iommu_group setup to IOMMU core code

2020-06-01 Thread Lu Baolu
Hi Jerry, On 6/1/20 9:17 PM, Jerry Snitselaar wrote: On Mon Jun 01 20, Jerry Snitselaar wrote: On Fri May 29 20, Jerry Snitselaar wrote: On Tue Apr 14 20, Joerg Roedel wrote: Hi, here is the second version of this patch-set. The first version with some more introductory text can be found

Re: [PATCH v2 00/33] iommu: Move iommu_group setup to IOMMU core code

2020-06-01 Thread Lu Baolu
Hi Jerry, On 6/1/20 6:42 PM, Jerry Snitselaar wrote: Hi Joerg, With this patchset, I have an epyc system where if I boot with iommu=nopt and force a dump I will see some io page faults for a nic on the system. The vmcore is harvested and the system reboots. I haven't reproduced it on other

[PATCH 1/2] iommu/vt-d: Make Intel SVM code 64-bit only

2020-05-31 Thread Lu Baolu
disable 32bit support for now and claim support only when all the missing pieces are ready in the future. Fixes: 1c4f88b7f1f92 ("iommu/vt-d: Shared virtual address in scalable mode") Suggested-by: Joerg Roedel Signed-off-by: Lu Baolu --- drivers/iommu/Kconfig | 2 +- 1 file changed, 1

[PATCH 2/2] iommu/vt-d: Set U/S bit in first level page table by default

2020-05-31 Thread Lu Baolu
-level translation. Fixes: b802d070a52a1 ("iommu/vt-d: Use iova over first level") Reported-by: Xin Zeng Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 5 ++--- include/linux/intel-iommu.h | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/intel

[PATCH 0/2] iommu/vt-d: Two fixes for v5.8

2020-05-31 Thread Lu Baolu
Hi Joerg, This encloses two fixes for v5.8. - Make Intel SVM code 64-bit only - Set U/S bit to make IOVA over first level compatible with 2nd level translations. Best regards, baolu Lu Baolu (2): iommu/vt-d: Make Intel SVM code 64-bit only iommu/vt-d: Set U/S bit in first level page table

Re: [PATCH] iommu/vt-d: Fix compile warning

2020-05-28 Thread Lu Baolu
On 5/29/20 2:03 AM, Jacob Pan wrote: Make intel_svm_unbind_mm() a static function. Fixes: 064a57d7ddfc ("iommu/vt-d: Replace intel SVM APIs with generic SVA APIs") Reported-by: kbuild test robot Signed-off-by: Jacob Pan Acked-by: Lu Baolu Best regards, baolu --- drivers/i

Re: [PATCH -next] iommu/vt-d: fix a GCC warning

2020-05-21 Thread Lu Baolu
static int ^ Signed-off-by: Qian Cai Fixes: 6ee1b77ba3ac0 ("iommu/vt-d: Add svm/sva invalidate function") Acked-by: Lu Baolu Best regards, baolu --- drivers/iommu/intel-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers

Re: [PATCH v13 0/8] Nested Shared Virtual Address (SVA) VT-d support

2020-05-16 Thread Lu Baolu
flushing more translation cache types iommu/vt-d: Add svm/sva invalidate function iommu/vt-d: Add custom allocator for IOASID Lu Baolu (1): iommu/vt-d: Enlightened PASID allocation drivers/iommu/dmar.c| 40 ++ drivers/iommu/intel

Re: [PATCH v13 4/8] iommu/vt-d: Add bind guest PASID support

2020-05-16 Thread Lu Baolu
Hi Jacob, On 2020/5/14 23:57, Jacob Pan wrote: Hi Christoph, Thanks a lot for the reviews, comments below. Jacob On Wed, 13 May 2020 22:59:30 -0700 Christoph Hellwig wrote: + if (dev_is_pci(dev)) { + /* VT-d supports devices with full 20 bit PASIDs only */ +

Re: [PATCH] iommu: Implement deferred domain attachment

2020-05-15 Thread Lu Baolu
Hi Joerg, On 2020/5/15 17:45, Joerg Roedel wrote: From: Joerg Roedel The IOMMU core code has support for deferring the attachment of a domain to a device. This is needed in kdump kernels where the new domain must not be attached to a device before the device driver takes it over. But this

Re: [PATCH v13 4/8] iommu/vt-d: Add bind guest PASID support

2020-05-14 Thread Lu Baolu
Hi Jacob, On 5/14/20 11:57 PM, Jacob Pan wrote: + /* +* PASID table is per device for better security. Therefore, for +* each bind of a new device even with an existing PASID, we need to +* call the nested mode setup function here. +*/ +

[PATCH v5 1/5] iommu/vt-d: Multiple descriptors per qi_submit_sync()

2020-05-11 Thread Lu Baolu
the Page-request Drain (PD) bit in the wait descriptor. Signed-off-by: Jacob Pan Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian --- drivers/iommu/dmar.c| 63 + drivers/iommu/intel-pasid.c | 4 +- drivers/iommu/intel-svm.c | 6

[PATCH v5 2/5] iommu/vt-d: debugfs: Add support to show inv queue internals

2020-05-11 Thread Lu Baolu
8 0014 9 000200250001672be824 Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian --- drivers/iommu/intel-iommu-debugfs.c | 62 + 1

[PATCH v5 5/5] iommu/vt-d: Remove redundant IOTLB flush

2020-05-11 Thread Lu Baolu
IOTLB flush already included in the PASID tear down and the page request drain process. There is no need to flush again. Signed-off-by: Jacob Pan Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian --- drivers/iommu/intel-svm.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff

[PATCH v5 4/5] iommu/vt-d: Add page request draining support

2020-05-11 Thread Lu Baolu
When a PASID is stopped or terminated, there can be pending PRQs (requests that haven't received responses) in remapping hardware. This adds the interface to drain page requests and call it when a PASID is terminated. Signed-off-by: Jacob Pan Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu

[PATCH v5 3/5] iommu/vt-d: Disable non-recoverable fault processing before unbind

2020-05-11 Thread Lu Baolu
in the mm notifier and will clear it when the pasid is unbound. Signed-off-by: Lu Baolu Reviewed-by: Jacob Pan --- drivers/iommu/intel-iommu.c | 4 ++-- drivers/iommu/intel-pasid.c | 26 +- drivers/iommu/intel-pasid.h | 4 +++- drivers/iommu/intel-svm.c | 9 ++--- 4

[PATCH v5 0/5] iommu/vt-d: Add page request draining support

2020-05-11 Thread Lu Baolu
erialized, no need to consider reentrance; - Ensure no new-coming prq before drain prq in queue; - Handle page request overflow case. v1->v2: - Fix race between multiple prq handling threads. Lu Baolu (5): iommu/vt-d: Multiple descriptors per qi_submit_sync() iommu/vt-d: debugfs:

Re: [PATCH v4 0/3] Replace private domain with per-group default domain

2020-05-10 Thread Lu Baolu
Hi Joerg, On 5/6/20 9:59 AM, Lu Baolu wrote: Some devices are required to use a specific type (identity or dma) of default domain when they are used with a vendor iommu. When the system level default domain type is different from it, the vendor iommu driver has to request a new default domain

Re: Failure to shutdown/reboot with intel_iommu=on

2020-05-08 Thread Lu Baolu
Hi Uwe, Have you tried commenting out intel_disable_iommus() in intel_iommu_shutdowan()? diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 0182cff2c7ac..532e62600f95 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -4928,8 +4928,10 @@ void

Re: [PATCH v4 3/5] iommu/vt-d: Disable non-recoverable fault processing before unbind

2020-05-07 Thread Lu Baolu
On 5/8/20 10:12 AM, Tian, Kevin wrote: From: Lu Baolu Sent: Thursday, May 7, 2020 9:23 PM Hi Kevin, On 2020/5/7 13:45, Tian, Kevin wrote: From: Lu Baolu Sent: Thursday, May 7, 2020 8:56 AM When a PASID is used for SVA by the device, it's possible that the PASID entry is cleared before

Re: [PATCH v4 4/5] iommu/vt-d: Add page request draining support

2020-05-07 Thread Lu Baolu
Hi Kevin, On 5/7/20 2:35 PM, Tian, Kevin wrote: From: Lu Baolu Sent: Thursday, May 7, 2020 8:56 AM When a PASID is stopped or terminated, there can be pending PRQs (requests that haven't received responses) in remapping hardware. This adds the interface to drain page requests and call it when

Re: [PATCH v4 3/5] iommu/vt-d: Disable non-recoverable fault processing before unbind

2020-05-07 Thread Lu Baolu
On 5/8/20 12:55 AM, Jacob Pan wrote: On Thu, 7 May 2020 08:55:32 +0800 Lu Baolu wrote: When a PASID is used for SVA by the device, it's possible that the PASID entry is cleared before the device flushes all ongoing DMA requests. The IOMMU should ignore the non-recoverable faults caused

Re: [PATCH v4 2/5] iommu/vt-d: debugfs: Add support to show inv queue internals

2020-05-07 Thread Lu Baolu
Hi Jacob, On 5/8/20 12:47 AM, Jacob Pan wrote: Hi Baolu, Very helpful feature, thanks for doing this. Just a small suggestion. Thanks a lot for reviewing my patch. On Thu, 7 May 2020 08:55:31 +0800 Lu Baolu wrote: Export invalidation queue internals of each iommu device through

Re: [PATCH v4 3/5] iommu/vt-d: Disable non-recoverable fault processing before unbind

2020-05-07 Thread Lu Baolu
Hi Kevin, On 2020/5/7 13:45, Tian, Kevin wrote: From: Lu Baolu Sent: Thursday, May 7, 2020 8:56 AM When a PASID is used for SVA by the device, it's possible that the PASID entry is cleared before the device flushes all ongoing DMA requests. The IOMMU should ignore the non-recoverable faults

Re: [PATCH v4 0/5] iommu/vt-d: Add page request draining support

2020-05-07 Thread Lu Baolu
Hi Kevin, Thanks a lot for reviewing. On 2020/5/7 14:38, Tian, Kevin wrote: From: Lu Baolu Sent: Thursday, May 7, 2020 8:55 AM When a PASID is stopped or terminated, there can be pending PRQs (requests that haven't received responses) in the software and remapping hardware. The pending page

[PATCH v4 5/5] iommu/vt-d: Remove redundant IOTLB flush

2020-05-06 Thread Lu Baolu
IOTLB flush already included in the PASID tear down and the page request drain process. There is no need to flush again. Signed-off-by: Jacob Pan Signed-off-by: Lu Baolu --- drivers/iommu/intel-svm.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/iommu/intel

[PATCH v4 2/5] iommu/vt-d: debugfs: Add support to show inv queue internals

2020-05-06 Thread Lu Baolu
8 0014 9 000200250001672be824 Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu-debugfs.c | 62 + 1 file changed, 62

[PATCH v4 3/5] iommu/vt-d: Disable non-recoverable fault processing before unbind

2020-05-06 Thread Lu Baolu
. This sets FPD bit when PASID entry is cleared in the mm notifier and clear it when the pasid is unbound. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 4 ++-- drivers/iommu/intel-pasid.c | 26 +- drivers/iommu/intel-pasid.h | 3 ++- drivers/iommu/intel-svm.c

[PATCH v4 4/5] iommu/vt-d: Add page request draining support

2020-05-06 Thread Lu Baolu
When a PASID is stopped or terminated, there can be pending PRQs (requests that haven't received responses) in remapping hardware. This adds the interface to drain page requests and call it when a PASID is terminated. Signed-off-by: Jacob Pan Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu

[PATCH v4 0/5] iommu/vt-d: Add page request draining support

2020-05-06 Thread Lu Baolu
alized, no need to consider reentrance; - Ensure no new-coming prq before drain prq in queue; - Handle page request overflow case. v1->v2: - Fix race between multiple prq handling threads. Lu Baolu (5): iommu/vt-d: Multiple descriptors per qi_submit_sync() iommu/vt-d: debugfs: Ad

[PATCH v4 1/5] iommu/vt-d: Multiple descriptors per qi_submit_sync()

2020-05-06 Thread Lu Baolu
the Page-request Drain (PD) bit in the wait descriptor. Signed-off-by: Jacob Pan Signed-off-by: Lu Baolu --- drivers/iommu/dmar.c| 63 + drivers/iommu/intel-pasid.c | 4 +- drivers/iommu/intel-svm.c | 6 +-- drivers/iommu

[PATCH v4 1/3] iommu/vt-d: Allow 32bit devices to uses DMA domain

2020-05-05 Thread Lu Baolu
, the compiler will complain that some functions are defined but not used. Cc: Daniel Drake Cc: Derrick Jonathan Cc: Jerry Snitselaar Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 291 +--- 1 file changed, 1 insertion(+), 290 deletions(-) diff --git

[PATCH v4 2/3] iommu/vt-d: Allow PCI sub-hierarchy to use DMA domain

2020-05-05 Thread Lu Baolu
DMA domain at the beginning because all PCI devices behind the bridge use the same source-id in their transactions and the domain couldn't be changed at run-time. Intel IOMMU driver is now aligned with the default domain framework, there's no need to keep this requirement anymore. Signed-off-by: Lu Baolu --

[PATCH v4 3/3] iommu/vt-d: Apply per-device dma_ops

2020-05-05 Thread Lu Baolu
. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 82 - 1 file changed, 26 insertions(+), 56 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index af309e8fa6f5..29d3940847d3 100644 --- a/drivers/iommu/intel-iommu.c

[PATCH v4 0/3] Replace private domain with per-group default domain

2020-05-05 Thread Lu Baolu
series will be deprecated due to a race concern between domain switching and device driver probing. v1->v2: - Rename the iommu ops callback to def_domain_type Lu Baolu (3): iommu/vt-d: Allow 32bit devices to uses DMA domain iommu/vt-d: Allow PCI sub-hierarchy to use DMA domain iommu/vt

Re: [PATCH v3 16/34] iommu/vt-d: Convert to probe/release_device() call-backs

2020-04-29 Thread Lu Baolu
On 2020/4/29 21:36, Joerg Roedel wrote: From: Joerg Roedel Convert the Intel IOMMU driver to use the probe_device() and release_device() call-backs of iommu_ops, so that the iommu core code does the group and sysfs setup. Signed-off-by: Joerg Roedel Reviewed-by: Lu Baolu Best regards

Re: [PATCH v3 04/34] iommu/vt-d: Wire up iommu_ops->def_domain_type

2020-04-29 Thread Lu Baolu
On 2020/4/29 21:36, Joerg Roedel wrote: From: Joerg Roedel The Intel VT-d driver already has a matching function to determine the default domain type for a device. Wire it up in intel_iommu_ops. Signed-off-by: Joerg Roedel Reviewed-by: Lu Baolu Best regards, baolu --- drivers/iommu

Re: [PATCH 5/5] virtio: Add bounce DMA ops

2020-04-29 Thread Lu Baolu
On 2020/4/29 14:50, Michael S. Tsirkin wrote: On Wed, Apr 29, 2020 at 01:42:13PM +0800, Lu Baolu wrote: On 2020/4/29 12:57, Michael S. Tsirkin wrote: On Wed, Apr 29, 2020 at 10:22:32AM +0800, Lu Baolu wrote: On 2020/4/29 4:41, Michael S. Tsirkin wrote: On Tue, Apr 28, 2020 at 11:19:52PM

Re: [PATCH v3 3/4] iommu/vt-d: Add page request draining support

2020-04-29 Thread Lu Baolu
Hi Jacob, On 2020/4/29 11:36, Jacob Pan wrote: On Wed, 22 Apr 2020 16:06:10 +0800 Lu Baolu wrote: When a PASID is stopped or terminated, there can be pending PRQs (requests that haven't received responses) in remapping hardware. This adds the interface to drain page requests and call it when

Re: [PATCH 5/5] virtio: Add bounce DMA ops

2020-04-28 Thread Lu Baolu
On 2020/4/29 12:57, Michael S. Tsirkin wrote: On Wed, Apr 29, 2020 at 10:22:32AM +0800, Lu Baolu wrote: On 2020/4/29 4:41, Michael S. Tsirkin wrote: On Tue, Apr 28, 2020 at 11:19:52PM +0530, Srivatsa Vaddagiri wrote: * Michael S. Tsirkin [2020-04-28 12:17:57]: Okay, but how is all

Re: [PATCH 5/5] virtio: Add bounce DMA ops

2020-04-28 Thread Lu Baolu
On 2020/4/29 4:41, Michael S. Tsirkin wrote: On Tue, Apr 28, 2020 at 11:19:52PM +0530, Srivatsa Vaddagiri wrote: * Michael S. Tsirkin [2020-04-28 12:17:57]: Okay, but how is all this virtio specific? For example, why not allow separate swiotlbs for any type of device? For example, this

Re: [PATCH] iommu/vt-d: Fix panic after kexec -p for kdump

2019-10-21 Thread Lu Baolu
By the way, Joerg Roedel is the IOMMU subsystem maintainer. If you have a v2, please add his email in the "To" list. You can always use scripts/get_maintainer.pl to check who should the patch be sent to. :-) Best regards, Baolu On 10/21/19 3:27 PM, Lu Baolu wrote: Hi John, On 10/1

Re: [PATCH] iommu/vt-d: Fix panic after kexec -p for kdump

2019-10-21 Thread Lu Baolu
46c784ecfe ("iommu/vt-d: Implement is_attach_deferred iommu ops entry") Cc: sta...@vger.kernel.org # v5.3+ With above: Reviewed-by: Lu Baolu Best regards, Baolu Signed-off-by: John Donnelly --- drivers/iommu/intel-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --gi

Re: [RFC PATCH] iommu/vt-d: Fix IOMMU field not populated on device hot re-plug

2019-10-11 Thread Lu Baolu
Hi Janusz, On 9/3/19 3:41 PM, Janusz Krzysztofik wrote: Hi Baolu, On Tuesday, September 3, 2019 3:29:40 AM CEST Lu Baolu wrote: Hi Janusz, On 9/2/19 4:37 PM, Janusz Krzysztofik wrote: I am not saying that keeping data is not acceptable. I just want to check whether there are any other

Re: [PATCH] iommu/vt-d: Return the correct dma mask when we are bypassing the IOMMU

2019-10-09 Thread Lu Baolu
s patch looks good to me. Reviewed-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 3f974919d3bd..79e35b3180ac 100644 --- a/drivers/iommu/intel-iommu.c

Re: [PATCH] iommu/vt-d: Return the correct dma mask when we are bypassing the IOMMU

2019-10-09 Thread Lu Baolu
Hi Christoph, On 10/9/19 2:51 PM, Christoph Hellwig wrote: On Wed, Oct 09, 2019 at 10:45:15AM +0800, Lu Baolu wrote: Do you mind explaining why we always return 32 bit here? See the comment in dma_get_required_mask(). Got it. Thank you. Best regards, Baolu

Re: [PATCH] iommu/vt-d: Return the correct dma mask when we are bypassing the IOMMU

2019-10-08 Thread Lu Baolu
Hi, On 10/8/19 10:33 PM, Arvind Sankar wrote: We must return a mask covering the full physical RAM when bypassing the IOMMU mapping. Also, in iommu_need_mapping, we need to check using dma_direct_get_required_mask to ensure that the device's dma_mask can cover physical RAM before deciding to

Re: [RFC PATCH 2/4] iommu/vt-d: Add first level page table interfaces

2019-09-25 Thread Lu Baolu
Hi Peter, Thanks for reviewing my code. On 9/25/19 1:21 PM, Peter Xu wrote: On Mon, Sep 23, 2019 at 08:24:52PM +0800, Lu Baolu wrote: This adds functions to manipulate first level page tables which could be used by a scalale mode capable IOMMU unit. intel_mmmap_range(domain, addr, end

[PATCH v9 3/5] iommu/vt-d: Don't switch off swiotlb if bounce page is used

2019-09-06 Thread Lu Baolu
The bounce page implementation depends on swiotlb. Hence, don't switch off swiotlb if the system has untrusted devices or could potentially be hot-added with any untrusted devices. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Lu Baolu Reviewed-by: Christoph Hellwig --- drivers

[PATCH v9 2/5] iommu/vt-d: Check whether device requires bounce buffer

2019-09-06 Thread Lu Baolu
-by: Lu Baolu Tested-by: Xu Pengfei Tested-by: Mika Westerberg --- Documentation/admin-guide/kernel-parameters.txt | 5 + drivers/iommu/intel-iommu.c | 7 +++ 2 files changed, 12 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation

[PATCH v9 1/5] swiotlb: Split size parameter to map/unmap APIs

2019-09-06 Thread Lu Baolu
This splits the size parameter to swiotlb_tbl_map_single() and swiotlb_tbl_unmap_single() into an alloc_size and a mapping_size parameter, where the latter one is rounded up to the iommu page size. Suggested-by: Christoph Hellwig Signed-off-by: Lu Baolu Reviewed-by: Christoph Hellwig

[PATCH v9 4/5] iommu/vt-d: Add trace events for device dma map/unmap

2019-09-06 Thread Lu Baolu
This adds trace support for the Intel IOMMU driver. It also declares some events which could be used to trace the events when an IOVA is being mapped or unmapped in a domain. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Mika Westerberg Signed-off-by: Lu Baolu Reviewed-by: Steven

[PATCH v9 0/5] iommu: Bounce page for untrusted devices

2019-09-06 Thread Lu Baolu
avoid code dumplication, but we found the swiotlb implementations are not ready for the use of bounce page pool. https://lkml.org/lkml/2019/3/19/259 - This patch series has been rebased to v5.1-rc2. Lu Baolu (5): swiotlb: Split size parameter to map/unmap APIs iommu/vt-d: Check whether

[PATCH v9 5/5] iommu/vt-d: Use bounce buffer for untrusted devices

2019-09-06 Thread Lu Baolu
. To address this, the Intel IOMMU driver will use bounce pages for those buffers which don't fill whole IOMMU pages. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Lu Baolu Tested-by: Xu Pengfei Tested-by: Mika Westerberg --- drivers/iommu/intel-iommu.c | 258

[PATCH v8 4/7] iommu/vt-d: Check whether device requires bounce buffer

2019-08-30 Thread Lu Baolu
-by: Lu Baolu Tested-by: Xu Pengfei Tested-by: Mika Westerberg --- Documentation/admin-guide/kernel-parameters.txt | 5 + drivers/iommu/intel-iommu.c | 6 ++ 2 files changed, 11 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation

[PATCH v7 6/7] iommu/vt-d: Add trace events for device dma map/unmap

2019-08-23 Thread Lu Baolu
This adds trace support for the Intel IOMMU driver. It also declares some events which could be used to trace the events when an IOVA is being mapped or unmapped in a domain. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Mika Westerberg Signed-off-by: Lu Baolu Reviewed-by: Steven

[PATCH v7 5/7] iommu/vt-d: Check whether device requires bounce buffer

2019-08-23 Thread Lu Baolu
-by: Lu Baolu Tested-by: Xu Pengfei Tested-by: Mika Westerberg --- Documentation/admin-guide/kernel-parameters.txt | 5 + drivers/iommu/intel-iommu.c | 6 ++ 2 files changed, 11 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation

[PATCH v7 7/7] iommu/vt-d: Use bounce buffer for untrusted devices

2019-08-23 Thread Lu Baolu
. To address this, the Intel IOMMU driver will use bounce pages for those buffers which don't fill whole IOMMU pages. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Lu Baolu Tested-by: Xu Pengfei Tested-by: Mika Westerberg --- drivers/iommu/intel-iommu.c | 256

[PATCH v7 4/7] swiotlb: Zero out bounce buffer for untrusted device

2019-08-23 Thread Lu Baolu
This is necessary to avoid exposing valid kernel data to any malicious device. Suggested-by: Christoph Hellwig Signed-off-by: Lu Baolu --- kernel/dma/swiotlb.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index

[PATCH v7 1/7] iommu/vt-d: Don't switch off swiotlb if use direct dma

2019-08-23 Thread Lu Baolu
The direct dma implementation depends on swiotlb. Hence, don't switch off swiotlb since direct dma interfaces are used in this driver. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Lu Baolu Reviewed-by: Christoph Hellwig --- drivers/iommu/Kconfig | 1 + drivers/iommu/intel

[PATCH v7 3/7] swiotlb: Split size parameter to map/unmap APIs

2019-08-23 Thread Lu Baolu
This splits the size parameter to swiotlb_tbl_map_single() and swiotlb_tbl_unmap_single() into an alloc_size and a mapping_size parameter, where the latter one is rounded up to the iommu page size. Suggested-by: Christoph Hellwig Signed-off-by: Lu Baolu Reviewed-by: Christoph Hellwig

[PATCH v7 2/7] PCI: Add dev_is_untrusted helper

2019-08-23 Thread Lu Baolu
There are several places in the kernel where it is necessary to check whether a device is a pci untrusted device. Add a helper to simplify the callers. Signed-off-by: Lu Baolu Reviewed-by: Christoph Hellwig --- include/linux/pci.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include

[PATCH v7 0/7] iommu: Bounce page for untrusted devices

2019-08-23 Thread Lu Baolu
ussed the possibility of reusing swiotlb code to avoid code dumplication, but we found the swiotlb implementations are not ready for the use of bounce page pool. https://lkml.org/lkml/2019/3/19/259 - This patch series has been rebased to v5.1-rc2. Lu Baolu (7): iommu/vt-d: Don't s

[PATCH v6 2/8] PCI: Add dev_is_untrusted helper

2019-07-29 Thread Lu Baolu
There are several places in the kernel where it is necessary to check whether a device is a pci untrusted device. Add a helper to simplify the callers. Signed-off-by: Lu Baolu Reviewed-by: Christoph Hellwig --- include/linux/pci.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include

[PATCH v6 3/8] swiotlb: Split size parameter to map/unmap APIs

2019-07-29 Thread Lu Baolu
This splits the size parameter to swiotlb_tbl_map_single() and swiotlb_tbl_unmap_single() into an alloc_size and a mapping_size parameter, where the latter one is rounded up to the iommu page size. Suggested-by: Christoph Hellwig Signed-off-by: Lu Baolu Reviewed-by: Christoph Hellwig

Re: [PATCH v5 09/10] iommu/vt-d: Add trace events for device dma map/unmap

2019-07-25 Thread Lu Baolu
Hi, On 7/25/19 8:26 PM, Steven Rostedt wrote: On Thu, 25 Jul 2019 11:17:16 +0800 Lu Baolu wrote: This adds trace support for the Intel IOMMU driver. It also declares some events which could be used to trace the events when an IOVA is being mapped or unmapped in a domain. Cc: Ashok Raj Cc

Re: [PATCH v5 02/10] iommu/vt-d: Use per-device dma_ops

2019-07-25 Thread Lu Baolu
Hi, On 7/25/19 7:43 PM, Christoph Hellwig wrote: On Thu, Jul 25, 2019 at 03:18:03PM +0800, Lu Baolu wrote: Don't we need to keep this bit so that we still allow the IOMMU to act if the device has a too small DMA mask to address all memory in the system, even if if it should otherwise

Re: [PATCH 0/6] iommu/vt-d: Fixes and cleanups for linux-next

2019-06-11 Thread Lu Baolu
Hi, This is supposed to be fixed by this patch https://lkml.org/lkml/2019/6/3/115 which is part of several RMRR related fixes and enhancements. Best regards, Baolu On 6/12/19 12:55 AM, Qian Cai wrote: On Sun, 2019-06-09 at 10:37 +0800, Lu Baolu wrote: Hi Joerg, This series includes

Re: [PATCH v5 3/7] iommu/vt-d: Introduce is_downstream_to_pci_bridge helper

2019-05-28 Thread Lu Baolu
Hi, On 5/28/19 7:50 PM, Eric Auger wrote: Several call sites are about to check whether a device belongs to the PCI sub-hierarchy of a candidate PCI-PCI bridge. Introduce an helper to perform that check. This looks good to me. Reviewed-by: Lu Baolu Best regards, Baolu Signed-off

Re: [PATCH v3 1/8] iommu: Add ops entry for supported default domain type

2019-05-08 Thread Lu Baolu
. But domain type saved in iommu_domain is consumed in iommu.c and exposed to user through sysfs. It's not clean if the iommu driver silently replace the default domain. Best regards, Lu Baolu Robin. On Mon, Apr 29, 2019 at 3:16 AM Lu Baolu wrote: This adds an optional ops entry to query

Re: [PATCH v3 5/8] iommu/vt-d: Implement def_domain_type iommu ops entry

2019-04-29 Thread Lu Baolu
_mask(dev)) { Agreed and will add this in the next version. Best regards, Lu Baolu

Re: [PATCH v3 08/10] iommu/vt-d: Check whether device requires bounce buffer

2019-04-23 Thread Lu Baolu
reasonable to me. Let's listen to more opinions. Best regards, Lu Baolu

Re: [PATCH 4/4] iommu/vt-d: Remove lazy allocation of domains

2019-03-09 Thread Lu Baolu
Hi, On 3/9/19 7:49 PM, James Sewart wrote: Hey Lu, On 9 Mar 2019, at 01:53, Lu Baolu wrote: Hi James, On 3/9/19 12:57 AM, James Sewart wrote: Hey Lu, On 8 Mar 2019, at 03:09, Lu Baolu wrote: Do you mind if I work on top of your patches for further cleanups and sign off a v2 together

Re: [PATCH 4/4] iommu/vt-d: Remove lazy allocation of domains

2019-03-08 Thread Lu Baolu
Hi James, On 3/9/19 12:57 AM, James Sewart wrote: Hey Lu, On 8 Mar 2019, at 03:09, Lu Baolu wrote: Do you mind if I work on top of your patches for further cleanups and sign off a v2 together with you? Sure, sounds good. I’ll fixup patch 3 and have a go at integrating iommu_prepare_isa

Re: [PATCH 4/4] iommu/vt-d: Remove lazy allocation of domains

2019-03-07 Thread Lu Baolu
Hi James, On 3/7/19 6:21 PM, James Sewart wrote: Hey Lu, On 7 Mar 2019, at 06:31, Lu Baolu wrote: Hi James, On 3/7/19 2:08 AM, James Sewart wrote: - /* -* For each rmrr -* for each dev attached to rmrr -* do -* locate drhd for dev, alloc

Re: [PATCH 4/4] iommu/vt-d: Remove lazy allocation of domains

2019-03-07 Thread Lu Baolu
Hi, On 3/7/19 6:21 PM, James Sewart wrote: Hey Lu, On 7 Mar 2019, at 06:31, Lu Baolu wrote: Hi James, On 3/7/19 2:08 AM, James Sewart wrote: - /* -* For each rmrr -* for each dev attached to rmrr -* do -* locate drhd for dev, alloc domain

Re: [PATCH 4/4] iommu/vt-d: Remove lazy allocation of domains

2019-03-06 Thread Lu Baolu
look great to me. But I do think we need further cleanups. The rmrr code is one example, and the identity domain (si_domain) is another. Do you mind if I work on top of your patches for further cleanups and sign off a v2 together with you? Best regards, Lu Baolu

Re: [PATCH 4/4] iommu/vt-d: Remove lazy allocation of domains

2019-03-05 Thread Lu Baolu
Hi, On 3/5/19 7:46 PM, James Sewart wrote: Hey Lu, On 5 Mar 2019, at 06:59, Lu Baolu wrote: Hi, It's hard for me to understand why do we remove the rmrr related code in this patch. The RMRR code removed here requires the lazy allocation of domains to exist, as it is run before iommu.c

Re: [PATCH 0/4] iommu/vt-d: Fix-up device-domain relationship by refactoring to use iommu group default domain.

2019-03-05 Thread Lu Baolu
o know whether multiple domains per group due to lack of ACS consideration will cause any issues that we need to fix in the stable kernels. Best regards, Lu Baolu Cheers, James On 5 Mar 2019, at 06:05, Lu Baolu wrote: Hi James, Very glad to see this. Thank you! On 3/4/19 11:41 PM, James

Re: [PATCH 4/4] iommu/vt-d: Remove lazy allocation of domains

2019-03-04 Thread Lu Baolu
urn -EINVAL; + return -ENOMEM; This is not related to this patch. Let's do it in a separated patch. spin_lock_irqsave(_domain_lock, flags); spin_lock(>lock); Best regards, Lu Baolu

Re: [PATCH 3/4] iommu/vt-d: Allow IOMMU_DOMAIN_DMA and IOMMU_DOMAIN_IDENTITY to be allocated

2019-03-04 Thread Lu Baolu
ing, right? If so, why do we need to have a special DOMAIN_FLAG_INITIALISED flag for DMA domains? + /* check if this iommu agaw is sufficient for max mapped address */ addr_width = agaw_to_width(iommu->agaw); if (addr_width > cap_mgaw(iommu->cap)) Best regards, Lu Baolu

Re: [PATCH 0/4] iommu/vt-d: Fix-up device-domain relationship by refactoring to use iommu group default domain.

2019-03-04 Thread Lu Baolu
by pci_device_group. Is this a bug fix or an improvement? What's the real issue will it cause if we go without this patch set? Best regards, Lu Baolu Patch 3 permits domain type IOMMU_DOMAIN_DMA to be allocated via the iommu_ops api, allowing the default_domain of an iommu group to be set in iommu.c

[PATCH 2/4] iommu/vt-d: Set context field after value initialized

2019-02-28 Thread Lu Baolu
Fixes: 7373a8cc38197 ("iommu/vt-d: Setup context and enable RID2PASID support") Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index abdd165a829c..c9

[PATCH 3/4] iommu/vt-d: Fix NULL pointer reference in intel_svm_bind_mm()

2019-02-28 Thread Lu Baolu
: Jacob Pan Reported-by: Dave Jiang Fixes: 2f26e0a9c9860 ("iommu/vt-d: Add basic SVM PASID support") Signed-off-by: Lu Baolu --- drivers/iommu/intel-svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c index c7

[PATCH 4/4] iommu/vt-d: Get domain ID before clear pasid entry

2019-02-28 Thread Lu Baolu
("iommu/vt-d: Add second level page table interface") Signed-off-by: Lu Baolu --- drivers/iommu/intel-pasid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel-pasid.c b/drivers/iommu/intel-pasid.c index 53fe5248d8f1..03b12d2ee213 100644 --- a/dri

[PATCH 0/4] iommu/vt-d: Several fixes for 5.1

2019-02-28 Thread Lu Baolu
Hi Joerg, This includes several small fixes. All are stable kernel irrelated. Please consider it for 5.1-rc1. Best regards, Lu Baolu Lu Baolu (4): iommu/vt-d: Disable ATS support on untrusted devices iommu/vt-d: Set context field after value initialized iommu/vt-d: Fix NULL pointer

[PATCH 1/4] iommu/vt-d: Disable ATS support on untrusted devices

2019-02-28 Thread Lu Baolu
Cc: Jacob Pan Cc: Mika Westerberg Suggested-by: Kevin Tian Suggested-by: Ashok Raj Fixes: fb58fdcd295b9 ("iommu/vt-d: Do not enable ATS for untrusted devices") Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a

[PATCH 1/1] iommu/vt-d: Check identity map for hot-added devices

2019-02-24 Thread Lu Baolu
identity mapped domain was replaced with a normal domain. Cc: Ashok Raj Cc: Jacob Pan Cc: Fenghua Yu Cc: sta...@vger.kernel.org Reported-by: Jis Ben Signed-off-by: Lu Baolu Tested-by: James Dong --- drivers/iommu/intel-iommu.c | 21 - 1 file changed, 12 insertions(+), 9 de

Re: [PATCH] iommu/vt-d: Handle hotplug devices' default identity mapping setting

2019-02-24 Thread Lu Baolu
scribed in the commit message. Best regards, Lu Baolu >From d942e60557fc7ea6fee535fb9a0a7d334d65b636 Mon Sep 17 00:00:00 2001 From: Lu Baolu Date: Sun, 24 Feb 2019 10:01:03 +0800 Subject: [PATCH 1/1] iommu/vt-d: Check identity map for hot-added devices The Intel IOMMU driver will put devices into

Re: [PATCH] iommu/vt-d: Handle hotplug devices' default identity mapping setting

2019-02-21 Thread Lu Baolu
James Best regards, Lu Baolu

Re: [PATCH] iommu/vt-d: Handle hotplug devices' default identity mapping setting

2019-02-21 Thread Lu Baolu
Hi On 2/22/19 1:06 PM, Lu Baolu wrote: Do you mind checking this? diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 6ecdcf8fc8c0..f62f30bc1339 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -2632,6 +2632,9 @@ static struct dmar_domain

Re: [PATCH] iommu/vt-d: Handle hotplug devices' default identity mapping setting

2019-02-21 Thread Lu Baolu
ate and initialize new domain for the device */ domain = alloc_domain(0); if (!domain) Best regards, Lu Baolu

[PATCH v7 9/9] vfio/type1: Handle different mdev isolation type

2019-02-21 Thread Lu Baolu
Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Jean-Philippe Brucker --- drivers/vfio/vfio_iommu_type1.c | 48 - 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/drivers/vfio

[PATCH v7 4/9] iommu/vt-d: Move common code out of iommu_attch_device()

2019-02-21 Thread Lu Baolu
This part of code could be used by both normal and aux domain specific attach entries. Hence move them into a common function to avoid duplication. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 60 ++--- 1

[PATCH v7 8/9] vfio/type1: Add domain at(de)taching group helpers

2019-02-21 Thread Lu Baolu
scope) instead. The added helper supports attaching domain to groups for both pci and mdev devices. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu Reviewed-by: Jean-Philippe Brucker --- drivers/vfio/vfio_iommu_type1.c

[PATCH v7 0/9] vfio/mdev: IOMMU aware mediated device

2019-02-21 Thread Lu Baolu
cture-specification [2] https://software.intel.com/en-us/download/intel-scalable-io-virtualization-technical-specification [3] https://schd.ws/hosted_files/lc32018/00/LC3-SIOV-final.pdf Best regards, Lu Baolu Change log: v6->v7: - Update PATCH 1/9 and the cover letter with Jean's comments

[PATCH v7 2/9] iommu/vt-d: Move enable pasid out of CONFIG_INTEL_IOMMU_SVM

2019-02-21 Thread Lu Baolu
This moves intel_iommu_enable_pasid() out of the scope of CONFIG_INTEL_IOMMU_SVM with more and more features requiring pasid function. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 22 +++--- drivers/iommu/intel-svm.c

[PATCH v7 3/9] iommu/vt-d: Add per-device IOMMU feature ops entries

2019-02-21 Thread Lu Baolu
This adds the iommu ops entries for aux-domain per-device feature query and enable/disable. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 159

[PATCH v7 7/9] vfio/mdev: Add iommu related member in mdev_device

2019-02-21 Thread Lu Baolu
don't need to set the iommu device if it uses vendor defined isolation. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Suggested-by: Kevin Tian Suggested-by: Alex Williamson Signed-off-by: Lu Baolu Reviewed-by: Jean-Philippe Brucker --- drivers/vfio/mdev/mdev_core.c

[PATCH v7 6/9] iommu/vt-d: Return ID associated with an auxiliary domain

2019-02-21 Thread Lu Baolu
: Kevin Tian Signed-off-by: Sanjay Kumar Signed-off-by: Liu Yi L Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 8ecf09db6047..b79c72cc5931 100644 --- a/drivers

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