RE: [RFC v2] /dev/iommu uAPI proposal

2021-08-10 Thread Tian, Kevin
> From: David Gibson > Sent: Tuesday, August 10, 2021 12:48 PM > > On Mon, Aug 09, 2021 at 08:34:06AM +, Tian, Kevin wrote: > > > From: David Gibson > > > Sent: Friday, August 6, 2021 12:45 PM > > > > > > In concept I feel the purpose of DMA endpoint is equivalent to the > > > routing > > >

Re: [PATCH] iommu/arm-smmu: Add clk_bulk_{prepare/unprepare} to system pm callbacks

2021-08-10 Thread Sai Prakash Ranjan
On 2021-08-03 11:36, Sai Prakash Ranjan wrote: On 2021-08-02 21:42, Will Deacon wrote: On Tue, Jul 27, 2021 at 03:03:22PM +0530, Sai Prakash Ranjan wrote: Some clocks for SMMU can have parent as XO such as gpu_cc_hub_cx_int_clk of GPU SMMU in QTI SC7280 SoC and in order to enter deep sleep

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

2021-08-10 Thread Sven Peter via iommu
Hi Joerg, This happens because apple/dart is missing the "Optimizing iommu_[map/unmap] performance" series which is already in the core branch [1]. The same commit works fine in iommu/next since that branch merges both iommu/core and apple/dart. Thanks, Sven [1]

[PATCHv2] iommu/arm-smmu: Add clk_bulk_{prepare/unprepare} to system pm callbacks

2021-08-10 Thread Sai Prakash Ranjan
Some clocks for SMMU can have parent as XO such as gpu_cc_hub_cx_int_clk of GPU SMMU in QTI SC7280 SoC and in order to enter deep sleep states in such cases, we would need to drop the XO clock vote in unprepare call and this unprepare callback for XO is in RPMh (Resource Power Manager-Hardened)

Re: [RFC v2] /dev/iommu uAPI proposal

2021-08-10 Thread Eric Auger
Hi Kevin, On 8/5/21 2:36 AM, Tian, Kevin wrote: >> From: Eric Auger >> Sent: Wednesday, August 4, 2021 11:59 PM >> > [...] >>> 1.2. Attach Device to I/O address space >>> +++ >>> >>> Device attach/bind is initiated through passthrough framework uAPI. >>> >>>

Re: [PATCH v10 01/17] iova: Export alloc_iova_fast() and free_iova_fast()

2021-08-10 Thread Yongji Xie
On Tue, Aug 10, 2021 at 11:02 AM Jason Wang wrote: > > > 在 2021/8/9 下午1:56, Yongji Xie 写道: > > On Thu, Aug 5, 2021 at 9:31 PM Jason Wang wrote: > >> > >> 在 2021/8/5 下午8:34, Yongji Xie 写道: > My main point, though, is that if you've already got something else > keeping track of the

[PATCH v3 08/13] memory: mtk-smi: Add clocks for smi-sub-common

2021-08-10 Thread Yong Wu
SMI sub common only have one output port. thus it has only one gals clocks(gals0). then, smi-sub-common require the three clocks(apb/smi/gals0) in has_gals case. Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git

[PATCH v3 09/13] memory: mtk-smi: Use devm_platform_ioremap_resource

2021-08-10 Thread Yong Wu
No functional change. Simplify probing code. Signed-off-by: Yong Wu Reviewed-by: Ikjoon Jang --- drivers/memory/mtk-smi.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 58d9f7667490..a001e41f5074 100644

[PATCH v3 03/13] memory: mtk-smi: Use clk_bulk clock ops

2021-08-10 Thread Yong Wu
Use clk_bulk interface instead of the orginal one to simplify the code. For SMI larbs: Require apb/smi clocks while gals is optional. For SMI common: Require apb/smi/gals0/gal1 in has_gals case. Otherwise, also only require apb/smi, No optional clk here. About the "has_gals"

[PATCH v3 04/13] memory: mtk-smi: Rename smi_gen to smi_type

2021-08-10 Thread Yong Wu
Prepare for adding smi sub common. Only rename from smi_gen to smi_type. No functional change. About the current "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 name "gen" is not proper. Signed-off-by: Yong Wu Reviewed-by:

[PATCH v3 10/13] memory: mtk-smi: mt8195: Add smi support

2021-08-10 Thread Yong Wu
MT8195 has two smi-common, their IP are the same. Only the larbs that connect with the smi-common are different. thus the bus_sel are different for the two smi-common. Signed-off-by: Yong Wu Reviewed-by: Ikjoon Jang --- drivers/memory/mtk-smi.c | 26 ++ 1 file changed,

