Re: [PATCH v10 10/13] iommu/arm-smmu-v3: Check for SVA features

2020-12-14 Thread Jean-Philippe Brucker
On Wed, Dec 09, 2020 at 07:49:09PM +, Krishna Reddy wrote: > Hi Jean, > > > Why is BTM mandated for SVA? I couldn't find this requirement in > > > SMMU spec (Sorry if I missed it or this got discussed earlier). But > > > if performance is the > > only concern here, > > > is it better just to

RE: [RFC PATCH v2 0/8] ACPI/IORT: Support for IORT RMR node

2020-12-14 Thread Shameerali Kolothum Thodi
Hi Steve, > -Original Message- > From: Steven Price [mailto:steven.pr...@arm.com] > Sent: 10 December 2020 10:26 > To: Shameerali Kolothum Thodi ; > linux-arm-ker...@lists.infradead.org; linux-a...@vger.kernel.org; > iommu@lists.linux-foundation.org; de...@acpica.org > Cc: Linuxarm ; loren

Re: [RFC PATCH v2 0/8] ACPI/IORT: Support for IORT RMR node

2020-12-14 Thread Robin Murphy
On 2020-12-14 10:55, Shameerali Kolothum Thodi wrote: Hi Steve, -Original Message- From: Steven Price [mailto:steven.pr...@arm.com] Sent: 10 December 2020 10:26 To: Shameerali Kolothum Thodi ; linux-arm-ker...@lists.infradead.org; linux-a...@vger.kernel.org; iommu@lists.linux-foundation

Re: [PATCH v8 4/9] of/iommu: Support dma-can-stall property

2020-12-14 Thread Jean-Philippe Brucker
On Thu, Nov 26, 2020 at 06:09:26PM +, Robin Murphy wrote: > On 2020-11-12 12:55, Jean-Philippe Brucker wrote: > > Copy the dma-can-stall property into the fwspec structure. > > Can't we just handle this as a regular device property? It's not part of the > actual IOMMU specifier, it doesn't nee

Re: [PATCH v2] dma-mapping: add unlikely hint for error path in dma_mapping_error

2020-12-14 Thread Robin Murphy
On 2020-12-13 16:32, Heiner Kallweit wrote: Zillions of drivers use the unlikely() hint when checking the result of dma_mapping_error(). This is an inline function anyway, so we can move the hint into this function and remove it from drivers. Reviewed-by: Robin Murphy FWIW I consider this cas

Re: [RFC PATCH v2 0/8] ACPI/IORT: Support for IORT RMR node

2020-12-14 Thread Steven Price
On 14/12/2020 12:33, Robin Murphy wrote: On 2020-12-14 10:55, Shameerali Kolothum Thodi wrote: Hi Steve, -Original Message- From: Steven Price [mailto:steven.pr...@arm.com] Sent: 10 December 2020 10:26 To: Shameerali Kolothum Thodi ; linux-arm-ker...@lists.infradead.org; linux-a...@vge

[PATCH -next] iommu: msm_iommu: Delete useless kfree code

2020-12-14 Thread Zheng Yongjun
The parameter of kfree function is NULL, so kfree code is useless, delete it. Signed-off-by: Zheng Yongjun --- drivers/iommu/msm_iommu.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c index 3615cd6241c4..1286674a1322

[PATCH -next] iommu/amd/init: convert comma to semicolon

2020-12-14 Thread Zheng Yongjun
Replace a comma between expression statements by a semicolon. Signed-off-by: Zheng Yongjun --- drivers/iommu/amd/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index 23a790f8f550..dad011e88268 100644 --- a/driver

RE: [RFC PATCH v2 0/8] ACPI/IORT: Support for IORT RMR node

2020-12-14 Thread Shameerali Kolothum Thodi
> -Original Message- > From: Steven Price [mailto:steven.pr...@arm.com] > Sent: 14 December 2020 13:43 > To: Robin Murphy ; Shameerali Kolothum Thodi > ; > linux-arm-ker...@lists.infradead.org; linux-a...@vger.kernel.org; > iommu@lists.linux-foundation.org; de...@acpica.org > Cc: Linuxarm

Re: [PATCH -next] iommu: msm_iommu: Delete useless kfree code

2020-12-14 Thread Bjorn Andersson
On Mon 14 Dec 07:47 CST 2020, Zheng Yongjun wrote: > The parameter of kfree function is NULL, so kfree code is useless, delete it. > > Signed-off-by: Zheng Yongjun Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > drivers/iommu/msm_iommu.c | 6 +- > 1 file changed, 1 insertion(+), 5 d

