Re: [RFC PATCH] component: Add common helpers for compare/release functions

2022-02-09 Thread Yong Wu via iommu
On Fri, 2022-01-28 at 23:24 +0100, Daniel Vetter wrote: > On Fri, Jan 28, 2022 at 04:11:01PM +0800, Yong Wu wrote: > > The component requires the compare/release functions, there are so > > many > > copy in current kernel. Just define three common helpers for them. > > No functional change. > > >

Re: [RFC PATCH] component: Add common helpers for compare/release functions

2022-02-09 Thread Yong Wu via iommu
On Fri, 2022-01-28 at 13:04 +, Robin Murphy wrote: > On 2022-01-28 08:11, Yong Wu wrote: > [...] > > diff --git a/include/linux/component.h b/include/linux/component.h > > index 16de18f473d7..5a7468ea827c 100644 > > --- a/include/linux/component.h > > +++ b/include/linux/component.h > > @@

Re: [PATCH] MAINTAINERS: Update maintainer list of DMA MAPPING BENCHMARK

2022-02-09 Thread Christoph Hellwig
Thanks, applied to the dma-mapping tree for 5.18. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v4 05/11] iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit

2022-02-09 Thread Jacob Pan
Hi Fenghua, On Mon, 7 Feb 2022 15:02:48 -0800, Fenghua Yu wrote: > @@ -1047,8 +1040,6 @@ struct iommu_sva *intel_svm_bind(struct device > *dev, struct mm_struct *mm, void } > > sva = intel_svm_bind_mm(iommu, dev, mm, flags); > - if (IS_ERR_OR_NULL(sva)) > -

Re: [PATCH v1 1/1] iommu/vt-d: Don't cast parameter in for_each_set_bit()

2022-02-09 Thread Lu Baolu
Hi Andy, On 2/10/22 1:49 AM, Andy Shevchenko wrote: While in this particular case it would not be a (critical) issue, the pattern itself is bad and error prone in case the location of the parameter is changed. Don't cast parameter to unsigned long pointer in for_each_set_bit(). Instead copy to

Re: [PATCH v2 09/10] iommu: Use dev_iommu_ops() helper

2022-02-09 Thread Lu Baolu
On 2/9/22 9:41 PM, Jason Gunthorpe wrote: On Tue, Feb 08, 2022 at 09:25:58AM +0800, Lu Baolu wrote: Convert all the feasible instances of dev->bus->iommu_ops to dev_iommu_ops() in order to making the operation of obtaining iommu_ops from a device consistent. Why are there two patches doing

Re: iommu/amd: bug report: page table memory leak

2022-02-09 Thread Daniel Jordan
Hello Suravee, On Wed, Feb 09, 2022 at 12:04:40AM +0700, Suthikulpanit, Suravee wrote: > Could you please try the following change to see if this fix the problem? > > diff --git a/drivers/iommu/amd/io_pgtable.c b/drivers/iommu/amd/io_pgtable.c > index 182c93a43efd..1eddf557636d 100644 > ---

Re: [PATCH v2 08/10] iommu: Remove unused argument in is_attach_deferred

