Re: [RFC PATCH v3 09/12] iommu/io-pgtable-arm: Implement arm_lpae_unmap_pages()

2021-04-06 Thread isaacm
On 2021-04-06 05:15, Will Deacon wrote: On Mon, Apr 05, 2021 at 12:11:09PM -0700, Isaac J. Manjarres wrote: Implement the unmap_pages() callback for the ARM LPAE io-pgtable format. Signed-off-by: Isaac J. Manjarres Suggested-by: Will Deacon --- drivers/iommu/io-pgtable-arm.c | 124

Re: [RFC PATCH v3 06/12] iommu: Split 'addr_merge' argument to iommu_pgsize() into separate parts

2021-04-06 Thread isaacm
On 2021-04-06 04:53, Will Deacon wrote: On Mon, Apr 05, 2021 at 12:11:06PM -0700, Isaac J. Manjarres wrote: 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

Re: [PATCH v8 7/9] vfio/mdev: Add iommu related member in mdev_device

2021-04-06 Thread Jason Gunthorpe
On Mon, Mar 25, 2019 at 09:30:34AM +0800, Lu Baolu wrote: > A parent device might create different types of mediated > devices. For example, a mediated device could be created > by the parent device with full isolation and protection > provided by the IOMMU. One usage case could be found on >

Re: [RFC PATCH v3 03/12] iommu/io-pgtable: Introduce map_pages() as a page table op

2021-04-06 Thread isaacm
On 2021-04-06 04:57, Will Deacon wrote: On Mon, Apr 05, 2021 at 12:11:03PM -0700, Isaac J. Manjarres wrote: 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

Re: [PATCH] iommu: Add device name to iommu map/unmap trace events

2021-04-06 Thread chenxiang (M)
Hi, 在 2021/2/12 18:50, Joerg Roedel 写道: On Tue, Feb 09, 2021 at 06:06:20PM +0530, Sai Prakash Ranjan wrote: diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 5e7fe519430a..6064187d9bb6 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -87,6 +87,7 @@ struct

Re: [PATCH v14 00/10] iommu: I/O page faults for SMMUv3

2021-04-06 Thread Jean-Philippe Brucker
On Thu, Apr 01, 2021 at 06:15:02PM +0100, Will Deacon wrote: > On Thu, Apr 01, 2021 at 05:47:09PM +0200, Jean-Philippe Brucker wrote: > > Add stall support to the SMMUv3 driver, along with a common I/O Page > > Fault handler. > > > > Since [v13] I added review and ack tags (Thanks!), and a

RE: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-06 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Tuesday, April 6, 2021 8:35 PM > > On Tue, Apr 06, 2021 at 01:27:15AM +, Tian, Kevin wrote: > > > > and here is one example why using existing VFIO/VDPA interface makes > > sense. say dev1 (w/ sva) and dev2 (w/o sva) are placed in a single VFIO > > container.

Re: [PATCH v8 7/9] vfio/mdev: Add iommu related member in mdev_device

2021-04-06 Thread Lu Baolu
Hi Jason, On 4/7/21 4:00 AM, Jason Gunthorpe wrote: On Mon, Mar 25, 2019 at 09:30:34AM +0800, Lu Baolu wrote: A parent device might create different types of mediated devices. For example, a mediated device could be created by the parent device with full isolation and protection provided by

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-06 Thread Jason Wang
在 2021/4/6 下午8:42, Jason Gunthorpe 写道: On Tue, Apr 06, 2021 at 09:35:17AM +0800, Jason Wang wrote: VFIO and VDPA has no buisness having map/unmap interfaces once we have /dev/ioasid. That all belongs in the iosaid side. I know they have those interfaces today, but that doesn't mean we have

Re: [PATCH v5.4 1/1] iommu/vt-d: Fix agaw for a supported 48 bit guest address width

2021-04-06 Thread Lu Baolu
Hi Saeed, On 4/7/21 12:35 AM, Saeed Mirzamohammadi wrote: The IOMMU driver calculates the guest addressability for a DMA request based on the value of the mgaw reported from the IOMMU. However, this is a fused value and as mentioned in the spec, the guest width should be calculated based on the

RE: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-06 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Tuesday, April 6, 2021 8:21 PM > > On Tue, Apr 06, 2021 at 01:02:05AM +, Tian, Kevin wrote: > > > From: Jason Gunthorpe > > > Sent: Tuesday, April 6, 2021 7:40 AM > > > > > > On Fri, Apr 02, 2021 at 07:58:02AM +, Tian, Kevin wrote: > > > > > From: Jason

Re: [PATCH] iommu: Add device name to iommu map/unmap trace events

2021-04-06 Thread Joerg Roedel
On Tue, Apr 06, 2021 at 02:56:53PM +0800, chenxiang (M) wrote: > Is it possible to use group id to identify different domains? No, the best is to do this during post-processing of your traces by also keeping tack of domain-device attachments/detachments. Regards, Joerg

Re: [PATCH RFC v1 15/15] iommu/virtio: Update fault type and reason info for viommu fault

2021-04-06 Thread Vivek Kumar Gautam
On 3/29/21 9:53 PM, Jean-Philippe Brucker wrote: On Fri, Mar 12, 2021 at 06:39:05PM +0530, Vivek Kumar Gautam wrote: To complete the page request we would also need to send the response back to the host from virtio backend when handling page request. So the virtio command should also be

Re: [PATCH v2 0/4] iommu/iova: Add CPU hotplug handler to flush rcaches to core code

