Re: [PATCH v2 5/8] iommu/vt-d: Add first level page table interfaces

2019-12-10 Thread Lu Baolu
Hi Jacob, On 12/3/19 7:27 AM, Jacob Pan wrote: On Thu, 28 Nov 2019 10:25:47 +0800 Lu Baolu wrote: This adds functions to manipulate first level page tables which could be used by a scalale mode capable IOMMU unit. FL and SL page tables are very similar, and I presume we are not using all

[PATCH v3 1/6] iommu/vt-d: Identify domains using first level page table

2019-12-10 Thread Lu Baolu
This checks whether a domain should use the first level page table for map/unmap and marks it in the domain structure. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 39 + 1 file changed, 39 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b

[PATCH v3 6/6] iommu/vt-d: Use iova over first level

2019-12-10 Thread Lu Baolu
After we make all map/unmap paths support first level page table. Let's turn it on if hardware supports scalable mode. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/

[PATCH v3 4/6] iommu/vt-d: Setup pasid entries for iova over first level

2019-12-10 Thread Lu Baolu
iova translation. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 48 +++-- include/linux/intel-iommu.h | 10 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index

[PATCH v3 3/6] iommu/vt-d: Add PASID_FLAG_FL5LP for first-level pasid setup

2019-12-10 Thread Lu Baolu
PASID_FLAG_FL5LP bit in the flags which indicates whether the 5-level paging mode should be used. Signed-off-by: Lu Baolu --- drivers/iommu/intel-pasid.c | 7 ++- drivers/iommu/intel-pasid.h | 6 ++ drivers/iommu/intel-svm.c | 8 ++-- 3 files changed, 14 insertions(+), 7 deletions

[PATCH v3 0/6] Use 1st-level for IOVA translation

2019-12-10 Thread Lu Baolu
he page table address binding to host's first level. Based-on-idea-by: Ashok Raj Based-on-idea-by: Kevin Tian Based-on-idea-by: Liu Yi L Based-on-idea-by: Jacob Pan Based-on-idea-by: Sanjay Kumar Based-on-idea-by: Lu Baolu Change log: v2->v3: - The previous version was posted here

[PATCH v3 5/6] iommu/vt-d: Flush PASID-based iotlb for iova over first level

2019-12-10 Thread Lu Baolu
When software has changed first-level tables, it should invalidate the affected IOTLB and the paging-structure-caches using the PASID- based-IOTLB Invalidate Descriptor defined in spec 6.5.2.4. Signed-off-by: Lu Baolu --- drivers/iommu/dmar.c| 41

[PATCH v3 2/6] iommu/vt-d: Add set domain DOMAIN_ATTR_NESTING attr

2019-12-10 Thread Lu Baolu
nested mode, otherwise failure. Signed-off-by: Yi Sun Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 56 + 1 file changed, 56 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index c93fe716e6b0..2b5a47584baf

Re: [PATCH 1/1] iommu/vt-d: Fix dmar pte read access not set error

2019-12-11 Thread Lu Baolu
Hi, On 12/12/19 12:35 AM, Jerry Snitselaar wrote: On Wed Dec 11 19, Lu Baolu wrote: If the default DMA domain of a group doesn't fit a device, it will still sit in the group but use a private identity domain. When map/unmap/iova_to_phys come through iommu API, the driver should still

Re: [PATCH] iommu/vt-d: Set ISA bridge reserved region as relaxable

2019-12-11 Thread Lu Baolu
rced by drivers such as vfio. Fixes: d850c2ee5fe2 ("iommu/vt-d: Expose ISA direct mapping region via iommu_get_resv_regions") Cc: sta...@vger.kernel.org # v5.3+ Link: https://lore.kernel.org/linux-iommu/20191211082304.2d4fa...@x1.home Reported-by: cprt Tested-by: cprt Signed-off-by: Alex

Re: [PATCH 1/1] iommu/vt-d: Fix dmar pte read access not set error

2019-12-11 Thread Lu Baolu
Hi, On 12/12/19 9:49 AM, Jerry Snitselaar wrote: On Wed Dec 11 19, Lu Baolu wrote: If the default DMA domain of a group doesn't fit a device, it will still sit in the group but use a private identity domain. When map/unmap/iova_to_phys come through iommu API, the driver should still serve

Re: [PATCH 0/3] iommu/vt-d bad RMRR workarounds

2019-12-11 Thread Lu Baolu
Hi, On 12/12/19 3:46 AM, Barret Rhoden via iommu wrote: I can imagine a bunch of ways around this. One option is to hook in a check for buggy RMRRs in intel-iommu.c. If the base and end are 0, just ignore the entry. That works for my specific buggy DMAR entry. There might be other buggy entr

Re: [PATCH 1/1] iommu/vt-d: Fix dmar pte read access not set error

