Re: [RFC] iommu: Use put_pages_list

2021-10-14 Thread Robin Murphy
On 2021-10-14 12:52, John Garry wrote: On 14/10/2021 12:20, Matthew Wilcox wrote: I'm going to keep pinging this patch weekly. On Thu, Oct 07, 2021 at 07:17:02PM +0100, Matthew Wilcox wrote: ping? Robin, Were you checking this? You mentioned "I got side-tracked trying to make io-pgtable use

Re: [PATCH] iommu/iova: Add support for IOVA max alignment tuning

2021-10-13 Thread Robin Murphy
On 2021-10-13 19:11, Georgi Djakov wrote: IOVAs are aligned to the smallest PAGE_SIZE order, where the requested IOVA can fit. But this might not work for all use-cases. It can cause IOVA fragmentation in some multimedia and 8K video use-cases that may require larger buffers to be allocated and

Re: [PATCH v7 9/9] iommu/dma: Reserve any RMR regions associated with a dev

2021-10-11 Thread Robin Murphy
On 2021-10-09 08:07, Jon Nettleton wrote: On Fri, Oct 8, 2021 at 3:10 PM Robin Murphy wrote: On 2021-08-05 09:07, Shameer Kolothum wrote: Get ACPI IORT RMR regions associated with a dev reserved so that there is a unity mapping for them in SMMU. This feels like most of it belongs

Re: [PATCH v7 2/9] ACPI/IORT: Add support for RMR node parsing

