Re: [RFC PATCH v3 5/6] dt-bindings: of: Add restricted DMA pool

2021-01-06 Thread Konrad Rzeszutek Wilk
On Wed, Jan 06, 2021 at 11:41:23AM +0800, Claire Chang wrote: > Introduce the new compatible string, restricted-dma-pool, for restricted > DMA. One can specify the address and length of the restricted DMA memory > region by restricted-dma-pool in the device tree. > > Signed-off-by: Claire Chang

[PATCH v4 04/17] iommu/hyperv: don't setup IRQ remapping when running as root

2021-01-06 Thread Wei Liu
The IOMMU code needs more work. We're sure for now the IRQ remapping hooks are not applicable when Linux is the root partition. Signed-off-by: Wei Liu Acked-by: Joerg Roedel Reviewed-by: Vitaly Kuznetsov --- drivers/iommu/hyperv-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)

Re: [RFC PATCH v3 0/6] Restricted DMA

2021-01-06 Thread Florian Fainelli
Hi, First of all let me say that I am glad that someone is working on a upstream solution for this issue, would appreciate if you could CC and Jim Quinlan on subsequent submissions. On 1/5/21 7:41 PM, Claire Chang wrote: > This series implements mitigations for lack of DMA access control on >

Re: [RFC PATCH v3 2/6] swiotlb: Add restricted DMA pool