[PATCH 5.9 057/105] arm-smmu-qcom: Ensure the qcom_scm driver has finished probing

2020-12-14 Thread Greg Kroah-Hartman
From: John Stultz [ Upstream commit 72b55c96f3a5ae6e486c20b5dacf5114060ed042 ] Robin Murphy pointed out that if the arm-smmu driver probes before the qcom_scm driver, we may call qcom_scm_qsmmu500_wait_safe_toggle() before the __scm is initialized. Now, getting this to happen is a bit contrived

Re: swiotlb/virtio: unchecked device dma address and length

2020-12-14 Thread Konrad Rzeszutek Wilk
On Fri, Dec 11, 2020 at 06:31:21PM +0100, Felicitas Hetzelt wrote: > Hello, Hi! Please see below my responses. > we have been analyzing the Hypervisor-OS interface of Linux > and discovered bugs in the swiotlb/virtio implementation that can be > triggered from a malicious Hypervisor / virtual dev

RE: [PATCH v10 10/13] iommu/arm-smmu-v3: Check for SVA features

2020-12-14 Thread Krishna Reddy
>> The Tegra Next Generation SOC uses arm-smmu-v3, but it doesn't have support >> for BTM. >> Do you have plan to get your earlier patch to handle invalidate >> notifications into upstream sometime soon? >> Can the dependency on BTM be relaxed with the patch? >> >> PATCH v9 13/13] iommu/arm-smmu-

[GIT PULL] IOMMU updates for 5.11

2020-12-14 Thread Will Deacon
Hi Linus, Please pull these IOMMU updates for 5.11: there's a good mixture of improvements to the core code and driver changes across the board. Summary in the tag and merge commits. One thing worth pointing out is that this includes a quirk to work around behaviour in the i915 driver (see 65f746

Re: [PATCH 4/7] vfio: iommu_type1: Fix missing dirty page when promote pinned_scope

2020-12-14 Thread Alex Williamson
On Thu, 10 Dec 2020 15:34:22 +0800 Keqian Zhu wrote: > When we pin or detach a group which is not dirty tracking capable, > we will try to promote pinned_scope of vfio_iommu. > > If we succeed to do so, vfio only report pinned_scope as dirty to > userspace next time, but these memory written bef

Re: [PATCH 1/7] vfio: iommu_type1: Clear added dirty bit when unwind pin

2020-12-14 Thread Alex Williamson
On Fri, 11 Dec 2020 14:51:47 +0800 zhukeqian wrote: > On 2020/12/11 3:16, Alex Williamson wrote: > > On Thu, 10 Dec 2020 15:34:19 +0800 > > Keqian Zhu wrote: > > > >> Currently we do not clear added dirty bit of bitmap when unwind > >> pin, so if pin failed at halfway, we set unnecessary dirt

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

2020-12-14 Thread Krishna Reddy
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 mandatory for the moment */ > + return master->ssid_bits && arm_smmu_iopf_sup

Re: swiotlb/virtio: unchecked device dma address and length

2020-12-14 Thread Jason Wang
On 2020/12/15 上午5:49, Konrad Rzeszutek Wilk wrote: On Fri, Dec 11, 2020 at 06:31:21PM +0100, Felicitas Hetzelt wrote: Hello, Hi! Please see below my responses. we have been analyzing the Hypervisor-OS interface of Linux and discovered bugs in the swiotlb/virtio implementation that can be tri

[PATCH] drivers/iommu: fix null-ptr-deref bug of rk_iommu_from_dev's ret-val

2020-12-14 Thread tangzhenhao
From: Sugar we should check the ret-val of function rk_iommu_from_dev to avoid null-ptr-deref. Signed-off-by: Sugar --- drivers/iommu/rockchip-iommu.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index e5d86b7177de..

[PATCH v4 00/13] iommu/amd: Add Generic IO Page Table Framework Support

2020-12-14 Thread Suravee Suthikulpanit
The framework allows callable implementation of IO page table. This allows AMD IOMMU driver to switch between different types of AMD IOMMU page tables (e.g. v1 vs. v2). This series refactors the current implementation of AMD IOMMU v1 page table to adopt the framework. There should be no functional

[PATCH v4 03/13] iommu/amd: Move pt_root to struct amd_io_pgtable

