Re: [PATCH v10 10/10] iommu/arm-smmu-v3: Add stall support for platform devices

2021-01-22 Thread Jean-Philippe Brucker
On Thu, Jan 21, 2021 at 07:12:36PM +, Jonathan Cameron wrote: > > @@ -2502,6 +2647,7 @@ static void arm_smmu_release_device(struct device > > *dev) > > > > master = dev_iommu_priv_get(dev); > > WARN_ON(arm_smmu_master_sva_enabled(master)); > > +

[PATCH v3 1/2] vfio/iommu_type1: Populate full dirty when detach non-pinned group

2021-01-22 Thread Keqian Zhu
If a group with non-pinned-page dirty scope is detached with dirty logging enabled, we should fully populate the dirty bitmaps at the time it's removed since we don't know the extent of its previous DMA, nor will the group be present to trigger the full bitmap when the user retrieves the dirty

[PATCH v3 0/2] vfio/iommu_type1: some fixes

2021-01-22 Thread Keqian Zhu
v3: - Populate bitmap unconditionally. - Sanity check notifier when remove all domains. v2: - Address suggestions from Alex. - Remove unnecessary patches. Keqian Zhu (2): vfio/iommu_type1: Populate full dirty when detach non-pinned group vfio/iommu_type1: Fix some sanity checks in

[PATCH v3 2/2] vfio/iommu_type1: Fix some sanity checks in detach group

2021-01-22 Thread Keqian Zhu
vfio_sanity_check_pfn_list() is used to check whether pfn_list and notifier are empty when remove the external domain, so it makes a wrong assumption that only external domain will use the pinning interface. Now we apply the pfn_list check when a vfio_dma is removed and apply the notifier check

Re: [PATCH v10 10/10] iommu/arm-smmu-v3: Add stall support for platform devices

2021-01-22 Thread Jonathan Cameron
On Fri, 22 Jan 2021 09:51:20 +0100 Jean-Philippe Brucker wrote: > On Thu, Jan 21, 2021 at 07:12:36PM +, Jonathan Cameron wrote: > > > @@ -2502,6 +2647,7 @@ static void arm_smmu_release_device(struct device > > > *dev) > > > > > > master = dev_iommu_priv_get(dev); > > >

Re: [PATCH v9 05/10] uacce: Enable IOMMU_DEV_FEAT_IOPF

2021-01-22 Thread Zhou Wang
On 2021/1/21 4:47, Dave Jiang wrote: > > On 1/8/2021 7:52 AM, Jean-Philippe Brucker wrote: >> The IOPF (I/O Page Fault) feature is now enabled independently from the >> SVA feature, because some IOPF implementations are device-specific and >> do not require IOMMU support for PCIe PRI or Arm SMMU

Re: [PATCH 1/1] iommu/arm-smmu-v3: add support for BBML

2021-01-22 Thread Will Deacon
On Thu, Nov 26, 2020 at 11:42:30AM +0800, Zhen Lei wrote: > When changing from a set of pages/smaller blocks to a larger block for an > address, the software should follow the sequence of BBML processing. > > When changing from a block to a set of pages/smaller blocks for an > address, there's no

Re: [PATCH 1/1] iommu/arm-smmu-v3: add support for BBML

2021-01-22 Thread Robin Murphy
On 2021-01-22 12:51, Will Deacon wrote: On Thu, Nov 26, 2020 at 11:42:30AM +0800, Zhen Lei wrote: When changing from a set of pages/smaller blocks to a larger block for an address, the software should follow the sequence of BBML processing. When changing from a block to a set of pages/smaller

Re: [PATCH v10 07/10] iommu/arm-smmu-v3: Maintain a SID->device structure

2021-01-22 Thread Auger Eric
Hi Jean, On 1/21/21 1:36 PM, Jean-Philippe Brucker wrote: > When handling faults from the event or PRI queue, we need to find the > struct device associated with a SID. Add a rb_tree to keep track of > SIDs. > > Acked-by: Jonathan Cameron > Signed-off-by: Jean-Philippe Brucker Reviewed-by:

[PATCH 0/3] iommu/arm-smmu-v3: TLB invalidation for SVA