2021-01-06 Thread Konrad Rzeszutek Wilk
Hello! In this file: > diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c > index e4368159f88a..7fb2ac087d23 100644 > --- a/kernel/dma/swiotlb.c > +++ b/kernel/dma/swiotlb.c .. > +static const struct reserved_mem_ops rmem_swiotlb_ops = { > + .device_init= rmem_swiotlb_device_init,

[PATCH v4 2/3] iommu/vt-d: Track device aux-attach with subdevice_domain_info

2021-01-06 Thread Liu Yi L
In the existing code, loop all devices attached to a domain does not include sub-devices attached via iommu_aux_attach_device(). This was found by when I'm working on the below patch, There is no device in the domain->devices list, thus unable to get the cap and ecap of iommu unit. But this

[PATCH v4 3/3] iommu/vt-d: Fix ineffective devTLB invalidation for subdevices

2021-01-06 Thread Liu Yi L
iommu_flush_dev_iotlb() is called to invalidate caches on device. It only loops the devices which are full-attached to the domain. For sub-devices, this is ineffective. This results in invalid caching entries left on the device. Fix it by adding loop for subdevices as well. Also, the domain->

[PATCH v4 0/3] iommu/vt-d: Misc fixes on scalable mode

2021-01-06 Thread Liu Yi L
Hi Baolu, Joerg, Will, This patchset aims to fix a bug regards to native SVM usage, and also two bugs around subdevice (attached to device via auxiliary manner) tracking and ineffective device_tlb flush. v3 -> v4: - Address comments from Baolu Lu and add acked-by - Fix issue reported by "Dan

[PATCH v4 1/3] iommu/vt-d: Move intel_iommu info from struct intel_svm to struct intel_svm_dev

2021-01-06 Thread Liu Yi L
Current struct intel_svm has a field to record the struct intel_iommu pointer for a PASID bind. And struct intel_svm will be shared by all the devices bind to the same process. The devices may be behind different DMAR units. As the iommu driver code uses the intel_iommu pointer stored in intel_svm

RE: [PATCH v3 3/3] iommu/vt-d: Fix ineffective devTLB invalidation for subdevices

2021-01-06 Thread Liu, Yi L
Hi Will, > From: Will Deacon > Sent: Wednesday, January 6, 2021 1:24 AM > > On Tue, Jan 05, 2021 at 05:50:22AM +, Liu, Yi L wrote: > > > > +static void __iommu_flush_dev_iotlb(struct device_domain_info > *info, > > > > + u64 addr, unsigned int mask) > > > >

Re: [PATCH] iommu/io-pgtable-arm: Allow non-coherent masters to use system cache

2021-01-06 Thread Sai Prakash Ranjan
Hi Will, On 2021-01-06 17:26, Will Deacon wrote: On Thu, Dec 24, 2020 at 12:10:07PM +0530, Sai Prakash Ranjan wrote: commit ecd7274fb4cd ("iommu: Remove unused IOMMU_SYS_CACHE_ONLY flag") removed unused IOMMU_SYS_CACHE_ONLY prot flag and along with it went the memory type setting required for

Re: [PATCH v2 6/6] iommu: Delete iommu_dev_has_feature()

2021-01-06 Thread Lu Baolu
On 1/6/21 9:35 PM, John Garry wrote: Function iommu_dev_has_feature() has never been referenced in the tree, and there does not appear to be anything coming soon to use it, so delete it. It will be used by the device driver which want to support the aux- domain capability, for example, below

Consult on ARM SMMU debugfs

2021-01-06 Thread chenxiang (M)
Hi Will, Robin or other guys, When debugging SMMU/SVA issue on huawei ARM64 board, we find that it lacks of enough debugfs for ARM SMMU driver (such as the value of STE/CD which we need to check sometimes). Currently it creates top-level iommu directory in debugfs, but there is no debugfs

[PATCH 4/6] vfio/iommu_type1: Drop parameter "pgsize" of vfio_dma_bitmap_alloc_all

2021-01-06 Thread Keqian Zhu
We always use the smallest supported page size of vfio_iommu as pgsize. Remove parameter "pgsize" of vfio_dma_bitmap_alloc_all. Signed-off-by: Keqian Zhu --- drivers/vfio/vfio_iommu_type1.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git

[PATCH 0/6] vfio/iommu_type1: Some optimizations about dirty tracking

2021-01-06 Thread Keqian Zhu
Hi, In patch series[1], I put forward some fixes and optimizations for vfio_iommu_type1. This extracts and improves the optimization part of it. [1] https://lore.kernel.org/linux-iommu/20201210073425.25960-1-zhukeqi...@huawei.com/T/#t Thanks, Keqian Keqian Zhu (6): vfio/iommu_type1: Make

[PATCH 3/6] vfio/iommu_type1: Initially set the pinned_page_dirty_scope

2021-01-06 Thread Keqian Zhu
For now there are 3 ways to promote the pinned_page_dirty_scope status of vfio_iommu: 1. Through vfio pin interface. 2. Detach a group without pinned_dirty_scope. 3. Attach a group with pinned_dirty_scope. For point 3, the only chance to promote the pinned_page_dirty_scope status is when

[PATCH 6/6] vfio/iommu_type1: Drop parameter "pgsize" of update_user_bitmap

2021-01-06 Thread Keqian Zhu
We always use the smallest supported page size of vfio_iommu as pgsize. Drop parameter "pgsize" of update_user_bitmap. Signed-off-by: Keqian Zhu --- drivers/vfio/vfio_iommu_type1.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c

[PATCH 1/6] vfio/iommu_type1: Make an explicit "promote" semantic

2021-01-06 Thread Keqian Zhu
When we want to promote the pinned_page_dirty_scope of vfio_iommu, we call the "update" function to visit all vfio_group, but when we want to downgrade this, we can set the flag as false directly. So we'd better make an explicit "promote" semantic to the "update" function. BTW, if vfio_iommu

[PATCH 5/6] vfio/iommu_type1: Drop parameter "pgsize" of vfio_iova_dirty_bitmap

2021-01-06 Thread Keqian Zhu
We always use the smallest supported page size of vfio_iommu as pgsize. Remove parameter "pgsize" of vfio_iova_dirty_bitmap. Signed-off-by: Keqian Zhu --- drivers/vfio/vfio_iommu_type1.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c

[PATCH 2/6] vfio/iommu_type1: Ignore external domain when promote pinned_scope

2021-01-06 Thread Keqian Zhu
The pinned_scope of external domain's groups are always true, that's to say we can safely ignore external domain when promote pinned_scope status of vfio_iommu. Signed-off-by: Keqian Zhu --- drivers/vfio/vfio_iommu_type1.c | 14 +++--- 1 file changed, 3 insertions(+), 11 deletions(-)

Re: [PATCH] x86/iommu: Fix two minimal issues in check_iommu_entries()

2021-01-06 Thread Zhenzhong Duan
On Tue, Jan 5, 2021 at 3:04 AM Konrad Rzeszutek Wilk wrote: > > On Wed, Dec 23, 2020 at 02:24:12PM +0800, Zhenzhong Duan wrote: > > check_iommu_entries() checks for cyclic dependency in iommu entries > > and fixes the cyclic dependency by setting x->depend to NULL. But > > this repairing isn't

Re: [PATCH v10 11/13] iommu/arm-smmu-v3: Add SVA device feature

2021-01-06 Thread Jean-Philippe Brucker
Hi, On Tue, Dec 15, 2020 at 01:09:29AM +, Krishna Reddy wrote: > Hi Jean, > > > +bool arm_smmu_master_sva_supported(struct arm_smmu_master *master) { > > + if (!(master->smmu->features & ARM_SMMU_FEAT_SVA)) > > + return false; > + > > + /* SSID and IOPF support are

Re: [PATCH] iommu/io-pgtable-arm: Allow non-coherent masters to use system cache

2021-01-06 Thread Will Deacon
On Thu, Dec 24, 2020 at 12:10:07PM +0530, Sai Prakash Ranjan wrote: > commit ecd7274fb4cd ("iommu: Remove unused IOMMU_SYS_CACHE_ONLY flag") > removed unused IOMMU_SYS_CACHE_ONLY prot flag and along with it went > the memory type setting required for the non-coherent masters to use > system cache.

Re: [PATCH RESEND 0/7] iommu: Permit modular builds of io-pgtable drivers

2021-01-06 Thread Will Deacon
On Mon, Jan 04, 2021 at 11:36:38PM -0800, Isaac J. Manjarres wrote: > The goal of the Generic Kernel Image (GKI) effort is to have a common > kernel image that works across multiple Android devices. This involves > generating a kernel image that has core features integrated into it, > while SoC

[PATCH v2 5/6] iommu: Delete iommu_domain_window_disable()

2021-01-06 Thread John Garry
Function iommu_domain_window_disable() is not referenced in the tree, so delete it. Signed-off-by: John Garry --- drivers/iommu/iommu.c | 9 - include/linux/iommu.h | 6 -- 2 files changed, 15 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index

[PATCH v2 0/6] IOMMU: Some more IOVA and core code tidy-up

2021-01-06 Thread John Garry
Just some tidy-up to IOVA and core code. Based on v5.11-rc2 Differences to v1: - Add core IOMMU patches John Garry (6): iova: Make has_iova_flush_queue() private iova: Delete copy_reserved_iova() iova: Stop exporting some more functions iommu: Stop exporting iommu_map_sg_atomic()

[PATCH v2 4/6] iommu: Stop exporting iommu_map_sg_atomic()

2021-01-06 Thread John Garry
Function iommu_map_sg_atomic() is only referenced in dma-iommu.c, which can only be built-in, so stop exporting. Signed-off-by: John Garry --- drivers/iommu/iommu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index ffeebda8d6de..4f4edb087ce6

[PATCH v2 6/6] iommu: Delete iommu_dev_has_feature()

2021-01-06 Thread John Garry
Function iommu_dev_has_feature() has never been referenced in the tree, and there does not appear to be anything coming soon to use it, so delete it. Signed-off-by: John Garry --- drivers/iommu/iommu.c | 11 --- include/linux/iommu.h | 7 --- 2 files changed, 18 deletions(-) diff

[PATCH v2 3/6] iova: Stop exporting some more functions

2021-01-06 Thread John Garry
The following functions are not referenced outside dma-iommu.c (and iova.c), which can only be built-in: - init_iova_flush_queue() - free_iova_fast() - queue_iova() - alloc_iova_fast() So stop exporting them. Signed-off-by: John Garry --- drivers/iommu/iova.c | 4 1 file changed, 4

[PATCH v2 1/6] iova: Make has_iova_flush_queue() private

2021-01-06 Thread John Garry
Function has_iova_flush_queue() has no users outside iova.c, so make it private. Signed-off-by: John Garry --- drivers/iommu/iova.c | 2 +- include/linux/iova.h | 6 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index

[PATCH v2 2/6] iova: Delete copy_reserved_iova()

2021-01-06 Thread John Garry
Since commit c588072bba6b ("iommu/vt-d: Convert intel iommu driver to the iommu ops"), function copy_reserved_iova() is not referenced, so delete it. Signed-off-by: John Garry --- drivers/iommu/iova.c | 30 -- include/linux/iova.h | 6 -- 2 files changed, 36

RE: [PATCH v10 11/13] iommu/arm-smmu-v3: Add SVA device feature

2021-01-06 Thread Krishna Reddy
> I agree that we should let a device driver enable SVA if it supports some > form of IOPF. Right, The PCIe device has capability to handle IO page faults on its own when ATS translation request response indicates that no valid mapping exist. SMMU doesn't involve/handle page faults for ATS