Re: CAAM: kernel BUG at drivers/crypto/caam/jr.c:230! (and dma-coherent query)

2021-03-03 Thread Robin Murphy
On 2021-03-03 10:26, Horia Geantă wrote: Adding some people in the loop, maybe they could help in understanding why lack of "dma-coherent" property for a HW-coherent device could lead to unexpected / strange side effects. On 3/1/2021 5:22 PM, Sascha Hauer wrote: Hi All, I am on a Layerscape

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

2021-03-02 Thread Robin Murphy
On 2021-02-25 17:51, 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 | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git

Re: [PATCH 1/1] Revert "iommu/iova: Retry from last rb tree node if iova search fails"

2021-03-01 Thread Robin Murphy
On 2021-02-25 13:54, John Garry wrote: On 29/01/2021 12:03, Robin Murphy wrote: On 2021-01-29 09:48, Leizhen (ThunderTown) wrote: Currently, we are thinking about the solution to the problem. However, because the end time of v5.11 is approaching, this patch is sent first. However

Re: next/master bisection: baseline.login on r8a77960-ulcb

2021-02-25 Thread Robin Murphy
On 2021-02-25 11:09, Thierry Reding wrote: On Wed, Feb 24, 2021 at 10:39:42PM +0100, Heiko Thiery wrote: Hi Christoph and all, On 23.02.21 10:56, Guillaume Tucker wrote: Hi Christoph, Please see the bisection report below about a boot failure on r8a77960-ulcb on next-20210222. Reports

Re: [PATCH 4/7] dma-mapping: add a dma_alloc_noncontiguous API

2021-02-16 Thread Robin Murphy
On 2021-02-02 09:51, Christoph Hellwig wrote: Add a new API that returns a potentiall virtually non-contigous sg_table and a DMA address. This API is only properly implemented for dma-iommu and will simply return a contigious chunk as a fallback. The intent is that media drivers can use this

Re: [PATCH v3 1/2] dt-bindings: iommu: add bindings for sprd iommu

2021-02-16 Thread Robin Murphy
On 2021-02-10 19:21, Rob Herring wrote: On Fri, Feb 5, 2021 at 1:21 AM Chunyan Zhang wrote: Hi Rob, On Fri, 5 Feb 2021 at 07:25, Rob Herring wrote: On Wed, Feb 03, 2021 at 05:07:26PM +0800, Chunyan Zhang wrote: From: Chunyan Zhang This iommu module can be used by Unisoc's multimedia

Re: [PATCH v2] iommu: Check dev->iommu in iommu_dev_xxx functions

2021-02-16 Thread Robin Murphy
On 2021-02-12 17:28, Shameerali Kolothum Thodi wrote: -Original Message- From: Shameerali Kolothum Thodi Sent: 12 February 2021 16:45 To: 'Robin Murphy' ; linux-ker...@vger.kernel.org; iommu@lists.linux-foundation.org Cc: j...@8bytes.org; jean-phili...@linaro.org; w...@kernel.org

Re: [RFC PATCH 1/8] of/device: Allow specifying a custom iommu_spec to of_dma_configure

2021-02-16 Thread Robin Murphy
Hi Mikko, On 2021-02-08 16:38, Mikko Perttunen wrote: To allow for more customized device tree bindings that point to IOMMUs, allow manual specification of iommu_spec to of_dma_configure. The initial use case for this is with Host1x, where the driver manages a set of device tree-defined IOMMU

Re: [PATCH v2] iommu: Check dev->iommu in iommu_dev_xxx functions

2021-02-12 Thread Robin Murphy
On 2021-02-12 14:54, Shameerali Kolothum Thodi wrote: Hi Robin/Joerg, -Original Message- From: Shameer Kolothum [mailto:shameerali.kolothum.th...@huawei.com] Sent: 01 February 2021 12:41 To: linux-ker...@vger.kernel.org; iommu@lists.linux-foundation.org Cc: j...@8bytes.org;

Re: DMA direct mapping fix for 5.4 and earlier stable branches

2021-02-09 Thread Robin Murphy
On 2021-02-09 12:36, Sumit Garg wrote: Hi Christoph, On Tue, 9 Feb 2021 at 15:06, Christoph Hellwig wrote: On Tue, Feb 09, 2021 at 10:23:12AM +0100, Greg KH wrote: From the view point of ZeroCopy using DMABUF, is 5.4 not mature enough, and is 5.10 enough mature ? This is the most

Re: [RFC PATCH 10/11] vfio/iommu_type1: Optimize dirty bitmap population based on iommu HWDBM

2021-02-09 Thread Robin Murphy
On 2021-02-09 11:57, Yi Sun wrote: On 21-02-07 18:40:36, Keqian Zhu wrote: Hi Yi, On 2021/2/7 17:56, Yi Sun wrote: Hi, On 21-01-28 23:17:41, Keqian Zhu wrote: [...] +static void vfio_dma_dirty_log_start(struct vfio_iommu *iommu, +struct vfio_dma *dma)

Re: [RFC PATCH 10/11] vfio/iommu_type1: Optimize dirty bitmap population based on iommu HWDBM