2021-01-22 Thread Jean-Philippe Brucker
To support sharing page tables with the CPU, the SMMU can participate in Broadcast TLB Maintenance (BTM), where TLB invalidate instructions from the CPU are received by the SMMU. For platforms that do no implement BTM [1], it is still possible to use SVA, by sending all TLB invalidations through

[PATCH 1/3] iommu/arm-smmu-v3: Split arm_smmu_tlb_inv_range()

2021-01-22 Thread Jean-Philippe Brucker
Extract some of the cmd initialization and the ATC invalidation from arm_smmu_tlb_inv_range(), to allow an MMU notifier to invalidate a VA range by ASID. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 62 - 1 file changed, 35

[PATCH 2/3] iommu/arm-smmu-v3: Make BTM optional for SVA

2021-01-22 Thread Jean-Philippe Brucker
When BTM isn't supported by the SMMU, send invalidations on the command queue. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 3 +++ drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 14 +++--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

[PATCH 3/3] iommu/arm-smmu-v3: Add support for VHE

2021-01-22 Thread Jean-Philippe Brucker
ARMv8.1 extensions added Virtualization Host Extensions (VHE), which allow to run a host kernel at EL2. When using normal DMA, Device and CPU address spaces are dissociated, and do not need to implement the same capabilities, so VHE hasn't been used in the SMMU until now. With shared address

Re: [PATCH v2 1/3] iommu/arm-smmu: Add support for driver IOMMU fault handlers

2021-01-22 Thread Robin Murphy
On 2021-01-22 12:41, Will Deacon wrote: On Tue, Nov 24, 2020 at 12:15:58PM -0700, Jordan Crouse wrote: Call report_iommu_fault() to allow upper-level drivers to register their own fault handlers. Signed-off-by: Jordan Crouse --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 16 +---

Re: [PATCH v2 1/3] iommu/arm-smmu: Add support for driver IOMMU fault handlers

2021-01-22 Thread Will Deacon
On Tue, Nov 24, 2020 at 12:15:58PM -0700, Jordan Crouse wrote: > Call report_iommu_fault() to allow upper-level drivers to register their > own fault handlers. > > Signed-off-by: Jordan Crouse > --- > > drivers/iommu/arm/arm-smmu/arm-smmu.c | 16 +--- > 1 file changed, 13

[PATCH 1/1] iommu/arm-smmu-v3: Use DEFINE_RES_MEM() to simplify code

2021-01-22 Thread Zhen Lei
No functional change. Signed-off-by: Zhen Lei --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index

Re: [PATCH 0/3] iommu/arm-smmu-v3: TLB invalidation for SVA

2021-01-22 Thread Jonathan Cameron
On Fri, 22 Jan 2021 12:52:55 +0100 Jean-Philippe Brucker wrote: > To support sharing page tables with the CPU, the SMMU can participate in > Broadcast TLB Maintenance (BTM), where TLB invalidate instructions from > the CPU are received by the SMMU. For platforms that do no implement BTM > [1],

Re: [PATCH] iommu/arm-smmu-v3: Remove the page 1 fixup

2021-01-22 Thread Jean-Philippe Brucker
On Thu, Jan 21, 2021 at 02:09:42PM +, Robin Murphy wrote: > Since we now keep track of page 1 via a separate pointer that already > encapsulates aliasing to page 0 as necessary, we can remove the clunky > fixup routine and simply use the relevant bases directly. The current > architecture spec

Re: [PATCH 1/2] dt-bindings: arm-smmu-qcom: Add Qualcomm SC8180X compatible

2021-01-22 Thread Will Deacon
On Wed, 20 Jan 2021 17:40:04 -0800, Bjorn Andersson wrote: > Add compatible for the ARM SMMU found in the Qualcomm SC8180x platform. Applied to will (for-joerg/arm-smmu/updates), thanks! [1/2] dt-bindings: arm-smmu-qcom: Add Qualcomm SC8180X compatible

Re: [PATCH] iommu/arm-smmu-v3: Remove the page 1 fixup

