Re: [PATCH RFC v2 06/11] iommu/vt-d: Add SVA domain support

2022-04-03 Thread Lu Baolu
On 2022/3/31 3:09, Jason Gunthorpe wrote: On Tue, Mar 29, 2022 at 01:37:55PM +0800, Lu Baolu wrote: Add support for SVA domain allocation and provide an SVA-specific iommu_domain_ops. Signed-off-by: Lu Baolu include/linux/intel-iommu.h | 1 + drivers/iommu/intel/iommu.c | 10 ++ d

Re: [PATCH RFC v2 04/11] iommu: Add attach/detach_dev_pasid domain ops

2022-04-03 Thread Lu Baolu
Hi Jason, On 2022/3/31 3:08, Jason Gunthorpe wrote: On Tue, Mar 29, 2022 at 01:37:53PM +0800, Lu Baolu wrote: Attaching an IOMMU domain to a PASID of a device is a generic operation for modern IOMMU drivers which support PASID-granular DMA address translation. Currently visible usage scenarios

Re: [PATCH RFC v2 03/11] iommu/sva: Add iommu_domain type for SVA

2022-04-03 Thread Lu Baolu
Hi Jason and Kevin, On 2022/4/3 7:32, Jason Gunthorpe wrote: On Sat, Apr 02, 2022 at 08:43:16AM +, Tian, Kevin wrote: This assumes any domain is interchangeable with any device, which is not the iommu model. We need a domain op to check if a device is compatiable with the domain for vfio a

Re: [PATCH RFC v2 08/11] iommu/sva: Use attach/detach_pasid_dev in SVA interfaces

2022-04-03 Thread Lu Baolu
On 2022/4/1 6:26, Jason Gunthorpe wrote: On Thu, Mar 31, 2022 at 01:59:22PM -0700, Jacob Pan wrote: + handle->dev = dev; + handle->domain = domain; + handle->pasid = mm->pasid; why do we need to store pasid here? Conceptually, pasid is per sva domain not per bind. You can get

Re: [PATCH RFC v2 02/11] iommu: Add iommu_group_singleton_lockdown()

2022-04-03 Thread Lu Baolu
On 2022/3/30 19:58, Jason Gunthorpe wrote: Testing the group size is inherently the wrong test to make. What is your suggestion then? Add a flag to the group that positively indicates the group can never have more than one member, even after hot plug. eg because it is impossible due to ACS, or

[PATCH 15/15] x86: remove cruft from