2021-02-09 Thread Robin Murphy
On 2021-02-07 09:56, Yi Sun wrote: Hi, On 21-01-28 23:17:41, Keqian Zhu wrote: [...] +static void vfio_dma_dirty_log_start(struct vfio_iommu *iommu, +struct vfio_dma *dma) +{ + struct vfio_domain *d; + + list_for_each_entry(d, >domain_list,

Re: [RFC PATCH 01/11] iommu/arm-smmu-v3: Add feature detection for HTTU

2021-02-05 Thread Robin Murphy
On 2021-02-05 11:48, Robin Murphy wrote: On 2021-02-05 09:13, Keqian Zhu wrote: Hi Robin and Jean, On 2021/2/5 3:50, Robin Murphy wrote: On 2021-01-28 15:17, Keqian Zhu wrote: From: jiangkunkun The SMMU which supports HTTU (Hardware Translation Table Update) can update the access flag

Re: [RFC PATCH 01/11] iommu/arm-smmu-v3: Add feature detection for HTTU

2021-02-05 Thread Robin Murphy
On 2021-02-05 09:13, Keqian Zhu wrote: Hi Robin and Jean, On 2021/2/5 3:50, Robin Murphy wrote: On 2021-01-28 15:17, Keqian Zhu wrote: From: jiangkunkun The SMMU which supports HTTU (Hardware Translation Table Update) can update the access flag and the dirty state of TTD by hardware

Re: [PATCH] dma-mapping: benchmark: pretend DMA is transmitting

2021-02-04 Thread Robin Murphy
On 2021-02-04 22:58, Barry Song wrote: In a real dma mapping user case, after dma_map is done, data will be transmit. Thus, in multi-threaded user scenario, IOMMU contention should not be that severe. For example, if users enable multiple threads to send network packets through 1G/10G/100Gbps

Re: [PATCH 7/8] swiotlb: respect min_align_mask

2021-02-04 Thread Robin Murphy
On 2021-02-04 19:30, Christoph Hellwig wrote: Respect the min_align_mask in struct device_dma_parameters in swiotlb. There are two parts to it: 1) for the lower bits of the alignment inside the io tlb slot, just extent the size of the allocation and leave the start of the slot

Re: [PATCH 5/8] swiotlb: refactor swiotlb_tbl_map_single

2021-02-04 Thread Robin Murphy
On 2021-02-04 19:30, Christoph Hellwig wrote: Split out a bunch of a self-contained helpers to make the function easier to follow. Signed-off-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 177 +-- 1 file changed, 87 insertions(+), 90 deletions(-)

Re: [PATCH 3/8] swiotlb: factor out a nr_slots helper

2021-02-04 Thread Robin Murphy
On 2021-02-04 19:30, Christoph Hellwig wrote: Factor out a helper to find the number of slots for a given size. Signed-off-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/kernel/dma/swiotlb.c

Re: [RFC PATCH 06/11] iommu/arm-smmu-v3: Scan leaf TTD to sync hardware dirty log

2021-02-04 Thread Robin Murphy
On 2021-01-28 15:17, Keqian Zhu wrote: From: jiangkunkun During dirty log tracking, user will try to retrieve dirty log from iommu if it supports hardware dirty log. This adds a new interface named sync_dirty_log in iommu layer and arm smmuv3 implements it, which scans leaf TTD and treats it's

Re: [RFC PATCH 05/11] iommu/arm-smmu-v3: Merge a span of page to block descriptor

2021-02-04 Thread Robin Murphy
On 2021-01-28 15:17, Keqian Zhu wrote: From: jiangkunkun When stop dirty log tracking, we need to recover all block descriptors which are splited when start dirty log tracking. This adds a new interface named merge_page in iommu layer and arm smmuv3 implements it, which reinstall block

Re: [RFC PATCH 04/11] iommu/arm-smmu-v3: Split block descriptor to a span of page

2021-02-04 Thread Robin Murphy
On 2021-01-28 15:17, Keqian Zhu wrote: From: jiangkunkun Block descriptor is not a proper granule for dirty log tracking. This adds a new interface named split_block in iommu layer and arm smmuv3 implements it, which splits block descriptor to an equivalent span of page descriptors. During

Re: [RFC PATCH 01/11] iommu/arm-smmu-v3: Add feature detection for HTTU

2021-02-04 Thread Robin Murphy
On 2021-01-28 15:17, Keqian Zhu wrote: From: jiangkunkun The SMMU which supports HTTU (Hardware Translation Table Update) can update the access flag and the dirty state of TTD by hardware. It is essential to track dirty pages of DMA. This adds feature detection, none functional change.

Re: [RFC PATCH 3/3] iommu/arm-smmu-v3: Add debug interfaces for SMMUv3

2021-02-04 Thread Robin Murphy
On 2021-01-29 09:06, Zhou Wang wrote: This patch adds debug interfaces for SMMUv3 driver in sysfs. It adds debug related files under /sys/kernel/debug/iommu/smmuv3. User should firstly set device and pasid to pci_dev and pasid by: (currently only support PCI device) echo ::. >

Re: [PATCH RFC v1 2/6] swiotlb: convert variables to arrays

2021-02-04 Thread Robin Murphy
On 2021-02-04 07:29, Christoph Hellwig wrote: On Wed, Feb 03, 2021 at 03:37:05PM -0800, Dongli Zhang wrote: This patch converts several swiotlb related variables to arrays, in order to maintain stat/status for different swiotlb buffers. Here are variables involved: - io_tlb_start and

Re: [PATCH 2/2] iommu: add Unisoc iommu basic driver

2021-02-02 Thread Robin Murphy
On 2021-02-02 14:41, Joerg Roedel wrote: On Tue, Feb 02, 2021 at 02:34:34PM +, Robin Murphy wrote: Nope, I believe if Arm Ltd. had any involvement in this I'd know about it :) Okay, got confused by thinking of ARM as the CPU architecture, not the company :) But given the intel/ and amd

Re: [PATCH 2/2] iommu: add Unisoc iommu basic driver

2021-02-02 Thread Robin Murphy
On 2021-02-02 14:01, Joerg Roedel wrote: On Tue, Feb 02, 2021 at 06:42:57PM +0800, Chunyan Zhang wrote: From: Chunyan Zhang This iommu module can be used by Unisoc's multimedia devices, such as display, Image codec(jpeg) and a few signal processors, including VSP(video), GSP(graphic),

Re: [PATCH] iommu: Update the document of IOMMU_DOMAIN_UNMANAGED

2021-02-02 Thread Robin Murphy
On 2021-02-02 08:53, Keqian Zhu wrote: Signed-off-by: Keqian Zhu --- include/linux/iommu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 77e561ed57fd..e8f2efae212b 100644 --- a/include/linux/iommu.h +++

Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver.

2021-02-02 Thread Robin Murphy
On 2021-02-02 11:21, Andy Shevchenko wrote: On Mon, Feb 01, 2021 at 04:25:55PM -0800, Jianxiong Gao wrote: + if (dma_set_min_align_mask(dev->dev, NVME_CTRL_PAGE_SIZE - 1)) Side note: we have DMA_BIT_MASK(), please use it. FWIW I'd actually disagree on that point. Conceptually, this

Re: [PATCH v4 1/2] perf/smmuv3: Don't reserve the PMCG register spaces

2021-02-01 Thread Robin Murphy
Murphy I hadn't considered that a comment is a very good idea, in case the cleanup-script crew find this in future and try to "simplify" it :) Thanks, Robin. Suggested-by: Robin Murphy Signed-off-by: Zhen Lei --- drivers/perf/arm_smmuv3_pmu.c | 25 +++-- 1 fi

Re: [PATCH v3 3/3] iommu/arm-smmu-v3: Reserving the entire SMMU register space

2021-02-01 Thread Robin Murphy
On 2021-01-30 01:54, Leizhen (ThunderTown) wrote: On 2021/1/29 23:27, Robin Murphy wrote: On 2021-01-27 11:32, Zhen Lei wrote: commit 52f3fab0067d ("iommu/arm-smmu-v3: Don't reserve implementation defined register space") only reserves the basic SMMU register space. So the ECMD

Re: [PATCH v5 06/27] dt-bindings: mediatek: Add binding for mt8192 IOMMU

2021-02-01 Thread Robin Murphy
On 2021-01-29 11:45, Tomasz Figa wrote: On Mon, Jan 25, 2021 at 4:34 PM Yong Wu wrote: On Mon, 2021-01-25 at 13:18 +0900, Tomasz Figa wrote: On Wed, Jan 20, 2021 at 4:08 PM Yong Wu wrote: On Wed, 2021-01-20 at 13:15 +0900, Tomasz Figa wrote: On Wed, Jan 13, 2021 at 3:45 PM Yong Wu

Re: [PATCH v3 2/3] perf/smmuv3: Add a MODULE_SOFTDEP() to indicate dependency on SMMU

2021-01-29 Thread Robin Murphy
On 2021-01-29 15:34, John Garry wrote: On 29/01/2021 15:12, Robin Murphy wrote: On 2021-01-27 11:32, Zhen Lei wrote: The MODULE_SOFTDEP() gives user space a hint of the loading sequence. And when command "modprobe arm_smmuv3_pmu" is executed, the arm_smmu_v3.ko is automatica

Re: [PATCH v3 3/3] iommu/arm-smmu-v3: Reserving the entire SMMU register space

2021-01-29 Thread Robin Murphy
registers, we can do that when we actually add ECMDQ support. Robin. Suggested-by: Robin Murphy Signed-off-by: Zhen Lei --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 24 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 2 -- 2 files changed, 4 insertions(+), 22

Re: [PATCH v3 2/3] perf/smmuv3: Add a MODULE_SOFTDEP() to indicate dependency on SMMU

2021-01-29 Thread Robin Murphy
On 2021-01-27 11:32, Zhen Lei wrote: The MODULE_SOFTDEP() gives user space a hint of the loading sequence. And when command "modprobe arm_smmuv3_pmu" is executed, the arm_smmu_v3.ko is automatically loaded in advance. Why do we need this? If probe order doesn't matter when both drivers are

Re: [PATCH v3 1/3] perf/smmuv3: Don't reserve the PMCG register spaces

2021-01-29 Thread Robin Murphy
elper" function ends up over twice the size of all the code it replaces[1], but for the actual functional change here, Reviewed-by: Robin Murphy Suggested-by: Robin Murphy Signed-off-by: Zhen Lei --- drivers/perf/arm_smmuv3_pmu.c | 27 +-- 1 file changed, 25

Re: [PATCH 1/1] Revert "iommu/iova: Retry from last rb tree node if iova search fails"

2021-01-29 Thread Robin Murphy
On 2021-01-29 09:48, Leizhen (ThunderTown) wrote: Currently, we are thinking about the solution to the problem. However, because the end time of v5.11 is approaching, this patch is sent first. However, that commit was made for a reason - how do we justify that one thing being slow is more

Re: [PATCH v6 07/33] iommu: Avoid reallocate default domain for a group

2021-01-28 Thread Robin Murphy
On 2021-01-28 21:14, Will Deacon wrote: On Thu, Jan 28, 2021 at 09:10:20PM +, Will Deacon wrote: On Wed, Jan 27, 2021 at 05:39:16PM +0800, Yong Wu wrote: On Tue, 2021-01-26 at 22:23 +, Will Deacon wrote: On Mon, Jan 11, 2021 at 07:18:48PM +0800, Yong Wu wrote: If

Re: [PATCH 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver.

2021-01-28 Thread Robin Murphy
On 2021-01-28 00:38, Jianxiong Gao wrote: NVMe driver relies on the address offset to function properly. This patch adds the offset preserve mask to NVMe driver when mapping via dma_map_sg_attrs and unmapping via nvme_unmap_sg. The mask depends on the page size defined by CC.MPS register of NVMe

Re: [PATCH 1/3] Adding page_offset_mask to device_dma_parameters

2021-01-28 Thread Robin Murphy
On 2021-01-28 00:38, Jianxiong Gao wrote: Some devices rely on the address offset in a page to function correctly (NVMe driver as an example). These devices may use a different page size than the Linux kernel. The address offset has to be preserved upon mapping, and in order to do so, we need to

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

2021-01-28 Thread Robin Murphy
On 2021-01-28 15:18, Keqian Zhu wrote: On 2021/1/27 17:39, Robin Murphy wrote: On 2021-01-27 07:36, Keqian Zhu wrote: On 2021/1/27 10:01, Leizhen (ThunderTown) wrote: On 2021/1/26 18:12, Will Deacon wrote: On Mon, Jan 25, 2021 at 08:23:40PM +, Robin Murphy wrote: Now we probably

Re: [PATCH RFC 0/9] Possible set of VT-d optimizations

2021-01-28 Thread Robin Murphy
On 2021-01-27 20:00, Chuck Lever wrote: Hi- This collection of patches seems to get the best throughtput results so far. The NFS WRITE result is fully restored, and the NFS READ result is very close to fully restored. Children see throughput for 12 initial writers = 5008474.03 kB/sec

Re: [PATCH v2] of/device: Update dma_range_map only when dev has valid dma-ranges

2021-01-27 Thread Robin Murphy
On 2021-01-27 19:09, Rob Herring wrote: On Wed, Jan 27, 2021 at 7:13 AM Robin Murphy wrote: [ + Christoph, Marek ] On 2021-01-27 13:00, Paul Kocialkowski wrote: Hi, On Tue 19 Jan 21, 18:52, Yong Wu wrote: The commit e0d072782c73 ("dma-mapping: introduce DMA range map, suppla

Re: [PATCH v2] of/device: Update dma_range_map only when dev has valid dma-ranges

2021-01-27 Thread Robin Murphy
pplanting dma_pfn_offset"), Suggested-by: Robin Murphy Signed-off-by: Yong Wu Signed-off-by: Paul Kocialkowski Reviewed-by: Rob Herring --- drivers/of/device.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/of/device.c b/drivers/of/device.c index aed

[PATCH 2/2] iommu/io-pgtable: Remove TLBI_ON_MAP quirk

2021-01-27 Thread Robin Murphy
IO_PGTABLE_QUIRK_TLBI_ON_MAP is now fully superseded by the core API's iotlb_sync_map callback. Signed-off-by: Robin Murphy --- drivers/iommu/io-pgtable-arm-v7s.c | 8 +--- include/linux/io-pgtable.h | 5 - 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers

[PATCH 1/2] iommu/msm: Hook up iotlb_sync_map

2021-01-27 Thread Robin Murphy
The core API can now accommodate invalidate-on-map style behaviour in a single efficient call, so hook that up instead of having io-pgatble do it piecemeal. Signed-off-by: Robin Murphy --- Just a little quick cleanup on top of the Mediatek TLB patches now queued - CC'ing a bunch of folks from

Re: [PATCH v2] of/device: Update dma_range_map only when dev has valid dma-ranges

2021-01-27 Thread Robin Murphy
nks, Robin. Cheers, Paul [1] https://lore.kernel.org/linux-arm-kernel/5c7946f3-b56e-da00-a750-be097c7ce...@arm.com/ CC: Rob Herring CC: Frank Rowand Fixes: e0d072782c73 ("dma-mapping: introduce DMA range map, supplanting dma_pfn_offset"), Suggested-by: Robin Murphy Signed-off-by:

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

2021-01-27 Thread Robin Murphy
On 2021-01-27 07:36, Keqian Zhu wrote: On 2021/1/27 10:01, Leizhen (ThunderTown) wrote: On 2021/1/26 18:12, Will Deacon wrote: On Mon, Jan 25, 2021 at 08:23:40PM +, Robin Murphy wrote: Now we probably will need some degreee of BBML feature awareness for the sake of SVA if and when we

Re: [PATCH] iommu: Check dev->iommu in iommu_dev_xxx functions

2021-01-26 Thread Robin Murphy
On 2021-01-26 16:40, Shameerali Kolothum Thodi wrote: Hi Robin, -Original Message- From: Robin Murphy [mailto:robin.mur...@arm.com] Sent: 26 January 2021 13:51 To: Shameerali Kolothum Thodi Cc: linux-ker...@vger.kernel.org; iommu@lists.linux-foundation.org; jean-phili...@linaro.org; w

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

2021-01-26 Thread Robin Murphy
On 2021-01-26 16:05, Rob Clark wrote: On Tue, Jan 26, 2021 at 3:41 AM Robin Murphy wrote: On 2021-01-25 21:51, Jordan Crouse wrote: On Fri, Jan 22, 2021 at 12:53:17PM +, Robin Murphy wrote: On 2021-01-22 12:41, Will Deacon wrote: On Tue, Nov 24, 2020 at 12:15:58PM -0700, Jordan Crouse

Re: [RFT PATCH 0/3] Performance regression noted in v5.11-rc after c062db039f40

2021-01-26 Thread Robin Murphy
On 2021-01-25 19:31, Chuck Lever wrote: On Jan 25, 2021, at 12:39 PM, Chuck Lever wrote: Hello Lu - Many thanks for your prototype. On Jan 24, 2021, at 9:38 PM, Lu Baolu wrote: This patch series is only for Request-For-Testing purpose. It aims to fix the performance regression

Re: [PATCH] iommu: Check dev->iommu in iommu_dev_xxx functions

2021-01-26 Thread Robin Murphy
On Tue, 26 Jan 2021 13:06:29 + Shameer Kolothum wrote: > The device iommu probe/attach might have failed leaving dev->iommu > to NULL and device drivers may still invoke these functions resulting > a crash in iommu vendor driver code. Hence make sure we check that. > > Signed-off-by:

Re: [PATCH v3 2/2] iommu: use the __iommu_attach_device() directly for deferred attach

2021-01-26 Thread Robin Murphy
of the iommu_attach_device(). The external interface iommu_attach_device() is not suitable for handling this situation. No objection to the cosmetic change - arguably parsing "attach" as a verb rather than a noun is more normal anyway :) Thus my previous review still stands: Reviewed-by: Robin Murphy

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

2021-01-26 Thread Robin Murphy
On 2021-01-25 21:51, Jordan Crouse wrote: On Fri, Jan 22, 2021 at 12:53:17PM +, Robin Murphy wrote: 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

Re: [PATCH] iommu/arm-smmu-qcom: Fix mask extraction for bootloader programmed SMRs

2021-01-26 Thread Robin Murphy
strictly validated in arm_smmu_probe_device()... Fix the SMR mask extraction step for bootloader programmed SMRs by masking out the valid bit when we know that we're already working with a valid SMR. This seems like the neatest approach to me. Reviewed-by: Robin Murphy Fixes: 07a7f2caaa5a ("iommu/arm-smmu

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

2021-01-25 Thread Robin Murphy
On 2021-01-23 10:08, Leizhen (ThunderTown) wrote: On 2021/1/22 20: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-25 Thread Robin Murphy
On 2021-01-23 10:20, 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: When changing from a set of pages/smaller blocks to a larger block for an address, the software should

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: [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 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 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 scatter

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 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 v1 2/2] iommu: add Unisoc iommu basic driver

2021-01-21 Thread Robin Murphy
On 2021-01-21 11:23, Chunyan Zhang wrote: From: Chunyan Zhang This patch only adds display iommu support, the driver was tested with sprd dpu and image codec processor. The iommu support for others would be added once finished tests with those devices, such as a few signal processors,

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

2021-01-21 Thread Robin Murphy
On 2021-01-21 15:48, Rob Herring wrote: On Wed, Jan 20, 2021 at 7:10 PM Robin Murphy wrote: On 2021-01-20 21:31, Rob Herring wrote: On Wed, Jan 20, 2021 at 11:30 AM Robin Murphy wrote: On 2021-01-20 16:53, Rob Herring wrote: On Wed, Jan 06, 2021 at 11:41:23AM +0800, Claire Chang wrote

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

2021-01-21 Thread Robin Murphy
relative to page 1, so the cleanup represents a little bit of convergence as well as just lines of code saved. Signed-off-by: Robin Murphy --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 42 - drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 8 ++-- 2 files changed, 20 insertions

Re: [PATCH 2/2] Revert "iommu/arm-smmu-v3: Don't reserve implementation defined register space"

2021-01-21 Thread Robin Murphy
On 2021-01-21 02:04, Leizhen (ThunderTown) wrote: On 2021/1/20 23:02, Robin Murphy wrote: On 2021-01-19 01:59, Zhen Lei wrote: This reverts commit 52f3fab0067d6fa9e99c1b7f63265dd48ca76046. This problem has been fixed by another patch. The original method had side effects, it was not mapped

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

2021-01-20 Thread Robin Murphy
On 2021-01-20 21:31, Rob Herring wrote: On Wed, Jan 20, 2021 at 11:30 AM Robin Murphy wrote: On 2021-01-20 16:53, Rob Herring wrote: 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

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

2021-01-20 Thread Robin Murphy
On 2021-01-20 16:53, Rob Herring wrote: 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

Re: [PATCH 1/2] perf/smmuv3: Don't reserve the register space that overlaps with the SMMUv3

2021-01-20 Thread Robin Murphy
On 2021-01-20 14:14, Leizhen (ThunderTown) wrote: On 2021/1/20 21:27, Robin Murphy wrote: On 2021-01-20 09:26, Leizhen (ThunderTown) wrote: On 2021/1/20 11:37, Leizhen (ThunderTown) wrote: On 2021/1/19 20:32, Robin Murphy wrote: On 2021-01-19 01:59, Zhen Lei wrote: Some SMMUv3

Re: [PATCH 2/2] Revert "iommu/arm-smmu-v3: Don't reserve implementation defined register space"

2021-01-20 Thread Robin Murphy
On 2021-01-19 01:59, Zhen Lei wrote: This reverts commit 52f3fab0067d6fa9e99c1b7f63265dd48ca76046. This problem has been fixed by another patch. The original method had side effects, it was not mapped to the user-specified resource size. The code will become more complex when ECMDQ is supported

Re: [PATCH 1/2] perf/smmuv3: Don't reserve the register space that overlaps with the SMMUv3

2021-01-20 Thread Robin Murphy
On 2021-01-20 09:26, Leizhen (ThunderTown) wrote: On 2021/1/20 11:37, Leizhen (ThunderTown) wrote: On 2021/1/19 20:32, Robin Murphy wrote: On 2021-01-19 01:59, Zhen Lei wrote: Some SMMUv3 implementation embed the Perf Monitor Group Registers (PMCG) inside the first 64kB region of the SMMU

Re: [RFC PATCH V2 2/2] iommu: add Unisoc iommu basic driver

2021-01-20 Thread Robin Murphy
On 2021-01-20 11:40, Chunyan Zhang wrote: [...] + pgt_base_iova = dom->pgt_va + + ((iova - mdata->iova_start) >> SPRD_IOMMU_PAGE_SHIFT); + + spin_lock_irqsave(>pgtlock, flags); + for (i = 0; i < page_num; i++) { + pgt_base_iova[i] = pabase >>

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

2021-01-19 Thread Robin Murphy
On 2021-01-08 14:52, Jean-Philippe Brucker wrote: The SMMU provides a Stall model for handling page faults in platform devices. It is similar to PCIe PRI, but doesn't require devices to have their own translation cache. Instead, faulting transactions are parked and the OS is given a chance to

Re: [PATCH 1/2 v2] dma-iommu: use static-key to minimize the impact in the fast-path

2021-01-19 Thread Robin Murphy
On 2021-01-19 15:26, Christoph Hellwig wrote: On Tue, Jan 19, 2021 at 07:16:15PM +0800, Lianbo Jiang wrote: +static DEFINE_STATIC_KEY_FALSE(__deferred_attach); Why the strange underscores? Wouldn't iommu_deferred_attach_enabled be a better name? - if

Re: [PATCH 2/2 v2] iommu: use the __iommu_attach_device() directly for deferred attach

2021-01-19 Thread Robin Murphy
of the iommu_attach_device(). The external interface iommu_attach_device() is not suitable for handling this situation. Reviewed-by: Robin Murphy Signed-off-by: Lianbo Jiang --- drivers/iommu/dma-iommu.c | 18 +++--- drivers/iommu/iommu.c | 12 include/linux/iommu.h | 2

Re: [PATCH 1/2] perf/smmuv3: Don't reserve the register space that overlaps with the SMMUv3

2021-01-19 Thread Robin Murphy
On 2021-01-19 01:59, Zhen Lei wrote: Some SMMUv3 implementation embed the Perf Monitor Group Registers (PMCG) inside the first 64kB region of the SMMU. Since SMMU and PMCG are managed by two separate drivers, and this driver depends on ARM_SMMU_V3, so the SMMU driver reserves the corresponding

Re: [PATCH v4 7/7] iommu/mediatek: Remove the tlb-ops for v7s

2021-01-18 Thread Robin Murphy
On 2021-01-07 12:29, Yong Wu wrote: Until now, we have already used the tlb operations from iommu framework, then the tlb operations for v7s can be removed. Correspondingly, Switch the paramenter "cookie" to the internal structure. Reviewed-by: Robin Murphy Signed-off-b

Re: [PATCH v4 6/7] iommu/mediatek: Gather iova in iommu_unmap to achieve tlb sync once

2021-01-18 Thread Robin Murphy
, gather->start is impossible ULONG_MAX, remove the checking. This patch aims to do tlb synchronization *once* in the iommu_unmap. Reviewed-by: Robin Murphy Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/driv

Re: [PATCH v4 5/7] iommu/io-pgtable: Allow io_pgtable_tlb ops optional

2021-01-18 Thread Robin Murphy
On 2021-01-07 12:29, Yong Wu wrote: This patch allows io_pgtable_tlb ops could be null since the IOMMU drivers may use the tlb ops from iommu framework. For the reasons I gave on v3, Reviewed-by: Robin Murphy Signed-off-by: Yong Wu --- include/linux/io-pgtable.h | 8 +--- 1 file

Re: [PATCH v4 4/7] iommu: Switch gather->end to the inclusive end

2021-01-18 Thread Robin Murphy
always do cleanup on top, and right now I'm more interested in getting these changes landed, so either way, Reviewed-by: Robin Murphy gart_iommu_sync_map(domain, gather->start, length); } diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 9ce0aa9e236b..ae8eddd4621b 100644 ---

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

2021-01-18 Thread Robin Murphy
On 2021-01-18 16:18, Chuck Lever wrote: On Jan 12, 2021, at 9:38 AM, Will Deacon wrote: [Expanding cc list to include DMA-IOMMU and intel IOMMU folks] On Fri, Jan 08, 2021 at 04:18:36PM -0500, Chuck Lever wrote: Hi- [ Please cc: me on replies, I'm not currently subscribed to iommu@lists

Re: [PATCH v3 6/7] iommu/mediatek: Gather iova in iommu_unmap to achieve tlb sync once

2021-01-18 Thread Robin Murphy
On 2021-01-18 16:58, Will Deacon wrote: On Mon, Jan 18, 2021 at 04:35:22PM +, Robin Murphy wrote: On 2020-12-16 10:36, Yong Wu wrote: In current iommu_unmap, this code is: iommu_iotlb_gather_init(_gather); ret = __iommu_unmap(domain, iova, size, _gather

Re: [PATCH v3 7/7] iommu/mediatek: Remove the tlb-ops for v7s

2021-01-18 Thread Robin Murphy
On 2020-12-16 10:36, Yong Wu wrote: Until now, we have already used the tlb operations from iommu framework, then the tlb operations for v7s can be removed. Correspondingly, Switch the paramenter "cookie" to internal structure. FWIW, Reviewed-by: Robin Murphy Signed-off-b

Re: [PATCH v3 6/7] iommu/mediatek: Gather iova in iommu_unmap to achieve tlb sync once

2021-01-18 Thread Robin Murphy
, gather->start is impossible ULONG_MAX, remove the checking. This patch aims to do tlb synchronization *once* in the iommu_unmap. Assuming the update to patch #4 simply results in "unsigned long end = iova + size - 1;" here, Reviewed-by: Robin Murphy Signed-off-by: Yong Wu

Re: [PATCH v3 5/7] iommu: Allow io_pgtable_tlb ops optional

2021-01-18 Thread Robin Murphy
a full set of NULL callbacks. Reviewed-by: Robin Murphy Signed-off-by: Yong Wu --- include/linux/io-pgtable.h | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h index adde9e49be08..c81796814afa 100644

Re: [PATCH v6 06/33] of/device: Move dma_range_map before of_iommu_configure

2021-01-18 Thread Robin Murphy
On 2021-01-15 05:30, Yong Wu wrote: On Thu, 2021-01-14 at 13:27 -0600, Rob Herring wrote: On Mon, Jan 11, 2021 at 07:18:47PM +0800, Yong Wu wrote: "dev->dma_range_map" contains the devices' dma_ranges information, This patch moves dma_range_map before of_iommu_configure. The iommu driver may

Re: [PATCH v4 2/3] iommu/iova: Avoid double-negatives in magazine helpers

2021-01-18 Thread Robin Murphy
On 2021-01-18 10:55, John Garry wrote: On 18/01/2021 10:08, Jean-Philippe Brucker wrote: Any idea why that's happening?  This fix seems ok but if we're expecting allocation failures for the loaded magazine then we could easily get it for cpu_rcaches too, and get a similar abort at runtime.

Re: [PATCH v4 3/3] iommu/iova: Flush CPU rcache for when a depot fills

2021-01-15 Thread Robin Murphy
On 2021-01-15 17:32, Jean-Philippe Brucker wrote: On Thu, Dec 10, 2020 at 02:23:09AM +0800, John Garry wrote: Leizhen reported some time ago that IOVA performance may degrade over time [0], but unfortunately his solution to fix this problem was not given attention. To summarize, the issue is

Re: Consult on ARM SMMU debugfs

2021-01-15 Thread Robin Murphy
On 2021-01-15 15:14, Russell King - ARM Linux admin wrote: On Mon, Jan 11, 2021 at 08:01:48PM +, Robin Murphy wrote: On 2021-01-07 02:45, chenxiang (M) wrote: Hi Will,� Robin or other guys, When debugging SMMU/SVA issue on huawei ARM64 board, we find that it lacks of enough debugfs

Re: [PATCH] iommu: check for the deferred attach when attaching a device

2021-01-15 Thread Robin Murphy
On 2021-01-15 14:26, lijiang wrote: Hi, Robin Thank you for the comment. 在 2021年01月13日 01:29, Robin Murphy 写道: On 2021-01-05 07:52, lijiang wrote: 在 2021年01月05日 11:55, lijiang 写道: Hi, Also add Joerg to cc list. Also add more people to cc list, Jerry Snitselaar and Tom Lendacky. Thanks

Re: [PATCH] iommu/arm-smmu-v3: Handle duplicated Stream IDs from other masters

2021-01-14 Thread Robin Murphy
On 2021-01-12 20:29, Ajay Kumar wrote: On Tue, Jan 12, 2021 at 12:57 AM Robin Murphy wrote: On 2021-01-07 13:03, Will Deacon wrote: On Thu, Jan 07, 2021 at 03:03:40PM +0530, Ajay Kumar wrote: When PCI function drivers(ex:pci-endpoint-test) are probed for already initialized PCIe-RC(Root

Re: [RFC PATCH v3 4/6] swiotlb: Add restricted DMA alloc/free support.

2021-01-13 Thread Robin Murphy
On 2021-01-13 12:48, Christoph Hellwig wrote: +#ifdef CONFIG_SWIOTLB + if (unlikely(dev->dma_io_tlb_mem)) + return swiotlb_alloc(dev, size, dma_handle, attrs); +#endif Another place where the dma_io_tlb_mem is useful to avoid the ifdef. -phys_addr_t

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

2021-01-13 Thread Robin Murphy
On 2021-01-13 17:43, Florian Fainelli wrote: On 1/13/21 7:27 AM, Robin Murphy wrote: On 2021-01-13 13:59, Nicolas Saenz Julienne wrote: Hi All, On Tue, 2021-01-12 at 16:03 -0800, Florian Fainelli wrote: On 1/5/21 7:41 PM, Claire Chang wrote: Add the initialization function to create

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

2021-01-13 Thread Robin Murphy
On 2021-01-13 13:59, Nicolas Saenz Julienne wrote: Hi All, On Tue, 2021-01-12 at 16:03 -0800, Florian Fainelli wrote: On 1/5/21 7:41 PM, Claire Chang wrote: Add the initialization function to create restricted DMA pools from matching reserved-memory nodes in the device tree. Signed-off-by:

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

2021-01-12 Thread Robin Murphy
On 2021-01-12 16:33, Christoph Hellwig wrote: On Tue, Jan 12, 2021 at 04:00:59PM +, Robin Murphy wrote: Out of curiosity, how much of the difference is attributable to actual indirect call overhead vs. the additional massive reduction in visits to arm_smmu_rpm_{get,put} that you fail

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

2021-01-12 Thread Robin Murphy
On 2021-01-07 17:57, Konrad Rzeszutek Wilk wrote: On Fri, Jan 08, 2021 at 01:39:18AM +0800, Claire Chang wrote: Hi Greg and Konrad, This change is intended to be non-arch specific. Any arch that lacks DMA access control and has devices not behind an IOMMU can make use of it. Could you share

Re: [RFC PATCH V2 2/2] iommu: add Unisoc iommu basic driver

2021-01-12 Thread Robin Murphy
On 2021-01-08 11:38, Chunyan Zhang wrote: From: Chunyan Zhang This patch only adds display iommu support, the driver was tested with sprd dpu. The iommu support for others would be added once finished tests with those devices, such as Image codec(jpeg) processor, a few signal processors,

Re: [PATCH] iommu: check for the deferred attach when attaching a device

2021-01-12 Thread Robin Murphy
On 2021-01-05 07:52, lijiang wrote: 在 2021年01月05日 11:55, lijiang 写道: Hi, Also add Joerg to cc list. Also add more people to cc list, Jerry Snitselaar and Tom Lendacky. Thanks. Thanks. Lianbo 在 2020年12月26日 13:39, Lianbo Jiang 写道: Currently, because domain attach allows to be deferred

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

2021-01-12 Thread Robin Murphy
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 scatter-gather list, which calls into the IOMMU driver through an indirect call. For an IOMMU driver

Re: [PATCH] dma: mark unmapped DMA scatter/gather invalid

2021-01-11 Thread Robin Murphy
On 2021-01-11 18:03, Marc Orr wrote: On 2021-01-11 15:43, Marc Orr wrote: minus sta...@vger.kernel.org, per gregkh@'s email. diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 0a4881e59aa7..3d9b17fe5771 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -374,9 +374,11 @@

<    5   6   7   8   9   10   11   12   13   14   >