2021-01-22 Thread Will Deacon
On Thu, 21 Jan 2021 14:09:42 +, Robin Murphy wrote: > Since we now keep track of page 1 via a separate pointer that already > encapsulates aliasing to page 0 as necessary, we can remove the clunky > fixup routine and simply use the relevant bases directly. The current > architecture spec

Re: [PATCH 1/1] iommu/arm-smmu-v3: Use DEFINE_RES_MEM() to simplify code

2021-01-22 Thread Will Deacon
On Fri, 22 Jan 2021 21:14:48 +0800, Zhen Lei wrote: > No functional change. Applied to will (for-joerg/arm-smmu/updates), thanks! [1/1] iommu/arm-smmu-v3: Use DEFINE_RES_MEM() to simplify code https://git.kernel.org/will/c/932bc8c7d742 Cheers, -- Will https://fixes.arm64.dev

Re: [PATCH 1/2] dt-bindings: arm-smmu: Add sm8350 compatible string

2021-01-22 Thread Will Deacon
On Fri, 15 Jan 2021 14:33:21 +0530, Vinod Koul wrote: > Add compatible string for sm8350 iommu to documentation. Applied to will (for-joerg/arm-smmu/updates), thanks! [1/2] dt-bindings: arm-smmu: Add sm8350 compatible string https://git.kernel.org/will/c/70b5b6a6daea [2/2] iommu:

Re: [PATCH 1/3] iommu/arm-smmu-v3: Split arm_smmu_tlb_inv_range()

2021-01-22 Thread Will Deacon
On Fri, Jan 22, 2021 at 12:52:56PM +0100, Jean-Philippe Brucker wrote: > Extract some of the cmd initialization and the ATC invalidation from > arm_smmu_tlb_inv_range(), to allow an MMU notifier to invalidate a VA > range by ASID. > > Signed-off-by: Jean-Philippe Brucker > --- >

Re: [PATCH 1/3] iommu/arm-smmu-v3: Split arm_smmu_tlb_inv_range()

2021-01-22 Thread Robin Murphy
On 2021-01-22 11:52, Jean-Philippe Brucker wrote: Extract some of the cmd initialization and the ATC invalidation from arm_smmu_tlb_inv_range(), to allow an MMU notifier to invalidate a VA range by ASID. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c |

Re: [PATCH 1/1] iommu/arm-smmu-v3: add support for BBML

2021-01-22 Thread Leizhen (ThunderTown)
On 2021/1/22 21:00, Robin Murphy wrote: > On 2021-01-22 12:51, Will Deacon wrote: >> On Thu, Nov 26, 2020 at 11:42:30AM +0800, Zhen Lei wrote: >>> When changing from a set of pages/smaller blocks to a larger block for an >>> address, the software should follow the sequence of BBML processing.

Re: [PATCH 1/1] iommu/arm-smmu-v3: add support for BBML

2021-01-22 Thread Will Deacon
On Fri, Jan 22, 2021 at 09:21:20PM +0800, Leizhen (ThunderTown) wrote: > On 2021/1/22 21:00, Robin Murphy wrote: > > On 2021-01-22 12:51, Will Deacon wrote: > >> On Thu, Nov 26, 2020 at 11:42:30AM +0800, Zhen Lei wrote: > >>>   -    tblp = ptep - ARM_LPAE_LVL_IDX(iova, lvl, data); > >>> -  

Re: [PATCH 2/2] dt-bindings: arm-smmu: Add binding for Qcom SDX55 SMMU

2021-01-22 Thread Will Deacon
On Tue, Jan 12, 2021 at 09:22:23PM -0600, Rob Herring wrote: > On Thu, 07 Jan 2021 20:01:18 +0530, Manivannan Sadhasivam wrote: > > Add devicetree binding for Qualcomm SDX55 SMMU. > > > > Cc: Will Deacon > > Cc: Robin Murphy > > Cc: Joerg Roedel > > Cc: iommu@lists.linux-foundation.org > >

Re: [PATCH 2/2] dt-bindings: arm-smmu: Add binding for Qcom SDX55 SMMU