[PATCH v3 11/13] memory: mtk-smi: mt8195: Add initial setting for smi-common

2021-08-10 Thread Yong Wu
To improve the performance, add 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 v3 12/13] memory: mtk-smi: mt8195: Add initial setting for smi-larb

2021-08-10 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 settings for each larb. a. THRT_UPDATE: the value in bits[7:4] of 0x24 is not so good. The HW default is 4, and we

[PATCH v3 05/13] memory: mtk-smi: Adjust some code position

2021-08-10 Thread Yong Wu
No functional change. Only move the code position to make the code more readable. 1. Put the register smi-common above smi-larb. Prepare to add some others register setting. 2. Put mtk_smi_larb_unbind around larb_bind. 3. Sort the SoC data alphabetically. and put them in one line as the

[PATCH v3 06/13] memory: mtk-smi: Add error handle for smi_probe

2021-08-10 Thread Yong Wu
Add error handle while component_add fail. Signed-off-by: Yong Wu Reviewed-by: Ikjoon Jang --- drivers/memory/mtk-smi.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 33b6c5efe102..b362d528944e 100644 ---

[PATCH v3 07/13] memory: mtk-smi: Add device link for smi-sub-common

2021-08-10 Thread Yong Wu
In mt8195, there are some larbs 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 smi-sub-common with

Re: [Freedreno] [PATCH 0/3] iommu/drm/msm: Allow non-coherent masters to use system cache

2021-08-10 Thread Will Deacon
On Mon, Aug 09, 2021 at 11:17:40PM +0530, Sai Prakash Ranjan wrote: > On 2021-08-09 23:10, Will Deacon wrote: > > On Mon, Aug 09, 2021 at 10:18:21AM -0700, Rob Clark wrote: > > > On Mon, Aug 9, 2021 at 10:05 AM Will Deacon wrote: > > > > On Mon, Aug 09, 2021 at 09:57:08AM -0700, Rob Clark wrote:

Re: [bug report] iommu_dma_unmap_sg() is very slow then running IO from remote numa node

2021-08-10 Thread John Garry
On 28/07/2021 16:17, Ming Lei wrote: Have you tried turning off the IOMMU to ensure that this is really just an IOMMU problem? You can try setting CONFIG_ARM_SMMU_V3=n in the defconfig or passing cmdline param iommu.passthrough=1 to bypass the the SMMU (equivalent to disabling for kernel

Re: [Freedreno] [PATCH 0/3] iommu/drm/msm: Allow non-coherent masters to use system cache

2021-08-10 Thread Sai Prakash Ranjan
On 2021-08-10 14:46, Will Deacon wrote: On Mon, Aug 09, 2021 at 11:17:40PM +0530, Sai Prakash Ranjan wrote: On 2021-08-09 23:10, Will Deacon wrote: > On Mon, Aug 09, 2021 at 10:18:21AM -0700, Rob Clark wrote: > > On Mon, Aug 9, 2021 at 10:05 AM Will Deacon wrote: > > > On Mon, Aug 09, 2021 at

[PATCH v3 00/13] MT8195 SMI support

2021-08-10 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. Change note: v3:1) In the dt-binding: a. Change mediatek,smi type from phandle-array to phandle from Rob.

[PATCH v3 01/13] dt-bindings: memory: mediatek: Add mt8195 smi binding

2021-08-10 Thread Yong Wu
Add 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 connect with different smi-larbs, then some setting(bus_sel) is different. Differentiate them with the compatible string. Something

[PATCH v3 02/13] dt-bindings: memory: mediatek: Add mt8195 smi sub common

2021-08-10 Thread Yong Wu
Add 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 a

RE: [RFC v2] /dev/iommu uAPI proposal

2021-08-10 Thread Tian, Kevin
> From: Eric Auger > Sent: Tuesday, August 10, 2021 3:17 PM > > Hi Kevin, > > On 8/5/21 2:36 AM, Tian, Kevin wrote: > >> From: Eric Auger > >> Sent: Wednesday, August 4, 2021 11:59 PM > >> > > [...] > >>> 1.2. Attach Device to I/O address space > >>> +++ >

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

[PATCH v3 13/13] MAINTAINERS: Add entry for MediaTek SMI

2021-08-10 Thread Yong Wu
I am the author of MediaTek SMI driver, and will to maintain and develop it further. Add myself to cover these items. Signed-off-by: Yong Wu --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index a61f4f3b78a9..91af55b45e80 100644 ---