2019-12-12 Thread Lu Baolu
Hi, On 12/13/19 8:30 AM, Jerry Snitselaar wrote: On Thu Dec 12 19, Lu Baolu wrote: Hi, On 12/12/19 9:49 AM, Jerry Snitselaar wrote: On Wed Dec 11 19, Lu Baolu wrote: If the default DMA domain of a group doesn't fit a device, it will still sit in the group but use a private identity d

Re: [PATCH 1/1] iommu/vt-d: Fix dmar pte read access not set error

2019-12-12 Thread Lu Baolu
Hi, On 12/13/19 11:16 AM, Jerry Snitselaar wrote: On Thu Dec 12 19, Jerry Snitselaar wrote: On Fri Dec 13 19, Lu Baolu wrote: Hi, On 12/13/19 8:30 AM, Jerry Snitselaar wrote: On Thu Dec 12 19, Lu Baolu wrote: Hi, On 12/12/19 9:49 AM, Jerry Snitselaar wrote: On Wed Dec 11 19, Lu Baolu

Re: [PATCH] iommu/vt-d: Allocate reserved region for ISA with correct permission

2019-12-13 Thread Lu Baolu
Hi Jerry, On 12/13/19 1:36 PM, Jerry Snitselaar wrote: Currently the reserved region for ISA is allocated with no permissions. If a dma domain is being used, mapping this region will fail. Set the permissions to DMA_PTE_READ|DMA_PTE_WRITE. Cc: Joerg Roedel Cc: Lu Baolu Cc: iommu@lists.linux

Re: [PATCH 0/3] iommu/vt-d bad RMRR workarounds

2019-12-13 Thread Lu Baolu
On 12/13/19 10:31 PM, Barret Rhoden wrote: On 12/11/19 9:43 PM, Lu Baolu wrote: The VT-d spec defines the BIOS considerations about RMRR in section 8.4: " BIOS must report the RMRR reported memory addresses as reserved (or as EFI runtime) in the system memory map returned through methods

Re: [PATCH v3 4/6] iommu/vt-d: Setup pasid entries for iova over first level

2019-12-13 Thread Lu Baolu
Hi Liu Yi, Thanks for reviewing my patch. On 12/13/19 5:23 PM, Liu, Yi L wrote: From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On Behalf Of Lu Baolu Sent: Wednesday, December 11, 2019 10:12 AM Subject: [PATCH v3 4/6] iommu/vt-d: Setup pasid entries for iova over first

Re: [PATCH v3 5/6] iommu/vt-d: Flush PASID-based iotlb for iova over first level

2019-12-13 Thread Lu Baolu
Hi Liu Yi, On 12/13/19 7:42 PM, Liu, Yi L wrote: From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On Behalf Of Lu Baolu Sent: Wednesday, December 11, 2019 10:12 AM To: Joerg Roedel ; David Woodhouse ; Subject: [PATCH v3 5/6] iommu/vt-d: Flush PASID-based iotlb for iova over

Re: [PATCH] iommu/vt-d: Allocate reserved region for ISA with correct permission

2019-12-14 Thread Lu Baolu
Hi Jerry, On 12/14/19 9:42 AM, Lu Baolu wrote: Hi Jerry, On 12/13/19 1:36 PM, Jerry Snitselaar wrote: Currently the reserved region for ISA is allocated with no permissions. If a dma domain is being used, mapping this region will fail. Set the permissions to DMA_PTE_READ|DMA_PTE_WRITE. Cc

Re: [PATCH] iommu/vt-d: Allocate reserved region for ISA with correct permission

2019-12-14 Thread Lu Baolu
Hi, On 12/13/19 1:36 PM, Jerry Snitselaar wrote: Currently the reserved region for ISA is allocated with no permissions. If a dma domain is being used, mapping this region will fail. Set the permissions to DMA_PTE_READ|DMA_PTE_WRITE. Cc: Joerg Roedel Cc: Lu Baolu Cc: iommu@lists.linux

Re: [PATCH v3 5/6] iommu/vt-d: Flush PASID-based iotlb for iova over first level

2019-12-16 Thread Lu Baolu
Hi Yi, On 12/15/19 5:22 PM, Liu, Yi L wrote: Ok, let me explain more... default pasid is meaningful only when the domain has been attached to a device as an aux-domain. right? No exactly. Each domain has a specific default pasid, no matter normal domain (RID based) or aux-domain (PASID based).

Re: [PATCH v3 5/6] iommu/vt-d: Flush PASID-based iotlb for iova over first level

2019-12-16 Thread Lu Baolu
Hi again, On 12/17/19 9:19 AM, Lu Baolu wrote: Hi Yi, On 12/15/19 5:22 PM, Liu, Yi L wrote: Ok, let me explain more... default pasid is meaningful only when the domain has been attached to a device as an aux-domain. right? No exactly. Each domain has a specific default pasid, no matter

Re: [PATCH v3 5/6] iommu/vt-d: Flush PASID-based iotlb for iova over first level

2019-12-16 Thread Lu Baolu
Hi, On 12/17/19 9:37 AM, Lu Baolu wrote: You are right. I will change it accordingly. The logic should look like: if (domain attached to physical device) flush_piotlb_with_RID2PASID() else if (domain_attached_to_mdev_device) flush_piotlb_with_default_pasid() Both! so no "