2021-01-22 Thread Manivannan Sadhasivam
On Fri, Jan 22, 2021 at 01:14:49PM +, Will Deacon wrote: > On Tue, Jan 12, 2021 at 09:22:23PM -0600, Rob Herring wrote: > > On Thu, 07 Jan 2021 20:01:18 +0530, Manivannan Sadhasivam wrote: > > > Add devicetree binding for Qualcomm SDX55 SMMU. > > > > > > Cc: Will Deacon > > > Cc: Robin

Re: [PATCH v9 05/10] uacce: Enable IOMMU_DEV_FEAT_IOPF

2021-01-22 Thread Dave Jiang
On 1/22/2021 4:53 AM, Zhou Wang wrote: On 2021/1/21 4:47, Dave Jiang wrote: On 1/8/2021 7:52 AM, Jean-Philippe Brucker wrote: The IOPF (I/O Page Fault) feature is now enabled independently from the SVA feature, because some IOPF implementations are device-specific and do not require IOMMU

RE: [PATCH RFC v1 00/15] iommu/virtio: Nested stage support with Arm

2021-01-22 Thread Shameerali Kolothum Thodi
Hi Vivek, > -Original Message- > From: Vivek Kumar Gautam [mailto:vivek.gau...@arm.com] > Sent: 21 January 2021 17:34 > To: Auger Eric ; linux-ker...@vger.kernel.org; > linux-arm-ker...@lists.infradead.org; iommu@lists.linux-foundation.org; > virtualizat...@lists.linux-foundation.org >

Re: [PATCH v2 0/5] Optimize iommu_map_sg() performance

2021-01-22 Thread Robin Murphy
On 2021-01-21 21:30, isa...@codeaurora.org wrote: On 2021-01-12 08:00, Robin Murphy wrote: On 2021-01-11 14:54, Isaac J. Manjarres wrote: The iommu_map_sg() code currently iterates through the given scatter-gather list, and in the worst case, invokes iommu_map() for each element in the

Re: [PATCH 2/3] iommu/arm-smmu-v3: Make BTM optional for SVA

2021-01-22 Thread Robin Murphy
On 2021-01-22 11:52, Jean-Philippe Brucker wrote: When BTM isn't supported by the SMMU, send invalidations on the command queue. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 3 +++ drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 14

Re: [PATCH 2/3] iommu/arm-smmu-v3: Make BTM optional for SVA