2022-04-03 Thread Christoph Hellwig
gets pulled in by all drivers using the DMA API. Remove x86 internal variables and unnecessary includes from it. Signed-off-by: Christoph Hellwig --- arch/x86/include/asm/dma-mapping.h | 11 --- arch/x86/include/asm/iommu.h | 2 ++ 2 files changed, 2 insertions(+), 11 deletions(-

[PATCH 14/15] swiotlb: remove swiotlb_init_with_tbl and swiotlb_init_late_with_tbl

2022-04-03 Thread Christoph Hellwig
No users left. Signed-off-by: Christoph Hellwig --- include/linux/swiotlb.h | 2 -- kernel/dma/swiotlb.c| 77 +++-- 2 files changed, 20 insertions(+), 59 deletions(-) diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h index 7b50c82f84ce9..7ed

[PATCH 13/15] swiotlb: merge swiotlb-xen initialization into swiotlb

2022-04-03 Thread Christoph Hellwig
Reuse the generic swiotlb initialization for xen-swiotlb. For ARM/ARM64 this works trivially, while for x86 xen_swiotlb_fixup needs to be passed as the remap argument to swiotlb_init_remap/swiotlb_init_late. Note that the lower bound of the swiotlb size is changed to the smaller IO_TLB_MIN_SLABS

[PATCH 12/15] swiotlb: provide swiotlb_init variants that remap the buffer

2022-04-03 Thread Christoph Hellwig
To shared more code between swiotlb and xen-swiotlb, offer a swiotlb_init_remap interface and add a remap callback to swiotlb_init_late that will allow Xen to remap the buffer the buffer without duplicating much of the logic. Signed-off-by: Christoph Hellwig --- arch/x86/pci/sta2x11-fixup.c | 2

[PATCH 11/15] swiotlb: pass a gfp_mask argument to swiotlb_init_late

2022-04-03 Thread Christoph Hellwig
Let the caller chose a zone to allocate from. This will be used later on by the xen-swiotlb initialization on arm. Signed-off-by: Christoph Hellwig Reviewed-by: Anshuman Khandual --- arch/x86/pci/sta2x11-fixup.c | 2 +- include/linux/swiotlb.h | 2 +- kernel/dma/swiotlb.c | 7 ++--

[PATCH 10/15] swiotlb: add a SWIOTLB_ANY flag to lift the low memory restriction

2022-04-03 Thread Christoph Hellwig
Power SVM wants to allocate a swiotlb buffer that is not restricted to low memory for the trusted hypervisor scheme. Consolidate the support for this into the swiotlb_init interface by adding a new flag. Signed-off-by: Christoph Hellwig --- arch/powerpc/include/asm/svm.h | 4 arch/p

[PATCH 09/15] swiotlb: make the swiotlb_init interface more useful

2022-04-03 Thread Christoph Hellwig
Pass a bool to pass if swiotlb needs to be enabled based on the addressing needs and replace the verbose argument with a set of flags, including one to force enable bounce buffering. Note that this patch removes the possibility to force xen-swiotlb use using swiotlb=force on the command line on x8

[PATCH 08/15] x86: centralize setting SWIOTLB_FORCE when guest memory encryption is enabled

2022-04-03 Thread Christoph Hellwig
Move enabling SWIOTLB_FORCE for guest memory encryption into common code. Signed-off-by: Christoph Hellwig --- arch/x86/kernel/cpu/mshyperv.c | 8 arch/x86/kernel/pci-dma.c | 8 arch/x86/mm/mem_encrypt_amd.c | 3 --- 3 files changed, 8 insertions(+), 11 deletions(-) diff

[PATCH 07/15] x86: remove the IOMMU table infrastructure

2022-04-03 Thread Christoph Hellwig
The IOMMU table tries to separate the different IOMMUs into different backends, but actually requires various cross calls. Rewrite the code to do the generic swiotlb/swiotlb-xen setup directly in pci-dma.c and then just call into the IOMMU drivers. Signed-off-by: Christoph Hellwig --- arch/ia64

[PATCH 06/15] MIPS/octeon: use swiotlb_init instead of open coding it

2022-04-03 Thread Christoph Hellwig
Use the generic swiotlb initialization helper instead of open coding it. Signed-off-by: Christoph Hellwig Acked-by: Thomas Bogendoerfer --- arch/mips/cavium-octeon/dma-octeon.c | 15 ++- arch/mips/pci/pci-octeon.c | 2 +- 2 files changed, 3 insertions(+), 14 deletions(-)

[PATCH 05/15] arm/xen: don't check for xen_initial_domain() in xen_create_contiguous_region

2022-04-03 Thread Christoph Hellwig
From: Stefano Stabellini It used to be that Linux enabled swiotlb-xen when running a dom0 on ARM. Since f5079a9a2a31 "xen/arm: introduce XENFEAT_direct_mapped and XENFEAT_not_direct_mapped", Linux detects whether to enable or disable swiotlb-xen based on the new feature flags: XENFEAT_direct_mapp

[PATCH 04/15] swiotlb: rename swiotlb_late_init_with_default_size

2022-04-03 Thread Christoph Hellwig
swiotlb_late_init_with_default_size is an overly verbose name that doesn't even catch what the function is doing, given that the size is not just a default but the actual requested size. Rename it to swiotlb_init_late. Signed-off-by: Christoph Hellwig Reviewed-by: Anshuman Khandual --- arch/x8

[PATCH 03/15] swiotlb: simplify swiotlb_max_segment

2022-04-03 Thread Christoph Hellwig
Remove the bogus Xen override that was usually larger than the actual size and just calculate the value on demand. Note that swiotlb_max_segment still doesn't make sense as an interface and should eventually be removed. Signed-off-by: Christoph Hellwig Reviewed-by: Anshuman Khandual --- driver

[PATCH 02/15] swiotlb: make swiotlb_exit a no-op if SWIOTLB_FORCE is set

2022-04-03 Thread Christoph Hellwig
If force bouncing is enabled we can't release the buffers. Signed-off-by: Christoph Hellwig Reviewed-by: Anshuman Khandual --- kernel/dma/swiotlb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index 73a41cec9e386..98bb0eb44a7bf 100644 --- a/

cleanup swiotlb initialization v8

2022-04-03 Thread Christoph Hellwig
Hi all, this series tries to clean up the swiotlb initialization, including that of swiotlb-xen. To get there is also removes the x86 iommu table infrastructure that massively obsfucates the initialization path. Git tree: git://git.infradead.org/users/hch/misc.git swiotlb-init-cleanup Gitw

[PATCH 01/15] dma-direct: use is_swiotlb_active in dma_direct_map_page

2022-04-03 Thread Christoph Hellwig
Use the more specific is_swiotlb_active check instead of checking the global swiotlb_force variable. Signed-off-by: Christoph Hellwig Reviewed-by: Anshuman Khandual --- kernel/dma/direct.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/dma/direct.h b/kernel/dma/direc

Re: [GIT PULL] second round of dma-mapping updates for Linux 5.18

2022-04-03 Thread pr-tracker-bot
The pull request you sent on Sun, 3 Apr 2022 14:22:47 +0200: > git://git.infradead.org/users/hch/dma-mapping.git tags/dma-mapping-5.18-1 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/63d12cc30574eec9241932cefa17a21df3afd8d0 Thank you! -- Deet-doot-dot, I am a bot.

[GIT PULL] second round of dma-mapping updates for Linux 5.18

2022-04-03 Thread Christoph Hellwig
The following changes since commit 5efabdadcf4a5b9a37847ecc85ba71cf2eff0fcf: Merge tag 'devicetree-fixes-for-5.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux (2022-03-29 08:55:16 -0700) are available in the Git repository at: git://git.infradead.org/users/hch/dma-mapping