Re: [PATCH v3 4/6] iommu/vt-d: Setup pasid entries for iova over first level

2019-12-16 Thread Lu Baolu
Hi Yi, On 12/15/19 5:37 PM, Liu, Yi L wrote: XD (bit 63) is only for the first level, and SNP (bit 11) is only for second level, right? I think we need to always set XD bit for IOVA over FL case. thoughts? Oops, I made a mistake here. Please forget SNP bit, there is no way to control SNP with

Re: [PATCH v3 5/6] iommu/vt-d: Flush PASID-based iotlb for iova over first level

2019-12-16 Thread Lu Baolu
Hi, On 2019/12/17 10:36, Liu, Yi L wrote: From: Liu, Yi L Sent: Tuesday, December 17, 2019 10:26 AM To: Lu Baolu ; Joerg Roedel ; David Woodhouse ; Alex Williamson Subject: RE: [PATCH v3 5/6] iommu/vt-d: Flush PASID-based iotlb for iova over first level From: Lu Baolu [mailto:baolu

Re: [PATCH v8 02/10] iommu/vt-d: Add nested translation helper function

2019-12-17 Thread Lu Baolu
Hi Jacob, On 12/17/19 3:24 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 level(FL) also subject to a second level(SL) page table translation. This mode is used for SVA virtua

Re: [PATCH v8 02/10] iommu/vt-d: Add nested translation helper function

2019-12-17 Thread Lu Baolu
Hi again, On 12/17/19 3:24 AM, Jacob Pan wrote: +/** + * intel_pasid_setup_nested() - Set up PASID entry for nested translation + * which is used for vSVA. The first level page tables are used for + * GVA-GPA or GIOVA-GPA translation in the guest, second level page tables + * are used for GPA-H

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

2019-12-17 Thread Lu Baolu
Hi, On 12/17/19 3:24 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 flush which will be passed down to the host as bind guest PASID calls. For the SL page tables, it wil

Re: [PATCH v8 06/10] iommu/vt-d: Cache virtual command capability register

2019-12-17 Thread Lu Baolu
Hi, On 12/17/19 3:24 AM, Jacob Pan wrote: 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 --- drivers/iommu/dmar.c| 1 + include/linux/intel-iommu.h | 4 2 files

Re: [PATCH v8 08/10] iommu/vt-d: Add custom allocator for IOASID

2019-12-17 Thread Lu Baolu
always come from the host. This ensures that 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 | 75 + include/linux/intel-iommu.h | 2 ++ 2 files changed, 77

Re: [PATCH v3 4/5] iommu: intel: Use generic_iommu_put_resv_regions()

2019-12-18 Thread Lu Baolu
Please tweak the title to "iommu/vt-d: Use generic_iommu_put_resv_regions()" then, Acked-by: Lu Baolu Best regards, baolu On 12/18/19 9:42 PM, Thierry Reding wrote: From: Thierry Reding Use the new standard function instead of open-coding it. Cc: David Woodhouse Signed-off-b

Re: [PATCH v8 04/10] iommu/vt-d: Support flushing more translation cache types

2019-12-18 Thread Lu Baolu
Hi, On 12/17/19 3:24 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. This patch adds invalidation functions that can be used for additional translation cache types. Signed-off-by: Jac

[PATCH v4 2/7] iommu/vt-d: Add set domain DOMAIN_ATTR_NESTING attr

2019-12-18 Thread Lu Baolu
nested mode, otherwise failure. Signed-off-by: Yi Sun Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 56 + 1 file changed, 56 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index c93fe716e6b0..2b5a47584baf

[PATCH v4 5/7] iommu/vt-d: Flush PASID-based iotlb for iova over first level

2019-12-18 Thread Lu Baolu
When software has changed first-level tables, it should invalidate the affected IOTLB and the paging-structure-caches using the PASID- based-IOTLB Invalidate Descriptor defined in spec 6.5.2.4. Signed-off-by: Lu Baolu --- drivers/iommu/dmar.c| 41 +++ drivers

[PATCH v4 0/7] Use 1st-level for IOVA translation

2019-12-18 Thread Lu Baolu
he page table address binding to host's first level. Based-on-idea-by: Ashok Raj Based-on-idea-by: Kevin Tian Based-on-idea-by: Liu Yi L Based-on-idea-by: Jacob Pan Based-on-idea-by: Sanjay Kumar Based-on-idea-by: Lu Baolu Change log: v3->v4: - The previous version was posted here

[PATCH v4 3/7] iommu/vt-d: Add PASID_FLAG_FL5LP for first-level pasid setup

2019-12-18 Thread Lu Baolu
PASID_FLAG_FL5LP bit in the flags which indicates whether the 5-level paging mode should be used. Signed-off-by: Lu Baolu --- drivers/iommu/intel-pasid.c | 7 ++- drivers/iommu/intel-pasid.h | 6 ++ drivers/iommu/intel-svm.c | 8 ++-- 3 files changed, 14 insertions(+), 7 deletions

[PATCH v4 1/7] iommu/vt-d: Identify domains using first level page table

2019-12-18 Thread Lu Baolu
This checks whether a domain should use the first level page table for map/unmap and marks it in the domain structure. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 39 + 1 file changed, 39 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b

[PATCH v4 6/7] iommu/vt-d: Use iova over first level

2019-12-18 Thread Lu Baolu
After we make all map/unmap paths support first level page table. Let's turn it on if hardware supports scalable mode. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/

[PATCH v4 4/7] iommu/vt-d: Setup pasid entries for iova over first level

2019-12-18 Thread Lu Baolu
iova translation. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 48 +++-- include/linux/intel-iommu.h | 16 - 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index

[PATCH v4 7/7] iommu/vt-d: debugfs: Add support to show page table internals

2019-12-18 Thread Lu Baolu
0x00015f3dc003 0x8ced7003 0x00015f3db003 0x00015f3dc003 0x8ced8003 0x00015f3db003 0x00015f3dc003 0x8ced9003 [ ... ] Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu-debugfs.c | 75 + drivers

[PATCH 2/2] iommu/vt-d: Loose requirement for flush queue initializaton

2019-12-18 Thread Lu Baolu
Currently if flush queue initialization fails, we return error or enforce the system-wide strict mode. These are unnecessary because we always check the existence of a flush queue before queuing any iova's for lazy flushing. Printing a informational message is enough. Signed-off-by: Lu

[PATCH 1/2] iommu/vt-d: Avoid iova flush queue in strict mode

2019-12-18 Thread Lu Baolu
If Intel IOMMU strict mode is enabled by users, it's unnecessary to create the iova flush queue. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 24 +++- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/

Re: [PATCH v4 4/7] iommu/vt-d: Setup pasid entries for iova over first level

2019-12-20 Thread Lu Baolu
Hi Yi, On 12/20/19 7:44 PM, Liu, Yi L wrote: From: Lu Baolu [mailto:baolu...@linux.intel.com] Sent: Thursday, December 19, 2019 11:17 AM To: Joerg Roedel ; David Woodhouse ; Alex Williamson Subject: [PATCH v4 4/7] iommu/vt-d: Setup pasid entries for iova over first level Intel VT-d in

Re: [PATCH v4 0/7] Use 1st-level for IOVA translation

2019-12-20 Thread Lu Baolu
Hi Yi, Thanks for the comments. On 12/20/19 7:50 PM, Liu, Yi L wrote: Hi Baolu, In a brief, this version is pretty good to me. However, I still want to have the following checks to see if anything missed. Wish it helps. 1) would using IOVA over FLPT default on? My opinion is that before we ha

Re: [PATCH v4 0/7] Use 1st-level for IOVA translation

2019-12-20 Thread Lu Baolu
Hi again, On 2019/12/20 19:50, Liu, Yi L wrote: 3) Per VT-d spec, FLPT has canonical requirement to the input addresses. So I'd suggest to add some enhance regards to it. Please refer to chapter 3.6:-). 3.6 First-Level Translation First-level translation restricts the input-address to a canonic

Re: [PATCH v4 0/7] Use 1st-level for IOVA translation

2019-12-21 Thread Lu Baolu
Hi Yi, On 12/21/19 11:14 AM, Lu Baolu wrote: Hi again, On 2019/12/20 19:50, Liu, Yi L wrote: 3) Per VT-d spec, FLPT has canonical requirement to the input addresses. So I'd suggest to add some enhance regards to it. Please refer to chapter 3.6:-). 3.6 First-Level Translation First-

Re: [PATCH 1/8] iommu/vt-d: clean up 32bit si_domain assignment

2019-12-22 Thread Lu Baolu
Hi, On 12/21/19 11:03 PM, Tom Murphy wrote: @@ -5618,9 +5583,13 @@ static int intel_iommu_add_device(struct device *dev) struct iommu_domain *domain; struct intel_iommu *iommu; struct iommu_group *group; + u64 dma_mask = *dev->dma_mask; u8 bus, devfn;

Re: 答复: [PATCH] iommu/vt-d: Don't reject nvme host due to scope mismatch

2019-12-23 Thread Lu Baolu
Hi, On 2019/12/23 15:59, Jim,Yan wrote: -邮件原件- 发件人: Jerry Snitselaar [mailto:jsnit...@redhat.com] 发送时间: 2019年12月20日 17:23 收件人: Jim,Yan 抄送: j...@8bytes.org; iommu@lists.linux-foundation.org; linux-ker...@vger.kernel.org 主题: Re: [PATCH] iommu/vt-d: Don't reject nvme host due to scope mism

[PATCH 1/1] iommu/vt-d: Add a quirk flag for scope mismatched devices

2019-12-23 Thread Lu Baolu
: Roland Dreier Cc: Jim Yan Signed-off-by: Lu Baolu --- drivers/iommu/dmar.c | 37 +++-- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index fb30d5053664..fc24abc70a05 100644 --- a/drivers/iommu/dmar.c +++ b

Re: 答复: 答复: [PATCH] iommu/vt-d: Don't reject nvme host due to scope mismatch

2019-12-23 Thread Lu Baolu
Hi Jim, On 2019/12/24 11:24, Jim,Yan wrote: -邮件原件- 发件人: Lu Baolu [mailto:baolu...@linux.intel.com] 发送时间: 2019年12月23日 21:05 收件人: Jim,Yan ; Jerry Snitselaar 抄送: iommu@lists.linux-foundation.org; linux-ker...@vger.kernel.org 主题: Re: 答复: [PATCH] iommu/vt-d: Don't reject nvme host d

[PATCH v5 1/9] iommu/vt-d: Identify domains using first level page table

2019-12-23 Thread Lu Baolu
This checks whether a domain should use the first level page table for map/unmap and marks it in the domain structure. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 39 + 1 file changed, 39 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b

[PATCH v5 2/9] iommu/vt-d: Add set domain DOMAIN_ATTR_NESTING attr

2019-12-23 Thread Lu Baolu
nested mode, otherwise failure. Signed-off-by: Yi Sun Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 56 + 1 file changed, 56 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 71ad5e5feae2..35f65628202c

[PATCH v5 4/9] iommu/vt-d: Setup pasid entries for iova over first level

2019-12-23 Thread Lu Baolu
iova translation. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 57 + include/linux/intel-iommu.h | 16 +++ 2 files changed, 62 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index

[PATCH v5 7/9] iommu/vt-d: Update first level super page capability

2019-12-23 Thread Lu Baolu
: Lu Baolu --- drivers/iommu/intel-iommu.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 1ebf5ed460cf..34e619318f64 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c

[PATCH v5 5/9] iommu/vt-d: Flush PASID-based iotlb for iova over first level

2019-12-23 Thread Lu Baolu
When software has changed first-level tables, it should invalidate the affected IOTLB and the paging-structure-caches using the PASID- based-IOTLB Invalidate Descriptor defined in spec 6.5.2.4. Signed-off-by: Lu Baolu --- drivers/iommu/dmar.c| 41 +++ drivers

[PATCH v5 9/9] iommu/vt-d: debugfs: Add support to show page table internals

2019-12-23 Thread Lu Baolu
0x00015f3dc003 0x8ced7003 0x00015f3db003 0x00015f3dc003 0x8ced8003 0x00015f3db003 0x00015f3dc003 0x8ced9003 [ ... ] Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu-debugfs.c | 75 + drivers

[PATCH v5 6/9] iommu/vt-d: Make first level IOVA canonical

2019-12-23 Thread Lu Baolu
bit [N-1] always cleared. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 54db6bc0b281..1ebf5ed460cf 100644 --- a/drivers/iommu/intel

[PATCH v5 3/9] iommu/vt-d: Add PASID_FLAG_FL5LP for first-level pasid setup

2019-12-23 Thread Lu Baolu
PASID_FLAG_FL5LP bit in the flags which indicates whether the 5-level paging mode should be used. Signed-off-by: Lu Baolu --- drivers/iommu/intel-pasid.c | 7 ++- drivers/iommu/intel-pasid.h | 6 ++ drivers/iommu/intel-svm.c | 8 ++-- 3 files changed, 14 insertions(+), 7 deletions

[PATCH v5 0/9] Use 1st-level for IOVA translation

2019-12-23 Thread Lu Baolu
he page table address binding to host's first level. Based-on-idea-by: Ashok Raj Based-on-idea-by: Kevin Tian Based-on-idea-by: Liu Yi L Based-on-idea-by: Jacob Pan Based-on-idea-by: Sanjay Kumar Based-on-idea-by: Lu Baolu Change log: v4->v5: - The previous version was posted

[PATCH v5 8/9] iommu/vt-d: Use iova over first level

2019-12-23 Thread Lu Baolu
After we make all map/unmap paths support first level page table. Let's turn it on if hardware supports scalable mode. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/

Re: 答复: 答复: 答复: [PATCH] iommu/vt-d: Don't reject nvme host due to scope mismatch

2019-12-24 Thread Lu Baolu
Hi, On 2019/12/24 16:18, Jim,Yan wrote: For both cases, a quirk flag seems to be more reasonable, so that unrelated devices will not be impacted. Best regards, baolu Hi Baolu, Thanks for your advice. And I modify the patch as follow. I just posted a patch for both NTG and NVME cases.

Re: 答复: 答复: 答复: 答复: [PATCH] iommu/vt-d: Don't reject nvme host due to scope mismatch

2019-12-24 Thread Lu Baolu
Hi, On 2019/12/25 9:52, Jim,Yan wrote: Hi, -邮件原件- 发件人: Lu Baolu [mailto:baolu...@linux.intel.com] 发送时间: 2019年12月24日 19:27 收件人: Jim,Yan ; Jerry Snitselaar 抄送: iommu@lists.linux-foundation.org; linux-ker...@vger.kernel.org 主题: Re: 答复: 答复: 答复: [PATCH] iommu/vt-d: Don't reject nvme

Re: 答复: 答复: 答复: 答复: 答复: [PATCH] iommu/vt-d: Don't reject nvme host due to scope mismatch

2019-12-24 Thread Lu Baolu
Hi, On 12/25/19 10:05 AM, Jim,Yan wrote: Hi, -邮件原件- 发件人: Lu Baolu [mailto:baolu...@linux.intel.com] 发送时间: 2019年12月25日 10:01 收件人: Jim,Yan ; Jerry Snitselaar 抄送: iommu@lists.linux-foundation.org; linux-ker...@vger.kernel.org 主题: Re: 答复: 答复: 答复: 答复: [PATCH] iommu/vt-d: Don't reject

Re: [PATCH v3 1/1] iommu/vt-d: Add Kconfig option to enable/disable scalable mode

2019-12-27 Thread Lu Baolu
On 11/12/19 2:39 PM, Lu Baolu wrote: This adds Kconfig option INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON to make it easier for distributions to enable or disable the Intel IOMMU scalable mode by default during kernel build. Signed-off-by: Lu Baolu Queued for v5.6. Thanks, -baolu

Re: [PATCH v5 0/8] VT-d Native Shared virtual memory cleanup and fixes

2019-12-27 Thread Lu Baolu
On 12/3/19 3:58 AM, Jacob Pan wrote: Mostly extracted from nested SVA/SVM series based on review comments of v7. https://lkml.org/lkml/2019/10/24/852 This series also adds a few important fixes for native use of SVA. Nested SVA new code will be submitted separately as a smaller set. Based on the

Re: [PATCH 2/2] iommu/vt-d: Loose requirement for flush queue initializaton

2019-12-27 Thread Lu Baolu
On 12/19/19 1:18 PM, Lu Baolu wrote: Currently if flush queue initialization fails, we return error or enforce the system-wide strict mode. These are unnecessary because we always check the existence of a flush queue before queuing any iova's for lazy flushing. Printing a informational me

Re: [PATCH 1/2] iommu/vt-d: Avoid iova flush queue in strict mode

2019-12-27 Thread Lu Baolu
On 12/19/19 1:18 PM, Lu Baolu wrote: If Intel IOMMU strict mode is enabled by users, it's unnecessary to create the iova flush queue. Signed-off-by: Lu Baolu Queued for v5.6. Thanks, -baolu ___ iommu mailing list iommu@lists.linux-foundatio

Re: [PATCH 1/1] iommu/vt-d: trace: Extend map_sg trace event

2019-12-27 Thread Lu Baolu
On 12/11/19 9:42 AM, Lu Baolu wrote: Current map_sg stores trace message in a coarse manner. This extends it so that more detailed messages could be traced. The map_sg trace message looks like: map_sg: dev=:00:17.0 [1/9] dev_addr=0xf8f9 phys_addr=0x158051000 size=4096 map_sg: dev=

Re: [PATCH] iommu/vt-d fix adding non-PCI devices to Intel IOMMU

2019-12-29 Thread Lu Baolu
ing a platform device to user level as far as I can see, so though this fix is not the best, it won't break anything. I will ack this fix so that the kernel crash could be fixed before we figure out a better solution. Cc: sta...@vger.kernel.org # v5.3+ Acked-by: Lu Baolu Best regards, -bao

Re: [RFC 1/5] iommu: Remove device link to group on failure

2019-12-31 Thread Lu Baolu
Hi, On 1/1/20 4:24 AM, Jon Derrick wrote: This adds the missing teardown step that removes the device link from the group when the device addition fails. This change looks good to me. Reviewed-by: Lu Baolu Best regards, baolu Signed-off-by: Jon Derrick --- drivers/iommu/iommu.c | 1

Re: [RFC 2/5] iommu/vt-d: Unlink device if failed to add to group

2019-12-31 Thread Lu Baolu
On 1/1/20 4:24 AM, Jon Derrick wrote: If the device fails to be added to the group, make sure to unlink the reference before returning. Signed-off-by: Jon Derrick This fix looks reasonable to me. Acked-by: Lu Baolu Best regards, baolu --- drivers/iommu/intel-iommu.c | 13

[RFC PATCH 1/4] driver core: Add iommu_passthrough to struct device

2019-12-31 Thread Lu Baolu
kernel command parameters. Signed-off-by: Lu Baolu --- include/linux/device.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/device.h b/include/linux/device.h index 96ff76731e93..763d2d078d34 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1247,6 +1247,8

[RFC PATCH 4/4] iommu: Determine default domain type before allocating domain

2019-12-31 Thread Lu Baolu
Determine the default domain type for each group and use it to allocate the iommu domain. Signed-off-by: Lu Baolu --- drivers/iommu/iommu.c | 35 --- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c

[RFC PATCH 2/4] PCI: Add "pci=iommu_passthrough=" parameter for iommu passthrough

2019-12-31 Thread Lu Baolu
The new parameter takes a list of devices separated by a semicolon. Each device specified will have its iommu_passthrough bit in struct device set. This is very similar to the existing 'disable_acs_redir' parameter. Signed-off-by: Lu Baolu --- .../admin-guide/kernel-parameters.txt

[RFC PATCH 3/4] iommu: Preallocate iommu group when probing devices

2019-12-31 Thread Lu Baolu
This splits iommu group allocation from adding devices. This makes it possible to determine the default domain type for each group as all devices belonging to the group have been determined. Signed-off-by: Lu Baolu --- drivers/iommu/iommu.c | 92 +++ 1

[RFC PATCH 0/4] iommu: Per-group default domain type

2019-12-31 Thread Lu Baolu
precedure to determine a per-group default domain type before allocating IOMMU domains and attaching them to devices. Please help to review it. Your comments and suggestions are appricated. Best regards, baolu Lu Baolu (4): driver core: Add iommu_passthrough to struct device PCI: Add &quo

Re: [PATCH 1/1] iommu/vt-d: Add a quirk flag for scope mismatched devices

2020-01-01 Thread Lu Baolu
On 12/24/19 2:22 PM, Lu Baolu wrote: We expect devices with endpoint scope to have normal PCI headers, and devices with bridge scope to have bridge PCI headers. However Some PCI devices may be listed in the DMAR table with bridge scope, even though they have a normal PCI header. Add a quirk

Re: [PATCH v5 0/9] Use 1st-level for IOVA translation

2020-01-01 Thread Lu Baolu
On 12/24/19 3:44 PM, Lu Baolu wrote: Intel VT-d in scalable mode supports two types of page tables for DMA translation: the first level page table and the second level page table. The first level page table uses the same format as the CPU page table, while the second level page table keeps

[PATCH 16/22] iommu/vt-d: Setup pasid entries for iova over first level

2020-01-01 Thread Lu Baolu
iova translation. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 57 + include/linux/intel-iommu.h | 16 +++ 2 files changed, 62 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index

[PATCH 21/22] iommu/vt-d: debugfs: Add support to show page table internals

2020-01-01 Thread Lu Baolu
0x00015f3dc003 0x8ced7003 0x00015f3db003 0x00015f3dc003 0x8ced8003 0x00015f3db003 0x00015f3dc003 0x8ced9003 [ ... ] Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu-debugfs.c | 75 + drivers

[PATCH 07/22] iommu/vt-d: Replace Intel specific PASID allocator with IOASID

2020-01-01 Thread Lu Baolu
From: Jacob Pan Make use of generic IOASID code to manage PASID allocation, free, and lookup. Replace Intel specific code. Signed-off-by: Jacob Pan Reviewed-by: Eric Auger Signed-off-by: Lu Baolu --- drivers/iommu/Kconfig | 1 + drivers/iommu/intel-iommu.c | 13 +++-- drivers

[PATCH 10/22] iommu/vt-d: trace: Extend map_sg trace event

2020-01-01 Thread Lu Baolu
=0x148351000 size=4096 Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c| 7 +++-- include/trace/events/intel_iommu.h | 48 ++ 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index

[PATCH 14/22] iommu/vt-d: Add set domain DOMAIN_ATTR_NESTING attr

2020-01-01 Thread Lu Baolu
nested mode, otherwise failure. Signed-off-by: Yi Sun Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 56 + 1 file changed, 56 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 71ad5e5feae2..35f65628202c

[PATCH 08/22] iommu/vt-d: Avoid sending invalid page response

2020-01-01 Thread Lu Baolu
eviewed-by: Eric Auger Signed-off-by: Lu Baolu --- drivers/iommu/intel-svm.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c index f0410e29fbc1..7c6a6e8b1c96 100644 --- a/drivers/iommu/intel-svm.c +++ b/drivers/i

[PATCH 06/22] iommu/vt-d: Fix off-by-one in PASID allocation

2020-01-01 Thread Lu Baolu
From: Jacob Pan PASID allocator uses IDR which is exclusive for the end of the allocation range. There is no need to decrement pasid_max. Fixes: af39507305fb ("iommu/vt-d: Apply global PASID in SVA") Reported-by: Eric Auger Signed-off-by: Jacob Pan Reviewed-by: Eric Auger Signed-

[PATCH 13/22] iommu/vt-d: Identify domains using first level page table

2020-01-01 Thread Lu Baolu
This checks whether a domain should use the first level page table for map/unmap and marks it in the domain structure. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 39 + 1 file changed, 39 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b

[PATCH 15/22] iommu/vt-d: Add PASID_FLAG_FL5LP for first-level pasid setup

2020-01-01 Thread Lu Baolu
PASID_FLAG_FL5LP bit in the flags which indicates whether the 5-level paging mode should be used. Signed-off-by: Lu Baolu --- drivers/iommu/intel-pasid.c | 7 ++- drivers/iommu/intel-pasid.h | 6 ++ drivers/iommu/intel-svm.c | 8 ++-- 3 files changed, 14 insertions(+), 7 deletions

[PATCH 04/22] iommu/vt-d: Reject SVM bind for failed capability check

2020-01-01 Thread Lu Baolu
From: Jacob Pan Add a check during SVM bind to ensure CPU and IOMMU hardware capabilities are met. Signed-off-by: Jacob Pan Reviewed-by: Eric Auger Signed-off-by: Lu Baolu --- drivers/iommu/intel-svm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iommu/intel-svm.c b

[PATCH 01/22] iommu/vt-d: Add Kconfig option to enable/disable scalable mode

2020-01-01 Thread Lu Baolu
This adds Kconfig option INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON to make it easier for distributions to enable or disable the Intel IOMMU scalable mode by default during kernel build. Signed-off-by: Lu Baolu --- drivers/iommu/Kconfig | 12 drivers/iommu/intel-iommu.c | 7

[PATCH 09/22] iommu/vt-d: Misc macro clean up for SVM

2020-01-01 Thread Lu Baolu
From: Jacob Pan Use combined macros for_each_svm_dev() to simplify SVM device iteration and error checking. Suggested-by: Andy Shevchenko Signed-off-by: Jacob Pan Reviewed-by: Eric Auger Signed-off-by: Lu Baolu --- drivers/iommu/intel-svm.c | 79 +++ 1

[PATCH 20/22] iommu/vt-d: Use iova over first level

2020-01-01 Thread Lu Baolu
After we make all map/unmap paths support first level page table. Let's turn it on if hardware supports scalable mode. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/

[PATCH 19/22] iommu/vt-d: Update first level super page capability

2020-01-01 Thread Lu Baolu
: Lu Baolu --- drivers/iommu/intel-iommu.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 1ebf5ed460cf..34e619318f64 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c

[PATCH 05/22] iommu/vt-d: Avoid duplicated code for PASID setup

2020-01-01 Thread Lu Baolu
From: Jacob Pan After each setup for PASID entry, related translation caches must be flushed. We can combine duplicated code into one function which is less error prone. Signed-off-by: Jacob Pan Reviewed-by: Eric Auger Signed-off-by: Lu Baolu --- drivers/iommu/intel-pasid.c | 48

[PATCH 02/22] iommu/vt-d: Fix CPU and IOMMU SVM feature matching checks

2020-01-01 Thread Lu Baolu
, these error message shall never appear in kernel log. Signed-off-by: Jacob Pan Reviewed-by: Eric Auger Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 10 ++ drivers/iommu/intel-svm.c | 40 + include/linux/intel-iommu.h | 5 - 3 files

[PATCH 11/22] iommu/vt-d: Avoid iova flush queue in strict mode

2020-01-01 Thread Lu Baolu
If Intel IOMMU strict mode is enabled by users, it's unnecessary to create the iova flush queue. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 24 +++- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/

[PATCH 18/22] iommu/vt-d: Make first level IOVA canonical

2020-01-01 Thread Lu Baolu
bit [N-1] always cleared. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 54db6bc0b281..1ebf5ed460cf 100644 --- a/drivers/iommu/intel

[PATCH 12/22] iommu/vt-d: Loose requirement for flush queue initializaton

2020-01-01 Thread Lu Baolu
Currently if flush queue initialization fails, we return error or enforce the system-wide strict mode. These are unnecessary because we always check the existence of a flush queue before queuing any iova's for lazy flushing. Printing a informational message is enough. Signed-off-by: Lu

[PULL REQUEST] iommu/vt-d: patches for v5.6

2020-01-01 Thread Lu Baolu
response iommu/vt-d: Misc macro clean up for SVM Lu Baolu (14): iommu/vt-d: Add Kconfig option to enable/disable scalable mode iommu/vt-d: trace: Extend map_sg trace event iommu/vt-d: Avoid iova flush queue in strict mode iommu/vt-d: Loose requirement for flush queue initializaton iommu

[PATCH 03/22] iommu/vt-d: Match CPU and IOMMU paging mode

2020-01-01 Thread Lu Baolu
table interface") Signed-off-by: Jacob Pan Reviewed-by: Eric Auger Signed-off-by: Lu Baolu --- drivers/iommu/intel-pasid.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/intel-pasid.c b/drivers/iommu/intel-pasid.c index 040a445be300..e7cb0b8a7

[PATCH 17/22] iommu/vt-d: Flush PASID-based iotlb for iova over first level

2020-01-01 Thread Lu Baolu
When software has changed first-level tables, it should invalidate the affected IOTLB and the paging-structure-caches using the PASID- based-IOTLB Invalidate Descriptor defined in spec 6.5.2.4. Signed-off-by: Lu Baolu --- drivers/iommu/dmar.c| 41 +++ drivers

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