2021-01-22 Thread Jean-Philippe Brucker
On Fri, Jan 22, 2021 at 02:04:55PM +, Robin Murphy wrote: > > @@ -182,9 +183,13 @@ static void arm_smmu_mm_invalidate_range(struct > > mmu_notifier *mn, > > unsigned long start, unsigned long end) > > { > > struct arm_smmu_mmu_notifier *smmu_mn =

[PATCH v2 3/3] iommu/arm-smmu-v3: Add support for VHE

2021-01-22 Thread Jean-Philippe Brucker
ARMv8.1 extensions added Virtualization Host Extensions (VHE), which allow to run a host kernel at EL2. When using normal DMA, Device and CPU address spaces are dissociated, and do not need to implement the same capabilities, so VHE hasn't been used in the SMMU until now. With shared address

[PATCH v2 2/3] iommu/arm-smmu-v3: Make BTM optional for SVA

2021-01-22 Thread Jean-Philippe Brucker
When BTM isn't supported by the SMMU, send invalidations on the command queue. Reviewed-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 3 +++ drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 10 +++---

[PATCH v2 0/3] iommu/arm-smmu-v3: TLB invalidation for SVA

2021-01-22 Thread Jean-Philippe Brucker
Since v1 [1] * Renamed arm_smmu_tlb_inv_range() * Removed unnecessary tlb_inv_command variable * Rebased onto for-joerg/arm-smmu/updates (oddly I didn't get any conflict, I hope it will apply this time) [1] https://lore.kernel.org/linux-iommu/20210122115257.2502526-1-jean-phili...@linaro.org/

[PATCH v2 1/3] iommu/arm-smmu-v3: Split arm_smmu_tlb_inv_range()

2021-01-22 Thread Jean-Philippe Brucker
Extract some of the cmd initialization and the ATC invalidation from arm_smmu_tlb_inv_range(), to allow an MMU notifier to invalidate a VA range by ASID. Reviewed-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 63

Re: performance regression noted in v5.11-rc after c062db039f40

2021-01-22 Thread Robin Murphy
On 2021-01-22 16:18, Chuck Lever wrote: On Jan 21, 2021, at 10:00 PM, Lu Baolu wrote: +Isaac On 1/22/21 3:09 AM, Chuck Lever wrote: On Jan 18, 2021, at 1:00 PM, Robin Murphy wrote: On 2021-01-18 16:18, Chuck Lever wrote: On Jan 12, 2021, at 9:38 AM, Will Deacon wrote: [Expanding cc

Re: performance regression noted in v5.11-rc after c062db039f40

2021-01-22 Thread Chuck Lever
> On Jan 21, 2021, at 10:00 PM, Lu Baolu wrote: > > +Isaac > > On 1/22/21 3:09 AM, Chuck Lever wrote: >>> On Jan 18, 2021, at 1:00 PM, Robin Murphy wrote: >>> >>> On 2021-01-18 16:18, Chuck Lever wrote: > On Jan 12, 2021, at 9:38 AM, Will Deacon wrote: > > [Expanding cc list

Re: performance regression noted in v5.11-rc after c062db039f40

2021-01-22 Thread Chuck Lever
> On Jan 22, 2021, at 12:38 PM, Robin Murphy wrote: > > On 2021-01-22 16:18, Chuck Lever wrote: >>> On Jan 21, 2021, at 10:00 PM, Lu Baolu wrote: >>> >>> +Isaac >>> >>> On 1/22/21 3:09 AM, Chuck Lever wrote: > On Jan 18, 2021, at 1:00 PM, Robin Murphy wrote: > > On 2021-01-18

Re: [PATCH v2 0/3] iommu/arm-smmu-v3: TLB invalidation for SVA

2021-01-22 Thread Will Deacon
On Fri, 22 Jan 2021 16:10:53 +0100, Jean-Philippe Brucker wrote: > Since v1 [1] > * Renamed arm_smmu_tlb_inv_range() > * Removed unnecessary tlb_inv_command variable > * Rebased onto for-joerg/arm-smmu/updates (oddly I didn't get any > conflict, I hope it will apply this time) > > [1] >

Re: [PATCH v4 0/7] MediaTek IOMMU improve tlb flush performance in map/unmap

2021-01-22 Thread Will Deacon
On Thu, Jan 07, 2021 at 08:29:02PM +0800, Yong Wu wrote: > This patchset is to improve tlb flushing performance in iommu_map/unmap > for MediaTek IOMMU. > > For iommu_map, currently MediaTek IOMMU use IO_PGTABLE_QUIRK_TLBI_ON_MAP > to do tlb_flush for each a memory chunk. this is so unnecessary.

Re: [PATCH 1/3] memory: mtk-smi: Use platform_register_drivers

2021-01-22 Thread Krzysztof Kozlowski
On Thu, Jan 21, 2021 at 02:24:27PM +0800, Yong Wu wrote: > In this file, we have 2 drivers, smi-common and smi-larb. > Use platform_register_drivers. > > Signed-off-by: Yong Wu > --- > drivers/memory/mtk-smi.c | 25 ++--- > 1 file changed, 6 insertions(+), 19 deletions(-)

Re: [PATCH 2/3] memory: mtk-smi: Add module_exit and module_license

2021-01-22 Thread Krzysztof Kozlowski
On Thu, Jan 21, 2021 at 02:24:28PM +0800, Yong Wu wrote: > The config MTK_SMI always depends on MTK_IOMMU which is built-in > currently. Thus we don't have module_exit before. This patch adds > module_exit and module_license. It is a preparing patch for supporting > MTK_SMI could been built as a

Re: [PATCH 3/3] memory: mtk-smi: Switch MTK_SMI to tristate

2021-01-22 Thread Krzysztof Kozlowski
On Thu, Jan 21, 2021 at 02:24:29PM +0800, Yong Wu wrote: > This patch switches MTK_SMI to tristate. Support it could be 'm'. > > Meanwhile, Fix a build issue while MTK_SMI is built as module. s/Fix/fix. What error is being fixed here? How can I reproduce it? Aren't you just adjusting it to