2021-10-11 Thread Robin Murphy
On 2021-10-09 08:06, Jon Nettleton wrote: [...] + if (rmr->flags & IOMMU_RMR_REMAP_PERMITTED) { + type = IOMMU_RESV_DIRECT_RELAXABLE; + /* + * Set IOMMU_CACHE as IOMMU_RESV_DIRECT_RELAXABLE is + *

Re: [PATCH v7 1/9] iommu: Introduce a union to struct iommu_resv_region

2021-10-11 Thread Robin Murphy
On 2021-10-11 06:47, Shameerali Kolothum Thodi wrote: -Original Message- From: Jon Nettleton [mailto:j...@solid-run.com] Sent: 09 October 2021 07:58 To: Robin Murphy Cc: Shameerali Kolothum Thodi ; linux-arm-kernel ; ACPI Devel Maling List ; Linux IOMMU ; Linuxarm ; Steven Price

Re: [PATCH v7 9/9] iommu/dma: Reserve any RMR regions associated with a dev

2021-10-08 Thread Robin Murphy
On 2021-08-05 09:07, Shameer Kolothum wrote: Get ACPI IORT RMR regions associated with a dev reserved so that there is a unity mapping for them in SMMU. This feels like most of it belongs in the IORT code rather than iommu-dma (which should save the temporary list copy as well). Robin.

Re: [PATCH v7 3/9] iommu/dma: Introduce generic helper to retrieve RMR info

2021-10-08 Thread Robin Murphy
On 2021-08-05 09:07, Shameer Kolothum wrote: Reserved Memory Regions(RMR) associated with an IOMMU can be described through ACPI IORT tables in systems with devices that require a unity mapping or bypass for those regions. Introduce a generic interface so that IOMMU drivers can retrieve and set

Re: [PATCH v7 2/9] ACPI/IORT: Add support for RMR node parsing

2021-10-08 Thread Robin Murphy
On 2021-08-05 09:07, Shameer Kolothum wrote: Add support for parsing RMR node information from ACPI. Find the associated streamid and smmu node info from the RMR node and populate a linked list with RMR memory descriptors. Signed-off-by: Shameer Kolothum --- drivers/acpi/arm64/iort.c | 134

Re: [PATCH v7 1/9] iommu: Introduce a union to struct iommu_resv_region

2021-10-08 Thread Robin Murphy
On 2021-08-05 09:07, Shameer Kolothum wrote: A union is introduced to struct iommu_resv_region to hold any firmware specific data. This is in preparation to add support for IORT RMR reserve regions and the union now holds the RMR specific information. Signed-off-by: Shameer Kolothum ---

Re: DPAA2 triggers, [PATCH] dma debug: report -EEXIST errors in add_dma_entry

2021-10-06 Thread Robin Murphy
On 2021-10-06 14:10, Gerald Schaefer wrote: On Fri, 1 Oct 2021 14:52:56 +0200 Gerald Schaefer wrote: On Thu, 30 Sep 2021 15:37:33 +0200 Karsten Graul wrote: On 14/09/2021 17:45, Ioana Ciornei wrote: On Wed, Sep 08, 2021 at 10:33:26PM -0500, Jeremy Linton wrote: +DPAA2, netdev maintainers

Re: [PATCH 0/5] iommu: Some IOVA code reorganisation

2021-10-04 Thread Robin Murphy
On 2021-10-04 12:44, Will Deacon wrote: On Fri, Sep 24, 2021 at 06:01:52PM +0800, John Garry wrote: The IOVA domain structure is a bit overloaded, holding: - IOVA tree management - FQ control - IOVA rcache memories Indeed only a couple of IOVA users use the rcache, and only dma-iommu.c uses

Re: [PATCH] swiotlb: set IO TLB segment size via cmdline

2021-09-17 Thread Robin Murphy
On 2021-09-17 10:36, Roman Skakun wrote: Hi, Christoph I use Xen PV display. In my case, PV display backend(Dom0) allocates contiguous buffer via DMA-API to to implement zero-copy between Dom0 and DomU. Well, something's gone badly wrong there - if you have to shadow the entire thing in a

[PATCH] iommu/dma: Tidy up Kconfig selects

2021-09-13 Thread Robin Murphy
Now that the dust has settled on converting all the x86 drivers to iommu-dma, we can punt the Kconfig selection to arch code where it was always intended to be. CC: Christoph Hellwig CC: Marek Szyprowski CC: x...@kernel.org CC: linux-i...@vger.kernel.org Signed-off-by: Robin Murphy --- arch

[PATCH 2/2] iommu/dma: Unexport IOVA cookie management

2021-09-13 Thread Robin Murphy
Reviewed-by: Jean-Philippe Brucker Signed-off-by: Robin Murphy --- drivers/iommu/dma-iommu.c | 7 --- drivers/iommu/iommu.c | 3 +-- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 896bea04c347..26cb95d3830a 100644

[PATCH 1/2] iommu/dart: Clean up IOVA cookie crumbs

2021-09-13 Thread Robin Murphy
The addition of the DART driver crossed over with moving IOVA cookie management into core code; clean up the now-unnecessary remnants here. Acked-by: Sven Peter Tested-by: Sven Peter Signed-off-by: Robin Murphy --- drivers/iommu/apple-dart.c | 2 -- 1 file changed, 2 deletions(-) diff --git

[PATCH 0/2] iommu: DMA domain epilogue

2021-09-13 Thread Robin Murphy
if you'd prefer to treat it as cleanup for 5.16. Your choice :) Cheers, Robin. Robin Murphy (2): iommu/dart: Clean up IOVA cookie crumbs iommu/dma: Unexport IOVA cookie management drivers/iommu/apple-dart.c | 2 -- drivers/iommu/dma-iommu.c | 7 --- drivers/iommu/iommu.c | 3 +-- 3

Re: [PATCH] dma-debug: prevent an error message from causing runtime problems

2021-09-10 Thread Robin Murphy
On 2021-09-10 13:05, Hamza Mahfooz wrote: For some drivers, that call add_dma_entry() from somewhere down the call stack. Nit: strictly, drivers don't call add_dma_entry(). Drivers only call the DMA API functions, and it is the DMA API internals which take a detour through dma-debug when

[PATCH] iommu: Clarify default domain Kconfig

2021-09-08 Thread Robin Murphy
for performance. These days, reducing the default level of isolation in a way which may go unnoticed by users who expect otherwise hardly seems worth risking for the sake of one line of Kconfig, so here's where we are. Reported-by: Linus Torvalds Signed-off-by: Robin Murphy --- drivers/iommu/Kconfig | 2

Re: [question] Assign multiple devices from different SMMUs to a arm_smmu_domain

2021-09-07 Thread Robin Murphy
On 2021-09-07 08:41, Kunkun Jiang wrote: Hi all, I am working on VFIO DMA dirty pages tracking based on ARM SMMU HTTU, and have done a lot of testing.In the test, I found a problem that greatly affects performance of VFIO DMA dirty pages tracking. According to the current arm-smmu-v3 driver,

Re: [PATCH v7 2/9] ACPI/IORT: Add support for RMR node parsing

2021-09-06 Thread Robin Murphy
On 2021-08-05 17:03, Lorenzo Pieralisi wrote: On Thu, Aug 05, 2021 at 09:07:17AM +0100, Shameer Kolothum wrote: [...] +static void __init iort_node_get_rmr_info(struct acpi_iort_node *iort_node) +{ + struct acpi_iort_node *smmu; + struct acpi_iort_rmr *rmr; + struct

Re: [git pull] IOMMU Updates for Linux v5.15

2021-09-06 Thread Robin Murphy
On 2021-09-03 22:44, Joerg Roedel wrote: On Fri, Sep 03, 2021 at 11:43:31AM -0700, Linus Torvalds wrote: choice prompt "IOMMU default domain type" depends on IOMMU_API default IOMMU_DEFAULT_DMA_LAZY if AMD_IOMMU || INTEL_IOMMU default

Re: [PATCH v2 3/8] iommu/dma: Disable get_sgtable for granule > PAGE_SIZE

2021-09-03 Thread Robin Murphy
On 2021-09-03 16:16, Sven Peter wrote: On Thu, Sep 2, 2021, at 21:42, Robin Murphy wrote: On 2021-09-02 19:19, Sven Peter wrote: On Wed, Sep 1, 2021, at 23:10, Alyssa Rosenzweig wrote: My biggest issue is that I do not understand how this function is supposed to be used correctly

Re: [PATCH v2 3/8] iommu/dma: Disable get_sgtable for granule > PAGE_SIZE

2021-09-02 Thread Robin Murphy
On 2021-09-02 19:19, Sven Peter wrote: On Wed, Sep 1, 2021, at 23:10, Alyssa Rosenzweig wrote: My biggest issue is that I do not understand how this function is supposed to be used correctly. It would work fine as-is if it only ever gets passed buffers allocated by the coherent API but

Re: [PATCH v4] iommu/of: Fix pci_request_acs() before enumerating PCI devices

2021-09-02 Thread Robin Murphy
On 2021-09-02 13:51, Anders Roxell wrote: On Wed, 1 Sept 2021 at 11:58, Robin Murphy wrote: On 2021-09-01 09:59, Marek Szyprowski wrote: On 21.05.2021 05:03, Wang Xingang wrote: From: Xingang Wang When booting with devicetree, the pci_request_acs() is called after the enumeration

Re: [PATCH v2 6/8] iommu: Move IOMMU pagesize check to attach_device

2021-09-01 Thread Robin Murphy
On 2021-09-01 18:14, Sven Peter wrote: On Tue, Aug 31, 2021, at 23:39, Alyssa Rosenzweig wrote: + if ((1 << __ffs(domain->pgsize_bitmap)) > PAGE_SIZE) { Not a fan of this construction. Could you assign `(1 << __ffs(domain->pgsize_bitmap))` to an appropriately named temporary (e.g

Re: [PATCH v4] iommu/of: Fix pci_request_acs() before enumerating PCI devices

2021-09-01 Thread Robin Murphy
On 2021-09-01 09:59, Marek Szyprowski wrote: On 21.05.2021 05:03, Wang Xingang wrote: From: Xingang Wang When booting with devicetree, the pci_request_acs() is called after the enumeration and initialization of PCI devices, thus the ACS is not enabled. And ACS should be enabled when IOMMU is

Re: [PATCH] iommu/io-pgtable: Abstract iommu_iotlb_gather access

2021-08-24 Thread Robin Murphy
On 2021-08-24 14:55, Geert Uytterhoeven wrote: Hi Robin, On Fri, Aug 20, 2021 at 3:22 PM Robin Murphy wrote: Previously io-pgtable merely passed the iommu_iotlb_gather pointer through to helpers, but now it has grown its own direct dereference. This turns out to break the build for !IOMMU_API

Re: [PATCH v4 15/24] iommu/io-pgtable: Remove non-strict quirk

2021-08-24 Thread Robin Murphy
Hi Geert, On 2021-08-24 14:25, Geert Uytterhoeven wrote: Hi Robin, On Wed, Aug 11, 2021 at 2:24 PM Robin Murphy wrote: IO_PGTABLE_QUIRK_NON_STRICT was never a very comfortable fit, since it's not a quirk of the pagetable format itself. Now that we have a more appropriate way to convey non

[PATCH] iommu/io-pgtable: Abstract iommu_iotlb_gather access

2021-08-20 Thread Robin Murphy
the gather mechanism and simply pass in NULL. Wrap this dereference in a suitable helper which can both be stubbed out for !IOMMU_API and encapsulate a NULL check otherwise. Fixes: 7a7c5badf858 ("iommu: Indicate queued flushes via gather data") Reported-by: kernel test robot Signed-off-by: Ro

Re: [PATCH v6 7/7] dma-iommu: account for min_align_mask

2021-08-19 Thread Robin Murphy
On 2021-08-17 02:38, David Stevens wrote: From: David Stevens For devices which set min_align_mask, swiotlb preserves the offset of the original physical address within that mask. Since __iommu_dma_map accounts for non-aligned addresses, passing a non-aligned swiotlb address with the swiotlb

Re: [PATCH v6 4/7] dma-iommu: fold _swiotlb helpers into callers

2021-08-19 Thread Robin Murphy
On 2021-08-17 02:38, David Stevens wrote: From: David Stevens Fold the _swiotlb helper functions into the respective _page functions, since recent fixes have moved all logic from the _page functions to the _swiotlb functions. Reviewed-by: Robin Murphy Signed-off-by: David Stevens

Re: [PATCH v6 3/7] dma-iommu: skip extra sync during unmap w/swiotlb

2021-08-19 Thread Robin Murphy
to iommu_dma_sync_sg_for_cpu for untrusted devices in iommu_dma_unmap_sg no longer necessary, so move that invocation later in the function. Reviewed-by: Robin Murphy Signed-off-by: David Stevens Reviewed-by: Christoph Hellwig --- drivers/iommu/dma-iommu.c | 11 ++- 1 file changed, 6 insertions(+), 5

Re: [PATCH v6 2/7] dma-iommu: fix arch_sync_dma for map

2021-08-19 Thread Robin Murphy
mapping never really worked, since it needs to be able to target swiotlb buffers. This also moves the architectural sync to before the call to __iommu_dma_map, to guarantee that untrusted devices can't see stale data they shouldn't see. Reviewed-by: Robin Murphy Fixes: 82612d66d51d ("

Re: [PATCH v4 00/24] iommu: Refactor DMA domain strictness

2021-08-18 Thread Robin Murphy
On 2021-08-18 12:29, Joerg Roedel wrote: On Wed, Aug 11, 2021 at 01:21:14PM +0100, Robin Murphy wrote: Robin Murphy (24): iommu: Pull IOVA cookie management into the core iommu/amd: Drop IOVA cookie management iommu/arm-smmu: Drop IOVA cookie management iommu/vt-d: Drop IOVA cookie

Re: [PATCH] iommu/arm-smmu-v3: Simplify useless instructions in arm_smmu_cmdq_build_cmd()

2021-08-17 Thread Robin Murphy
On 2021-08-17 12:34, Zhen Lei wrote: Although the parameter 'cmd' is always passed by a local array variable, and only this function modifies it, the compiler does not know this. The compiler almost always reads the value of cmd[i] from memory rather than directly using the value cached in the

Re: [iommu:apple/dart 3/3] drivers/iommu/apple-dart.c:730:17: error: initialization of 'size_t (*)(struct iommu_domain *, long unsigned int, size_t, struct iommu_iotlb_gather *)' {aka 'long unsigned i

2021-08-16 Thread Robin Murphy
On 2021-08-16 07:48, Sven Peter wrote: On Thu, Aug 12, 2021, at 13:29, Joerg Roedel wrote: Hi Sven, On Tue, Aug 10, 2021 at 08:09:53AM +0200, Sven Peter wrote: This happens because apple/dart is missing the "Optimizing iommu_[map/unmap] performance" series which is already in the core

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

2021-08-13 Thread Robin Murphy
On 2021-08-13 17:47, Will Deacon wrote: Hi Joerg, Please pull these Arm SMMU updates for 5.15. There's not tonnes here, but a good mixture of optimisations and cleanups -- summary in the tag. This applies cleanly against iommu/next, but I suspect it will conflict with Robin's series on the

Re: [PATCH 1/4] iommu/arm-smmu-v3: Use command queue batching helpers to improve performance

2021-08-13 Thread Robin Murphy
On 2021-08-11 12:48, Zhen Lei wrote: The obvious key to the performance optimization of commit 587e6c10a7ce ("iommu/arm-smmu-v3: Reduce contention during command-queue insertion") is to allow multiple cores to insert commands in parallel after a brief mutex contention. Obviously, inserting as

Re: 回复: 回复: [External]Re: An cma optimization patch is used for cma_[alloc|free].

2021-08-13 Thread Robin Murphy
://lwn.net/Articles/801230/ Thank you all. Best Regards, -邮件原件- 发件人: Robin Murphy 发送时间: 2021年8月13日 17:16 收件人: Jichao Zou ; David Hildenbrand ; a...@linux-foundation.org; linux-ker...@vger.kernel.org; linux...@kvack.org; minc...@kernel.org; song.bao@hisilicon.com; h...@lst.de; m.szyprow

Re: 回复: [External]Re: An cma optimization patch is used for cma_[alloc|free].

2021-08-13 Thread Robin Murphy
On 2021-08-13 09:27, Jichao Zou wrote: Hi David, I'll git-send-email patch again. Your understanding is exactly right. Let me explain the background of Patch, we are developing Android phone, kernel is 5.10.43 LTS, we encounter cma_alloc failed during kernel startup,

Re: [RFC PATCH 2/3] iommu/dma-iommu: Support iovad->granule > PAGE_SIZE

2021-08-12 Thread Robin Murphy
On 2021-08-11 21:18, Sven Peter wrote: On Tue, Aug 10, 2021, at 11:51, Robin Murphy wrote: On 2021-08-09 21:45, Sven Peter wrote: On Mon, Aug 9, 2021, at 19:41, Robin Murphy wrote: On 2021-08-07 12:47, Sven Peter via iommu wrote: On Fri, Aug 6, 2021, at 20:04, Robin Murphy wrote

Re: [PATCH v3 2/5] dma-iommu: fix arch_sync_dma for map

2021-08-12 Thread Robin Murphy
On 2021-08-12 10:21, David Stevens wrote: On Thu, Aug 12, 2021 at 3:47 AM Robin Murphy wrote: On 2021-08-11 03:42, David Stevens wrote: From: David Stevens When calling arch_sync_dma, we need to pass it the memory that's actually being used for dma. When using swiotlb bounce buffers

Re: [PATCH v3 5/5] dma-iommu: account for min_align_mask

2021-08-12 Thread Robin Murphy
On 2021-08-12 02:45, David Stevens wrote: On Thu, Aug 12, 2021 at 4:12 AM Robin Murphy wrote: On 2021-08-11 03:42, David Stevens wrote: From: David Stevens For devices which set min_align_mask, swiotlb preserves the offset of the original physical address within that mask. Since

Re: [PATCH v3 5/5] dma-iommu: account for min_align_mask

2021-08-11 Thread Robin Murphy
On 2021-08-11 03:42, David Stevens wrote: From: David Stevens For devices which set min_align_mask, swiotlb preserves the offset of the original physical address within that mask. Since __iommu_dma_map accounts for non-aligned addresses, passing a non-aligned swiotlb address with the swiotlb

Re: [PATCH v3 4/5] dma-iommu: Check CONFIG_SWIOTLB more broadly

2021-08-11 Thread Robin Murphy
-by: Robin Murphy Signed-off-by: David Stevens --- drivers/iommu/dma-iommu.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index be0214b1455c..89b689bf801f 100644 --- a/drivers/iommu/dma

Re: [PATCH v3 3/5] dma-iommu: add SKIP_CPU_SYNC after syncing

2021-08-11 Thread Robin Murphy
On 2021-08-11 03:42, David Stevens wrote: From: David Stevens After syncing in map/unmap, add the DMA_ATTR_SKIP_CPU_SYNC flag so anything that uses attrs later on will skip any sync work that has already been completed. In particular, this skips copying from the swiotlb twice during unmap.

Re: [PATCH v3 2/5] dma-iommu: fix arch_sync_dma for map

2021-08-11 Thread Robin Murphy
On 2021-08-11 03:42, David Stevens wrote: From: David Stevens When calling arch_sync_dma, we need to pass it the memory that's actually being used for dma. When using swiotlb bounce buffers, this is the bounce buffer. Move arch_sync_dma into the __iommu_dma_map_swiotlb helper, so it can use

Re: [PATCH v3 1/5] dma-iommu: fix sync_sg with swiotlb

2021-08-11 Thread Robin Murphy
the above check and fold the if (!dev_is_dma_coherent(dev)) into the else line. Same for iommu_dma_sync_sg_for_device. +1 With those also cleaned up, Reviewed-by: Robin Murphy ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCHv4] iommu/arm-smmu: Optimize ->tlb_flush_walk() for qcom implementation

2021-08-11 Thread Robin Murphy
On 2021-08-11 11:30, Will Deacon wrote: On Wed, Aug 11, 2021 at 11:37:25AM +0530, Sai Prakash Ranjan wrote: diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index f7da8953afbe..3904b598e0f9 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++

[PATCH v4 24/24] iommu: Allow enabling non-strict mode dynamically

2021-08-11 Thread Robin Murphy
ear use-case for tightening up security *after* the device may already have done whatever it is that you don't trust it not to do, so we only consider the relaxation case. Signed-off-by: Robin Murphy --- v3: Actually think about concurrency, rework most of the fq data accesses to be (hopefu

[PATCH v4 23/24] iommu: Merge strictness and domain type configs

2021-08-11 Thread Robin Murphy
To parallel the sysfs behaviour, merge the new build-time option for DMA domain strictness into the default domain type choice. Suggested-by: Joerg Roedel Reviewed-by: Lu Baolu Reviewed-by: Jean-Philippe Brucker Reviewed-by: John Garry Signed-off-by: Robin Murphy --- v3: Remember to update

[PATCH v4 21/24] iommu: Expose DMA domain strictness via sysfs

2021-08-11 Thread Robin Murphy
as well. Reviewed-by: Lu Baolu Reviewed-by: John Garry Signed-off-by: Robin Murphy --- v3: Summarise the implications in the documentation for completeness --- Documentation/ABI/testing/sysfs-kernel-iommu_groups | 6 +- drivers/iommu/iommu.c | 2 ++ 2 files

[PATCH v4 22/24] iommu: Only log strictness for DMA domains

2021-08-11 Thread Robin Murphy
Garry Reviewed-by: Lu Baolu Signed-off-by: Robin Murphy --- drivers/iommu/iommu.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index b141161d5bbc..63face36fc49 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu

[PATCH v4 20/24] iommu: Express DMA strictness via the domain type

2021-08-11 Thread Robin Murphy
. - Ensures that we only end up using flush queues for drivers which are aware of them and can actually benefit. - Allows us to handle flush queue init failure by falling back to strict mode instead of leaving it to possibly blow up later. Reviewed-by: Lu Baolu Signed-off-by: Robin Murphy

[PATCH v4 19/24] iommu/vt-d: Prepare for multiple DMA domain types

2021-08-11 Thread Robin Murphy
simply be made unconditional, since iommu-dma already knows only to touch DMA domains. Reviewed-by: Lu Baolu Signed-off-by: Robin Murphy --- drivers/iommu/intel/iommu.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers

[PATCH v4 18/24] iommu/arm-smmu: Prepare for multiple DMA domain types

2021-08-11 Thread Robin Murphy
In preparation for the strict vs. non-strict decision for DMA domains to be expressed in the domain type, make sure we expose our flush queue awareness by accepting the new domain type. Signed-off-by: Robin Murphy --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 1 + drivers/iommu/arm/arm-smmu

[PATCH v4 17/24] iommu/amd: Prepare for multiple DMA domain types

2021-08-11 Thread Robin Murphy
The DMA ops reset/setup can simply be unconditional, since iommu-dma already knows only to touch DMA domains. Signed-off-by: Robin Murphy --- drivers/iommu/amd/iommu.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd

[PATCH v4 15/24] iommu/io-pgtable: Remove non-strict quirk

2021-08-11 Thread Robin Murphy
ordering we can have a lovely cleanup all round. Signed-off-by: Robin Murphy --- v3: New --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 3 --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 3 --- drivers/iommu/io-pgtable-arm-v7s.c | 12 ++-- drivers/iommu/io-pgtable-arm.c

[PATCH v4 16/24] iommu: Introduce explicit type for non-strict DMA domains

2021-08-11 Thread Robin Murphy
Promote the difference between strict and non-strict DMA domains from an internal detail to a distinct domain feature and type, to pave the road for exposing it through the sysfs default domain interface. Reviewed-by: Lu Baolu Reviewed-by: Jean-Philippe Brucker Signed-off-by: Robin Murphy

[PATCH v4 14/24] iommu: Indicate queued flushes via gather data

2021-08-11 Thread Robin Murphy
, also fill in some info for @freelist which was overlooked previously. Signed-off-by: Robin Murphy --- v3: New --- drivers/iommu/dma-iommu.c | 1 + drivers/iommu/iova.c | 7 +++ include/linux/iommu.h | 8 +++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers

[PATCH v4 13/24] iommu/dma: Remove redundant "!dev" checks

2021-08-11 Thread Robin Murphy
iommu_dma_init_domain() is now only called from iommu_setup_dma_ops(), which has already assumed dev to be non-NULL. Reviewed-by: John Garry Reviewed-by: Lu Baolu Signed-off-by: Robin Murphy --- drivers/iommu/dma-iommu.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git

[PATCH v4 12/24] iommu/dma: Unexport IOVA cookie management

2021-08-11 Thread Robin Murphy
Reviewed-by: Jean-Philippe Brucker Signed-off-by: Robin Murphy --- drivers/iommu/dma-iommu.c | 7 --- drivers/iommu/iommu.c | 3 +-- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 98ba927aee1a..10067fbc4309 100644

[PATCH v4 11/24] iommu/virtio: Drop IOVA cookie management

2021-08-11 Thread Robin Murphy
The core code bakes its own cookies now. Reviewed-by: Jean-Philippe Brucker Signed-off-by: Robin Murphy --- drivers/iommu/virtio-iommu.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index 6abdcab7273b..80930ce04a16

[PATCH v4 10/24] iommu/sun50i: Drop IOVA cookie management

2021-08-11 Thread Robin Murphy
The core code bakes its own cookies now. CC: Maxime Ripard Signed-off-by: Robin Murphy --- v3: Also remove unneeded include --- drivers/iommu/sun50i-iommu.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i

[PATCH v4 09/24] iommu/sprd: Drop IOVA cookie management

2021-08-11 Thread Robin Murphy
The core code bakes its own cookies now. Acked-by: Chunyan Zhang Signed-off-by: Robin Murphy --- v3: Also remove unneeded include --- drivers/iommu/sprd-iommu.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/iommu/sprd-iommu.c b/drivers/iommu/sprd-iommu.c index

[PATCH v4 08/24] iommu/rockchip: Drop IOVA cookie management

2021-08-11 Thread Robin Murphy
The core code bakes its own cookies now. Tested-by: Heiko Stuebner Acked-by: Heiko Stuebner Signed-off-by: Robin Murphy --- v3: Also remove unneeded include --- drivers/iommu/rockchip-iommu.c | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/iommu

[PATCH v4 07/24] iommu/mtk: Drop IOVA cookie management

2021-08-11 Thread Robin Murphy
The core code bakes its own cookies now. CC: Yong Wu Signed-off-by: Robin Murphy --- v3: Also remove unneeded includes --- drivers/iommu/mtk_iommu.c| 7 --- drivers/iommu/mtk_iommu_v1.c | 1 - 2 files changed, 8 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu

[PATCH v4 06/24] iommu/ipmmu-vmsa: Drop IOVA cookie management

2021-08-11 Thread Robin Murphy
The core code bakes its own cookies now. Reviewed-by: Yoshihiro Shimoda Tested-by: Yoshihiro Shimoda Signed-off-by: Robin Murphy --- v3: Also remove unneeded include --- drivers/iommu/ipmmu-vmsa.c | 28 1 file changed, 4 insertions(+), 24 deletions(-) diff

[PATCH v4 05/24] iommu/exynos: Drop IOVA cookie management

2021-08-11 Thread Robin Murphy
The core code bakes its own cookies now. Acked-by: Marek Szyprowski Tested-by: Marek Szyprowski Signed-off-by: Robin Murphy --- v3: Also remove unneeded include --- drivers/iommu/exynos-iommu.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers

[PATCH v4 04/24] iommu/vt-d: Drop IOVA cookie management

2021-08-11 Thread Robin Murphy
The core code bakes its own cookies now. Reviewed-by: Lu Baolu Signed-off-by: Robin Murphy --- drivers/iommu/intel/iommu.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index c12cc955389a..7e168634c433 100644 --- a/drivers

[PATCH v4 03/24] iommu/arm-smmu: Drop IOVA cookie management

2021-08-11 Thread Robin Murphy
The core code bakes its own cookies now. Signed-off-by: Robin Murphy --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 7 --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 15 --- drivers/iommu/arm/arm-smmu/qcom_iommu.c | 9 - 3 files changed, 4 insertions(+), 27

[PATCH v4 02/24] iommu/amd: Drop IOVA cookie management

2021-08-11 Thread Robin Murphy
The core code bakes its own cookies now. Signed-off-by: Robin Murphy --- drivers/iommu/amd/iommu.c | 12 1 file changed, 12 deletions(-) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 52fe2326042a..0fd98d35d73b 100644 --- a/drivers/iommu/amd/iommu.c +++ b

[PATCH v4 01/24] iommu: Pull IOVA cookie management into the core

2021-08-11 Thread Robin Murphy
-by: Marek Szyprowski Tested-by: Yoshihiro Shimoda Reviewed-by: Jean-Philippe Brucker Reviewed-by: Lu Baolu Signed-off-by: Robin Murphy --- v3: Use a simpler temporary check instead of trying to be clever with the error code --- drivers/iommu/iommu.c | 7 +++ include/linux/iommu.h | 3

[PATCH v4 00/24] iommu: Refactor DMA domain strictness

2021-08-11 Thread Robin Murphy
-Philippe Brucker Robin Murphy (24): iommu: Pull IOVA cookie management into the core iommu/amd: Drop IOVA cookie management iommu/arm-smmu: Drop IOVA cookie management iommu/vt-d: Drop IOVA cookie management iommu/exynos: Drop IOVA cookie management iommu/ipmmu-vmsa: Drop IOVA cookie

Re: [RFC PATCH 2/3] iommu/dma-iommu: Support iovad->granule > PAGE_SIZE

2021-08-10 Thread Robin Murphy
On 2021-08-09 21:45, Sven Peter wrote: On Mon, Aug 9, 2021, at 19:41, Robin Murphy wrote: On 2021-08-07 12:47, Sven Peter via iommu wrote: On Fri, Aug 6, 2021, at 20:04, Robin Murphy wrote: On 2021-08-06 16:55, Sven Peter via iommu wrote: @@ -1006,6 +1019,31 @@ static int

Re: [PATCH v3 24/25] iommu/dma: Factor out flush queue init

2021-08-09 Thread Robin Murphy
On 2021-08-09 20:05, Rajat Jain wrote: On Wed, Aug 4, 2021 at 10:16 AM Robin Murphy wrote: Factor out flush queue setup from the initial domain init so that we can potentially trigger it from sysfs later on in a domain's lifetime. Reviewed-by: Lu Baolu Reviewed-by: John Garry Signed-off

Re: [RFC PATCH 2/3] iommu/dma-iommu: Support iovad->granule > PAGE_SIZE

2021-08-09 Thread Robin Murphy
On 2021-08-07 09:41, Sven Peter wrote: Hi, Thanks a lot for quick reply! On Fri, Aug 6, 2021, at 20:04, Robin Murphy wrote: On 2021-08-06 16:55, Sven Peter via iommu wrote: DMA IOMMU domains can support hardware where the IOMMU page size is larger than the CPU page size. Alignments need

Re: [RFC PATCH 2/3] iommu/dma-iommu: Support iovad->granule > PAGE_SIZE

2021-08-09 Thread Robin Murphy
On 2021-08-07 12:47, Sven Peter via iommu wrote: On Fri, Aug 6, 2021, at 20:04, Robin Murphy wrote: On 2021-08-06 16:55, Sven Peter via iommu wrote: @@ -1006,6 +1019,31 @@ static int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg, if (dev_is_untrusted(dev

Re: [PATCH v3 24/25] iommu/dma: Factor out flush queue init

2021-08-09 Thread Robin Murphy
On 2021-08-09 13:52, Will Deacon wrote: On Wed, Aug 04, 2021 at 06:15:52PM +0100, Robin Murphy wrote: Factor out flush queue setup from the initial domain init so that we can potentially trigger it from sysfs later on in a domain's lifetime. Reviewed-by: Lu Baolu Reviewed-by: John Garry

Re: [PATCH v3 25/25] iommu: Allow enabling non-strict mode dynamically

2021-08-09 Thread Robin Murphy
On 2021-08-09 13:49, Will Deacon wrote: On Wed, Aug 04, 2021 at 06:15:53PM +0100, Robin Murphy wrote: Allocating and enabling a flush queue is in fact something we can reasonably do while a DMA domain is active, without having to rebuild it from scratch. Thus we can allow a strict -> non-str

Re: [RFC PATCH 2/3] iommu/dma-iommu: Support iovad->granule > PAGE_SIZE

2021-08-06 Thread Robin Murphy
On 2021-08-06 16:55, Sven Peter via iommu wrote: DMA IOMMU domains can support hardware where the IOMMU page size is larger than the CPU page size. Alignments need to be done with respect to both PAGE_SIZE and iovad->granule. Additionally, the sg list optimization to use a single IOVA allocation

Re: [PATCH] iommu/arm-smmu-v3: Remove some unneeded init in arm_smmu_cmdq_issue_cmdlist()

2021-08-05 Thread Robin Murphy
On 2021-08-05 16:16, John Garry wrote: On 05/08/2021 15:41, Robin Murphy wrote: I suppose they could be combined into a smaller sub-struct and loaded in a single operation, but it looks messy, and prob without much gain. Indeed I wouldn't say that saving memory is the primary concern here

Re: [PATCH] iommu/arm-smmu-v3: Remove some unneeded init in arm_smmu_cmdq_issue_cmdlist()

2021-08-05 Thread Robin Murphy
On 2021-08-05 14:40, John Garry wrote: On 05/08/2021 12:24, Robin Murphy wrote: On 2021-06-21 17:36, John Garry wrote: Members of struct "llq" will be zero-inited, apart from member max_n_shift. But we write llq.val straight after the init, so it was pointless to zero init t

Re: [PATCH] iommu/arm-smmu-v3: Remove some unneeded init in arm_smmu_cmdq_issue_cmdlist()

2021-08-05 Thread Robin Murphy
On 2021-08-05 12:24, Robin Murphy wrote: On 2021-06-21 17:36, John Garry wrote: Members of struct "llq" will be zero-inited, apart from member max_n_shift. But we write llq.val straight after the init, so it was pointless to zero init those other members. As such, separately i

Re: [PATCH] iommu/arm-smmu-v3: Remove some unneeded init in arm_smmu_cmdq_issue_cmdlist()

2021-08-05 Thread Robin Murphy
heline padding which is both pointless and painful. With that, Reviewed-by: Robin Murphy However, having looked this closely I'm now tangentially wondering why max_n_shift isn't inside the padded union? It's read at the same time as both prod and cons by queue_has_space(), and never updated, so there doesn't

Re: [PATCH] of: restricted dma: Don't fail device probe on rmem init failure

2021-08-05 Thread Robin Murphy
se and try to continue probing the device as we do if the kernel doesn't have the restricted DMA patches applied or either CONFIG_OF_ADDRESS or CONFIG_HAS_DMA =n. Makes sense to me; Reviewed-by: Robin Murphy Although if we allow probe to succeed when a pool really was there for a reason, it

Re: [PATCH v3 02/25] iommu/amd: Drop IOVA cookie management

2021-08-05 Thread Robin Murphy
On 2021-08-04 18:15, Robin Murphy wrote: The core code bakes its own cookies now. Signed-off-by: Robin Murphy --- v3: Also remove unneeded include --- drivers/iommu/amd/iommu.c | 13 - 1 file changed, 13 deletions(-) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd

[PATCH v3 25/25] iommu: Allow enabling non-strict mode dynamically

2021-08-04 Thread Robin Murphy
ear use-case for tightening up security *after* the device may already have done whatever it is that you don't trust it not to do, so we only consider the relaxation case. CC: Sai Praneeth Prakhya Signed-off-by: Robin Murphy --- v3: Actually think about concurrency, rework most of the fq d

[PATCH v3 24/25] iommu/dma: Factor out flush queue init

2021-08-04 Thread Robin Murphy
Factor out flush queue setup from the initial domain init so that we can potentially trigger it from sysfs later on in a domain's lifetime. Reviewed-by: Lu Baolu Reviewed-by: John Garry Signed-off-by: Robin Murphy --- drivers/iommu/dma-iommu.c | 30 -- include

[PATCH v3 23/25] iommu: Merge strictness and domain type configs

2021-08-04 Thread Robin Murphy
To parallel the sysfs behaviour, merge the new build-time option for DMA domain strictness into the default domain type choice. Suggested-by: Joerg Roedel Reviewed-by: Lu Baolu Reviewed-by: Jean-Philippe Brucker Signed-off-by: Robin Murphy --- v3: Remember to update parameter documentation

[PATCH v3 22/25] iommu: Only log strictness for DMA domains

2021-08-04 Thread Robin Murphy
Garry Reviewed-by: Lu Baolu Signed-off-by: Robin Murphy --- drivers/iommu/iommu.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index b141161d5bbc..63face36fc49 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu

[PATCH v3 21/25] iommu: Expose DMA domain strictness via sysfs

2021-08-04 Thread Robin Murphy
as well. CC: Sai Praneeth Prakhya Reviewed-by: Lu Baolu Reviewed-by: John Garry Signed-off-by: Robin Murphy --- v3: Summarise the implications in the documentation for completeness --- Documentation/ABI/testing/sysfs-kernel-iommu_groups | 6 +- drivers/iommu/iommu.c

[PATCH v3 20/25] iommu: Express DMA strictness via the domain type

2021-08-04 Thread Robin Murphy
. - Ensures that we only end up using flush queues for drivers which are aware of them and can actually benefit. - Allows us to handle flush queue init failure by falling back to strict mode instead of leaving it to possibly blow up later. Reviewed-by: Lu Baolu Signed-off-by: Robin Murphy

[PATCH v3 19/25] iommu/vt-d: Prepare for multiple DMA domain types

2021-08-04 Thread Robin Murphy
simply be made unconditional, since iommu-dma already knows only to touch DMA domains. Reviewed-by: Lu Baolu Signed-off-by: Robin Murphy --- drivers/iommu/intel/iommu.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers

[PATCH v3 18/25] iommu/arm-smmu: Prepare for multiple DMA domain types

2021-08-04 Thread Robin Murphy
In preparation for the strict vs. non-strict decision for DMA domains to be expressed in the domain type, make sure we expose our flush queue awareness by accepting the new domain type. Signed-off-by: Robin Murphy --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 1 + drivers/iommu/arm/arm-smmu

[PATCH v3 17/25] iommu/amd: Prepare for multiple DMA domain types

2021-08-04 Thread Robin Murphy
The DMA ops reset/setup can simply be unconditional, since iommu-dma already knows only to touch DMA domains. Signed-off-by: Robin Murphy --- drivers/iommu/amd/iommu.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd

[PATCH v3 16/25] iommu: Introduce explicit type for non-strict DMA domains

2021-08-04 Thread Robin Murphy
Promote the difference between strict and non-strict DMA domains from an internal detail to a distinct domain feature and type, to pave the road for exposing it through the sysfs default domain interface. Reviewed-by: Lu Baolu Reviewed-by: Jean-Philippe Brucker Signed-off-by: Robin Murphy

[PATCH v3 15/25] iommu/io-pgtable: Remove non-strict quirk

2021-08-04 Thread Robin Murphy
ordering we can have a lovely cleanup all round. Signed-off-by: Robin Murphy --- v3: New --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 3 --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 3 --- drivers/iommu/io-pgtable-arm-v7s.c | 12 ++-- drivers/iommu/io-pgtable-arm.c

[PATCH v3 14/25] iommu: Indicate queued flushes via gather data

2021-08-04 Thread Robin Murphy
, also fill in some info for @freelist which was overlooked previously. Signed-off-by: Robin Murphy --- v3: New --- drivers/iommu/dma-iommu.c | 1 + drivers/iommu/iova.c | 7 +++ include/linux/iommu.h | 8 +++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers

[PATCH v3 13/25] iommu/dma: Remove redundant "!dev" checks

2021-08-04 Thread Robin Murphy
iommu_dma_init_domain() is now only called from iommu_setup_dma_ops(), which has already assumed dev to be non-NULL. Reviewed-by: John Garry Reviewed-by: Lu Baolu Signed-off-by: Robin Murphy --- drivers/iommu/dma-iommu.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git

  1   2   3   4   5   6   7   8   9   10   >