[RFC PATCH v2 4/5] dma/pool: create dma atomic pool only if dma zone has mamaged pages

2021-08-10 Thread Baoquan He
Currently three dma atomic pools are initialized as long as the relevant kernel codes are built in. While in kdump kernel of x86_64, this is not right when trying to create atomic_pool_dma, because there's no managed pages in DMA zone. In the case, DMA zone only has low 1M memory presented and

Re: [RFC v1 6/8] mshv: command line option to skip devices in PV-IOMMU

2021-08-10 Thread Wei Liu
On Wed, Aug 04, 2021 at 12:33:54PM +0530, Praveen Kumar wrote: > On 04-08-2021 03:26, Wei Liu wrote: > >>> struct iommu_domain domain; > >>> @@ -774,6 +784,41 @@ static struct iommu_device > >>> *hv_iommu_probe_device(struct device *dev) > >>> if (!dev_is_pci(dev)) > >>> return

Re: [RFC v1 5/8] mshv: add paravirtualized IOMMU support

2021-08-10 Thread Wei Liu
On Wed, Aug 04, 2021 at 12:13:42PM +0530, Praveen Kumar wrote: > On 04-08-2021 03:17, Wei Liu wrote: > >>> +static size_t hv_iommu_unmap(struct iommu_domain *d, unsigned long iova, > >>> +size_t size, struct iommu_iotlb_gather *gather) > >>> +{ > >>> + size_t unmapped; > >>> +

Re: [bug report] iommu_dma_unmap_sg() is very slow then running IO from remote numa node

2021-08-10 Thread Ming Lei
On Tue, Aug 10, 2021 at 10:36:47AM +0100, John Garry wrote: > On 28/07/2021 16:17, Ming Lei wrote: > > > > > Have you tried turning off the IOMMU to ensure that this is really > > > > > just > > > > > an IOMMU problem? > > > > > > > > > > You can try setting CONFIG_ARM_SMMU_V3=n in the defconfig

Re: [PATCH V3 01/13] x86/HV: Initialize GHCB page in Isolation VM

2021-08-10 Thread Tianyu Lan
Hi Wei: Thanks for review. On 8/10/2021 6:56 PM, Wei Liu wrote: On Mon, Aug 09, 2021 at 01:56:05PM -0400, Tianyu Lan wrote: [...] static int hv_cpu_init(unsigned int cpu) { union hv_vp_assist_msr_contents msr = { 0 }; @@ -85,6 +111,8 @@ static int hv_cpu_init(unsigned int

Re: [PATCH V3 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-08-10 Thread Tianyu Lan
On 8/10/2021 7:03 PM, Wei Liu wrote: diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index 0bb4d9ca7a55..b3683083208a 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c @@ -607,6 +607,12 @@ EXPORT_SYMBOL_GPL(hv_get_isolation_type); bool

Re: [RFC v2] /dev/iommu uAPI proposal

2021-08-10 Thread David Gibson
On Fri, Aug 06, 2021 at 09:32:11AM -0300, Jason Gunthorpe wrote: > On Fri, Aug 06, 2021 at 02:45:26PM +1000, David Gibson wrote: > > > Well, that's kind of what I'm doing. PCI currently has the notion of > > "default" address space for a RID, but there's no guarantee that other > > buses (or

Re: [PATCH V3 01/13] x86/HV: Initialize GHCB page in Isolation VM

2021-08-10 Thread Wei Liu
On Mon, Aug 09, 2021 at 01:56:05PM -0400, Tianyu Lan wrote: [...] > static int hv_cpu_init(unsigned int cpu) > { > union hv_vp_assist_msr_contents msr = { 0 }; > @@ -85,6 +111,8 @@ static int hv_cpu_init(unsigned int cpu) > } > } > > + hyperv_init_ghcb(); > + Why

Re: [PATCH V3 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-08-10 Thread Wei Liu
On Mon, Aug 09, 2021 at 01:56:07PM -0400, Tianyu Lan wrote: > From: Tianyu Lan > > Add new hvcall guest address host visibility support to mark > memory visible to host. Call it inside set_memory_decrypted > /encrypted(). Add HYPERVISOR feature check in the > hv_is_isolation_supported() to

Re: [PATCH V3 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-08-10 Thread Tianyu Lan
On 8/10/2021 6:12 AM, Dave Hansen wrote: On 8/9/21 10:56 AM, Tianyu Lan wrote: From: Tianyu Lan Add new hvcall guest address host visibility support to mark memory visible to host. Call it inside set_memory_decrypted /encrypted(). Add HYPERVISOR feature check in the

[PATCH] iommu: APPLE_DART should depend on ARCH_APPLE

2021-08-10 Thread Geert Uytterhoeven
The Apple DART (Device Address Resolution Table) IOMMU is only present on Apple ARM SoCs like the M1. Hence add a dependency on ARCH_APPLE, to prevent asking the user about this driver when configuring a kernel without support for the Apple Silicon SoC family. Fixes: 05ce9d20d699b093

Re: [PATCH RFC 0/8] iommu/arm-smmu-v3: add support for ECMDQ register mode

2021-08-10 Thread Will Deacon
On Sat, Jun 26, 2021 at 07:01:22PM +0800, Zhen Lei wrote: > SMMU v3.3 added a new feature, which is Enhanced Command queue interface > for reducing contention when submitting Commands to the SMMU, in this > patch set, ECMDQ is the abbreviation of Enhanced Command Queue. > > When the hardware

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

2021-08-10 Thread Will Deacon
On Tue, Aug 03, 2021 at 11:09:17AM +0530, Sai Prakash Ranjan wrote: > On 2021-08-02 21:13, Will Deacon wrote: > > On Wed, Jun 23, 2021 at 07:12:01PM +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

Re: [PATCH 07/11] treewide: Replace the use of mem_encrypt_active() with prot_guest_has()

2021-08-10 Thread Kuppuswamy, Sathyanarayanan
On 8/10/21 12:48 PM, Tom Lendacky wrote: On 8/10/21 1:45 PM, Kuppuswamy, Sathyanarayanan wrote: On 7/27/21 3:26 PM, Tom Lendacky wrote: diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index de01903c3735..cafed6456d45 100644 --- a/arch/x86/kernel/head64.c +++

Re: [PATCH v3 14/14] tpm: Allow locality 2 to be set when initializing the TPM for Secure Launch

2021-08-10 Thread Jarkko Sakkinen
On Mon, Aug 09, 2021 at 12:38:56PM -0400, Ross Philipson wrote: > The Secure Launch MLE environment uses PCRs that are only accessible from > the DRTM locality 2. By default the TPM drivers always initialize the > locality to 0. When a Secure Launch is in progress, initialize the > locality to 2.

Re: [PATCH v3 02/14] x86/boot: Add missing handling of setup_indirect structures

2021-08-10 Thread Jarkko Sakkinen
On Mon, Aug 09, 2021 at 12:38:44PM -0400, Ross Philipson wrote: > One of the two functions in ioremap.c that handles setup_data was > missing the correct handling of setup_indirect structures. What is "correct handling", and how was it broken? What is 'setup_indirect'? > Functionality missing

Re: [PATCH v3 00/14] x86: Trenchboot secure dynamic launch Linux kernel support

2021-08-10 Thread Jarkko Sakkinen
On Mon, Aug 09, 2021 at 12:38:42PM -0400, Ross Philipson wrote: > The focus of Trechboot project (https://github.com/TrenchBoot) is to > enhance the boot security and integrity. This requires the linux kernel ~

Re: [PATCH 07/11] treewide: Replace the use of mem_encrypt_active() with prot_guest_has()

2021-08-10 Thread Tom Lendacky via iommu
On 8/10/21 1:45 PM, Kuppuswamy, Sathyanarayanan wrote: > > > On 7/27/21 3:26 PM, Tom Lendacky wrote: >> diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c >> index de01903c3735..cafed6456d45 100644 >> --- a/arch/x86/kernel/head64.c >> +++ b/arch/x86/kernel/head64.c >> @@ -19,7

Re: [PATCH 07/11] treewide: Replace the use of mem_encrypt_active() with prot_guest_has()

2021-08-10 Thread Kuppuswamy, Sathyanarayanan
On 7/27/21 3:26 PM, Tom Lendacky wrote: diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index de01903c3735..cafed6456d45 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include

Re: [PATCH RFC 2/8] iommu/arm-smmu-v3: Add and use static helper function arm_smmu_cmdq_issue_cmd_with_sync()

2021-08-10 Thread Will Deacon
On Sat, Jun 26, 2021 at 07:01:24PM +0800, 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.

Re: [PATCH RFC 0/2] dma-pool: allow user to disable atomic pool

2021-08-10 Thread Tom Lendacky via iommu
On 8/5/21 1:54 AM, Baoquan He wrote: > On 06/24/21 at 11:47am, Robin Murphy wrote: >> On 2021-06-24 10:29, Baoquan He wrote: >>> On 06/24/21 at 08:40am, Christoph Hellwig wrote: So reduce the amount allocated. But the pool is needed for proper operation on systems with memory

Re: [Patch V3 0/2] iommu/arm-smmu: Fix races in iommu domain/group creation

2021-08-10 Thread Will Deacon
On Tue, 10 Aug 2021 10:13:59 +0530, Ashish Mhetre wrote: > When two devices with same SID are getting probed concurrently through > iommu_probe_device(), the iommu_group and iommu_domain are allocated more > than once because they are not protected for concurrency. This is leading > to context

Re: [PATCHv2] iommu/arm-smmu: Add clk_bulk_{prepare/unprepare} to system pm callbacks

2021-08-10 Thread Will Deacon
On Tue, 10 Aug 2021 12:18:08 +0530, Sai Prakash Ranjan wrote: > Some clocks for SMMU can have parent as XO such as gpu_cc_hub_cx_int_clk > of GPU SMMU in QTI SC7280 SoC and in order to enter deep sleep states in > such cases, we would need to drop the XO clock vote in unprepare call and > this

Re: [PATCH RFC 2/8] iommu/arm-smmu-v3: Add and use static helper function arm_smmu_cmdq_issue_cmd_with_sync()

2021-08-10 Thread Leizhen (ThunderTown)
On 2021/8/11 2:24, Will Deacon wrote: > On Sat, Jun 26, 2021 at 07:01:24PM +0800, 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

Re: [PATCH RFC 0/2] dma-pool: allow user to disable atomic pool

2021-08-10 Thread Baoquan He
On 08/10/21 at 03:52pm, Tom Lendacky wrote: > On 8/5/21 1:54 AM, Baoquan He wrote: > > On 06/24/21 at 11:47am, Robin Murphy wrote: > >> On 2021-06-24 10:29, Baoquan He wrote: > >>> On 06/24/21 at 08:40am, Christoph Hellwig wrote: > So reduce the amount allocated. But the pool is needed for

Re: [PATCH RFC 0/8] iommu/arm-smmu-v3: add support for ECMDQ register mode

2021-08-10 Thread Leizhen (ThunderTown)
On 2021/8/11 2:35, Will Deacon wrote: > On Sat, Jun 26, 2021 at 07:01:22PM +0800, Zhen Lei wrote: >> SMMU v3.3 added a new feature, which is Enhanced Command queue interface >> for reducing contention when submitting Commands to the SMMU, in this >> patch set, ECMDQ is the abbreviation of

[PATCH v3 0/5] Fixes for dma-iommu swiotlb bounce buffers

2021-08-10 Thread David Stevens
From: David Stevens This patch set includes various fixes for dma-iommu's swiotlb bounce buffers for untrusted devices. There are three fixes for correctness issues, one performance issue, and one general cleanup. The min_align_mask issue was found when running fio on an untrusted nvme device

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

2021-08-10 Thread David Stevens
From: David Stevens The is_swiotlb_buffer function takes the physical address of the swiotlb buffer, not the physical address of the original buffer. The sglist contains the physical addresses of the original buffer, so for the sync_sg functions to work properly when a bounce buffer might have

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

2021-08-10 Thread David Stevens
From: David Stevens Introduce a new dev_use_swiotlb function to guard swiotlb code, instead of overloading dev_is_untrusted. This allows CONFIG_SWIOTLB to be checked more broadly, so the swiotlb related code can be removed more aggressively. Signed-off-by: David Stevens ---

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

2021-08-10 Thread David Stevens
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 aligned size results in the offset being

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

2021-08-10 Thread David Stevens
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 the bounce buffer address if necessary. This

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

2021-08-10 Thread David Stevens
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. Signed-off-by: David Stevens ---

Re: [PATCH RFC 0/2] dma-pool: allow user to disable atomic pool

2021-08-10 Thread Christoph Hellwig
On Tue, Aug 10, 2021 at 03:52:25PM -0500, Tom Lendacky via iommu wrote: > I think the atomic pool is used by the NVMe driver. My understanding is > that driver will do a dma_alloc_coherent() from interrupt context, so it > needs to use GFP_ATOMIC. The pool was created because dma_alloc_coherent()

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

2021-08-10 Thread Christoph Hellwig
On Wed, Aug 11, 2021 at 11:42:43AM +0900, David Stevens wrote: > From: David Stevens > > The is_swiotlb_buffer function takes the physical address of the swiotlb > buffer, not the physical address of the original buffer. The sglist > contains the physical addresses of the original buffer, so for