2020-12-14 Thread Suravee Suthikulpanit
To better organize the data structure since it contains IO page table related information. Signed-off-by: Suravee Suthikulpanit --- drivers/iommu/amd/amd_iommu.h | 2 +- drivers/iommu/amd/amd_iommu_types.h | 2 +- drivers/iommu/amd/iommu.c | 2 +- 3 files changed, 3 insertions(+)

[PATCH v4 02/13] iommu/amd: Prepare for generic IO page table framework

2020-12-14 Thread Suravee Suthikulpanit
Add initial hook up code to implement generic IO page table framework. Signed-off-by: Suravee Suthikulpanit --- drivers/iommu/amd/Kconfig | 1 + drivers/iommu/amd/Makefile | 2 +- drivers/iommu/amd/amd_iommu_types.h | 35 ++ drivers/iommu/amd/io_pgtable.c |

[PATCH v4 04/13] iommu/amd: Convert to using amd_io_pgtable

2020-12-14 Thread Suravee Suthikulpanit
Make use of the new struct amd_io_pgtable in preparation to remove the struct domain_pgtable. Signed-off-by: Suravee Suthikulpanit --- drivers/iommu/amd/amd_iommu.h | 1 + drivers/iommu/amd/iommu.c | 25 ++--- 2 files changed, 11 insertions(+), 15 deletions(-) diff --gi

[PATCH v4 07/13] iommu/amd: Restructure code for freeing page table

2020-12-14 Thread Suravee Suthikulpanit
By consolidate logic into v1_free_pgtable helper function, which is called from IO page table framework. Signed-off-by: Suravee Suthikulpanit --- drivers/iommu/amd/amd_iommu.h | 1 - drivers/iommu/amd/io_pgtable.c | 41 -- drivers/iommu/amd/iommu.c | 21 +++

[PATCH v4 05/13] iommu/amd: Declare functions as extern

2020-12-14 Thread Suravee Suthikulpanit
And move declaration to header file so that they can be included across multiple files. There is no functional change. Signed-off-by: Suravee Suthikulpanit --- drivers/iommu/amd/amd_iommu.h | 3 +++ drivers/iommu/amd/iommu.c | 39 +-- 2 files changed, 22 inse

[PATCH v4 06/13] iommu/amd: Move IO page table related functions

2020-12-14 Thread Suravee Suthikulpanit
Preparing to migrate to use IO page table framework. There is no functional change. Signed-off-by: Suravee Suthikulpanit --- drivers/iommu/amd/amd_iommu.h | 18 ++ drivers/iommu/amd/io_pgtable.c | 473 drivers/iommu/amd/iommu.c | 476 +-

[PATCH v4 11/13] iommu/amd: Introduce iommu_v1_iova_to_phys

2020-12-14 Thread Suravee Suthikulpanit
This implements iova_to_phys for AMD IOMMU v1 pagetable, which will be used by the IO page table framework. Signed-off-by: Suravee Suthikulpanit --- drivers/iommu/amd/io_pgtable.c | 22 ++ drivers/iommu/amd/iommu.c | 16 +--- 2 files changed, 23 insertions(+)

[PATCH v4 01/13] iommu/amd: Re-define amd_iommu_domain_encode_pgtable as inline

2020-12-14 Thread Suravee Suthikulpanit
Move the function to header file to allow inclusion in other files. Signed-off-by: Suravee Suthikulpanit --- drivers/iommu/amd/amd_iommu.h | 13 + drivers/iommu/amd/iommu.c | 10 -- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/amd/amd_iom

[PATCH v4 13/13] iommu/amd: Adopt IO page table framework for AMD IOMMU v1 page table

2020-12-14 Thread Suravee Suthikulpanit
Switch to using IO page table framework for AMD IOMMU v1 page table. Signed-off-by: Suravee Suthikulpanit --- drivers/iommu/amd/amd_iommu.h | 1 + drivers/iommu/amd/init.c | 2 ++ drivers/iommu/amd/iommu.c | 48 ++- 3 files changed, 39 insertions(+), 12

[PATCH v4 08/13] iommu/amd: Remove amd_iommu_domain_get_pgtable

2020-12-14 Thread Suravee Suthikulpanit
Since the IO page table root and mode parameters have been moved into the struct amd_io_pg, the function is no longer needed. Therefore, remove it along with the struct domain_pgtable. Signed-off-by: Suravee Suthikulpanit --- drivers/iommu/amd/amd_iommu.h | 4 ++-- drivers/iommu/amd/amd_i