Re: [PATCH 1/2] iommu: Fix race condition during default domain allocation

2021-06-16 Thread Ashish Mhetre
On 6/11/2021 6:19 PM, Robin Murphy wrote: External email: Use caution opening links or attachments On 2021-06-11 11:45, Will Deacon wrote: On Thu, Jun 10, 2021 at 09:46:53AM +0530, Ashish Mhetre wrote: Domain is getting created more than once during asynchronous multiple display

Re: swiotlb/caamjr regression (Was: [GIT PULL] (swiotlb) stable/for-linus-5.12)

2021-06-16 Thread Dominique MARTINET
Christoph Hellwig wrote on Thu, Jun 17, 2021 at 07:12:32AM +0200: > On Thu, Jun 17, 2021 at 09:39:15AM +0900, Dominique MARTINET wrote: > > Konrad Rzeszutek Wilk wrote on Wed, Jun 16, 2021 at 08:27:39PM -0400: > > > Thank you for testing that - and this is a bummer indeed. > > > > Hm, actually

Re: swiotlb/caamjr regression (Was: [GIT PULL] (swiotlb) stable/for-linus-5.12)

2021-06-16 Thread Christoph Hellwig
On Thu, Jun 17, 2021 at 09:39:15AM +0900, Dominique MARTINET wrote: > Konrad Rzeszutek Wilk wrote on Wed, Jun 16, 2021 at 08:27:39PM -0400: > > Thank you for testing that - and this is a bummer indeed. > > Hm, actually not that surprising if it was working without the offset > adjustments and

Re: Plan for /dev/ioasid RFC v2

2021-06-16 Thread Liu Yi L
Hi Alex, On Wed, 16 Jun 2021 13:39:37 -0600, Alex Williamson wrote: > On Wed, 16 Jun 2021 06:43:23 + > "Tian, Kevin" wrote: > > > > From: Alex Williamson > > > Sent: Wednesday, June 16, 2021 12:12 AM > > > > > > On Tue, 15 Jun 2021 02:31:39 + > > > "Tian, Kevin" wrote: > > > >

Re: [RFC PATCH] iommu: add domain->nested