2021-04-06 Thread John Garry
On 25/03/2021 17:53, Will Deacon wrote: On Thu, Mar 25, 2021 at 08:29:57PM +0800, John Garry wrote: The Intel IOMMU driver supports flushing the per-CPU rcaches when a CPU is offlined. Let's move it to core code, so everyone can take advantage. Also throw in a patch to stop exporting

Re: [RFC PATCH 3/6] iommu: Use bitmap to calculate page size in iommu_pgsize()

2021-04-06 Thread Will Deacon
On Thu, Apr 01, 2021 at 06:39:35PM -0700, isa...@codeaurora.org wrote: > On 2021-04-01 09:47, Will Deacon wrote: > > 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:

Re: [RFC PATCH v3 06/12] iommu: Split 'addr_merge' argument to iommu_pgsize() into separate parts

2021-04-06 Thread Will Deacon
On Mon, Apr 05, 2021 at 12:11:06PM -0700, Isaac J. Manjarres wrote: > 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

Re: [RFC PATCH v3 04/12] iommu: Add a map_pages() op for IOMMU drivers

2021-04-06 Thread Will Deacon
On Mon, Apr 05, 2021 at 12:11:04PM -0700, Isaac J. Manjarres wrote: > 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

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-06 Thread Jason Gunthorpe
On Tue, Apr 06, 2021 at 01:27:15AM +, Tian, Kevin wrote: > > and here is one example why using existing VFIO/VDPA interface makes > sense. say dev1 (w/ sva) and dev2 (w/o sva) are placed in a single VFIO > container. Forget about SVA, it is an irrelevant detail of how a PASID is

Re: [RFC PATCH v3 03/12] iommu/io-pgtable: Introduce map_pages() as a page table op

2021-04-06 Thread Will Deacon
On Mon, Apr 05, 2021 at 12:11:03PM -0700, Isaac J. Manjarres wrote: > 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

Re: [RFC PATCH v3 11/12] iommu/arm-smmu: Implement the unmap_pages() IOMMU driver callback

2021-04-06 Thread Will Deacon
On Mon, Apr 05, 2021 at 12:11:11PM -0700, Isaac J. Manjarres wrote: > 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. > > Signed-off-by: Isaac J. Manjarres > Suggested-by: Will Deacon > --- >

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-06 Thread Jason Gunthorpe
On Tue, Apr 06, 2021 at 01:02:05AM +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Tuesday, April 6, 2021 7:40 AM > > > > On Fri, Apr 02, 2021 at 07:58:02AM +, Tian, Kevin wrote: > > > > From: Jason Gunthorpe > > > > Sent: Thursday, April 1, 2021 9:47 PM > > > > > > > > On

Re: [RFC PATCH v3 05/12] iommu: Use bitmap to calculate page size in iommu_pgsize()

2021-04-06 Thread Will Deacon
On Mon, Apr 05, 2021 at 12:11:05PM -0700, Isaac J. Manjarres wrote: > 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:

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-06 Thread Jason Gunthorpe
On Tue, Apr 06, 2021 at 12:37:35AM +, Tian, Kevin wrote: > With nested translation it is GVA->GPA->HPA. The kernel needs to > fix fault related to GPA->HPA (managed by VFIO/VDPA) while > handle_mm_fault only handles HVA->HPA. In this case, the 2nd-level > page fault is expected to be

Re: [RFC PATCH v3 09/12] iommu/io-pgtable-arm: Implement arm_lpae_unmap_pages()

2021-04-06 Thread Will Deacon
On Mon, Apr 05, 2021 at 12:11:09PM -0700, Isaac J. Manjarres wrote: > Implement the unmap_pages() callback for the ARM LPAE io-pgtable > format. > > Signed-off-by: Isaac J. Manjarres > Suggested-by: Will Deacon > --- > drivers/iommu/io-pgtable-arm.c | 124 +++-- > 1

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-06 Thread Jason Gunthorpe
On Tue, Apr 06, 2021 at 09:35:17AM +0800, Jason Wang wrote: > > VFIO and VDPA has no buisness having map/unmap interfaces once we have > > /dev/ioasid. That all belongs in the iosaid side. > > > > I know they have those interfaces today, but that doesn't mean we have > > to keep using them for

Re: [PATCH 1/6] iommu: Move IOVA power-of-2 roundup into allocator

2021-04-06 Thread John Garry
So then we have the issue of how to dynamically increase this rcache threshold. The problem is that we may have many devices associated with the same domain. So, in theory, we can't assume that when we increase the threshold that some other device will try to fast free an IOVA which was

Re: [PATCH v14 09/10] ACPI/IORT: Enable stall support for platform devices

2021-04-06 Thread Lorenzo Pieralisi
On Thu, Apr 01, 2021 at 05:47:18PM +0200, Jean-Philippe Brucker wrote: > Copy the "Stall supported" bit, that tells whether a named component > supports stall, into the dma-can-stall device property. > > Acked-by: Jonathan Cameron > Signed-off-by: Jean-Philippe Brucker > --- >

[PATCH RESEND] lib/scatterlist: Fix NULL pointer deference

2021-04-06 Thread Ricardo Ribalda
When sg_alloc_table_from_pages is called with n_pages = 0, we write in a non-allocated page. Fix it by checking early the error condition. [7.666801] BUG: kernel NULL pointer dereference, address: 0010 [7.667487] #PF: supervisor read access in kernel mode [7.667970] #PF:

[PATCH v5.4 1/1] iommu/vt-d: Fix agaw for a supported 48 bit guest address width

2021-04-06 Thread Saeed Mirzamohammadi
The IOMMU driver calculates the guest addressability for a DMA request based on the value of the mgaw reported from the IOMMU. However, this is a fused value and as mentioned in the spec, the guest width should be calculated based on the supported adjusted guest address width (SAGAW). This is