2022-02-09 Thread Lu Baolu
On 2/9/22 9:52 PM, Robin Murphy wrote: diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 2b5f4e57a8bb..80f1294be634 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -5052,8 +5052,7 @@ intel_iommu_dev_disable_feat(struct device *dev, enum

Re: [PATCH v2 06/10] drm/nouveau/device: Get right pgsize_bitmap of iommu_domain

2022-02-09 Thread Lu Baolu
On 2/9/22 9:31 PM, Jason Gunthorpe wrote: On Tue, Feb 08, 2022 at 09:25:55AM +0800, Lu Baolu wrote: The supported page sizes of an iommu_domain are saved in the pgsize_bitmap field. Retrieve the value from the right place. Signed-off-by: Lu Baolu Reviewed-by: Robin Murphy

Re: [PATCH v2 02/10] iommu: Remove guest pasid related interfaces and definitions

2022-02-09 Thread Lu Baolu
Hi Jason, On 2/9/22 9:29 PM, Jason Gunthorpe wrote: diff --git a/include/uapi/linux/iommu.h b/include/uapi/linux/iommu.h index 59178fc229ca..65d8b0234f69 100644 --- a/include/uapi/linux/iommu.h +++ b/include/uapi/linux/iommu.h @@ -158,185 +158,4 @@ struct iommu_page_response { __u32

Re: [PATCH 1/2] iommu/vt-d: Fix PCI bus rescan device hot add

2022-02-09 Thread Jacob Pan
Hi Joerg, On Thu, 3 Feb 2022 09:25:58 +0100, Joerg Roedel wrote: > On Tue, Feb 01, 2022 at 11:19:18AM -0800, Jacob Pan wrote: > > Do you mean having an IRQ remapping notifier regardless IOMMU-API is > > enabled, right? > > It make sense, I will give it a try. > > Yeah, that would be best. I

Re: [PATCH v3 1/2] dt-bindings: iommu: renesas,ipmmu-vmsa: add r8a779f0 support

2022-02-09 Thread Rob Herring
On Tue, 08 Feb 2022 09:20:29 +0900, Yoshihiro Shimoda wrote: > Document the compatible values for the IPMMU-VMSA blocks in > the Renesas R-Car S4-8 (R8A779F0) SoC and R-Car Gen4. > > Signed-off-by: Yoshihiro Shimoda > Reviewed-by: Geert Uytterhoeven > --- >

[PATCH AUTOSEL 5.10 17/27] iommu: Fix potential use-after-free during probe

2022-02-09 Thread Sasha Levin
From: Vijayanand Jitta [ Upstream commit b54240ad494300ff0994c4539a531727874381f4 ] Kasan has reported the following use after free on dev->iommu. when a device probe fails and it is in process of freeing dev->iommu in dev_iommu_free function, a deferred_probe_work_func runs in parallel and

[PATCH AUTOSEL 5.15 19/36] iommu: Fix potential use-after-free during probe

2022-02-09 Thread Sasha Levin
From: Vijayanand Jitta [ Upstream commit b54240ad494300ff0994c4539a531727874381f4 ] Kasan has reported the following use after free on dev->iommu. when a device probe fails and it is in process of freeing dev->iommu in dev_iommu_free function, a deferred_probe_work_func runs in parallel and

[PATCH AUTOSEL 5.16 24/42] iommu: Fix potential use-after-free during probe

2022-02-09 Thread Sasha Levin
From: Vijayanand Jitta [ Upstream commit b54240ad494300ff0994c4539a531727874381f4 ] Kasan has reported the following use after free on dev->iommu. when a device probe fails and it is in process of freeing dev->iommu in dev_iommu_free function, a deferred_probe_work_func runs in parallel and

[PATCH v1 1/1] iommu/vt-d: Don't cast parameter in for_each_set_bit()

2022-02-09 Thread Andy Shevchenko
While in this particular case it would not be a (critical) issue, the pattern itself is bad and error prone in case the location of the parameter is changed. Don't cast parameter to unsigned long pointer in for_each_set_bit(). Instead copy to a local variable on stack of a proper type and use.

Re: [PATCH v2 1/5] dt-bindings: reserved-memory: Document memory region specifier

2022-02-09 Thread Thierry Reding
On Sun, Feb 06, 2022 at 11:27:00PM +0100, Janne Grunau wrote: > On 2021-09-15 17:19:39 +0200, Thierry Reding wrote: > > On Tue, Sep 07, 2021 at 07:44:44PM +0200, Thierry Reding wrote: > > > On Tue, Sep 07, 2021 at 10:33:24AM -0500, Rob Herring wrote: > > > > On Fri, Sep 3, 2021 at 10:36 AM Thierry

[PATCH] iommu: explicitly check for NULL in iommu_dma_get_resv_regions()

2022-02-09 Thread Aleksandr Fedorov
iommu_dma_get_resv_regions() assumes that iommu_fwspec field for corresponding device is set which is not always true. Since iommu_dma_get_resv_regions() seems to be a future-proof generic API that can be used by any iommu driver, add an explicit check for NULL. Currently it can work by accident

Re: [PATCH] uio: Replace mutex info_lock with percpu_ref to improve performance

2022-02-09 Thread Guixin Liu
在 2022/2/9 15:40, Christoph Hellwig 写道: On Tue, Feb 08, 2022 at 03:19:20PM +0800, Guixin Liu wrote: This patch includes a modification to repace mutex info_lock with percpu_ref, in order to improve uio performance. What performance critical use case do you have for uio? Everyone really

Re: [PATCH v2 08/10] iommu: Remove unused argument in is_attach_deferred

2022-02-09 Thread Robin Murphy
On 2022-02-08 01:25, Lu Baolu wrote: The is_attach_deferred iommu_ops callback is a device op. The domain argument is unnecessary and never used. Remove it to make code clean. Suggested-by: Robin Murphy Signed-off-by: Lu Baolu --- include/linux/iommu.h | 2 +-

Re: [PATCH v2 10/10] iommu: Split struct iommu_ops

2022-02-09 Thread Jason Gunthorpe via iommu
On Tue, Feb 08, 2022 at 10:46:14PM -0800, Christoph Hellwig wrote: > On Tue, Feb 08, 2022 at 09:25:59AM +0800, Lu Baolu wrote: > > Move the domain specific operations out of struct iommu_ops into a new > > structure that only has domain specific operations. This solves the > > problem of needing

Re: [PATCH v2 09/10] iommu: Use dev_iommu_ops() helper

2022-02-09 Thread Jason Gunthorpe via iommu
On Tue, Feb 08, 2022 at 09:25:58AM +0800, Lu Baolu wrote: > Convert all the feasible instances of dev->bus->iommu_ops to > dev_iommu_ops() in order to making the operation of obtaining > iommu_ops from a device consistent. Why are there two patches doing this conversion? Roll this into the prior

Re: [PATCH v2 08/10] iommu: Remove unused argument in is_attach_deferred

2022-02-09 Thread Jason Gunthorpe via iommu
On Tue, Feb 08, 2022 at 09:25:57AM +0800, Lu Baolu wrote: > The is_attach_deferred iommu_ops callback is a device op. The domain > argument is unnecessary and never used. Remove it to make code clean. > > Suggested-by: Robin Murphy > Signed-off-by: Lu Baolu > --- > include/linux/iommu.h

Re: [PATCH v2 07/10] iommu: Use right way to retrieve iommu_ops

2022-02-09 Thread Jason Gunthorpe via iommu
On Tue, Feb 08, 2022 at 09:25:56AM +0800, Lu Baolu wrote: > The common iommu_ops is hooked to both device and domain. When a helper > has both device and domain pointer, the way to get the iommu_ops looks > messy in iommu core. This sorts out the way to get iommu_ops. The device > related helpers

Re: [PATCH v2 06/10] drm/nouveau/device: Get right pgsize_bitmap of iommu_domain

2022-02-09 Thread Jason Gunthorpe via iommu
On Tue, Feb 08, 2022 at 09:25:55AM +0800, Lu Baolu wrote: > The supported page sizes of an iommu_domain are saved in the pgsize_bitmap > field. Retrieve the value from the right place. > > Signed-off-by: Lu Baolu > Reviewed-by: Robin Murphy > Link: >

Re: [PATCH v2 05/10] iommu: Remove apply_resv_region

2022-02-09 Thread Jason Gunthorpe via iommu
On Tue, Feb 08, 2022 at 09:25:54AM +0800, Lu Baolu wrote: > The apply_resv_region callback in iommu_ops was introduced to reserve an > IOVA range in the given DMA domain when the IOMMU driver manages the IOVA > by itself. As all drivers converted to use dma-iommu in the core, there's > no driver

Re: [PATCH v2 04/10] iommu: Remove aux-domain related interfaces and iommu_ops

2022-02-09 Thread Jason Gunthorpe via iommu
On Tue, Feb 08, 2022 at 09:25:53AM +0800, Lu Baolu wrote: > The aux-domain related interfaces and iommu_ops are not referenced > anywhere in the tree. We've also reached a consensus to redesign it > based the new iommufd framework. Remove them to avoid dead code. > > Signed-off-by: Lu Baolu >

Re: [PATCH v2 03/10] iommu/vt-d: Remove aux-domain related callbacks

2022-02-09 Thread Jason Gunthorpe via iommu
On Tue, Feb 08, 2022 at 09:25:52AM +0800, Lu Baolu wrote: > The aux-domain related callbacks are not called in the tree. Remove them > to avoid dead code. > > Signed-off-by: Lu Baolu > Reviewed-by: Christoph Hellwig > --- > include/linux/intel-iommu.h | 17 -- >

Re: [PATCH v2 02/10] iommu: Remove guest pasid related interfaces and definitions

2022-02-09 Thread Jason Gunthorpe via iommu
On Tue, Feb 08, 2022 at 09:25:51AM +0800, Lu Baolu wrote: > The guest pasid related uapi interfaces and definitions are not referenced > anywhere in the tree. We've also reached a consensus to replace them with > a new iommufd design. Remove them to avoid dead code. > > Signed-off-by: Lu Baolu >

Re: [PATCH v2 01/10] iommu/vt-d: Remove guest pasid related callbacks

2022-02-09 Thread Jason Gunthorpe via iommu
On Tue, Feb 08, 2022 at 09:25:50AM +0800, Lu Baolu wrote: > The guest pasid related callbacks are not called in the tree. Remove them > to avoid dead code. > > Signed-off-by: Lu Baolu > Reviewed-by: Christoph Hellwig > --- > include/linux/intel-iommu.h | 10 -- > include/linux/intel-svm.h |

Re: Error when running fio against nvme-of rdma target (mlx5 driver)

2022-02-09 Thread Robin Murphy
On 2022-02-09 02:50, Martin Oliveira wrote: Hello, We have been hitting an error when running IO over our nvme-of setup, using the mlx5 driver and we are wondering if anyone has seen anything similar/has any suggestions. Both initiator and target are AMD EPYC 7502 machines connected over

[PATCH V2 2/2] x86/hyperv: Make swiotlb bounce buffer allocation not just from low pages

2022-02-09 Thread Tianyu Lan
From: Tianyu Lan In Hyper-V Isolation VM, swiotlb bnounce buffer size maybe 1G at most and there maybe no enough memory from 0 to 4G according to memory layout. Devices in Isolation VM can use memory above 4G as DMA memory and call swiotlb_alloc_from_low_pages() to allocate swiotlb bounce buffer

[PATCH V2 1/2] Swiotlb: Add swiotlb_alloc_from_low_pages switch

2022-02-09 Thread Tianyu Lan
From: Tianyu Lan Hyper-V Isolation VM and AMD SEV VM uses swiotlb bounce buffer to share memory with hypervisor. Current swiotlb bounce buffer is only allocated from 0 to ARCH_LOW_ADDRESS_LIMIT which is default to 0xUL. Isolation VM and AMD SEV VM needs 1G bounce buffer at most. This

[PATCH V2 0/2] x86/hyperv/Swiotlb: Add swiotlb_set_alloc_from_low_pages() switch function.

2022-02-09 Thread Tianyu Lan
From: Tianyu Lan Hyper-V Isolation VM may fail to allocate swiotlb bounce buffer due to there is no enough contiguous memory from 0 to 4G in some cases. Current swiotlb code allocates bounce buffer in the low end memory. This patchset adds a new function swiotlb_set_alloc_from_low_pages() to

Re: [PATCH v2 1/1] iommu/vt-d: Move intel_iommu_ops to header file

2022-02-09 Thread Andy Shevchenko
On Mon, Feb 07, 2022 at 04:12:40PM +0200, Andy Shevchenko wrote: > Compiler is not happy about hidden declaration of intel_iommu_ops. > > .../iommu.c:414:24: warning: symbol 'intel_iommu_ops' was not declared. > Should it be static? > > Move declaration to header file to make compiler happy.

Re: [PATCH v2 1/1] iommu/dma: Use DMA ops setter instead of direct assignment

2022-02-09 Thread Andy Shevchenko
On Tue, Feb 08, 2022 at 11:06:56PM -0800, Christoph Hellwig wrote: > On Mon, Feb 07, 2022 at 03:55:32PM +, Robin Murphy wrote: > > On 2022-02-07 14:13, Andy Shevchenko wrote: > > > Use DMA ops setter instead of direct assignment. Even we know that > > > this module doesn't perform access to

Re: Error when running fio against nvme-of rdma target (mlx5 driver)

2022-02-09 Thread Chaitanya Kulkarni via iommu
On 2/8/22 6:50 PM, Martin Oliveira wrote: > Hello, > > We have been hitting an error when running IO over our nvme-of setup, using > the mlx5 driver and we are wondering if anyone has seen anything similar/has > any suggestions. > > Both initiator and target are AMD EPYC 7502 machines