2021-06-16 Thread Zhangfei Gao
On 2021/6/16 下午10:44, Christoph Hellwig wrote: On Wed, Jun 16, 2021 at 10:38:02PM +0800, Zhangfei Gao wrote: +++ b/include/linux/iommu.h @@ -87,6 +87,7 @@ struct iommu_domain { void *handler_token; struct iommu_domain_geometry geometry; void *iova_cookie; + int

Re: [PATCH v12 06/12] swiotlb: Use is_swiotlb_force_bounce for swiotlb data bouncing

2021-06-16 Thread Stefano Stabellini
On Wed, 16 Jun 2021, Claire Chang wrote: > Propagate the swiotlb_force into io_tlb_default_mem->force_bounce and > use it to determine whether to bounce the data or not. This will be > useful later to allow for different pools. > > Signed-off-by: Claire Chang > --- > include/linux/swiotlb.h |

Re: swiotlb/caamjr regression (Was: [GIT PULL] (swiotlb) stable/for-linus-5.12)

2021-06-16 Thread Dominique MARTINET
Konrad Rzeszutek Wilk wrote on Wed, Jun 16, 2021 at 08:27:39PM -0400: > Thank you for testing that - and this is a bummer indeed. Hm, actually not that surprising if it was working without the offset adjustments and doing non-aligned mappings -- perhaps the nvme code just needs to round the

Re: swiotlb/caamjr regression (Was: [GIT PULL] (swiotlb) stable/for-linus-5.12)

2021-06-16 Thread Konrad Rzeszutek Wilk
On Wed, Jun 16, 2021 at 01:49:54PM -0700, Jianxiong Gao wrote: > On Fri, Jun 11, 2021 at 3:35 AM Konrad Rzeszutek Wilk > wrote: > > > > On Fri, Jun 11, 2021 at 08:21:53AM +0200, Christoph Hellwig wrote: > > > On Thu, Jun 10, 2021 at 05:52:07PM +0300, Horia Geantă wrote: > > > > I've noticed the

Re: [PATCH v12 11/12] dt-bindings: of: Add restricted DMA pool

2021-06-16 Thread Stefano Stabellini
On Wed, 16 Jun 2021, 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 reserved-memory node. > > Signed-off-by: Claire Chang > --- >

Re: swiotlb/caamjr regression (Was: [GIT PULL] (swiotlb) stable/for-linus-5.12)

2021-06-16 Thread Jianxiong Gao via iommu
On Fri, Jun 11, 2021 at 3:35 AM Konrad Rzeszutek Wilk wrote: > > On Fri, Jun 11, 2021 at 08:21:53AM +0200, Christoph Hellwig wrote: > > On Thu, Jun 10, 2021 at 05:52:07PM +0300, Horia Geantă wrote: > > > I've noticed the failure also in v5.10 and v5.11 stable kernels, > > > since the patch set

Re: Plan for /dev/ioasid RFC v2

2021-06-16 Thread Alex Williamson
On Wed, 16 Jun 2021 06:43:23 + "Tian, Kevin" wrote: > > From: Alex Williamson > > Sent: Wednesday, June 16, 2021 12:12 AM > > > > On Tue, 15 Jun 2021 02:31:39 + > > "Tian, Kevin" wrote: > > > > > > From: Alex Williamson > > > > Sent: Tuesday, June 15, 2021 12:28 AM > > > > > > >

Re: [PATCH] dt-bindings: Drop redundant minItems/maxItems

2021-06-16 Thread Wolfram Sang
On Tue, Jun 15, 2021 at 01:15:43PM -0600, Rob Herring wrote: > If a property has an 'items' list, then a 'minItems' or 'maxItems' with the > same size as the list is redundant and can be dropped. Note that is DT > schema specific behavior and not standard json-schema behavior. The tooling > will

[PATCH v4 7/7] iommu/amd: Use only natural aligned flushes in a VM

2021-06-16 Thread Nadav Amit
From: Nadav Amit When running on an AMD vIOMMU, it is better to avoid TLB flushes of unmodified PTEs. vIOMMUs require the hypervisor to synchronize the virtualized IOMMU's PTEs with the physical ones. This process induce overheads. AMD IOMMU allows us to flush any range that is aligned to the

[PATCH v4 6/7] iommu/amd: Sync once for scatter-gather operations

2021-06-16 Thread Nadav Amit
From: Nadav Amit On virtual machines, software must flush the IOTLB after each page table entry update. The iommu_map_sg() code iterates through the given scatter-gather list and invokes iommu_map() for each element in the scatter-gather list, which calls into the vendor IOMMU driver through

[PATCH v4 4/7] iommu: Factor iommu_iotlb_gather_is_disjoint() out

2021-06-16 Thread Nadav Amit
From: Nadav Amit Refactor iommu_iotlb_gather_add_page() and factor out the logic that detects whether IOTLB gather range and a new range are disjoint. To be used by the next patch that implements different gathering logic for AMD. Note that updating gather->pgsize unconditionally does not

[PATCH v4 5/7] iommu/amd: Tailored gather logic for AMD

2021-06-16 Thread Nadav Amit
From: Nadav Amit AMD's IOMMU can flush efficiently (i.e., in a single flush) any range. This is in contrast, for instnace, to Intel IOMMUs that have a limit on the number of pages that can be flushed in a single flush. In addition, AMD's IOMMU do not care about the page-size, so changes of the

[PATCH v4 3/7] iommu: Improve iommu_iotlb_gather helpers

2021-06-16 Thread Nadav Amit
From: Robin Murphy The Mediatek driver is not the only one which might want a basic address-based gathering behaviour, so although it's arguably simple enough to open-code, let's factor it out for the sake of cleanliness. Let's also take this opportunity to document the intent of these helpers

[PATCH v4 2/7] iommu/amd: Do not use flush-queue when NpCache is on

2021-06-16 Thread Nadav Amit
From: Nadav Amit Do not use flush-queue on virtualized environments, where the NpCache capability of the IOMMU is set. This is required to reduce virtualization overheads. This change follows a similar change to Intel's VT-d and a detailed explanation as for the rationale is described in commit

[PATCH v4 1/7] iommu/amd: Selective flush on unmap

2021-06-16 Thread Nadav Amit
From: Nadav Amit Recent patch attempted to enable selective page flushes on AMD IOMMU but neglected to adapt amd_iommu_iotlb_sync() to use the selective flushes. Adapt amd_iommu_iotlb_sync() to use selective flushes and change amd_iommu_unmap() to collect the flushes. As a defensive measure, to

[PATCH v4 0/7] iommu/amd: Enable page-selective flushes

2021-06-16 Thread Nadav Amit
From: Nadav Amit The previous patch, commit 268aa4548277 ("iommu/amd: Page-specific invalidations for more than one page") was supposed to enable page-selective IOTLB flushes on AMD. Besides the bug that was already fixed by commit a017c567915f ("iommu/amd: Fix wrong parentheses on

Re: [PATCH v4 5/6] iommu/dma: Simplify calls to iommu_setup_dma_ops()

2021-06-16 Thread Robin Murphy
On 2021-06-10 08:51, Jean-Philippe Brucker wrote: dma-iommu uses the address bounds described in domain->geometry during IOVA allocation. The address size parameters of iommu_setup_dma_ops() are useful for describing additional limits set by the platform firmware, but aren't needed for drivers

Re: [PATCH v4 6/6] iommu/virtio: Enable x86 support

2021-06-16 Thread Eric Auger
Hi jean, On 6/10/21 9:51 AM, Jean-Philippe Brucker wrote: > With the VIOT support in place, x86 platforms can now use the > virtio-iommu. > > Because the other x86 IOMMU drivers aren't yet ready to use the > acpi_dma_setup() path, x86 doesn't implement arch_setup_dma_ops() at the > moment.

Re: [PATCH v4 5/6] iommu/dma: Simplify calls to iommu_setup_dma_ops()

2021-06-16 Thread Eric Auger
Hi Jean, On 6/10/21 9:51 AM, Jean-Philippe Brucker wrote: > dma-iommu uses the address bounds described in domain->geometry during > IOVA allocation. The address size parameters of iommu_setup_dma_ops() > are useful for describing additional limits set by the platform > firmware, but aren't

Re: [PATCH 2/2] swiotlb-xen: override common mmap and get_sgtable dma ops

2021-06-16 Thread Christoph Hellwig
On Wed, Jun 16, 2021 at 11:39:07AM -0400, Boris Ostrovsky wrote: > > On 6/16/21 11:35 AM, Christoph Hellwig wrote: > > On Wed, Jun 16, 2021 at 11:33:50AM -0400, Boris Ostrovsky wrote: > >> Isn't the expectation of virt_to_page() that it only works on > >> non-vmalloc'd addresses? (This is not a

Re: [PATCH 2/2] swiotlb-xen: override common mmap and get_sgtable dma ops

2021-06-16 Thread Boris Ostrovsky
On 6/16/21 11:35 AM, Christoph Hellwig wrote: > On Wed, Jun 16, 2021 at 11:33:50AM -0400, Boris Ostrovsky wrote: >> Isn't the expectation of virt_to_page() that it only works on non-vmalloc'd >> addresses? (This is not a rhetorical question, I actually don't know). > Yes. Thus is why I'd

Re: [PATCH 2/2] swiotlb-xen: override common mmap and get_sgtable dma ops

2021-06-16 Thread Christoph Hellwig
On Wed, Jun 16, 2021 at 11:33:50AM -0400, Boris Ostrovsky wrote: > Isn't the expectation of virt_to_page() that it only works on non-vmalloc'd > addresses? (This is not a rhetorical question, I actually don't know). Yes. Thus is why I'd suggest to just do the vmalloc_to_page or virt_to_page

Re: [PATCH 2/2] swiotlb-xen: override common mmap and get_sgtable dma ops

2021-06-16 Thread Boris Ostrovsky
On 6/16/21 10:21 AM, Christoph Hellwig wrote: > On Wed, Jun 16, 2021 at 10:12:55AM -0400, Boris Ostrovsky wrote: >> I wonder now whether we could avoid code duplication between here and >> dma_common_mmap()/dma_common_get_sgtable() and use your helper there. >> >> >> Christoph, would that work? 

Re: [PATCH v4 4/6] iommu/dma: Pass address limit rather than size to iommu_setup_dma_ops()

2021-06-16 Thread Eric Auger
Hi Jean, On 6/10/21 9:51 AM, Jean-Philippe Brucker wrote: > Passing a 64-bit address width to iommu_setup_dma_ops() is valid on > virtual platforms, but isn't currently possible. The overflow check in > iommu_dma_init_domain() prevents this even when @dma_base isn't 0. Pass > a limit address

Re: [RFC PATCH] iommu: add domain->nested

2021-06-16 Thread Christoph Hellwig
On Wed, Jun 16, 2021 at 10:38:02PM +0800, Zhangfei Gao wrote: > +++ b/include/linux/iommu.h > @@ -87,6 +87,7 @@ struct iommu_domain { > void *handler_token; > struct iommu_domain_geometry geometry; > void *iova_cookie; > + int nested; This should probably be a bool : 1;

[RFC PATCH] iommu: add domain->nested

2021-06-16 Thread Zhangfei Gao
Add domain->nested to decide whether domain is in nesting mode, since attr DOMAIN_ATTR_NESTING is removed in the patches: 7876a83 iommu: remove iommu_domain_{get,set}_attr 7e14754 iommu: remove DOMAIN_ATTR_NESTING Signed-off-by: Zhangfei Gao --- Nesting info is still required for vsva according

Re: [PATCH 2/2] swiotlb-xen: override common mmap and get_sgtable dma ops

2021-06-16 Thread Christoph Hellwig
On Wed, Jun 16, 2021 at 10:12:55AM -0400, Boris Ostrovsky wrote: > I wonder now whether we could avoid code duplication between here and > dma_common_mmap()/dma_common_get_sgtable() and use your helper there. > > > Christoph, would that work?  I.e. something like You should not duplicate the

Re: [PATCH 2/2] swiotlb-xen: override common mmap and get_sgtable dma ops

2021-06-16 Thread Boris Ostrovsky
On 6/16/21 7:42 AM, Roman Skakun wrote: > This commit is dedicated to fix incorrect conversion from > cpu_addr to page address in cases when we get virtual > address which allocated through xen_swiotlb_alloc_coherent() > and can be mapped in the vmalloc range. > As the result, virt_to_page()

Re: [PATCH] dt-bindings: Drop redundant minItems/maxItems

2021-06-16 Thread Marc Kleine-Budde
On 15.06.2021 13:15:43, Rob Herring wrote: > If a property has an 'items' list, then a 'minItems' or 'maxItems' with the > same size as the list is redundant and can be dropped. Note that is DT > schema specific behavior and not standard json-schema behavior. The tooling > will fixup the final

[PATCH v7 02/15] iommu: Add an unmap_pages() op for IOMMU drivers

2021-06-16 Thread Georgi Djakov
From: "Isaac J. Manjarres" Add a callback for IOMMU drivers to provide a path for the IOMMU framework to call into an IOMMU driver, which can call into the io-pgtable code, to unmap a virtually contiguous range of pages of the same size. For IOMMU drivers that do not specify an unmap_pages()

[PATCH v7 09/15] iommu/io-pgtable-arm: Prepare PTE methods for handling multiple entries

2021-06-16 Thread Georgi Djakov
From: "Isaac J. Manjarres" The PTE methods currently operate on a single entry. In preparation for manipulating multiple PTEs in one map or unmap call, allow them to handle multiple PTEs. Signed-off-by: Isaac J. Manjarres Suggested-by: Robin Murphy Signed-off-by: Georgi Djakov ---

[PATCH v7 06/15] iommu: Split 'addr_merge' argument to iommu_pgsize() into separate parts

2021-06-16 Thread Georgi Djakov
From: Will Deacon The 'addr_merge' parameter to iommu_pgsize() is a fabricated address intended to describe the alignment requirements to consider when choosing an appropriate page size. On the iommu_map() path, this address is the logical OR of the virtual and physical addresses. Subsequent

[PATCH v7 15/15] iommu/arm-smmu: Implement the map_pages() IOMMU driver callback

2021-06-16 Thread Georgi Djakov
From: "Isaac J. Manjarres" Implement the map_pages() callback for the ARM SMMU driver to allow calls from iommu_map to map multiple pages of the same size in one call. Also, remove the map() callback for the ARM SMMU driver, as it will no longer be used. Signed-off-by: Isaac J. Manjarres

[PATCH v7 00/15] Optimizing iommu_[map/unmap] performance

2021-06-16 Thread Georgi Djakov
When unmapping a buffer from an IOMMU domain, the IOMMU framework unmaps the buffer at a granule of the largest page size that is supported by the IOMMU hardware and fits within the buffer. For every block that is unmapped, the IOMMU framework will call into the IOMMU driver, and then the

[PATCH v7 12/15] iommu/io-pgtable-arm-v7s: Implement arm_v7s_unmap_pages()

2021-06-16 Thread Georgi Djakov
From: "Isaac J. Manjarres" Implement the unmap_pages() callback for the ARM v7s io-pgtable format. Signed-off-by: Isaac J. Manjarres Signed-off-by: Georgi Djakov --- drivers/iommu/io-pgtable-arm-v7s.c | 24 +--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git

[PATCH v7 14/15] iommu/arm-smmu: Implement the unmap_pages() IOMMU driver callback

2021-06-16 Thread Georgi Djakov
From: "Isaac J. Manjarres" Implement the unmap_pages() callback for the ARM SMMU driver to allow calls from iommu_unmap to unmap multiple pages of the same size in one call. Also, remove the unmap() callback for the SMMU driver, as it will no longer be used. Signed-off-by: Isaac J. Manjarres

[PATCH v7 08/15] iommu: Add support for the map_pages() callback

2021-06-16 Thread Georgi Djakov
From: "Isaac J. Manjarres" Since iommu_pgsize can calculate how many pages of the same size can be mapped/unmapped before the next largest page size boundary, add support for invoking an IOMMU driver's map_pages() callback, if it provides one. Signed-off-by: Isaac J. Manjarres Suggested-by:

[PATCH v7 01/15] iommu/io-pgtable: Introduce unmap_pages() as a page table op

2021-06-16 Thread Georgi Djakov
From: "Isaac J. Manjarres" The io-pgtable code expects to operate on a single block or granule of memory that is supported by the IOMMU hardware when unmapping memory. This means that when a large buffer that consists of multiple such blocks is unmapped, the io-pgtable code will walk the page

[PATCH v7 10/15] iommu/io-pgtable-arm: Implement arm_lpae_unmap_pages()

2021-06-16 Thread Georgi Djakov
From: "Isaac J. Manjarres" Implement the unmap_pages() callback for the ARM LPAE io-pgtable format. Signed-off-by: Isaac J. Manjarres Suggested-by: Will Deacon Signed-off-by: Georgi Djakov --- drivers/iommu/io-pgtable-arm.c | 120 + 1 file changed, 74

[PATCH v7 13/15] iommu/io-pgtable-arm-v7s: Implement arm_v7s_map_pages()

2021-06-16 Thread Georgi Djakov
From: "Isaac J. Manjarres" Implement the map_pages() callback for the ARM v7s io-pgtable format. Signed-off-by: Isaac J. Manjarres Signed-off-by: Georgi Djakov --- drivers/iommu/io-pgtable-arm-v7s.c | 26 ++ 1 file changed, 22 insertions(+), 4 deletions(-) diff --git

[PATCH v7 07/15] iommu: Hook up '->unmap_pages' driver callback

2021-06-16 Thread Georgi Djakov
From: Will Deacon Extend iommu_pgsize() to populate an optional 'count' parameter so that we can direct unmapping operation to the ->unmap_pages callback if it has been provided by the driver. Signed-off-by: Will Deacon Signed-off-by: Isaac J. Manjarres Signed-off-by: Georgi Djakov ---

[PATCH v7 11/15] iommu/io-pgtable-arm: Implement arm_lpae_map_pages()

2021-06-16 Thread Georgi Djakov
From: "Isaac J. Manjarres" Implement the map_pages() callback for the ARM LPAE io-pgtable format. Signed-off-by: Isaac J. Manjarres Signed-off-by: Georgi Djakov --- drivers/iommu/io-pgtable-arm.c | 41 +++-- 1 file changed, 31 insertions(+), 10

[PATCH v7 05/15] iommu: Use bitmap to calculate page size in iommu_pgsize()

2021-06-16 Thread Georgi Djakov
From: Will Deacon Avoid the potential for shifting values by amounts greater than the width of their type by using a bitmap to compute page size in iommu_pgsize(). Signed-off-by: Will Deacon Signed-off-by: Isaac J. Manjarres Signed-off-by: Georgi Djakov --- drivers/iommu/iommu.c | 31

[PATCH v7 04/15] iommu: Add a map_pages() op for IOMMU drivers

2021-06-16 Thread Georgi Djakov
From: "Isaac J. Manjarres" Add a callback for IOMMU drivers to provide a path for the IOMMU framework to call into an IOMMU driver, which can call into the io-pgtable code, to map a physically contiguous rnage of pages of the same size. For IOMMU drivers that do not specify a map_pages()

[PATCH v7 03/15] iommu/io-pgtable: Introduce map_pages() as a page table op

2021-06-16 Thread Georgi Djakov
From: "Isaac J. Manjarres" Mapping memory into io-pgtables follows the same semantics that unmapping memory used to follow (i.e. a buffer will be mapped one page block per call to the io-pgtable code). This means that it can be optimized in the same way that unmapping memory was, so add a

Re: [PATCH v4 3/6] ACPI: Add driver for the VIOT table

2021-06-16 Thread Eric Auger
Hi Jean, On 6/10/21 9:51 AM, Jean-Philippe Brucker wrote: > The ACPI Virtual I/O Translation Table describes topology of > para-virtual platforms, similarly to vendor tables DMAR, IVRS and IORT. > For now it describes the relation between virtio-iommu and the endpoints > it manages. > > Three

Re: [PATCH v4 0/6] Add support for ACPI VIOT

2021-06-16 Thread Eric Auger
Hi Jean, On 6/10/21 9:51 AM, Jean-Philippe Brucker wrote: > Add a driver for the ACPI VIOT table, which provides topology > information for para-virtual IOMMUs. Enable virtio-iommu on > non-devicetree platforms, including x86. > > Since v3 [1] I fixed a build bug for !CONFIG_IOMMU_API. Joerg

Re: [PATCH] dt-bindings: Drop redundant minItems/maxItems

2021-06-16 Thread Jonathan Cameron
On Tue, 15 Jun 2021 13:15:43 -0600 Rob Herring wrote: > If a property has an 'items' list, then a 'minItems' or 'maxItems' with the > same size as the list is redundant and can be dropped. Note that is DT > schema specific behavior and not standard json-schema behavior. The tooling > will fixup

Re: [PATCH v12 00/12] Restricted DMA

2021-06-16 Thread Will Deacon
Hi Claire, On Wed, Jun 16, 2021 at 02:21:45PM +0800, Claire Chang wrote: > This series implements mitigations for lack of DMA access control on > systems without an IOMMU, which could result in the DMA accessing the > system memory at unexpected times and/or unexpected addresses, possibly >

[PATCH 9/9] memory: mtk-smi: mt8195: Add initial setting for smi-larb

2021-06-16 Thread Yong Wu
To improve the performance, We add some initial setting for smi larbs. there are two part: 1), Each port has the special ostd(outstanding) value in each larb. 2), Two general setting for each larb. In some SoC, this setting maybe changed dynamically for some special case like 4K, and this initial

[PATCH 7/9] memory: mtk-smi: mt8195: Add smi support

2021-06-16 Thread Yong Wu
mt8195 has two smi-common. the IP are the same. only the larbs that connect with the smi-common are different. thus the bus_sel is different for the two smi-common. Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 23 +++ 1 file changed, 23 insertions(+) diff --git

[PATCH 8/9] memory: mtk-smi: mt8195: Add initial setting for smi-common

2021-06-16 Thread Yong Wu
To improve the performance, This patch adds initial setting for smi-common. some register use some fix setting(suggested from DE). Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 42 1 file changed, 38 insertions(+), 4 deletions(-) diff --git

[PATCH 6/9] memory: mtk-smi: Add smi sub common support

2021-06-16 Thread Yong Wu
This patch adds smi-sub-common support. some larbs may connect with the smi-sub-common, then connect with smi-common. Before we create device link between smi-larb with smi-common, If we have sub-common, we should use device link the smi-larb and smi-sub-common, then use device link between the

[PATCH 5/9] memory: mtk-smi: Adjust some code position

2021-06-16 Thread Yong Wu
This patch has no functional change, Only move the code position to make the code more readable. 1. Put the register smi-common above smi-larb. this is preparing to add many others register setting. 2. put mtk_smi_larb_bind near larb_unbind. 3. Sort the SoC data alphabetically. and put them

[PATCH 3/9] memory: mtk-smi: Use clk_bulk instead of the clk ops

2021-06-16 Thread Yong Wu
smi have many clocks: apb/smi/gals. This patch use clk_bulk interface instead of the orginal one to simply the code. gals is optional clk(some larbs may don't have gals). use clk_bulk_optional instead. and then remove the has_gals flag. Also remove clk fail logs since bulk interface already

[PATCH 4/9] memory: mtk-smi: Rename smi_gen to smi_type

2021-06-16 Thread Yong Wu
This is a preparing patch for adding smi sub common. About the previou smi_gen, we have gen1/gen2 that stand for the generation number for HW. I plan to add a new type(sub_common), then the "gen" is not prober. this patch only change it to "type", No functional change. Signed-off-by: Yong Wu

[PATCH 2/9] dt-bindings: memory: mediatek: Add mt8195 smi sub common

2021-06-16 Thread Yong Wu
This patch adds the binding for smi-sub-common. The SMI block diagram like this: IOMMU | | smi-common -- | | larb0 larb7 <-max is 8 The smi-common connects with smi-larb and IOMMU. The maximum larbs number that connects with

[PATCH 1/9] dt-bindings: memory: mediatek: Add mt8195 smi binding

2021-06-16 Thread Yong Wu
This patch adds mt8195 smi supporting in the bindings. In mt8195, there are two smi-common HW, one is for vdo(video output), the other is for vpp(video processing pipe). They connects with different smi-larbs, then some setting(bus_sel) is different. Differentiate them with the compatible string.

[PATCH 0/9] MT8195 SMI support

2021-06-16 Thread Yong Wu
This patchset mainly adds SMI support for mt8195. Comparing with the previous version, add two new functions: a) add smi sub common b) add initial setting for smi-common and smi-larb. Yong Wu (9): dt-bindings: memory: mediatek: Add mt8195 smi binding dt-bindings: memory: mediatek: Add mt8195

Re: [PATCH] swiotlb-xen: override common mmap and get_sgtable dma ops

2021-06-16 Thread Roman Skakun
> We make sure that we allocate contiguous memory in > xen_swiotlb_alloc_coherent(). I understood. Thanks! -- Best Regards, Roman. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

[PATCH 2/2] swiotlb-xen: override common mmap and get_sgtable dma ops

2021-06-16 Thread Roman Skakun
This commit is dedicated to fix incorrect conversion from cpu_addr to page address in cases when we get virtual address which allocated through xen_swiotlb_alloc_coherent() and can be mapped in the vmalloc range. As the result, virt_to_page() cannot convert this address properly and return

[PATCH 1/2] Revert "swiotlb-xen: remove xen_swiotlb_dma_mmap and xen_swiotlb_dma_get_sgtable"

2021-06-16 Thread Roman Skakun
This reverts commit 922659ea771b3fd728149262c5ea15608fab9719. Signed-off-by: Roman Skakun --- drivers/xen/swiotlb-xen.c | 29 +++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index

Re: [PATCH] dt-bindings: Drop redundant minItems/maxItems

2021-06-16 Thread Mark Brown
On Tue, Jun 15, 2021 at 01:15:43PM -0600, Rob Herring wrote: > If a property has an 'items' list, then a 'minItems' or 'maxItems' with the > same size as the list is redundant and can be dropped. Note that is DT > schema specific behavior and not standard json-schema behavior. The tooling > will

[PATCH v13 6/6] iommu: Remove mode argument from iommu_set_dma_strict()

2021-06-16 Thread John Garry
We only ever now set strict mode enabled in iommu_set_dma_strict(), so just remove the argument. Signed-off-by: John Garry Reviewed-by: Robin Murphy --- drivers/iommu/amd/init.c| 2 +- drivers/iommu/intel/iommu.c | 6 +++--- drivers/iommu/iommu.c | 5 ++--- include/linux/iommu.h

[PATCH v13 5/6] iommu/amd: Add support for IOMMU default DMA mode build options

2021-06-16 Thread John Garry
From: Zhen Lei Make IOMMU_DEFAULT_LAZY default for when AMD_IOMMU config is set, which matches current behaviour. For "fullflush" param, just call iommu_set_dma_strict(true) directly. Since we get a strict vs lazy mode print already in iommu_subsys_init(), and maintain a deprecation print when

[PATCH v13 4/6] iommu/vt-d: Add support for IOMMU default DMA mode build options

2021-06-16 Thread John Garry
From: Zhen Lei Make IOMMU_DEFAULT_LAZY default for when INTEL_IOMMU config is set, as is current behaviour. Also delete global flag intel_iommu_strict: - In intel_iommu_setup(), call iommu_set_dma_strict(true) directly. Also remove the print, as iommu_subsys_init() prints the mode and we have

[PATCH v13 3/6] iommu: Enhance IOMMU default DMA mode build options

2021-06-16 Thread John Garry
From: Zhen Lei First, add build options IOMMU_DEFAULT_{LAZY|STRICT}, so that we have the opportunity to set {lazy|strict} mode as default at build time. Then put the two config options in an choice, as they are mutually exclusive. [jpg: Make choice between strict and lazy only (and not

[PATCH v13 2/6] iommu: Print strict or lazy mode at init time

2021-06-16 Thread John Garry
As well as the default domain type, it's useful to know whether strict or lazy for DMA domains, so add this info in a separate print. The (stict/lazy) mode may be also set via iommu.strict earlyparm, but this will be processed prior to iommu_subsys_init(), so that print will be accurate for

[PATCH v13 0/6] iommu: Enhance IOMMU default DMA mode build options

2021-06-16 Thread John Garry
This is a reboot of Zhen Lei's series from a couple of years ago, which never made it across the line. I still think that it has some value, so taking up the mantle. Motivation: Allow lazy mode be default mode for DMA domains for all ARCHs, and not only those who hardcode it (to be lazy). For

[PATCH v13 1/6] iommu: Deprecate Intel and AMD cmdline methods to enable strict mode

2021-06-16 Thread John Garry
Now that the x86 drivers support iommu.strict, deprecate the custom methods. Signed-off-by: John Garry --- Documentation/admin-guide/kernel-parameters.txt | 5 +++-- drivers/iommu/amd/init.c| 4 +++- drivers/iommu/intel/iommu.c | 1 + 3 files changed,

Re: [PATCH] dt-bindings: Drop redundant minItems/maxItems

2021-06-16 Thread Philipp Zabel
On Tue, 2021-06-15 at 13:15 -0600, Rob Herring wrote: > If a property has an 'items' list, then a 'minItems' or 'maxItems' with the > same size as the list is redundant and can be dropped. Note that is DT > schema specific behavior and not standard json-schema behavior. The tooling > will fixup

[GIT PULL] iommu/arm-smmu: Updates for 5.14

2021-06-16 Thread Will Deacon
Hi Joerg, Please pull these Arm SMMU updates for 5.14. Of particular note is the support for stalling faults with platform devices using SMMUv3 -- this concludes the bulk of the SVA work from Jean-Philippe. Other than that, one thing to note is that the patch from Thierry adding the

Re: [PATCH] dt-bindings: Drop redundant minItems/maxItems

2021-06-16 Thread Vinod Koul
On 15-06-21, 13:15, Rob Herring wrote: > If a property has an 'items' list, then a 'minItems' or 'maxItems' with the > same size as the list is redundant and can be dropped. Note that is DT > schema specific behavior and not standard json-schema behavior. The tooling > will fixup the final schema

Re: [PATCH 1/1] iommu/arm-smmu-v3: remove unnecessary oom message

2021-06-16 Thread Will Deacon
On Wed, Jun 16, 2021 at 09:47:18AM +0800, Leizhen (ThunderTown) wrote: > > > On 2021/6/15 19:55, Will Deacon wrote: > > On Tue, Jun 15, 2021 at 12:51:38PM +0100, Robin Murphy wrote: > >> On 2021-06-15 12:34, Will Deacon wrote: > >>> On Tue, Jun 15, 2021 at 07:22:10PM +0800, Leizhen (ThunderTown)

Re: [PATCH v4 1/6] ACPI: arm64: Move DMA setup operations out of IORT

2021-06-16 Thread Eric Auger
Hi jean, On 6/10/21 9:51 AM, Jean-Philippe Brucker wrote: > Extract generic DMA setup code out of IORT, so it can be reused by VIOT. > Keep it in drivers/acpi/arm64 for now, since it could break x86 > platforms that haven't run this code so far, if they have invalid > tables. > > Signed-off-by:

Re: [PATCH v4 2/6] ACPI: Move IOMMU setup code out of IORT

2021-06-16 Thread Eric Auger
Hi jean, On 6/10/21 9:51 AM, Jean-Philippe Brucker wrote: > Extract the code that sets up the IOMMU infrastructure from IORT, since > it can be reused by VIOT. Move it one level up into a new > acpi_iommu_configure_id() function, which calls the IORT parsing > function which in turn calls the

Re: [PATCH] iommu/io-pgtable-arm: Optimize partial walk flush for large scatter-gather list

2021-06-16 Thread Sai Prakash Ranjan
On 2021-06-16 12:28, Sai Prakash Ranjan wrote: Hi Robin, On 2021-06-15 19:23, Robin Murphy wrote: On 2021-06-15 12:51, Sai Prakash Ranjan wrote: ... Hi @Robin, from these discussions it seems they are not ok with the change for all SoC vendor implementations and do not have any data on

Re: [PATCH v12 3/5] iommu/vt-d: Add support for IOMMU default DMA mode build options

2021-06-16 Thread Lu Baolu
On 2021/6/15 16:25, Robin Murphy wrote: On 2021-06-15 08:26, Lu Baolu wrote: Hi John, On 6/14/21 4:03 PM, John Garry wrote: On 12/06/2021 03:14, Lu Baolu wrote: On 2021/6/11 20:20, John Garry wrote: diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 2a71347611d4..4467353f981b

Re: [PATCH v12 09/12] swiotlb: Add restricted DMA alloc/free support

2021-06-16 Thread Christoph Hellwig
On Wed, Jun 16, 2021 at 02:21:54PM +0800, Claire Chang wrote: > Add the functions, swiotlb_{alloc,free} and is_swiotlb_for_alloc to > support the memory allocation from restricted DMA pool. > > The restricted DMA pool is preferred if available. > > Note that since coherent allocation needs

Re: [PATCH v12 06/12] swiotlb: Use is_swiotlb_force_bounce for swiotlb data bouncing

2021-06-16 Thread Christoph Hellwig
On Wed, Jun 16, 2021 at 02:21:51PM +0800, Claire Chang wrote: > Propagate the swiotlb_force into io_tlb_default_mem->force_bounce and > use it to determine whether to bounce the data or not. This will be > useful later to allow for different pools. > > Signed-off-by: Claire Chang Looks good,

Re: [PATCH] iommu/io-pgtable-arm: Optimize partial walk flush for large scatter-gather list

2021-06-16 Thread Sai Prakash Ranjan
Hi Robin, On 2021-06-15 19:23, Robin Murphy wrote: On 2021-06-15 12:51, Sai Prakash Ranjan wrote: ... Hi @Robin, from these discussions it seems they are not ok with the change for all SoC vendor implementations and do not have any data on such impact. As I mentioned above, on QCOM

RE: Plan for /dev/ioasid RFC v2

2021-06-16 Thread Tian, Kevin
> From: Alex Williamson > Sent: Wednesday, June 16, 2021 12:56 AM > > On Tue, 15 Jun 2021 01:21:35 + > "Tian, Kevin" wrote: > > > > From: Jason Gunthorpe > > > Sent: Monday, June 14, 2021 9:38 PM > > > > > > On Mon, Jun 14, 2021 at 03:09:31AM +, Tian, Kevin wrote: > > > > > > > If a

RE: Plan for /dev/ioasid RFC v2

2021-06-16 Thread Tian, Kevin
> From: Alex Williamson > Sent: Wednesday, June 16, 2021 12:12 AM > > On Tue, 15 Jun 2021 02:31:39 + > "Tian, Kevin" wrote: > > > > From: Alex Williamson > > > Sent: Tuesday, June 15, 2021 12:28 AM > > > > > [...] > > > > IOASID. Today the group fd requires an IOASID before it hands out a

Re: [PATCH v4 0/6] Add support for ACPI VIOT

2021-06-16 Thread Jean-Philippe Brucker
Hi Rafael, On Thu, Jun 10, 2021 at 09:51:27AM +0200, Jean-Philippe Brucker wrote: > Add a driver for the ACPI VIOT table, which provides topology > information for para-virtual IOMMUs. Enable virtio-iommu on > non-devicetree platforms, including x86. > > Since v3 [1] I fixed a build bug for

Re: [PATCH v11 00/12] Restricted DMA

2021-06-16 Thread Claire Chang
v12: https://lore.kernel.org/patchwork/cover/1447254/ On Wed, Jun 16, 2021 at 11:52 AM Claire Chang wrote: > > This series implements mitigations for lack of DMA access control on > systems without an IOMMU, which could result in the DMA accessing the > system memory at unexpected times and/or

[PATCH v12 12/12] of: Add plumbing for restricted DMA pool

2021-06-16 Thread Claire Chang
If a device is not behind an IOMMU, we look up the device node and set up the restricted DMA when the restricted-dma-pool is presented. Signed-off-by: Claire Chang --- drivers/of/address.c| 33 + drivers/of/device.c | 3 +++ drivers/of/of_private.h | 6

[PATCH v12 11/12] dt-bindings: of: Add restricted DMA pool

2021-06-16 Thread Claire Chang
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 reserved-memory node. Signed-off-by: Claire Chang --- .../reserved-memory/reserved-memory.txt | 36

[PATCH v12 10/12] swiotlb: Add restricted DMA pool initialization

2021-06-16 Thread Claire Chang
Add the initialization function to create restricted DMA pools from matching reserved-memory nodes. Regardless of swiotlb setting, the restricted DMA pool is preferred if available. The restricted DMA pools provide a basic level of protection against the DMA overwriting buffer contents at

[PATCH v12 09/12] swiotlb: Add restricted DMA alloc/free support

2021-06-16 Thread Claire Chang
Add the functions, swiotlb_{alloc,free} and is_swiotlb_for_alloc to support the memory allocation from restricted DMA pool. The restricted DMA pool is preferred if available. Note that since coherent allocation needs remapping, one must set up another device coherent pool by shared-dma-pool and

[PATCH v12 08/12] swiotlb: Refactor swiotlb_tbl_unmap_single

2021-06-16 Thread Claire Chang
Add a new function, swiotlb_release_slots, to make the code reusable for supporting different bounce buffer pools. Signed-off-by: Claire Chang Reviewed-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 35 --- 1 file changed, 20 insertions(+), 15 deletions(-)

[PATCH v12 07/12] swiotlb: Move alloc_size to swiotlb_find_slots

2021-06-16 Thread Claire Chang
Rename find_slots to swiotlb_find_slots and move the maintenance of alloc_size to it for better code reusability later. Signed-off-by: Claire Chang Reviewed-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git

[PATCH v12 06/12] swiotlb: Use is_swiotlb_force_bounce for swiotlb data bouncing

2021-06-16 Thread Claire Chang
Propagate the swiotlb_force into io_tlb_default_mem->force_bounce and use it to determine whether to bounce the data or not. This will be useful later to allow for different pools. Signed-off-by: Claire Chang --- include/linux/swiotlb.h | 11 +++ kernel/dma/direct.c | 2 +-

[PATCH v12 05/12] swiotlb: Update is_swiotlb_active to add a struct device argument

2021-06-16 Thread Claire Chang
Update is_swiotlb_active to add a struct device argument. This will be useful later to allow for different pools. Signed-off-by: Claire Chang Reviewed-by: Christoph Hellwig --- drivers/gpu/drm/i915/gem/i915_gem_internal.c | 2 +- drivers/gpu/drm/nouveau/nouveau_ttm.c| 2 +-

[PATCH v12 04/12] swiotlb: Update is_swiotlb_buffer to add a struct device argument

2021-06-16 Thread Claire Chang
Update is_swiotlb_buffer to add a struct device argument. This will be useful later to allow for different pools. Signed-off-by: Claire Chang Reviewed-by: Christoph Hellwig --- drivers/iommu/dma-iommu.c | 12 ++-- drivers/xen/swiotlb-xen.c | 2 +- include/linux/swiotlb.h | 7

[PATCH v12 03/12] swiotlb: Set dev->dma_io_tlb_mem to the swiotlb pool used

2021-06-16 Thread Claire Chang
Always have the pointer to the swiotlb pool used in struct device. This could help simplify the code for other pools. Signed-off-by: Claire Chang Reviewed-by: Christoph Hellwig --- drivers/base/core.c| 4 include/linux/device.h | 4 kernel/dma/swiotlb.c | 8 3 files

[PATCH v12 02/12] swiotlb: Refactor swiotlb_create_debugfs

2021-06-16 Thread Claire Chang
Split the debugfs creation to make the code reusable for supporting different bounce buffer pools. Signed-off-by: Claire Chang Reviewed-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/kernel/dma/swiotlb.c

  1   2   >